"Anatomy of a Claude Code Harness — The 3-8-3 Design for Controlling AI Coding Agents"
A control structure built on 3 agents, 8 skills, and 3 hooks
핵심 요약
- Separation of concerns across three roles: Main Orchestrator (judgment), Executor (implementation), and Quality Agent (verification)
- Eight skills, each defined primarily by "don't do this" constraints, actively prevent confirmation bias in AI behavior
- Three non-blocking hooks (Session-start, Pre-compact, Post-edit-check) automate verification at every stage
Background
This design started from a simple observation: without constraints, AI defaults to confirmation bias. When an AI coding agent operates freely, it repeats the same failures and declares tasks complete without verification. The guiding principle became "don't" matters more than "do" — distribute verification across every phase and strip unnecessary context to reduce hallucinations.
The Architecture
Three Agents
Main Orchestrator (Opus) — Evaluates request ambiguity and routes accordingly. Classifies tasks as simple (1-2 steps) or complex (3+ steps).
Executor Agent (Sonnet) — Receives only a compressed handoff document and executes. Subject to a hard rule: three consecutive failures with the same strategy triggers an automatic stop.
Quality Agent (Sonnet) — Operates with read-only permissions for objective verification. Auto-invoked when four or more errors accumulate.
Eight Skills — Constraints as Capabilities
Each skill focuses less on "what to do" and more on "what not to do."
- Brainstorming — Single-option proposals are banned. Must present 2-3 alternatives.
- Deep-Interview — Keeps asking questions until ambiguity scores drop below 20%.
- Writing-Plans — Breaks execution into 2-5 minute granular steps.
- Verification — Six sequential checks: Build, Type Check, Lint, Test, Security, Diff.
- Code-Review — Strict severity classification: CRITICAL / WARNING / INFO.
- Testing — Enforces
should_return_X_when_Ynaming. Four edge-case categories are mandatory. - Git-Commit — Records decision context as permanent commit trailers.
- Project-Doctor — Runs a 21-item diagnostic, including hardcoded API key detection.
Three Hooks (Non-blocking)
- Session-start — Auto-injects the project plan (plan.md) and accumulated lessons (lessons.md).
- Pre-compact — Auto-generates a handoff skeleton before context compaction.
- Post-edit-check — Scans for debug remnants and leaked API keys.
Lessons Learned
The key insight is to never centralize verification. Distribute it across skill boundaries, hook boundaries, and agent boundaries so problems get caught early at each stage. Passing only a compressed handoff document to the Executor — rather than the full session history — was a deliberate choice to prevent unnecessary context from triggering hallucinations.
Takeaway
The core of the 3-8-3 structure is this: give AI freedom, but define exactly where it must stop. Constraints are not limitations — they are the quality guarantee.
댓글
댓글 쓰기