How windy3f3f3f3f/claude-code-from-scratch works
Mini Claude Code is a learning-oriented coding agent, implemented in TypeScript and Python. Its main workflow is: a user submits a coding task through the CLI; the agent builds prompts and calls a model, checks permissions, executes requested tools, and returns results through the terminal. Sessions, context management, memory, skills, sub-agents, and MCP extend that loop. The graph emphasizes the TypeScript runtime and README-documented capabilities; several feature links are documented but their implementations were not sampled.
Main entry points: agent.ts Agent loop · cli.ts CLI and REPL · tools.ts Permissions and tools · mcp.ts MCP integration
Components 16
CLI and interaction
- CLI and REPL
src/cli.ts - Terminal UI
src/ui.ts - Session persistence
src/session.ts
Agent orchestration
- Agent loop
src/agent.ts - Prompt construction
src/prompt.ts - Permissions and tools
src/tools.ts - Context management
src/agent.ts - Autonomy modes
src/autonomy.ts
Agent capabilities
- Memory system
src/memory.ts - Skills
src/skills.ts - Sub-agents
src/subagent.ts - MCP integration
src/mcp.ts
External systems
- Project files
- Model API
- MCP servers
Other components
- User
Connections 17
- User → CLI and REPL: submits task
- CLI and REPL → Agent loop: starts agent
- CLI and REPL → Session persistence: loads and saves
- CLI and REPL → Terminal UI: displays interaction
- Agent loop → Prompt construction: builds prompts
- Agent loop → Model API: sends requests
- Model API → Agent loop: returns responses
- Agent loop → Permissions and tools: checks and executes
- Permissions and tools → Project files: reads and writes
- Agent loop → Context management: manages history
- Agent loop → Autonomy modes: evaluates goals
- Agent loop → Memory system: recalls and saves
- Agent loop → Skills: discovers and invokes
- Agent loop → Sub-agents: delegates tasks
- Agent loop → MCP integration: discovers and routes tools
- MCP integration → MCP servers: connects over stdio
- Agent loop → Terminal UI: prints responses