How edwin-metcalf/metcode works
MetCode is a local terminal coding assistant: the user selects an Ollama model, enters a prompt, and receives a response after the agent coordinates any requested tools. Tool calls cover sandboxed file operations, confirmed shell commands, and multi-step plans; slash commands manage model choice and saved conversations. Startup loads the customizable system prompt. The graph reflects the shown wiring and README-described capabilities; unsampled implementation details are represented only where documented.
Main entry points: ui.go Interactive CLI · ollama.go Ollama HTTP client · agent.go Turn and tool loop · tools.go Tool dispatcher
Components 17
CLI runtime
- Startup wiring
cmd/metcode/main.go - Interactive CLI
internal/ui/ui.go - Slash commands
internal/ui/commands.go - Request spinner
internal/ui/spinner.go
Agent and model
- Turn and tool loop
internal/agent/agent.go - Ollama HTTP client
internal/ollama/ollama.go
Workspace tools
- Tool definitions
internal/tools/definitions.go - Tool dispatcher
internal/tools/tools.go - Sandboxed file tools
internal/tools/files.go - Confirmed commands
internal/tools/command.go
Plans and conversations
- Plan operations
internal/tools/planhelpers.go - Plan step types
internal/plan/plan.go - Conversation storage
internal/conversation/conversation.go
Prompt configuration
- System prompt loader
internal/prompt/prompt.go
Other components
- Terminal user
- Ollama server
- Custom prompt file
Connections 22
- Terminal user → Startup wiring: launches
README.md - Startup wiring → System prompt loader: loads prompt
cmd/metcode/main.go - System prompt loader → Custom prompt file: loads or creates
README.md - Startup wiring → Interactive CLI: starts
cmd/metcode/main.go - Interactive CLI → Terminal user: reads prompts
internal/ui/ui.go - Interactive CLI → Turn and tool loop: submits turn
internal/ui/ui.go - Interactive CLI → Slash commands: routes commands
internal/ui/ui.go - Interactive CLI → Request spinner: uses while waiting
internal/ui/ui.go - Slash commands → Ollama HTTP client: lists models
internal/ui/commands.go - Slash commands → Conversation storage: saves and loads
internal/ui/commands.go - Turn and tool loop → Ollama HTTP client: sends chat
internal/agent/agent.go - Ollama HTTP client → Ollama server: calls chat API
internal/ollama/ollama.go - Ollama server → Ollama HTTP client: returns response
internal/ollama/ollama.go - Turn and tool loop → Tool definitions: advertises tools
internal/agent/agent.go - Turn and tool loop → Tool dispatcher: dispatches calls
internal/agent/agent.go - Tool dispatcher → Sandboxed file tools: dispatches file calls
internal/tools/tools.go - Tool dispatcher → Confirmed commands: dispatches command
internal/tools/tools.go - Tool dispatcher → Plan operations: dispatches plan calls
internal/tools/tools.go - Plan operations → Plan step types: updates plan items
internal/tools/planhelpers.go - Ollama HTTP client → Ollama server: lists models
internal/ollama/ollama.go - Terminal user → Sandboxed file tools: approves edits
internal/tools/files.go - Terminal user → Confirmed commands: approves execution
internal/tools/command.go