Skip to content

Code Review Workflow

ReviewOrchestrator manages a two-agent review-fix iteration cycle. A reviewer agent examines a diff and produces structured ReviewFeedback with comments. If the feedback contains errors, an author agent receives the comments and applies fixes. The cycle repeats until the reviewer approves or max_rounds is reached.

Terminal window
chimera review --diff changes.patch --model glm-5 --max-rounds 3
from chimera.review import ReviewOrchestrator, ReviewFeedback
from chimera.core.agent import Agent
from chimera.providers.factory import create_provider
provider = create_provider(model="glm-5")
reviewer = Agent(provider=provider)
author = Agent(provider=provider)
orchestrator = ReviewOrchestrator(max_rounds=3)
approved = orchestrator.run(
diff=open("changes.patch").read(),
reviewer=reviewer,
author=author,
env=None,
)
print(f"Approved: {approved}")
print(f"Rounds: {orchestrator.current_round}")
print(f"Total comments: {orchestrator.total_comments}")
class ReviewOrchestrator:
def __init__(self, max_rounds: int = 3) -> None
def run(self, diff: str, reviewer: Agent, author: Agent, env: Environment | None = None) -> bool
def add_review(self, feedback: ReviewFeedback) -> ReviewRound
def mark_fixed(self) -> None
def needs_another_round(self) -> bool

Properties: max_rounds, rounds (list of ReviewRound), current_round, is_approved, is_complete, total_comments.

Dataclass with fields: comments (list of ReviewComment), approved (bool), summary (str).

Properties: has_critical, has_errors, comment_count, files_reviewed.

Methods: by_severity(severity), by_file(file), parse_from_text(text) (static, parses [SEVERITY] file:line: message format).

Dataclass with fields: file, line, severity (Severity enum), message, suggestion.

Enum: INFO, SUGGESTION, WARNING, ERROR, CRITICAL.

  • The orchestrator is a specialised two-agent composition (reviewer + author iteration); drop it into a Pipeline if you want to chain it with planning or testing stages.
  • ReviewFeedback.parse_from_text(text) recognises the [SEVERITY] file:line: message line format the reviewer agent is prompted to emit. Override the prompt for a different output shape and supply a custom parser.
  • For multi-perspective reviews (security / performance / maintainability / etc.), see chimera.review.perspective and the review_server MCP server.
  • The CLI chimera review --diff <patch> is a thin wrapper around ReviewOrchestrator.run().
from chimera.review import (
ReviewComment,
ReviewFeedback,
ReviewOrchestrator,
Severity,
)