How legend-of-alan/ghostmode works
Ghost Mode is a Rust library that lets an agent run a Python script against host tools through a sandbox, returning only the script's result. The documented workflow is: expose execute/poll schemas to the model, pass execute or poll requests to Sandbox, run scripts through a Monty backend, dispatch script tool calls to the Host, and return a bounded Status. The README also documents MCP host integration, alternative schema formats, resource limits, polling, session dump/restore, and signing. Edges follow the excerpts or README; unsampled implementation details are not inferred.
Main entry points: sandbox.rs Sandbox API · monty.rs Monty backends · mcp.rs MCP host · host.rs Host interface
Components 16
Agent API
- Tool schemas
src/schema.rs - Sandbox API
src/sandbox.rs - Run status
src/sandbox.rs - Output budgeting
src/sandbox/output.rs
Script runtime
- Backend contract
src/backend.rs - Monty backends
src/backend/monty.rs - In-process runner
src/backend/monty/in_process.rs - Worker pool runner
src/backend/monty/pool.rs - Value conversion
src/backend/monty/value.rs
Host tools
- Host interface
src/host.rs - MCP host
src/mcp.rs
Session state
- Session dump
src/sandbox.rs - Dump signing
src/sandbox.rs
Other components
- Agent model
- Agent caller
- MCP server
Connections 20
- Agent caller → Tool schemas: gets definitions
README.md - Tool schemas → Agent model: provides functions
README.md - Agent caller → Sandbox API: passes requests
README.md - Sandbox API → Backend contract: runs scripts
src/backend.rs - Backend contract → Monty backends: implemented by
src/backend.rs - Monty backends → In-process runner: selects runner
src/backend/monty.rs - Monty backends → Worker pool runner: selects runner
src/backend/monty.rs - In-process runner → Value conversion: converts calls
src/backend/monty/in_process.rs - Worker pool runner → Value conversion: converts calls
src/backend/monty/pool.rs - Sandbox API → Host interface: dispatches calls
README.md - Host interface → Sandbox API: returns answers
README.md - Sandbox API → Output budgeting: bounds output
src/sandbox.rs - Sandbox API → Run status: returns status
README.md - Run status → Agent caller: sent to model
README.md - Sandbox API → Session dump: dumps sessions
src/sandbox.rs - Session dump → Sandbox API: restores sessions
src/sandbox.rs - Dump signing → Session dump: authenticates bytes
src/sandbox.rs - MCP host → Host interface: implements interface
src/mcp.rs - MCP host → MCP server: calls tools
src/mcp.rs - Agent caller → MCP host: configures host
README.md