How Claude Code Works
Deep-dive architecture analysis of Claude Code: agent loop, context engineering, tooling, and security.
- Source repo
- Windy3f3f3f3f/how-claude-code-works
- Stars
- ★ 3.9k
- Last updated
- 3d ago
- FARS reviewed
- Nov 08, 2026
- License
- MIT
- FA score
- 49/100 · Major gaps
At a glance
- How it runs
- Works with
- Platform-specificClaude Code
- Cost
- Free, no paid service needed
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- Developers wanting to learn production-grade coding agent architecture can read the main loop and context engineering chapters.
- Not a fit if
- Users who want to run Claude Code itself — this is source analysis, not a working tool
- Teams needing authoritative official internals — it is independent research, unaffiliated with Anthropic
- Readers wanting a quick skim — the docs are dense with a steep learning curve
- Website
- windy3f3f3f3f.github.io ↗ set on GitHub
- Maintenance
- Commits in the last 30 dayslast commit 2026-11-29+1.0 ★/day over 7 days
- Source review
- 49/100 · Major gaps 1 safety controls not found
What does this agent do, and when should you use it?
how-claude-code-works is an in-depth architecture study of Anthropic's Claude Code, based on a snapshot of its 500k-line TypeScript source. The repository offers 21 topical documents covering the system main loop, context compaction, tool system, permission security, multi-agent collaboration, and more. It is bilingual (Chinese and English) with a Docsify online site and a companion project, claude-code-from-scratch. It's an unofficial educational project, disclaiming any affiliation with Anthropic.
This repository performs reverse engineering analysis of Claude Code's internals. It reads the source snapshot, extracts architectural decisions, and produces documentation. Documents use Mermaid diagrams to describe system flows and provide specific numbers (e.g., 235ms startup, 7-layer defense). The companion project claude-code-from-scratch offers TypeScript and Python implementations of about 4300 lines. The repository itself does not execute code but provides educational analysis.
- Developers wanting to learn production-grade coding agent architecture can read the main loop and context engineering chapters.
- Users aiming to deeply customize Claude Code can study Hooks, memory, and skills system chapters.
- Developers interested in AI safety can explore the 7-layer defense in the permission and security chapter.
- Students building a coding agent from scratch can follow the claude-code-from-scratch project.
- Users evaluating Claude Code's newer features (e.g., /goal, Auto Mode) can refer to black-box reverse engineering sections.
How do you install or deploy this agent?
This repository is a documentation project, not traditional software. To run the docs site locally: git clone https://github.com/Windy3f3f3f3f/how-claude-code-works.git. Install Node.js and Docsify: npm i docsify-cli -g.
How do you use this agent?
cd how-claude-code-works, run docsify serve docs, then open http://localhost:3000 in your browser. Alternatively, read online at https://windy3f3f3f3f.github.io/how-claude-code-works/#/.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- dependency security — Pin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
What are this agent's strengths and limitations?
- Based on real source snapshot, offers concrete architectural details and metrics (e.g., 7-layer defense, 4-level compaction) rather than generalities.
- Bilingual (Chinese primary), with 21 in-depth chapters, beneficial for Chinese-speaking developers.
- Companion from-scratch project enables hands-on learning.
- Analysis is based on v2.1.6x snapshot and may be outdated; newer features rely on black-box reverse engineering with uncertain accuracy.
- Unofficial and disclaimed; may not match actual Claude Code internals.
- Requires technical background; documentation is dense and may have a steep learning curve.
How does this agent compare with similar options?
The repository does not mention specific alternatives, but it can be compared to architecture analyses of other agent frameworks like LangChain or AutoGPT.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| How Claude Code Works This agent | 49 · Major gaps | Web appFree | ★ 3.9k | 3d ago | — | Claude Code |
| mu Coding Agent | 72 · Some gaps | Desktop appFree + model costs | ★ 627 | 3d ago | TypeScript | — |
| Claude Reviews Claude Code | 51 · Major gaps | Web appFree | ★ 1.6k | 8mo ago | — | — |
| Agent Design Patterns (ADPS) | 72 · Some gaps | Library / SDKFree | ★ 363 | 15d ago | HTML | — |
How does FollowAgents rate this agent?
Why each dimension lost points
This is architectural learning material rather than an executable Agent, and it provides little evidence about least privilege for this repository itself (1). The security chapter describes deny/ask rules, sensitive paths, and user confirmation in concrete terms (2), and gives a useful account of permission decisions and some data flows (2); sensitive-data handling is not comprehensively covered (1). The supplied material contains no dependency inventory or dependency-security review (0). It discusses external effects such as shell commands, hooks, MCP, and file writes, with confirmation and isolation mechanisms, but does not fully establish controls for this product itself (1). Worktree cleanup and recoverable folding offer partial recovery evidence, while rollback coverage is limited (1). The project disclaims official status, describes its research as independent, and cites source paths (2).
The README and security chapter are broadly consistent on defense in depth and permission modes, but the supplied chapter is truncated and many claims are unsupported by the supplied files (1). Dependency availability is not documented (0). Some automatic recovery and denial paths are described, but guidance for readers handling errors in this product is limited (1).
The README identifies audiences including Agent developers, Claude Code users, security readers, and researchers, and gives topic-based reading paths (3). It states the educational and unofficial scope and distinguishes snapshot analysis from later black-box inference (2). There is no Agent trigger mechanism described for this repository (0). The material focuses on Claude Code and includes reading guidance, but the supplied evidence has no installation steps or specific environment setup guidance (1).
The table of contents, reading paths, architecture diagram, and update log provide strong organization (3). The supplied files give no installation or use instructions for a repository product (0). Most chapter names and terms are stable, though the README and file title disagree on the chapter number, and snapshot and later analysis are combined (2). Configuration examples and reading advice are provided, but no FAQ appears in the supplied material (2). The README states that the work is unofficial, identifies its snapshot basis, and distinguishes later black-box analysis (2). The MIT license text is complete (3). The update log is detailed, but its mapping to a repository revision is unclear, and its dates are in the future relative to the assessment date (2). Contributors are listed and Issue/PR discussion is invited, but ownership and a formal update path are unclear (1).
The material offers a clear contents list, layered explanations, diagrams, and permission examples that readers can use directly for study (3). It claims source-level analysis that may add value beyond generic Agent descriptions, but the supplied evidence cannot verify most details, so the marginal value is rated good rather than complete (2). Reading requires no framework execution and has low setup cost; the extensive scope still requires substantial time, partly offset by navigation aids (2).
Many claims include source paths, function names, and line references, providing some audit trail (2). This review received only the README, a security chapter, and the license, so cited implementation details lack corroboration from the referenced source or independent material (1). The README explicitly says the analysis is independent and may not match the official implementation, and labels post-snapshot coverage as black-box inference (2), though many specific claims are still stated definitively.
- Not found in source: dependency securityPin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
- Treat this as educational architecture analysis, not official Anthropic documentation or an executable Agent; the README says the analysis may not match the actual internal implementation.
- This assessment uses only the supplied README, a security-chapter excerpt, and the license. Unprovided files are unknown, so source-level claims, dependency security, and complete security coverage cannot be confirmed.
- The README and security document disagree on the chapter number, and update-log dates are later than this assessment date; verify revision alignment and document currency.
FAQ
Is this analysis official?
Which version is the analysis based on?
Can I run the code in this repository?
Is there an English version?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.