Orchestrator for Implementor and Review Loop - AI Agent Code Review Patterns

Fazm Team··2 min read

Orchestrator for Implementor and Review Loop - AI Agent Code Review Patterns

The most effective multi-agent coding pattern is simple: one agent writes the code, another reviews it, and an orchestrator manages the loop. The shared file approach makes this work without complex message passing.

The Shared File Pattern

Instead of agents communicating through APIs or message queues, they communicate through the filesystem. The orchestrator creates a task file. The implementor reads it, writes code, and updates the file with what it did. The reviewer reads the code and the task file, then writes review comments back to the same shared location.

This works because files are the natural interface for code. No serialization overhead. No protocol negotiation. Just read and write.

How the Loop Works

  1. The orchestrator writes a task specification to a shared markdown file
  2. The implementor agent reads the spec, writes the code, and updates the task file with implementation notes
  3. The reviewer agent reads both the code and the notes, then writes review feedback
  4. If the reviewer flags issues, the orchestrator sends the implementor back to fix them
  5. The loop continues until the reviewer approves or a maximum iteration count is reached

Three iterations is usually the sweet spot. After that, diminishing returns set in and you are better off having a human look at the remaining issues.

Why This Beats Single-Agent Review

A single agent reviewing its own code has a blind spot - it makes the same assumptions during review that it made during implementation. Two separate agents with different system prompts catch different classes of errors. The implementor optimizes for getting things working. The reviewer optimizes for correctness, edge cases, and maintainability.

Practical Orchestration Tips

Keep the orchestrator lightweight. It should not understand the code - it just manages the loop. Use file timestamps to detect when agents have finished their work. Set a timeout so a stuck agent does not block the pipeline forever.

The shared file approach also gives you a complete audit trail. Every iteration is recorded. You can replay the entire review process to understand why decisions were made.

Fazm is an open source macOS AI agent. Open source on GitHub.

More on This Topic

Related Posts