Sub topic 12
Verifying subagent work before you trust it
This chapter assumes you can run tests and linters from the command line, read a Git diff, and understand how an orchestrator hands work to subagents. The earlier chapters on delegation briefs and result aggregation cover that background.
Why a summary is not evidence
A subagent returns a summary of what it did. That summary is the subagent's own account, and it can be wrong. The subagent may say "all tests pass" after running only some of them. It may also describe a change it planned but never saved, or report success on a task that quietly drifted from your brief.
Treat the summary as a claim to check. Your orchestrator, or you, should confirm the claim against the actual workspace.
What to check
Check the workspace in layers, from cheapest to most expensive.
- Scope. Compare the changed files with the scope in the brief. Any edit outside the allowed paths is a red flag.
- Checks. Run the "Done when" command from the brief yourself. Do not rely on the subagent's report of its result.
- Wider checks. Run the full test suite, type checker, and linter. A change can pass its own tests and still break code elsewhere.
- Review. Read the diff. Look for deleted tests, loosened assertions, hard-coded values, and skipped checks.
Diff review is the step that catches the failures automated checks miss.A quick scope check in Git looks like this:
# Files changed on the subagent's branch, compared with main
git diff --name-only main...agent/tests
# Anything outside tests/ is out of scope for this task
git diff --name-only main...agent/tests | grep -v '^tests/'If the second command prints anything, the subagent left its scope. Reject the change or ask for a fix.
Common failure patterns
| Pattern | What it looks like | How to catch it |
|---|---|---|
| Weakened tests | An assertion is removed so a failing test passes | Read the diff of test files |
| Unrun checks | The summary claims a result, but no command was run | Re-run the command yourself |
| Scope creep | Unrelated files are edited | Compare `git diff --name-only` with the brief |
| Invented details | A function or flag that does not exist is used | Run the code, and type-check it |
| Conflicting changes | Two subagents edit the same logic differently | Merge the branches and run the full suite |
Verify after merging, too
Each branch can pass on its own and still fail when combined. Subagents work in separate workspaces, so neither saw the other's changes. After you merge, run the whole suite again on the merged result.
Make verification cheap
Verification is only practical if the brief makes it easy. Write a "Done when" line that is a runnable command, and ask the subagent to return the exact command and its result. Then you can run the same command and compare outputs.
Exercise
A subagent reports "Added tests for parseargs, all passing." Its brief limited it to tests/testcli.py. Name three checks you run before merging.
Show answer
First, run git diff --name-only against main and confirm only tests/testcli.py changed. Second, run the brief's "Done when" command, pytest tests/testcli.py, yourself and confirm it passes. Third, read the diff for weakened or removed assertions. After merging, also run the full test suite.