How samuellin967/claude-code works
Claude Code is a terminal-based AI software-engineering agent. The main workflow runs from a developer’s prompt through the interactive CLI and query engine to model responses and tool execution, with results presented and session state persisted. Commands and integrations add distinct workflows for permissions, agents, tasks, memory, plugins, MCP, and IDE/remote bridging. The README documents several subsystems whose implementation files are not in the supplied tree; those are represented at documented directory level, and their detailed internal wiring is omitted.
Main entry points: tools Tool system · QueryEngine.ts Query engine · App.tsx Terminal UI · commands.ts Slash commands
Components 19
CLI interaction
- Terminal UI
src/components/App.tsx - Slash commands
src/commands.ts
Agent runtime
- Query engine
src/QueryEngine.ts - Query pipeline
src/query - Tool system
src/tools - Tool permissions
src/hooks/toolPermission - Session storage
src/utils/sessionStorage.ts - Portable session access
src/utils/sessionStoragePortable.ts
Agent capabilities
- MCP servers
src/services/mcp - Agent coordination
src/coordinator - Skills
src/skills - Persistent memory
src/memdir - Task management
src/tasks
Integrations
- Plugins
src/plugins - IDE bridge
src/bridge/bridgeMain.ts - Remote sessions
src/remote
Other components
- Developer
- Anthropic API
- Project files and shell
Connections 20
- Developer → Terminal UI: enters prompts
- Developer → Slash commands: invokes commands
- Terminal UI → Query engine: submits input
- Slash commands → Query engine: starts workflows
- Query engine → Query pipeline: runs queries
- Query pipeline → Anthropic API: sends model requests
- Query pipeline → Tool system: dispatches tool calls
- Tool system → Tool permissions: checks authorization
- Tool permissions → Developer: requests approval
- Tool system → Project files and shell: operates on project
- Tool system → MCP servers: invokes server tools
- Query engine → Session storage: flushes session state
- Session storage → Portable session access: uses transcript reads
- Query engine → Agent coordination: coordinates agents
- Tool system → Skills: executes skills
- Tool system → Task management: manages tasks
- Query engine → Persistent memory: uses memory context
- Slash commands → Plugins: manages plugins
- Terminal UI → IDE bridge: connects IDE
- IDE bridge → Remote sessions: supports remote sessions