Anthropic's Claude Code operates across six distinct layers, not as a simple CLI. The architecture, detailed by developer @akshay_pachaar, reveals a harness system where the model is just one node in a perception-action-observation loop.
Key facts
- Six layers: Input, Knowledge, Execution, Integration, Multi-Agent, Observability.
- Knowledge layer uses 3-layer context compressor at 92% threshold.
- Multi-Agent layer uses Redis pub/sub for subagent communication.
- Execution layer uses typed registry with one handler per tool.
- Master loop: perception → action → observation.
The Six Layers
Claude Code's architecture, as mapped by @akshay_pachaar, comprises six layers that transform a language model into a production-grade agent. The Input Layer handles session management, permission gating, and YAML-based trust tiers before any request reaches the model. The Knowledge Layer holds the skill registry, a 3-layer context compressor operating at a 92% threshold, task graph, and cross-session memory store—this is where harness intelligence lives outside the weights.
The Execution Layer runs tool dispatch through a typed registry with one handler per tool: bash, read, write, grep, glob, revert. A streaming runtime handles parallel execution, and prompt cache reuses stable prefixes at 10% cost. The Integration Layer connects the MCP runtime to external servers (filesystem, git, custom), with tools registering inward and memory writes outward to agent_memory.md.
The Multi-Agent Layer is the most underappreciated piece. It includes a subagent spawner, teammate mailboxes over Redis pub/sub, an FSM protocol (IDLE→REQUEST→WAIT→RESPOND), an autonomous board with atomic locks, and worktree isolation with per-task branches and conflict detection on merge. The Observability Layer wraps everything with an event bus featuring lifecycle hooks and a background executor running daemon threads non-blocking.
The Master Loop
At the center sits the master agent loop: perception → action → observation. It is deliberately simple—a "dumb loop" where the model reasons and the harness mediates. This design pattern, shared across Anthropic, OpenAI, LangChain, and others, prioritizes reliability over complexity.
Why This Matters
The unique take: Claude Code's architecture reveals that the real innovation in AI agents is not the model but the harness engineering. The Knowledge layer's context compressor at 92% threshold and the Multi-Agent layer's Redis-based FSM protocol represent infrastructure decisions that determine whether an agent succeeds or fails in production. This is the architecture behind what feels like magic—it is not magic, it is harness engineering.
What to watch
Watch for Anthropic's upcoming technical report on Claude Code's benchmark performance—specifically SWE-Bench and SWE-Bench Verified scores—and whether the multi-agent layer's FSM protocol scales beyond the current subagent limit.









