Related ToolsClaude CodeClaude

Claude Forge Uses GAN-Style Agent Loops to Catch AI Coding Mistakes

Claude by Anthropic
Image: Anthropic

A new open-source project called Claude Forge applies an idea from image generation to AI-assisted coding: adversarial loops. Instead of one AI agent writing code and hoping for the best, five specialized Claude Code agents take turns generating and criticizing each other's work.

The architecture borrows from GANs (generative adversarial networks), a technique where two neural networks compete against each other, one creating output and another judging it, until the output passes muster. Claude Forge adapts that pattern to software development with a clear division of labor:

  • Planner drafts phased implementation plans (roughly 50,000 tokens per phase)
  • Plan Reviewer tears those plans apart, checking for hallucinated file paths, dependency cycles, and ambiguous specs
  • Implementer builds the code using test-driven development with atomic commits
  • Code Reviewer verifies the implementation matches the approved plan
  • Final Reviewer runs a holistic integration check for production readiness

Each agent gets its own fresh context window and only sees the previous agent's output, never its reasoning. That isolation is deliberate. Plans stay immutable once approved, and all feedback routes through a centralized feedback.md file. Reviewers use rhetorical questions to guide generators rather than prescribing exact fixes.

The safety rails are sensible: each loop maxes out at three iterations before escalating to a human. Reviewers cannot modify source code directly. The implementer is instructed to ask for clarification rather than guess.

Two slash commands drive the workflow. /brainstorm runs an interactive design session that explores your codebase and asks 5 to 15 clarifying questions before producing a design spec. /pipeline orchestrates the full build cycle with resumable execution if you hit a timeout.

The project is brand new (MIT licensed, seven commits, one contributor as of today) and requires Claude Code CLI plus a Git-initialized project to run. Installation is as simple as copying the .claude/skills/ directory into your own project.

The concept is sound. Single-agent coding assistants tend to compound their own mistakes because they review their own reasoning. Forcing a separate agent with a clean context to play adversary is a practical way to catch the hallucinations and logical gaps that trip up AI-generated code. Whether the overhead of five agents per task is worth it for smaller projects is an open question, but for complex codebases where bugs are expensive, the tradeoff could pay for itself quickly.