AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Claude Code Sourcemap Learning Notebook

mcp-gabbiesbv-claude-code-sourcemap-learning-notebook · by gabbiesbv

Reverse-engineer Claude Code sourcemaps to study its architecture, design choices, and reusable AI agent patterns

No reviews yet
0 installs
24 views
0.0% view→install

Install

$ agentstack add mcp-gabbiesbv-claude-code-sourcemap-learning-notebook

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-gabbiesbv-claude-code-sourcemap-learning-notebook)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Claude Code Sourcemap Learning Notebook? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Claude Code Sourcemap Learning Notebook

[](https://github.com/gabbiesbv/claude-code-sourcemap-learning-notebook/raw/refs/heads/main/zh-CN/claude-learning-code-notebook-sourcemap-1.6-beta.1.zip) [](LICENSE)

> 🌐 [中文版 / Chinese Version](README_CN.md)

Reverse-engineering Claude Code's 512K+ lines of TypeScript — extracting the architecture, design decisions, and 11 transferable patterns that make a production AI Agent work.

Not just a code walkthrough. An architectural analysis that explains why each design choice was made, with alternatives compared.

What You'll Learn

  • 🔄 Query Loop — Streaming tool execution, read-write lock concurrency, 3-layer AbortController cascade
  • 🛠️ Tool SystembuildTool() factory + Zod schema as prompt, 40+ tools with 18+ feature flags
  • 🔒 5-Layer Security — Permission rules → mode → tool checks → path safety → macOS Seatbelt sandbox
  • 🤖 Multi-Agent — Coordinator orchestration, default isolation with explicit sharing, cache-friendly forking
  • 🔌 MCP & Skills — 3-layer skill architecture, bundled skill lazy extraction, /simplify 3-agent parallel review
  • 🧠 Prompt Engineering — 7 categories with 40+ prompt files, static/dynamic separation for cache optimization
  • 🎙️ Voice & Buddy — Record-first-connect-later latency elimination, deterministic generation

Chapters

| # | Topic | Core Source Files | Time | |---|-------|-------------------|------| | [00](zh-CN/00index.md) | Index & Architecture Overview | — | 10min | | [01](zh-CN/01architectureoverview.md) | Global Architecture | main.tsx, App.tsx, QueryEngine.ts | 30min | | [02](zh-CN/02toolsystem.md) | Tool System | Tool.ts, tools.ts, GlobTool.ts | 45min | | [03](zh-CN/03permissionsecurity.md) | Permission & Security | permissions.ts, filesystem.ts | 45min | | [04](zh-CN/04queryloopapi.md) | Query Loop & API ⭐ | query.ts, StreamingToolExecutor.ts | 50min | | [05](zh-CN/05multiagentsystem.md) | Multi-Agent + Coordinator ⭐ | AgentTool.tsx, runAgent.ts | 50min | | [06](zh-CN/06mcpextensions.md) | MCP, Skills & Extensions | mcp/client.ts, skills/ | 45min | | [07](zh-CN/07promptengineering.md) | Prompt Engineering | prompts.ts, BashTool/prompt.ts | 60min | | [08](zh-CN/08voice_buddy.md) | Voice Mode & Buddy | voiceStreamSTT.ts, buddy/ | 30min |

Total ~5.5 hours for a systematic understanding of Claude Code internals.

> Course content available in [Chinese (zh-CN/)](zh-CN/) and [English (en/)](en/).

Learning Paths

| Path | Chapters | Time | |------|----------|------| | Quick Start | 00 → 01 → 02 → 04 | 2h | | Security Focus | 00 → 03 → 02 | 1.5h | | Agent Research | 00 → 05 → 04 → 06 | 2.5h | | Prompt Research | 00 → 07 | 1h | | Full Course | 00 → 01 → ... → 08 | 5.5h |

Key Discoveries

| Chapter | Most Valuable Finding | |---------|----------------------| | 01 | React/Ink terminal UI — CLI can use React | | 02 | buildTool() factory + Zod schema doubles as prompt | | 03 | 5-layer defense; bypass mode still has safety floor (.git/.claude protected) | | 04 | StreamingToolExecutor concurrent execution, 5-layer compression pipeline | | 05 | Coordinator star topology, fork prompt cache sharing, 10-step finally cleanup | | 06 | Skills 3-layer architecture, /simplify 3-agent parallel review | | 07 | 40+ prompt files with static/dynamic separation, Meta-Prompt generates Agents | | 08 | Record-first-connect-later eliminates latency, Buddy Bones not persisted |

11 Transferable Design Patterns

Extracted from Ch.04 & Ch.05 — applicable to any Agent system:

From Query Loop: Optimistic Recovery · Layered Degradation · State Machine + Transition Log · Read-Write Lock Concurrency · Immutable Config Snapshot · Hierarchical Cancellation

From Multi-Agent: Capability-based Security · Cache-Friendly Forking · Deterministic Cleanup · Star Topology Orchestration · Monotonic Permission Narrowing

> Each pattern includes Claude Code implementation details and universal applications (DB, K8s, microservices, etc.) in the chapter notes.

Sister Project: nano-claude-code

> 1,646 lines of TypeScript · 15 files · 4 dependencies

nano-claude-code rewrites Claude Code's core as a minimal, hackable implementation you can actually run and modify.

| | Claude Code | nano-claude-code | |---|---|---| | Files | ~1,900 | 15 | | Lines | 512,000+ | 1,646 | | Dependencies | 50+ | 4 | | Tools | 40+ | 6 |

Read the notebook to understand the architecture. Run nano-claude-code to build your own.

👉 github.com/dadiaomengmeimei/nano-claude-code

Links

License

MIT. The analyzed Claude Code source code is copyrighted by Anthropic. This project is for educational and research purposes only.


If this helps you, give it a ⭐! Follow @dadiaomengmeimei for more AI source code analysis.

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.