Code · Agents
AgentSmith
Persistent, searchable memory for AI agents, so they remember across restarts.
What it is
Most agents forget everything when the process stops. AgentSmith wraps an agent built with the Rust Rig framework and records every turn in a SQLite database with full-text search, the way Atuin does for shell history. Before each reply, it searches past conversations for relevant turns and adds them to the prompt.
Using it
use agentsmith::{AgentHistory, SmartAgent};
use rig::providers::openai;
let history = AgentHistory::new("my_agent.db", Some("session-123")).await?;
let client = openai::Client::new(&std::env::var("OPENAI_API_KEY")?);
let agent = client.agent("gpt-4").preamble("You are a helpful assistant.").build();
let mut smart = SmartAgent::new(agent, history);
let reply = smart.chat("How did we fix the JSON parsing bug?").await?;
AgentHistory can also be used directly: log_turn records a message with metadata (duration, success, tokens), search and recent retrieve turns, summarize_session writes a summary, and import_jsonl loads an existing log.
Ideas for using it
- A coding assistant that remembers your project’s past bugs and fixes.
- Support bots that recall a customer’s earlier conversations.
- Agent analytics: search all sessions for failures and see what preceded them.
Status
Prototype; built for Rig agents. SQLite only.