cc-architecture

A technical reference describing Claude Code's internal architecture, including its startup process, tools, permissions, and extension points.

In plain words
What is it for?
It is for building or debugging Claude Code plugins, agents, skills, and hooks.
Why use it?
It gives implementation details for understanding or changing how Claude Code works internally.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/codependentai/claude-code-toolkit/cc-architecture
Any agent
npx skills add codependentai/claude-code-toolkit --skill cc-architecture
Clone the repo
git clone --depth 1 https://github.com/codependentai/claude-code-toolkit

Made for: Claude Code, Codex.

Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,737 The whole file, excluding the scripts and references it only reads on demand.
Security scan F 4 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.03737
Opus 5 $0.00020 $0.01869
Sonnet 5 $0.00008 $0.00747
Haiku 4.5 $0.00004 $0.00374

Measured 2d ago against content hash 06e334808e55, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade F, and why

cc-architecture scanned grade F with 4 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

Full shell AST parser in `utils/bash/` — runs BEFORE `canUseTool()`. Flags: `rm -rf /`, fork bombs, `curl | bash`, sudo escalation, tty injection, history manipulation. Flagged = rejected regardless of permission rules.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

Full shell AST parser in `utils/bash/` — runs BEFORE `canUseTool()`. Flags: `rm -rf /`, fork bombs, `curl | bash`, sudo escalation, tty injection, history manipulation. Flagged = rejected regardless of permission rules.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

Full shell AST parser in `utils/bash/` — runs BEFORE `canUseTool()`. Flags: `rm -rf /`, fork bombs, `curl | bash`, sudo escalation, tty injection, history manipulation. Flagged = rejected regardless of permission rules.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

Full shell AST parser in `utils/bash/` — runs BEFORE `canUseTool()`. Flags: `rm -rf /`, fork bombs, `curl | bash`, sudo escalation, tty injection, history manipulation. Flagged = rejected regardless of permission rules.
skills/cc-architecture/SKILL.md · 300 lines

How it starts

The opening of the file, as written. The whole thing — 300 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Claude Code Architecture Reference

Source: verified against Claude Code source (March 2026). Numbers and structure may shift between releases.

Codebase Scale

Metric Count
Source files ~1,928
Lines of TypeScript ~121K
Built-in tools 46
CLI commands 88
Service modules 22
React hooks 104
UI components 392 files
Feature flags 88-99

Source Organization

  • Entrypoints: cli.tsx (bootstrap), init.ts, mcp.ts (MCP server mode), sdk/ (Agent SDK types + schemas)
  • Commands: 88 dirs — commit, config, memory, doctor, upgrade, login, daemon, bridge, bg, etc.
  • Tools: 46 tools — BashTool, FileReadTool, FileEditTool, AgentTool, MCPTool, WebFetchTool, Glob, Grep, Write, TodoWrite, ToolSearch, SkillTool, WorkflowTool, TungstenTool, TeamCreateTool, TeamDeleteTool, etc.
  • Services: 22 dirs — api/ (Claude API client), mcp/ (protocol, 24 files), tools/ (StreamingToolExecutor, registry), compact/ (context compaction), analytics/, oauth/, plugins/
  • UI: components/ (392 files, Ink terminal UI), hooks/ (104 files, React hooks), ink/ (custom reconciler + Yoga flexbox + ANSI parser)
  • Utilities: permissions/ (24 files), bash/ (AST parser for safety), model/ (selection/routing), settings/, git.ts
  • State/Infra: state/, bridge/ (31 files, IDE remote-control), cli/ (WS/SSE transport), memdir/ (8 files, memory persistence), tasks/ (background task management), coordinator/ (multi-agent orchestration), assistant/ (session management), voice/ (push-to-talk input)

Boot Sequence

Traced from entrypoints/cli.tsx with profileCheckpoint markers:

  1. cli_entry — entry validation, minimal imports
  2. Feature gates evaluated — compile-time bun:bundle tree-shaking
  3. Fast paths (zero overhead, exit early):
    • --version — immediate console.log, no imports
    • --dump-system-prompt — load config, model, system prompt, output, exit
    • --claude-in-chrome-mcp — load MCP server for Chrome extension
    • --chrome-native-host — Chrome native messaging
    • --computer-use-mcp (CHICAGO_MCP gate) — computer use MCP
  4. Daemon worker path (--daemon-worker=<kind>) — lean, no configs loaded
  5. Bridge path (--bridge) — enableConfigs, auth check, policy limits, bridge/main.ts
  6. Daemon path (daemon command) — enableConfigs, sinks, daemon/main.ts
  7. Background path (bg command) — enableConfigs, background runner
  8. Template/environment/runner paths — feature-gated experimental
  9. Main REPL path — full UI initialization:
    • Config loaded (settings.json, CLAUDE.md files from project tree, .envrc via direnv)
    • Auth checked (OAuth from ~/.claude/auth.json or ANTHROPIC_API_KEY)
    • GrowthBook initialized (remote feature flags async)
    • Tools assembled (46 built-in + MCP tool schemas merged dynamically)
    • MCP servers connected (stdio/SSE/WebSocket in parallel)
    • System prompt built (from 10+ sources: role definition, tool schemas, CLAUDE.md, memory, git context, OS info)
    • Ink renders terminal UI via custom React reconciler + Yoga flexbox
    • Query loop begins, background tasks (MCP heartbeats, analytics) on timers

Read the full file on GitHub · 300 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 300 lines · 41 tokens per session scan F 06e334808e55

Subscribe to this mod's changes

cc-architecture is a skill published in the GitHub repository codependentai/claude-code-toolkit (5 stars, last pushed 4mo ago), licensed MIT. It adds 41 tokens to every session and 3,737 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it F with 4 findings (asks for root, downloads and executes remote code, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens