Mixtape CLI
Session storage and REPL utilities for mixtape agents.
Session Persistence
Store conversations in SQLite so they survive restarts:
use ;
use SqliteStore;
async
Sessions are scoped to the current working directory. Each directory gets its own conversation history.
Custom Location
let store = new?;
Parent directories are created automatically.
Interactive REPL
Run a full-featured CLI for your agent:
use ;
use run_cli;
async
The REPL provides:
- Command history with up/down arrows
- Reverse search with Ctrl+R
- Multi-line input with Ctrl+J
- Special commands (
/help,/clear,!shell) - Rich tool output formatting
- Context usage display
Tool Permissions
For agents that need user confirmation before running tools, use .interactive() with a grant store:
use ;
use run_cli;
async
The .interactive() builder method configures the agent to emit PermissionRequired events for tools without a matching grant. The run_cli() function automatically handles these events by prompting the user for approval.
Approval Prompters
The CLI provides pluggable approval UX via the ApprovalPrompter trait:
use ;
let request = PermissionRequest ;
let choice = prompt_for_approval;
The default prompter offers four options:
y- approve once (don't remember)e- trust this exact call (session)t- trust entire tool (session)n- deny
Implement ApprovalPrompter for custom approval UX (e.g., GUI dialogs, web interfaces).
Custom Event Presentation
For building custom UIs that handle tool output and permissions, use the event queue pattern:
use ;
use ;
// Create shared event queue
let event_queue = new_event_queue;
// Add presentation hook to agent
agent.add_hook;
// Create presenter to render events
let verbosity = new;
let presenter = new;
// Call presenter.flush() periodically to render queued events
See the permissions example for a complete implementation.
Exports
| Item | Purpose |
|---|---|
SqliteStore |
SQLite-based session storage |
run_cli |
Interactive REPL loop |
ApprovalPrompter |
Trait for custom approval UX |
SimplePrompter |
Default approval prompter |
DefaultPrompter |
Type alias for SimplePrompter |
PermissionRequest |
Permission request data for prompters |
prompt_for_approval |
Convenience function using default prompter |
PresentationHook |
Hook that queues tool events for presentation |
EventPresenter |
Renders queued events with formatting |
new_event_queue |
Create event queue for PresentationHook |
Verbosity |
Output verbosity level (Quiet, Normal, Verbose) |
CliError |
Error type for CLI operations |