How ericthz/zebra works
Zebra is a pure-Go AI-agent reference implementation, exposed through an interactive CLI, an HTTP API, and a standalone MCP server. The primary workflow accepts a user request, runs an agent conversation with model routing and optional tools, skills, memory, and knowledge retrieval, then returns a response. The repository also documents multiple agent modes and capabilities such as voice, asynchronous tasks, and shadow evaluation. Connections reflect the shown excerpts and README; unsampled implementation details are represented only where documented.
Main entry points: agent.go Agent engine · server.go HTTP API · server/main.go Server assembly · zebra/main.go Interactive CLI
Components 22
Entry points
- Interactive CLI
cmd/zebra/main.go - HTTP API
internal/server/server.go - Server assembly
cmd/server/main.go - MCP entrypoint
cmd/mcp/main.go
Agent runtime
- Agent engine
internal/agent/agent.go - Agent modes
internal/agent/plan.go - Worker routing
internal/supervisor/supervisor.go
Context capabilities
- Knowledge retrieval
internal/rag/index.go - Skill injection
internal/skill/retrieve.go - Conversation memory
internal/memory/memory.go - Context budgeting
internal/agent/context.go
Service features
- Voice interaction
internal/provider/voice.go - Async tasks
internal/server/tasks.go - Shadow evaluation
internal/eval/shadow.go - Environment inventory
internal/observe/env.go - Capability inventory
internal/observe/inventory.go - User feedback
internal/server/feedback.go
Model and tools
- Model routing
internal/provider/router.go - Tool execution
internal/tool/registry.go - MCP server
internal/mcp/server.go
Other components
- CLI user
- HTTP client
Connections 27
- CLI user → Interactive CLI: enters requests
README.md - HTTP client → HTTP API: posts chat
README.md - Interactive CLI → Agent engine: runs conversation
cmd/zebra/main.go - Interactive CLI → Agent modes: selects mode
cmd/zebra/main.go - HTTP API → Agent engine: builds agent
- Server assembly → HTTP API: assembles service
README.md - Agent engine → Model routing: requests completion
internal/agent/agent.go - Agent engine → Tool execution: executes tool calls
internal/agent/agent.go - Agent engine → Knowledge retrieval: retrieves context
internal/agent/agent.go - Agent engine → Skill injection: injects skills
internal/agent/agent.go - Agent engine → Conversation memory: uses memory
internal/agent/agent.go - Agent engine → Context budgeting: trims messages
internal/agent/agent.go - Agent modes → Agent engine: reuses engine
internal/agent/agent.go - Worker routing → Agent engine: builds workers
- Worker routing → Model routing: routes requests
internal/supervisor/supervisor.go - Server assembly → Knowledge retrieval: loads documents
cmd/server/main.go - Knowledge retrieval → Conversation memory: embeds chunks
internal/rag/index.go - MCP entrypoint → MCP server: starts transport
cmd/mcp/main.go - MCP entrypoint → Tool execution: registers tools
cmd/mcp/main.go - HTTP API → Async tasks: serves task routes
internal/server/server.go - Async tasks → Agent engine: runs task
internal/server/tasks.go - Server assembly → Voice interaction: configures optionally
cmd/server/main.go - HTTP API → Shadow evaluation: supports evaluation
internal/server/server.go - Server assembly → Shadow evaluation: configures evaluator
cmd/server/main.go - HTTP API → User feedback: serves feedback routes
internal/server/server.go - Interactive CLI → Capability inventory: prints capabilities
internal/observe/inventory.go - Server assembly → Environment inventory: loads configuration
cmd/server/main.go