How gitlawb/zero works
Zero is a local-terminal AI coding agent. Its principal workflow starts with an interactive prompt or headless command, runs an agent turn against a configured model, invokes workspace and command tools under permission and sandbox controls, then presents results and preserves session state locally. Other documented capabilities include provider setup, MCP and specialist extensions, language-server diagnostics, and resumable sessions. The map follows the README and repository paths; sampled excerpts are incomplete, so uncertain internal wiring is omitted.
Main entry points: app.go CLI Router · loop.go Agent Loop · builtin_catalog.go Workspace Tools · run.go Terminal UI
Components 22
User Interaction
- CLI Router
internal/cli/app.go - Terminal UI
internal/tui/run.go
Agent Runtime
- Agent Loop
internal/agent/loop.go - Code Diagnostics
internal/lsp/manager.go
Tools and Safety
- Tool Registry
internal/tools/registry.go - Workspace Tools
internal/tools/builtin_catalog.go - Sandbox Policy
internal/sandbox/engine.go - Command Execution
internal/execution/runner.go
Local State
- Session Store
internal/sessions/store.go - Provider Configuration
internal/config/resolver.go - Credential Store
internal/credstore/credstore.go - Session Daemon
internal/daemon/server.go
Providers and Extensions
- Model Providers
internal/providers/factory.go - OAuth Login
internal/oauth/manager.go - MCP Integration
internal/mcp/registry.go - Specialist Agents
internal/specialist/runtime.go - Skills and Plugins
internal/skills/skills.go - Hooks
internal/hooks/dispatch.go
Other components
- Terminal User
- Model API
- Project Files
- MCP Servers
Connections 25
- Terminal User → CLI Router: runs commands
- CLI Router → Terminal UI: starts TUI
- CLI Router → Agent Loop: runs headless turn
- Terminal UI → Agent Loop: submits prompt
- CLI Router → Provider Configuration: loads configuration
- CLI Router → Session Store: opens sessions
- Agent Loop → Model Providers: requests completion
- Model Providers → Model API: sends model request
- Agent Loop → Tool Registry: dispatches tool calls
- Tool Registry → Workspace Tools: resolves tools
- Workspace Tools → Project Files: reads and edits
- Workspace Tools → Sandbox Policy: checks permissions
- Workspace Tools → Command Execution: runs commands
- Command Execution → Project Files: operates in workspace
- Workspace Tools → Code Diagnostics: requests diagnostics
- Agent Loop → Session Store: persists turns
- Provider Configuration → Credential Store: resolves secrets
- CLI Router → OAuth Login: manages login
- OAuth Login → Credential Store: stores tokens
- CLI Router → MCP Integration: configures servers
- MCP Integration → MCP Servers: connects tools
- Agent Loop → Specialist Agents: runs subagents
- CLI Router → Skills and Plugins: manages extensions
- CLI Router → Hooks: dispatches hooks
- CLI Router → Session Daemon: starts daemon