Skip to main content
Code Guide

Claude Code: 48 Architecture Diagrams

Visual reference for Claude Code internals: architecture, MCP ecosystem, multi-agent patterns, security models, and development workflows. 38 SVGs rendered at build time, zero client JavaScript.

49 Diagrams
12 Themes
SVG Inline rendering
Claude Code: Foundations 4 diagrams

Core concepts: 4-layer model, workflow pipeline, decision tree, 5 permission modes

"Chatbot to Context System": 4-Layer Model

Claude Code is a context system, not a chatbot. It transforms your message into a rich multi-layer prompt before calling the API. This diagram shows the 4-layer augmentation that happens invisibly with every request.

User Message

Layer 1: System Prompt

Layer 2: Context Injection

Layer 3: Tool Definitions

Layer 4: Conversation History

Claude API

Claude Response

CLAUDE.md files
global + project + subdir

Working directory
Git status
Project files

Glob, Grep, Read,
Bash, Task, MCP tools

Previous messages
+ tool results

How Claude Code Works (line ~2360)

9-Step Workflow Pipeline

Every request to Claude Code goes through this pipeline, from parsing your intent to displaying the final response. Understanding this loop helps you write better instructions and diagnose issues faster.

Yes

No

User Message

Parse Intent

Load Context

Plan Actions

Execute Tools

More tools
needed?

Collect Results

Update Context

Generate Response

Display to User

Getting Started (line ~277)

Quick Decision Tree: "Should I use Claude Code?"

Not every task needs Claude Code. This decision tree helps you route the right tasks to the right tool (Claude Code CLI vs Claude.ai vs clipboard-based approaches).

No

Yes

Yes

No

No

Yes

Yes

No

No

Yes

Start: I have a task

Involves
codebase?

Pure writing
or analysis?

Repetitive or
>30 min manual?

Use Claude.ai
or API

Clipboard +
Claude.ai

Single file,
simple change?

Claude Code
✓ Best choice

Need file
access?

Quick Start Decision; see also `machine-readable/reference.yaml` (decide section)

Permission Modes Comparison

Claude Code has 5 permission modes that control what it can do automatically vs. what requires your approval. Choosing the wrong mode is the #1 safety mistake.

🚫 dontAsk Mode

ALL operations

Auto-denied

Unless pre-approved
via /permissions add

🔍 Plan Mode (Read-Only)

File reads

Auto-approved

File writes

Blocked

Shell commands

Blocked

Exit by approving the plan
or Shift+Tab

⚠️ bypassPermissions Mode

ALL operations

Auto-approved

Use only in:
CI/CD, sandboxed
environments

✏️ acceptEdits Mode

File reads

Auto-approved

File writes

Auto-approved

Shell commands

Prompt required

Risky ops

Prompt required

🔒 Default Mode (Recommended)

File reads

Auto-approved

File writes

Prompt required

Shell commands

Prompt required

Risky ops

Prompt required

Permission System (line ~760)

Claude Code: Context & Sessions 4 diagrams

Context zones, memory hierarchy, session management, and fresh context patterns

Context Management Zones

Your context window has 4 distinct zones, each requiring different strategies. Knowing which zone you're in prevents context bloat and maintains response quality throughout long sessions.

🔴 85–100% — Critical

Auto-compact
triggered at 80%

Essential ops only

Start new session
for new tasks

🟠 75–85% — Caution

Suggest /compact
proactively

Reduce verbosity

Defer non-critical
operations

🔵 50–75% — Normal

Monitor usage

Consider /compact
for old threads

Normal operation

🟢 0–50% — Comfortable