Claude Code Architecture Study

A detailed study of Claude Code’s CLI agent loop, tools, permissions, context handling, and multi-agent architecture.

Stars
★ 12k
Last updated
8mo ago
FARS reviewed
Nov 08, 2026

At a glance

How it runs
CLI
Works with
Platform-specific
Setup effort
High · needs real infrastructure
You'll need
BunNode.js >= 18Shell / CLINetwork accessLocal filesystemMCP Server
Typical use
An engineer designing a coding agent can study the complete loop from Claude API streaming through tool execution and tool-result feedback.
Not a fit if
  • Teams needing reproducible install and first-run docs
  • Commercial products or revenue-generating work (prohibited)
  • Teams needing multi-provider model portability
Maintenance
No commits for 6+ monthslast commit 2026-04-01+1.0 ★/day over 7 days

What does this agent do, and when should you use it?

This is a learning and technical-research repository about Claude Code’s CLI agent architecture, not a documented standalone agent distribution ready for deployment. It describes a streaming execution model centered on query.ts and QueryEngine.ts: accept user input, call the Claude API, execute requested tools, and append their results to the message loop. The material covers more than 40 built-in tools, roughly 80 slash commands, permission rules, context compaction, session persistence, MCP, remote bridging, and sub-agent execution. Documented interfaces include a React/Ink terminal UI, a headless SDK query engine, and an MCP entry point, with state and transcripts stored primarily on the local filesystem. The repository also contains English, Chinese, Japanese, and Korean reports about telemetry, feature flags, remote controls, and prospective functionality. Because reproducible installation, build, credential, and first-run instructions are absent, it is best evaluated as an architecture reference rather than an adoptable production release.

In the documented lifecycle, processUserInput() parses prompts and slash commands, while fetchSystemPromptParts() assembles tool sections and CLAUDE.md memory before query() streams a response from the Claude API. When the model emits tool_use, StreamingToolExecutor separates concurrency-safe work from serial work, and canUseTool() applies PreToolUse hooks, allow or deny rules, an interactive prompt, and tool-specific permission checks. Approved calls run through tool.call(); their tool_result values are appended to messages[] and sent through the loop again. The inventory includes BashTool, FileReadTool, FileEditTool, FileWriteTool, GlobTool, GrepTool, WebFetchTool, WebSearchTool, AgentTool, and MCPTool. The study also describes autoCompact, snipCompact, and contextCollapse for context management, plus append-only JSONL transcripts, session resumption, and session forking. AgentTool, SendMessageTool, TeamCreateTool, and task commands support local, remote, in-process, and worktree-isolated agent modes, while bridgeMain.ts and related modules relay remote sessions. The repository itself primarily produces architecture documentation and multilingual analysis; it does not document a verified standalone agent workflow that readers can install and invoke.

  1. An engineer designing a coding agent can study the complete loop from Claude API streaming through tool execution and tool-result feedback.
  2. A CLI developer handling risky operations can examine the layered authorization flow across hooks, matching rules, user prompts, and tool-level checks.
  3. A team building long-running assistant sessions can evaluate the documented autoCompact, snipCompact, contextCollapse, and JSONL recovery patterns.
  4. A technical lead assessing multi-agent designs can compare in-process teammates, forked children, remote agents, and worktree isolation.
  5. A security researcher examining Claude Code can use the quadrilingual reports on telemetry, feature flags, undercover behavior, and remote configuration.

How do you install or deploy this agent?

The source does not provide copyable clone-to-install, dependency installation, build, or launch commands. It also omits the required Bun version, package-manager procedure, and Claude API credential configuration. The only runtime details supplied are Bun and a bundle compiled for Node.js >= 18, which are insufficient to establish a reproducible installation. The repository therefore cannot be verified from the supplied material as an installable standalone agent.

How do you use this agent?

Use it as a structured architecture study: begin with The Agent Pattern and Architecture Overview, then consult the Tool System, Permission System, Context Management, MCP, Session Persistence, and Sub-Agent sections for individual mechanisms. The deeper reports are organized under docs/en, docs/zh, docs/ja, and docs/ko. For actual execution, the source lacks build commands, Claude API credential setup, an entry-point invocation, and a first working example, so no accurate runnable procedure can be given.

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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

External MCP tool bridge

Inherits capabilities of connected MCP servers; audit third-party servers before enabling.

FARS trust-control audit

Not found in source — apply before daily use
  • dependency security — Pin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
  • rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.

What are this agent's strengths and limitations?

Pros
  • Maps the full path from entry points and the query engine to tools, services, and application state, using concrete filenames and class names.
  • Organizes production-agent concerns into 12 progressive mechanisms spanning planning, sub-agents, compaction, background tasks, teams, and worktree isolation.
  • Documents the permission decision chain, tool lifecycle, and concurrent execution model in enough detail to support security-oriented design study.
  • Provides the same family of deep-dive reports in English, Chinese, Japanese, and Korean for multilingual engineering teams.
Limitations
  • Commercial use is explicitly prohibited, excluding adoption in commercial products and revenue-generating work.
  • There are no reproducible installation, build, credential, or first-run instructions, leaving deployability unverified.
  • The studied core path is tied to Claude Code and the Claude API, with no demonstrated multi-provider portability.
  • The README contains research claims about hidden, future, and unreleased features without independent verification evidence or stability guarantees in the supplied material.
  • The repository license is listed as unknown while separate non-commercial and intellectual-property restrictions are asserted, creating an unclear adoption boundary.

How does this agent compare with similar options?

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Claude Code Architecture Study This agent 37 · Major gaps CLI ★ 12k 8mo ago — —
Pocket Flow 45 · Major gaps Library / SDKFree + model costs ★ 11k 4mo ago Python —
Fetch.ai Agent Examples 44 · Major gaps CLIFree + model costs ★ 1.6k 3d ago Python OpenAI API · Claude API
Agents Best Practices 72 · Some gaps Agent plugin / skillFree + model costs ★ 2.5k 1mo ago — Codex · Claude Code

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
37/ 100 5-point scale 1.9 / 5
Trust 10/29
Reliability 2/14
Adaptability 9/18
Convention 7/18
Effectiveness 7/13
Verifiability 2/8
Why each dimension lost points
Trust10 / 29 · 1.7/5

The material describes tool permission rules, interactive confirmation, path checks, and telemetry flows, giving partial support for least privilege, confirmation, and data-flow transparency. However, this is secondary research about Claude Code, not evidence of the candidate repository's own permission implementation. Telemetry includes device, account, repository-hash, and optionally full tool-input data, while sensitive-data safeguards are thin. Dependency security, rollback, and maintainer update responsibility are unsupported. Sources are described broadly as public references and community discussions, with limited attribution.

Reliability2 / 14 · 0.7/5

The README provides a substantial architecture, component, and query-flow overview, but the telemetry report relies mainly on source files and line numbers not included in the packet, so its implementation claims cannot be checked against the underlying code. The specific telemetry claims also lack direct corroboration from the architectural summary. Retries and disk persistence are mentioned, but availability guarantees and failure-message behavior are not evidenced.

Adaptability9 / 18 · 2.5/5

The project identifies developers learning about or using CLI Agent technology as its audience and focuses on Claude Code architecture; tool, agent, permission, and MCP scenarios are clear. The research material's applicability boundaries and reader environment requirements are lightly explained, and no installation or usage setup is provided.

Convention7 / 18 · 1.9/5

The README has a clear directory tree, architecture diagrams, categorized tool inventory, multilingual report structure, process explanations, and key-findings summaries. The commercial-use restriction and infringement contact statement do not amount to a clear open-source license. Installation notes, FAQ, maintenance responsibility, and update path are absent. The reports identify v2.1.88 as their subject, but there is no clear version history or maintenance commitment.

Effectiveness7 / 13 · 2.7/5

The diagrams, tool inventory, permission flow, and data-flow summary help readers build a quick mental model of Claude Code and provide research value. Detailed claims depend on implementation files not included here, so some conclusions cannot be verified from this packet; the commercial-use restriction also narrows applicability, and costs versus expected benefits are not discussed.

Verifiability2 / 8 · 1.3/5

The README and telemetry report give some traceability through source filenames, line numbers, endpoints, and configuration names. The underlying source files are not included, and there is no independent corroboration in the packet. The report sometimes blends source observations, community discussion, and interpretation without clearly separating fact from inference.

Risks and how to mitigate them
  • Not found in source: dependency securityPin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
  • Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
  • This is research material about Claude Code, not a runnable Agent product whose functionality, safety, or quality can be established from this packet; key implementation files are not included.
  • The report says telemetry sends environment, account, and repository-hash data, and that an environment variable can enable full tool-input logging. Treat these privacy claims cautiously until the original implementation and applicable settings are verified.
  • The README prohibits commercial use but provides no clear license, so commercial-use rights are unclear.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision ce8ca4a8e722
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/learn-coding-agent.svg)](https://followagents.com/en/agents/learn-coding-agent)
<a href="https://followagents.com/en/agents/learn-coding-agent"><img src="https://followagents.com/badge/learn-coding-agent.svg" alt="FARS review"></a>

FAQ

Is this a coding agent I can install directly?
The supplied material presents it as a learning and research repository and provides no complete installation, build, or first-run workflow, so direct deployment cannot be verified.
Can it be used in a commercial project?
No. The repository explicitly prohibits commercial use and profit-making activities.
What platform does the documented runtime depend on?
The core query path calls the Claude API and studies the Claude Code CLI ecosystem. The material also identifies Bun, Node.js >= 18, local filesystem access, networking, shell execution, and MCP.
How are dangerous tool calls authorized?
Inputs are validated before PreToolUse hooks and allow, deny, or ask rules are applied. Unmatched calls can trigger an interactive decision, followed by a tool-specific permission check.
Can interrupted sessions be recovered?
The described architecture appends messages to local JSONL logs and supports continuing the latest session, resuming by ID, and forking session history, although runnable commands are not documented.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts