Expand description
Completion contracts: evidence-based verification that a sub-agent’s task is actually done, instead of trusting its self-report.
A contract is a small list of machine-checkable exit criteria declared at
spawn time (exit_criteria on sessions_spawn). When the sub-agent
finishes, the runtime executes every criterion and annotates the result
with per-criterion evidence — “done” then means verified done (v0.4.0
item C+E in docs/roadmap/competitive-intel-update-2026-07.md).
Safety model:
- File criteria only accept RELATIVE paths and resolve inside the chat’s
working directory — a contract cannot be used to probe
~/.sshor other host paths, and evidence excerpts are capped. - Command criteria run through the sub-agent’s own
bashtool viaCommandRunner, so the sandbox router, dangerous-pattern checks, andtool_policyall apply exactly as if the agent had run the command.
Structs§
- Criterion
Outcome - Outcome of checking one criterion.
Enums§
Constants§
- MAX_
CRITERIA - Hard cap on criteria per contract — a contract is a checklist, not a test suite; anything larger belongs in an actual test the agent runs itself.
Traits§
- Command
Runner - Executes
Commandcriteria. Production wires this to the sub-agent’s bash tool; tests use a stub.
Functions§
- parse_
exit_ criteria - Parse the
exit_criteriatool-input value.Nonewhen absent/null; errors on malformed entries so bad contracts fail loudly at spawn time instead of silently verifying nothing. - render_
for_ prompt - Render the contract for the sub-agent’s task prompt so it knows exactly what will be checked when it declares completion.
- render_
report - Render the verification block prepended to the sub-agent’s result text.
- verify_
criteria - Check every criterion and collect evidence. Never panics; unreadable files or runner errors surface as failed criteria with the error as evidence (fail closed).