agent-patterns

ac-traceability

flowchart TD
    Issue([Issue with AC items]) --> Builder[Builder agent]
    Builder --> Patch[Patch block]
    Builder --> ACBlock[AC coverage block]
    Patch --> Reviewer[Reviewer agent]
    ACBlock --> Reviewer
    Reviewer --> Check{All AC checked?}
    Check -- yes --> Done([DONE])
    Check -- unchecked without justification --> NeedsReview([NEEDS REVIEW])

The builder agent produces a machine-scannable acceptance-criteria coverage block alongside its patch. Each AC item is either checked with a code location or explicitly excluded with a reason. The reviewer validates coverage by reading the block, not the full diff.

How it works

  1. The builder agent receives a list of AC items from the implementation brief.
  2. For each AC item, the builder emits either:
    • [x] <AC text> — covered by <file>:<line>
    • [ ] <AC text> — blocked: <reason> (e.g. “depends on #45”, “out of scope per brief”)
  3. The reviewer agent receives the patch and the AC block as separate inputs. It checks that every [ ] item has an explicit justification. Any unchecked item without a reason triggers NEEDS_REVIEW.
  4. A dedicated command (/ac-check) can run the coverage block independently against the current branch without a full review pass.

When to use

When not to use

Trade-offs

   
Pro Reviewer does not need to re-read the full diff to confirm coverage
Pro Unchecked AC with no justification is mechanically detectable — no prose judgment required
Pro AC block doubles as an audit trail committed to the repo
Con Builder must emit accurate file:line references — hallucinated locations are worse than no block
Con AC items must be discrete and verifiable upfront; vague AC produces a vague block
Con Adds a structured output contract the builder must satisfy on every call

Failure modes

Implementation reference

ai-dev-tools: