How he-yufeng/corecoder works
CoreCoder is a small, runnable coding-agent engine intended as a readable foundation for building agents. Its main workflow is terminal input through the CLI into the agent loop, which requests model responses and dispatches tool calls until it can return a reply. The graph also preserves documented capabilities such as sub-agents, context compression, consent, undo, sessions, hooks, and MCP. Edges use the excerpts, source-index references, or README; some subsystem wiring is not shown in detail.
Main entry points: corecoder/agent.py Agent loop · cli.py CLI and REPL · tools/agent.py Sub-agents · mcp.py MCP tools and resources
Components 26
Terminal interface
- CLI and REPL
corecoder/cli.py - Runtime configuration
corecoder/config.py
Agent engine
- Agent loop
corecoder/agent.py - System prompt
corecoder/prompt.py - Context compression
corecoder/context.py
Agent tools
- Tool registry
corecoder/tools/__init__.py - Tool interface
corecoder/tools/base.py - Read files
corecoder/tools/read.py - Write files
corecoder/tools/write.py - Edit files
corecoder/tools/edit.py - Find files and text
corecoder/tools/glob_tool.py - Search text
corecoder/tools/grep.py - Shell commands
corecoder/tools/bash.py - Shell runner
corecoder/shell.py - Task checklist
corecoder/tools/todo.py - Sub-agents
corecoder/tools/agent.py
Safety and state
- Tool consent
corecoder/permissions.py - Tool hooks
corecoder/hooks.py - Undo checkpoints
corecoder/checkpoints.py - Saved sessions
corecoder/session.py
Model and MCP
- LLM client
corecoder/llm.py - MCP tools and resources
corecoder/mcp.py - MCP HTTP transport
corecoder/mcp_http.py
Other components
- User
- OpenAI-compatible model API
- MCP servers
Connections 32
- User → CLI and REPL: enters prompt
README.md - CLI and REPL → Agent loop: starts and prompts
corecoder/cli.py - CLI and REPL → Runtime configuration: loads settings
corecoder/cli.py - CLI and REPL → Saved sessions: loads and saves
corecoder/cli.py - CLI and REPL → Tool consent: configures consent
corecoder/cli.py - CLI and REPL → Tool hooks: configures hooks
corecoder/cli.py - CLI and REPL → Undo checkpoints: handles undo
corecoder/cli.py - CLI and REPL → MCP tools and resources: loads MCP tools
corecoder/cli.py - Agent loop → LLM client: requests responses
corecoder/agent.py - LLM client → OpenAI-compatible model API: sends model requests
README.md - Agent loop → Context compression: compresses history
corecoder/agent.py - Agent loop → System prompt: builds system prompt
corecoder/agent.py - Agent loop → Tool registry: uses registered tools
corecoder/agent.py - Tool registry → Tool interface: implements interface
corecoder/tools/__init__.py - Agent loop → Tool consent: checks tool consent
corecoder/agent.py - Agent loop → Tool hooks: runs tool hooks
corecoder/agent.py - Agent loop → Read files: dispatches calls
corecoder/agent.py - Agent loop → Write files: dispatches calls
corecoder/agent.py - Agent loop → Edit files: dispatches calls
corecoder/agent.py - Agent loop → Find files and text: dispatches calls
corecoder/agent.py - Agent loop → Search text: dispatches calls
corecoder/agent.py - Agent loop → Shell commands: dispatches calls
corecoder/agent.py - Agent loop → Task checklist: dispatches calls
corecoder/agent.py - Agent loop → Sub-agents: dispatches calls
corecoder/agent.py - Shell commands → Shell runner: runs commands
corecoder/tools/bash.py - Edit files → Undo checkpoints: records edits
corecoder/tools/edit.py - Write files → Undo checkpoints: records writes
corecoder/tools/write.py - Sub-agents → Agent loop: creates workers
corecoder/tools/agent.py - Sub-agents → Shell commands: tracks working directory
corecoder/tools/agent.py - Sub-agents → Task checklist: isolates checklists
corecoder/tools/agent.py - MCP tools and resources → MCP HTTP transport: uses HTTP transport
corecoder/mcp.py - MCP tools and resources → MCP servers: connects to servers
corecoder/mcp.py