| Crates.io | mixtape-cli |
| lib.rs | mixtape-cli |
| version | 0.2.1 |
| created_at | 2026-01-05 04:52:33.377734+00 |
| updated_at | 2026-01-06 06:53:56.785398+00 |
| description | Session storage and REPL utilities for the mixtape agent framework |
| homepage | |
| repository | https://github.com/adlio/mixtape |
| max_upload_size | |
| id | 2023102 |
| size | 137,400 |
Session storage and REPL utilities for mixtape agents.
Store conversations in SQLite so they survive restarts:
use mixtape_core::{Agent, ClaudeSonnet4_5};
use mixtape_cli::SqliteStore;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let store = SqliteStore::default_location()?; // .mixtape/sessions.db
let agent = Agent::builder()
.bedrock(ClaudeSonnet4_5)
.with_session_store(store)
.build()
.await?;
agent.run("Remember this for later").await?;
Ok(())
}
Sessions are scoped to the current working directory. Each directory gets its own conversation history.
let store = SqliteStore::new("/path/to/sessions.db")?;
Parent directories are created automatically.
Run a full-featured CLI for your agent:
use mixtape_core::{Agent, ClaudeSonnet4_5};
use mixtape_cli::run_cli;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let agent = Agent::builder()
.bedrock(ClaudeSonnet4_5)
.build()
.await?;
run_cli(agent).await?;
Ok(())
}
The REPL provides:
/help, /clear, !shell)For agents that need user confirmation before running tools, use the permission system:
use mixtape_core::{Agent, ClaudeSonnet4_5, MemoryGrantStore};
use mixtape_cli::run_cli;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a grant store and pre-approve safe tools
let store = MemoryGrantStore::new();
store.grant_tool("read_file").await?; // Trust entire tool
let agent = Agent::builder()
.bedrock(ClaudeSonnet4_5)
.with_grant_store(store)
.build()
.await?;
run_cli(agent).await?;
Ok(())
}
Tools without a matching grant will emit PermissionRequired events. The REPL handles these
by prompting the user interactively.
The CLI provides pluggable approval UX via the ApprovalPrompter trait:
use mixtape_cli::{ApprovalPrompter, PermissionRequest, SimplePrompter};
use mixtape_core::AuthorizationResponse;
// Use the default prompter
let prompter = SimplePrompter;
let choice: AuthorizationResponse = prompter.prompt(&request);
The SimplePrompter offers four options:
y - approve once (don't remember)e - trust this exact call (session)t - trust entire tool (session)n - denyImplement ApprovalPrompter for custom approval UX (e.g., GUI dialogs, web interfaces).
| 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 |
Rich tool output formatting hook |
Verbosity |
Output verbosity level |
CliError |
Error type for CLI operations |