Code Review Workflow
What It Does
Section titled “What It Does”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.
chimera review --diff changes.patch --model glm-5 --max-rounds 3Python API
Section titled “Python API”from chimera.review import ReviewOrchestrator, ReviewFeedbackfrom chimera.core.agent import Agentfrom 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}")Key Classes
Section titled “Key Classes”ReviewOrchestrator
Section titled “ReviewOrchestrator”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) -> boolProperties: max_rounds, rounds (list of ReviewRound), current_round, is_approved, is_complete, total_comments.
ReviewFeedback
Section titled “ReviewFeedback”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).
ReviewComment
Section titled “ReviewComment”Dataclass with fields: file, line, severity (Severity enum), message, suggestion.
Severity
Section titled “Severity”Enum: INFO, SUGGESTION, WARNING, ERROR, CRITICAL.
Integration
Section titled “Integration”- The orchestrator is a specialised two-agent
composition (reviewer + author iteration);
drop it into a
Pipelineif you want to chain it with planning or testing stages. ReviewFeedback.parse_from_text(text)recognises the[SEVERITY] file:line: messageline 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.perspectiveand thereview_serverMCP server. - The CLI
chimera review --diff <patch>is a thin wrapper aroundReviewOrchestrator.run().
Import
Section titled “Import”from chimera.review import ( ReviewComment, ReviewFeedback, ReviewOrchestrator, Severity,)