Auto-Review — Automatic Post-Build Review
Reviewer agent with clean context that inspects changes made by the builder.
Concept
After a builder agent completes its work, the Auto-Reviewer receives only the diff of the changes and the original task — with no builder history. This clean context enables an unbiased review.
The reviewer has exclusive access to read-only tools (it cannot modify files). It looks for:
- Logic bugs and uncovered edge cases
- Security issues (SQL injection, XSS, secrets, etc.)
- Violations of project conventions
- Simplification opportunities
- Missing tests
If it finds issues, it can generate a fix prompt for the builder to resolve them in a second pass.
Configuration
auto_review:
enabled: true # Enable post-build auto-review
review_model: claude-sonnet-4-6 # Model for the reviewer (null = same as builder)
max_fix_passes: 1 # Fix passes (0 = report only, 1-3 = fix)
Flow
Builder completes task
│
├── 1. get_recent_diff(workspace) → get git diff
│
├── 2. AutoReviewer.review_changes(task, diff)
│ ├── Create fresh AgentLoop (clean context)
│ ├── Prompt: original task + diff
│ ├── Agent "review" with read-only tools
│ └── ReviewResult(has_issues, review_text, cost)
│
├── 3. If has_issues and max_fix_passes > 0:
│ ├── build_fix_prompt(review_text) → fix prompt
│ └── Builder executes fix
│
└── 4. Final result
Python API
AutoReviewer
class AutoReviewer:
def __init__(
self,
agent_factory: Callable[..., Any], # (**kwargs) → AgentLoop
review_model: str | None = None, # Model for the reviewer
) -> None: ...
def review_changes(
self,
task: str, # Original task
git_diff: str, # Diff of the changes
) -> ReviewResult: ...
@staticmethod
def build_fix_prompt(review_text: str) -> str:
"""Generates a fix prompt based on the review."""
@staticmethod
def get_recent_diff(
workspace_root: str,
commits_back: int = 1,
) -> str:
"""Gets the diff of the last N commits."""
ReviewResult
class ReviewResult:
has_issues: bool # True if issues were found
review_text: str # Full review text
cost: float # USD cost of the review
REVIEW_SYSTEM_PROMPT
The reviewer’s system prompt:
You are a senior code reviewer. Your job is to review code changes
made by another agent and find issues.
Specifically look for:
1. Logic bugs and uncovered edge cases
2. Security issues (SQL injection, XSS, secrets, etc.)
3. Violations of project conventions
4. Simplification opportunities
5. Missing tests
Be specific: file, line, exact change.
If there are no issues: say "No issues found."
Error handling
If the LLM call fails during the review, the AutoReviewer does not propagate the exception. Instead, it returns a ReviewResult with:
has_issues = Truereview_text = "Error during review: <message>"cost = 0.0
This allows the main flow to continue without interruption.
”No issues” detection
The reviewer responds “No issues found” (or variations) when there are no problems. Detection is case-insensitive and looks for the pattern “no issues” in the response.
Programmatic usage example
from architect.agents.reviewer import AutoReviewer, ReviewResult
def my_agent_factory(**kwargs):
# Create fresh AgentLoop
...
reviewer = AutoReviewer(
agent_factory=my_agent_factory,
review_model="claude-sonnet-4-6",
)
# Get recent diff
diff = AutoReviewer.get_recent_diff("/path/to/repo")
# Review changes
result = reviewer.review_changes(
task="Implement JWT authentication",
git_diff=diff,
)
if result.has_issues:
# Generate fix prompt
fix_prompt = AutoReviewer.build_fix_prompt(result.review_text)
# Execute fix with the builder...