How zvnoob/agent works
Agent is a terminal coding assistant whose main workflow is: the user submits a turn, the configured Lua registry advertises tools to a streaming chat client, and the runtime dispatches requested tools before returning their results to the model. Shell execution passes through a seccomp supervisor and Lua permission policy; tools can report through Lua-drawn TUI panels. The README also documents filesystem tools, MCP connections, conversation memory, reloadable configuration, and syntax-highlighted streaming UI. Runtime wiring is grounded in the README and sampled entry points; unsampled subsystem links are included only where documented.
Main entry points: main.rs Turn loop · mcps.lua Tool registry · lua.rs Lua bridge · bash_tool.lua Shell tool
Components 22
Conversation runtime
- Turn loop
src/main.rs - Chat client
src/api.rs - Conversation memory
src/memory.rs
Lua configuration
- Starter config
lua/init.lua - Lua bridge
src/lua.rs
Tools and policy
- Tool registry
lua/mcps.lua - Filesystem tools
lua/fs.lua - Shell tool
lua/bash_tool.lua - Bash support
lua/lib/bash.lua - Permission policy
lua/policy.lua - Ask protocol
lua/lib/ask.lua - MCP transports
src/mcp.rs
Sandbox runtime
- Sandbox supervisor
src/seccomp/mod.rs - Async sandbox adapter
src/async_sandbox.rs - Syscall tables
src/seccomp/arch/mod.rs
Terminal interface
- TUI shell
src/tui/mod.rs - Turn panel
src/tui/panel.rs - Markdown highlighting
src/tui/highlight.rs - Panel operations
src/panels.rs
Other components
- User
- Chat endpoint
- MCP servers
Connections 25
- User → TUI shell: submits turn
- TUI shell → Turn loop: submits input
- Turn loop → Starter config: loads configuration
- Starter config → Lua bridge: configures agent
- Turn loop → Chat client: requests stream
- Chat client → Chat endpoint: sends chat request
- Chat endpoint → Chat client: streams events
- Turn loop → Tool registry: dispatches tool call
- Tool registry → Filesystem tools: registers tools
- Tool registry → Shell tool: registers tools
- Shell tool → Bash support: uses shell support
- Shell tool → Async sandbox adapter: runs command
- Async sandbox adapter → Sandbox supervisor: drives sandbox
- Sandbox supervisor → Syscall tables: resolves syscalls
- Permission policy → Ask protocol: requests decision
- Lua bridge → Sandbox supervisor: mediates policy asks
- Ask protocol → Panel operations: draws permission prompt
- Panel operations → Turn panel: applies panel ops
- Turn loop → Panel operations: collects panel ops
- TUI shell → Turn panel: renders conversation
- Turn panel → Markdown highlighting: highlights messages
- Turn loop → Conversation memory: archives turns
- Lua bridge → Conversation memory: reads and writes
- Tool registry → MCP transports: uses transports
- MCP transports → MCP servers: connects to servers