A study of how an agentic coding CLI is put together, told twice: once as prose chapters, once as Python.
chapters-md/- Thirty-four descriptive chapters, one per subsystem: the query loop, tool architecture, hooks, session persistence, sandboxing, MCP, memory, and the rest. Prose, not code.code-python/- The same architecture expressed as Python modules, so the shapes the chapters describe can be read as types and functions instead of paragraphs.
Read it as an architecture study. The interesting part of an agentic CLI is not any single tool; it is how the loop, the registry, the hooks, and the sandbox constrain each other.
Chapters are numbered. Start at Chapter 00 for the overview, then read in order or jump to whatever subsystem you came for.
- 00 - Introduction
- 01 - Workspace Context
- 02 - Cost Tracking
- 03 - Session History
- 04 - The Query Loop
- 05 - Task Management
- 06 - Tool Architecture
- 07 - Application State
- 08 - Bridge System
- 09 - Slash Commands
- 10 - Hook Events
- 11 - Cron Scheduling
- 12 - Session Persistence
- 13 - Bundled Skills
- 14 - Swarm Orchestration
- 15 - MCP Protocol
- 16 - Sandbox Enforcement
- 17 - Tool Registry
- 18 - Bash Tool
- 19 - File Tools
- 20 - Search Tools
- 21 - Agent Tool
- 22 - Web Tools
- 23 - Task Tools
- 24 - Team Tools
- 25 - Plan Mode
- 26 - Cron Tools
- 27 - Worktree Tools
- 28 - Specialized Tools
- 29 - Services Overview
- 30 - Compaction and Dreams
- 31 - Memory System
- 32 - Type System
- 33 - Utilities
Independent work. Not affiliated with, authorized by, or endorsed by Anthropic. "Claude" and "Claude Code" are trademarks of Anthropic, used here only to name the subject of the study.