How twowb/znaide works
znaide is a terminal-based general-purpose AI agent. Users enter a natural-language task interactively or with -p; the session sends context and tools to an OpenAI-compatible model, dispatches permitted tool calls, and returns the result. The major runtime branches include file and command safety with undo, search/web/memory tools, MCP, skills, personas, and persistent/resumable sessions. The graph follows documented capabilities and sampled call sites; some UI and integration wiring is not visible in the excerpts, so uncertain links are omitted.
Main entry points: session.rs Agent Session · mod.rs Tool Registry · main.rs CLI Entry · app.rs Terminal UI
Components 25
User Experience
- CLI Entry
crates/cli/src/main.rs - Terminal UI
crates/tui/src/app.rs - Config Wizard
crates/tui/src/config_ui.rs
Agent Runtime
- Agent Session
crates/core/src/session.rs - Model Client
crates/core/src/llm/openai.rs - Configuration
crates/core/src/config.rs - File References
crates/core/src/refs.rs
Tools and Safety
- Permission Checks
crates/core/src/permissions.rs - Tool Registry
crates/core/src/tools/mod.rs - File Tools
crates/core/src/tools/file.rs - Search Tools
crates/core/src/tools/search.rs - Shell Runner
crates/core/src/tools/shell.rs - Web Fetch
crates/core/src/tools/web.rs
Persistent State
- Undo Snapshots
crates/core/src/undo.rs - Session History
crates/core/src/session.rs - Memory Tools
crates/core/src/tools/memory.rs - Long-term Memory
crates/core/src/tools/memory.rs
Extensions
Other components
- User
- Model Endpoint
- MCP Server
- Update Sources
Connections 29
- User → CLI Entry: starts task
- CLI Entry → Configuration: loads settings
- CLI Entry → Agent Session: starts session
- CLI Entry → Terminal UI: runs interactive
- User → Terminal UI: enters commands
- Terminal UI → Agent Session: sends commands
- Terminal UI → Config Wizard: opens setup
- Config Wizard → Model Client: queries models
- Config Wizard → Configuration: saves settings
- Agent Session → Model Client: requests completion
- Model Client → Model Endpoint: sends requests
- Model Endpoint → Model Client: returns reply
- Agent Session → Tool Registry: dispatches tools
- Tool Registry → File Tools: routes file calls
- Tool Registry → Search Tools: routes searches
- Tool Registry → Shell Runner: routes commands
- Tool Registry → Web Fetch: routes web calls
- Agent Session → Permission Checks: checks actions
- Agent Session → Undo Snapshots: snapshots before writes
- Agent Session → Session History: records and resumes
- Agent Session → File References: expands references
- Agent Session → Personas: loads persona
- Agent Session → Skills: loads and runs skills
- Agent Session → MCP Tools: dispatches MCP calls
- MCP Tools → MCP Server: invokes tools
- Tool Registry → Memory Tools: routes memory calls
- Memory Tools → Long-term Memory: reads and writes
- CLI Entry → Updater: checks or updates
- Updater → Update Sources: fetches releases