00. System Overview

What This Source Tree Is

This tree reads like the main source directory of a terminal AI product. It contains the app shell, command router, tool registry, API client layer, MCP integration, terminal UI, session memory, settings, plugins, and many operational support services.

The source suggests a product organized around one main idea: the model is only one part of the system. The rest of the code exists to make model output usable inside a real developer workflow.

Top-Level Architecture

LayerMain PathsRole
Boot and CLI shellmain.tsx, entrypoints/, commands.tsStarts the app, parses mode and command options, chooses interactive or non-interactive flow.
Tool bustools.ts, Tool.ts, tools/*Registers capabilities and defines how the model can invoke local actions.
Safety and permissionstools/BashTool/*, utils/permissions/, hooks/toolPermission/Places constraints between model intent and local execution.
Service layerservices/api/*, services/mcp/*, services/oauth/*Connects the client to APIs, auth flows, MCP servers, quotas, and managed settings.
Terminal UIcomponents/*, ink/*, screens/*Renders the product-like terminal interface.
Session and memoryhistory.ts, services/compact/, services/SessionMemory/, utils/memory/Keeps long sessions usable and recovers important context.

What Matters Most

  • The app is not just a prompt wrapper. It is a command-and-tool operating shell.
  • Tool contracts and permission context are treated as first-class types.
  • Command execution is layered behind validation, policy, and UI affordances.
  • MCP is treated as a built-in integration surface rather than a side plugin.
  • The terminal UI is large because the product experience is part of the system design.

What This Will Not Teach You

It does not teach model training, Anthropic backend internals, or secret model quality tricks. It teaches client engineering: how to build a serious terminal-native agent product around a model.

Source Navigation

Recommended Source Files

  • source/main.tsx
  • source/commands.ts
  • source/tools.ts
  • source/services/api/client.ts
  • source/history.ts

Next Files to Read

  • source/Tool.ts
  • source/services/api/claude.ts
  • source/services/mcp/auth.ts