-
Notifications
You must be signed in to change notification settings - Fork 1
Workflow Agent Review Loop
How agent-assisted code review works in a SpecRoute-driven project. Pairs an agent's structured analysis with a human's judgment authority.
For the canonical version, see workflows/agent-review-loop.md.
Code review has two distinct workloads:
- Mechanical — walk the diff, check tests against requirements, scan for security patterns, verify frontmatter, check cross-references resolve.
- Judgmental — assess whether the design choice is right, whether the abstraction will hold, whether the change matches team intent.
Agents are excellent at #1 and unreliable at #2. The pattern delegates #1 to agents and reserves #2 for humans.
PR opened
↓
Author runs /audit pre-PR
↓
CI runs (tests, lint, security scan)
↓
Agent review pass
├── Read PR diff
├── Read linked task + requirements + design
├── Apply prompts/shared/code-review-prompt.md
└── Output: structured review (Blockers / Concerns / Suggestions / What's good)
↓
Human reviewer reads agent review + diff
├── Approve ───────→ Author squash-merges
└── Request changes → Author addresses; loop
Before opening the PR:
- Run
/audit(sanitization + frontmatter + vendor matrix + broken links + TODO health). - Confirm every back-referenced requirement has a test.
- Read the diff one more time as if you hadn't written it.
Standard CI: unit + integration tests, type checks, lint, security scans, dependency audits. Reviewers don't approve red builds.
The agent CLI runs the code-review prompt over the PR. Inputs:
- The PR diff.
- The linked task ID (from PR title or commit messages).
- The corresponding
tasks.md,requirements.md,design.md. - Relevant rules under
rules/.
The prompt is prompts/shared/code-review-prompt.md. Output structure:
## Summary
<1–2 sentence summary>
## Blockers (request changes)
- <issue: file, line, what's wrong, what to do>
## Concerns (discuss)
- <issue>
## Suggestions (nits)
- <issue>
## What's good
- <thing>
The agent posts this as a PR comment.
A human reads the agent's review, the PR diff, and the linked spec for context. Then decides:
- Approve — agent found nothing material; human concurs.
- Request changes — agent's blockers are real, OR human sees something the agent missed.
- Block — structural problem (wrong design, wrong scope, wrong abstraction). Often surfaces only at human review.
The human is not deferring to the agent. The human reads the agent's findings as a comprehensive checklist and adds judgment on top.
- For each blocker: fix and push a new commit.
- For concerns: respond inline (defend with rationale, or accept and change).
- For nits: usually fix.
Re-request review when ready. Agent re-runs against updated diff; human re-reads.
PR approved + CI green → merge. Check the task box in tasks.md.
- Missing tests for back-referenced requirements.
- Frontmatter contract violations.
- Security patterns (SQL string concat, missing input validation, unquoted shell vars).
- Sanitization issues (private project names, secrets, absolute paths).
- Broken markdown links.
- Drift between design doc and implementation.
- Performance budgets exceeded.
- Out-of-scope changes.
- Whether the design choice is correct in context (vs. correct against
design.md). - Whether the abstraction will hold as the system grows.
- Whether the change matches unstated team intent.
- Whether the task as defined was the right task.
- Trade-offs not captured in the spec (cost, ergonomics, future flexibility).
The agent's review is a checklist, not a vote.
- Approving because the agent approved. Read the diff yourself.
- Bikeshedding with the agent. Agents will debate style if invited. Don't invite.
- Asking the agent to "fix it." The author owns the PR; the reviewer requests changes.
- Replacing reviewers entirely with agents. Removes the judgment layer.
- Skipping CI because the agent didn't flag anything. CI catches different things (timing-dependent failures, integration-environment quirks).
If the agent's review is shallow or wrong:
- Update
prompts/shared/code-review-prompt.mdto be more specific. - Add the agent's blind spot to its
.mdoperating principles. - Train the team on what the agent does and doesn't catch.
Agent review quality is a function of prompt quality + agent definition quality. Treat both as living artifacts.
| Vendor | Agent review viability |
|---|---|
| Claude Code | Strong — sub-agents via Task tool; can dispatch a code-reviewer agent |
| Codex | Strong — skills can be invoked with $name or from the /skills menu |
| Gemini CLI | Strong — Agent Skills can expose a review workflow and subagents can perform the review |
| Cursor | Limited — rule-based, not workflow-based |
| Kiro | Strong — file-saved hook can trigger review on PR-relevant changes |
| Devin Desktop | Strong — Devin Local supports skills and subagents; Cascade users can invoke the review prompt manually |
For vendors with limited support, fall back to manual prompt invocation.
- Prompts — the code-review-prompt template
-
Rules —
code-review-rules.mddocuments the bar - Workflow Spec to Implementation — the implementation loop the review caps
Repository · Issues · Roadmap · Changelog · Security · License (Apache 2.0) — © Enovatr Labs
- Philosophy
- Spec-Driven Development
- Agentic Coding Model
- Automation Decision Framework
- Multi-Agent Orchestration
- Two-Tier Docs Pattern
- Multi-Vendor Context Files
- Documentation Structure
- Agent Memory
- Artifact Taxonomy
- PRDs
- Specs
- Agents
- Skills
- Commands
- Hooks
- Prompts
- Rules
- Frontmatter Contracts
- Sanitization