What You Can Learn
- How a large terminal app uses React + Ink as a product-grade CLI shell.
- How tool registration and prompt wiring are separated from execution.
- How dangerous local actions are wrapped in layered permission checks.
- How a client talks to model APIs, OAuth flows, and MCP servers.
- How session state, history, compacting, and mode switching are organized.
Project Map
source/main.tsx: main CLI boot pathsource/commands.ts: slash-command registrysource/tools.ts: tool registrysource/Tool.ts: shared tool contractssource/tools/BashTool/*: command execution safetysource/services/api/*: model/API client layersource/services/mcp/*: MCP auth and transportsource/components/*andsource/ink/*: terminal UI
Chapters
- 00. System Overview
- 00A. Conceptual How It Works
- 01. Startup Flow
- 02. Tools and Permission Layers
- 03. API Clients and MCP
- 04. Terminal UI and Session State
- 05. Recommended Reading Order
- 06. Deep Read: main.tsx
- 07. Deep Read: BashTool
- 08. Trust, History, and Compacting
- 09. Study Exercises and Skill Gains
- 10. Deep Read: commands.ts
- 11. Tool Contracts in Tool.ts
- 12. Deep Read: services/api/client.ts
- 13. Deep Read: services/mcp/auth.ts
- 14. Source Map and Module Index
- 15. Deep Read: services/api/claude.ts
- 16. Deep Read: AgentTool
- 17. Prompt Input and Message UI
- 18. Global Permission System
- 19. Deep Read: FileReadTool
- 20. Deep Read: FileEditTool
- 21. Session Memory
- 22. Compact Subsystem
- 23. Top 20 Files to Study
Goal-Based Tracks
Reading Strategy
Do not start by reading everything. Start with the boot path, then the tool registry, then one concrete tool such as BashTool, then the API layer, then the MCP layer, and only after that the UI and long-tail services.
Current Judgment
The copied tree looks like a large client application source tree, not a normal buildable open-source repository. It contains a rich CLI shell, command router, tool bus, API client code, MCP support, session logic, and a large terminal UI layer. The most valuable engineering lessons are in system decomposition and safety controls, not in any hidden model magic.