本文由 AI 分析生成
建立時間: 2026-07-30 來源: https://x.com/zodchiii/status/2066882971374678057
Summary
@zodchiii describes a minimal 3-file Claude Code loop architecture: a builder agent with full file access, a read-only checker agent that outputs exactly FAILED or ALL GREEN, and an Opus orchestrator limited to 5 cycles. The strict separation of permissions (builder writes, checker only reads) and binary checker output eliminate the vague partial-success states that cause loops to drift indefinitely.
@zodchiii 描述了一個最小化的 3 檔案 Claude Code 迴圈架構:擁有完整檔案存取權的 builder agent、只讀的 checker agent(輸出 FAILED 或 ALL GREEN),以及限制 5 次循環的 Opus 編排器。嚴格的權限分離與二元化輸出消除了導致迴圈無限漂移的模糊「幾乎成功」狀態。
Key Points
- 3 files:
.claude/agents/builder.md(Sonnet, Read/Write/Edit/Glob/Grep/Bash),.claude/agents/checker.md(Sonnet, Read/Grep/Glob/Bash only),.claude/commands/loop.md(Opus orchestrator, max 5 cycles) - Checker outputs exactly two values: FAILED or ALL GREEN — eliminates ambiguous partial-success states
- Stop rules: ALL GREEN reached; 5 cycles exhausted; same failure repeats twice in a row; a fix breaks a previously passing check
- Permission separation is structural: checker literally cannot write files, eliminating a class of coordination failures
- Real-world example: 3 cycles to implement rate limiting (FAILED → FAILED → ALL GREEN)
Insights
Enforcing read-only access for the checker is a structural guarantee rather than a prompt instruction—the checker cannot corrupt files even if its output is confused. The strictly binary output (ALL GREEN / FAILED) is equally important: partial-success states like “mostly working” are what cause loops to stall or drift. The stop rule “same failure twice in a row” catches fixpoint failures where the agent is cycling without progress, without needing MAX_ITER to be very small. This is a minimal but complete loop architecture.
Connections
- Loop Engineering A Technical Roadmap for an Autonomous Loop — Deeper technical counterpart with reward-hacking defense, Docker isolation, structured logging
- Loop Engineering Build an AI That Codes While You Sleep — Production context (Boris Cherny, 259 PRs) showing where these architectures lead
- claude-code
- autonomous-agents
Raw Excerpt
“Most setups run agents once and hand you whatever comes out. A team that runs in loops keeps going until the work actually passes.”