Skip to content

Architecture — Overview

You use Claude Code every day. Here’s what happens between your prompt and its response.


The 5-Level AI Maturity Model

Not all AI tools are the same. They differ in how much autonomous decision-making they perform. Claude Code deliberately operates at Level 4–5 depending on your permission settings.

LevelNameDescriptionExample
1ManualHuman does everything; no AI involvementTyping code by hand
2ToolSingle-shot API call; no state, no loopsChatGPT chat, Copilot autocomplete
3AssistantMulti-turn context with memory across a sessionClaude.ai with project memory
4CopilotAI proposes actions; human approves each stepClaude Code in default permission mode
5AgentAI loops autonomously: calls tools, self-checks, retriesClaude Code in auto mode

Claude Code starts at Level 4 (ask permission, human approves) and moves toward Level 5 (auto mode) as you configure trust rules. The architecture is built to support both.


The 6-Pipeline Architecture

Claude Code is not a single program. It is six nested layers, each with a distinct responsibility. Data flows inward on request and outward on response.

graph TD A["Terminal UI<br/>(renders output, captures keystrokes)"] B["Query Loop<br/>(the agent's while-true heartbeat)"] C["Tool Orchestration<br/>(parallel vs serial scheduling)"] D["Multi-Agent System<br/>(spawn and coordinate subagents)"] E["Context Management<br/>(token budget, compaction, memory)"] F["Permission & Security<br/>(6-layer classification pipeline)"] A --> B --> C --> D --> E --> F style A fill:#1e293b,color:#94a3b8,stroke:#334155 style B fill:#1e293b,color:#7dd3fc,stroke:#334155 style C fill:#1e293b,color:#86efac,stroke:#334155 style D fill:#1e293b,color:#fda4af,stroke:#334155 style E fill:#1e293b,color:#fcd34d,stroke:#334155 style F fill:#1e293b,color:#c4b5fd,stroke:#334155
LayerResponsibility
Terminal UIRenders streaming output, handles keyboard shortcuts, manages the display
Query LoopThe while(true) agent heartbeat — drives every turn of conversation
Tool OrchestrationSchedules tools into parallel batches or serial queues, starts streaming execution
Multi-Agent SystemSpawns subagents with isolated contexts, routes permission bubbles upward
Context ManagementTracks token usage, triggers compaction, prefetches memory, manages system prompt
Permission & SecurityClassifies every action through 6 security layers before execution

The Feedback Loop

This is the core of agency. The loop is what transforms a static language model into a dynamic agent.

sequenceDiagram participant U as You participant L as LLM participant T as Tool Orchestrator U->>L: prompt + context L->>T: tool_use blocks (in response stream) T->>T: execute tools (parallel where safe) T->>L: tool_result messages injected back L->>L: sees results, decides next action L-->>U: text response (if done) L->>T: more tool_use blocks (if not done)

The LLM never directly touches your filesystem or runs commands. Every action goes through Tool Orchestration, which enforces the Permission Pipeline before anything executes. The LLM only sees results — it decides what to do next based on what came back.

This loop IS the agency. A language model that cannot loop is just a text generator. The loop is what lets Claude read a file, discover an error, fix it, re-run the test, and verify — without you guiding each step.


By the Numbers

ComponentCount
Built-in tools43
Slash commands (approx.)~88
Hook events26
Bundled skills16
Official plugins32
Background task types7
UI components390

Dive Deeper

Each layer of the architecture has its own page:


Why This Matters to You

  • Better prompts: Knowing the loop runs multiple iterations helps you write prompts that guide Claude through complex multi-step work rather than expecting a single-shot answer.
  • Permission intuition: Claude asks for permission when an action hits a gate in the Permission Pipeline — not arbitrarily. Understanding the layers tells you exactly which rule to add to stop the interruptions.
  • Debugging slow sessions: If Claude seems to “think forever,” it is most likely in a long tool execution loop. Knowing this helps you add /compact proactively or break the task into smaller pieces.
  • Trusting auto mode: The loop is not running unchecked. Every tool call passes through 6 security layers. Auto mode means the layers clear it automatically — not that they are skipped.