Answer in brief
Use tests, logs, static checks, and a separate reviewer as external evidence.
“Done” is a claim, not evidence. A reliable workflow loops through change, real check output, failure classification, and correction until the contract is satisfied.
Four Feedback Layers
| Layer | Evidence | Finds |
|---|---|---|
| Structure | Formatter, types, schema | Syntax and interface defects |
| Behavior | Unit, integration, E2E tests | Regressions |
| Runtime | Logs, exit status, metrics | Environment and timing failures |
| Semantics | Human or independent reviewer | Requirement, safety, maintainability issues |
Use the cheapest relevant check early and stronger suites at integration milestones.
Make Results Drive the Next Step
Tool calls and results are session facts. Require the Agent to read exit codes and failure summaries, never infer success because a command was issued, and classify failures as new regression, pre-existing failure, environment failure, or flaky behavior.
For an API change, a useful matrix is:
- related unit tests after the local function change;
- type and integration tests after schema or routing changes;
- project lint/build/target suites at completion;
- CI or another platform for environment-sensitive behavior.
Independent Review
A separate reviewer starts from the contract, diff, and evidence instead of the implementer’s narrative:
Review read-only. Find correctness, security, compatibility, and coverage issues.
Every finding needs a file/location and trigger scenario.
Separate blockers, suggestions, and unknowns. Do not edit.
Use a fresh session, a review fork, or a subagent. The orchestrator must reproduce blockers rather than accepting them by assertion.
Completion Report
Changes:
Verification commands and exit status:
Independent review and resolution:
Checks not run:
Residual risk and rollback:
Deliberately create one failing test in a practice repository and verify that the Agent reads, classifies, and resolves or reports it before declaring completion.
Next: Context, Compaction, Sessions, and Forks.