by pacifio
The Rust SDK for building coding agents. Tool execution, LLM streaming, graph memory, sub-agent orchestration, MCP — as composable library functions.
# Add to your Claude Code skills
git clone https://github.com/pacifio/cerseiLast scanned: 5/26/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-26T07:46:45.751Z",
"semgrepRan": false,
"npmAuditRan": true,
"pipAuditRan": true
}cersei is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by pacifio. The Rust SDK for building coding agents. Tool execution, LLM streaming, graph memory, sub-agent orchestration, MCP — as composable library functions. It has 396 GitHub stars.
Yes. cersei passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/pacifio/cersei" and add it to your Claude Code skills directory (see the Installation section above).
cersei is primarily written in Rust. It is open-source under pacifio on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh cersei against similar tools.
No comments yet. Be the first to share your thoughts!
The complete Rust SDK for building coding agents.
Cersei gives you every building block of a production coding agent — tool execution, LLM streaming, sub-agent orchestration, persistent memory, skills, MCP integration — as composable library functions. Build a Claude Code replacement, embed an agent in your app, or create something entirely new.
use cersei::prelude::*;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let output = Agent::builder()
.provider(Anthropic::from_env()?)
.tools(cersei::tools::coding())
.permission_policy(AllowAll)
.run_with("Fix the failing tests in src/")
.await?;
println!("{}", output.text());
Ok(())
}
MIT License | Built by Adib Mohsin | Docs | GitHub
| Claude Code | OpenCode | Cersei SDK | Abstract CLI | |
|---|---|---|---|---|
| Form factor | CLI app | CLI app | Library | CLI app |
| Embeddable | No | No | Yes | No (uses SDK) |
| Provider | Anthropic only | Multi-provider | Multi-provider | Multi-provider |
| Language | TypeScript | TypeScript | Rust | Rust |
| Custom tools | Plugins | Plugins | impl Tool / #[derive(Tool)] |
Via SDK |
| Startup | ~269ms | ~300ms | N/A (library) | ~34ms |
| Binary / RSS | 174MB / 330MB | — | N/A | 5.8MB / 4.9MB |
| Memory | File-based | SQLite | File + Graph | File + Graph |
| Skills | .claude/commands/ |
.claude/skills/ |
Both formats | Both formats |
Cersei is built from the architecture of Claude Code (reverse-engineered Rust port) and designed so that anyone can build a complete, drop-in replacement for Claude Code, OpenCode, or any coding agent — as a library call.
Abstract is a complete CLI coding agent built on Cersei. One binary, zero runtime dependencies, graph memory by default.
# Install
cargo install --path crates/abstract-cli
# Use
abstract # Interactive REPL
abstract "fix the failing tests" # Single-shot
abstract --resume # Resume last session
abstract --model opus --max # Opus with max thinking
abstract --no-permissions --json # CI mode with NDJSON output
All numbers from run_tool_bench.sh --full.
| Metric | Abstract | Claude Code | Winner |
|---|---|---|---|
| Startup (warm) | 32ms | 266ms | Abstract (8.2x) |
| Binary size | 6.0 MB | 174 MB | Abstract (29x) |
| Memory (RSS) | 4.9 MB | 333 MB | Abstract (68x) |
| Tool dispatch | 0.02-17ms | 5-265ms+ | Abstract |
| Memory recall | 98us (graph) | 7,545ms (LLM) | Abstract (77,000x) |
| Memory write | 30us (graph) | 20,687ms (agent) | Abstract (689,000x) |
| MEMORY.md load | 9.6us | 17.1ms | Abstract (1,781x) |
| Sequential throughput | 906ms/req | 12,079ms/req | Abstract (13.3x) |
| System prompt tokens | ~2,200 | ~8,000+ | Abstract (3.6x fewer) |
| LLM call for recall | Not needed | Required (Sonnet) | Abstract |
Claude Code's memory recall calls Sonnet every turn to rank the top 5 files by relevance (7.5s measured). Abstract's graph does indexed lookups in 98 microseconds — same capability, no LLM call, no API cost.
Full benchmark: crates/abstract-cli/benchmarks/REPORT.md
/help, /commit, /review, /memory, /model, /diff, etc.)~/.abstract/config.toml + .abstract/config.toml--json)[dependencies]
cersei = { git = "https://github.com/pacifio/cersei" }
tokio = { version = "1", features = ["full"] }
anyhow = "1"
For graph-backed memory (optional):
cersei-memory = { git = "https://github.com/pacifio/cersei", features = ["graph"] }
cersei Facade crate — use cersei::prelude::*;
cersei-types Provider-agnostic messages, errors, stream events
cersei-provider Provider trait + Anthropic/OpenAI implementations
cersei-tools 30+ tools, permissions, bash classifier, skills, git utils
cersei-tools-derive #[derive(Tool)] proc macro
cersei-agent Agent builder, agentic loop, compact, coordinator, effort
cersei-memory Memory trait, memdir, CLAUDE.md, sessions, Grafeo graph
cersei-hooks Hook/middleware system
cersei-mcp MCP client (JSON-RPC 2.0, stdio transport)
abstract-cli CLI coding agent ("abstract") — REPL, commands, config, permissions
Any LLM backend. Built-in: Anthropic (with OAuth), OpenAI (compatible with Ollama, Azure, vLLM).
Agent::builder().provider(Anthropic::from_env()?) // Anthropic API key
Agent::builder().provider(OpenAi::builder()
.base_url("http://localhost:11434/v1") // Ollama
.model("llama3.1:70b").api_key("ollama").build()?)
Agent::builder().provider(MyCustomProvider) // impl Provider
Every tool a coding agent needs, organized into sets:
cersei::tools::all() // 30+ tools
cersei::tools::coding() // filesystem + shell + web
cersei::tools::filesystem() // Read, Write, Edit, Glob, Grep, NotebookEdit
cersei::tools::shell() // Bash, PowerShell
cersei::tools::web() // WebFetch, WebSearch
cersei::tools::planning() // EnterPlanMode, ExitPlanMode, TodoWrite
cersei::tools::scheduling() // CronCreate/List/Delete, Sleep, RemoteTrigger
cersei::tools::orchestration() // SendMessage, Tasks (6 tools), Worktree
Custom tools in 10 lines:
The
#[derive(Tool)]macro generates code with#[async_trait::async_trait]andcercei-tools, to make it work add both of it to depending on your project.async-trait = "0.1" cersei = { path = "path/to/cersei" } # or git cersei-tools = { path = "path/to/cersei/crates/cersei-tools" }or write
use cersei::tools as cersei_tools;when usingderive(Tool);
#[derive(Tool)]
#[tool(name = "search", description = "Search docs", permission = "read_only")]
struct SearchTool;
#[async_trait]
impl ToolExecute for SearchTool {
type Input = SearchInput; // derives Deserialize + JsonSchema
async fn run(&self, input: SearchInput, ctx: &ToolContext) -> ToolResult {
ToolResult::success(format!("Found: {}", input.query))
}
}
Spawn parallel workers, coordinate tasks, pass messages between agents:
// AgentTool — model spawns sub-agents autonomously
Agent::builder()
.tool(AgentTool::new(|| Box::new(Anthropic::from_env()?), cersei::tools::coding()))
// Coordinator mode — orchestrate parallel workers
Agent::builder()
.tools(cersei::tools::all()) // includes Agent, Tasks, SendMessage
// Workers get filtered tools (no Agent — prevents recursion)
// Task system
// TaskCreate → TaskUpdate → TaskGet → TaskList → TaskStop → TaskOutput
use cersei::memory::manager::MemoryManager;
let mm = MemoryManager::new(project_root)
.with_graph(Path::new("./memory.grafeo"))?; // optional graph layer
// Tier 1: Flat files (~/.claude/projects/<root>/memory/)
let metas = mm.scan(); // scan .md files with frontmatter
let content = mm.build_context(); // build system prompt injection
// Tier 2: CLAUDE.md hierarchy (managed > user > project > local)
// Automatically merged into build_context()
// Tier 3: Graph memory (Grafeo, optional)
let id = mm.store_memory("User prefers Rust", MemoryType::User, 0.9)?;
mm.tag_memory(&id, "preferences");
let results = mm.recall("Rust", 5); // graph query with fallback to text match
// Session persistence (JSONL, append-only, tombstone soft-delete)
mm.write_user_message("session-1", Message::user("Hello"))?;
let messages = mm.load_session_messages("session-1")?;
// Auto-discovers skills from:
// .claude/commands/*.md (Claude Code format)
// .claude/skills/*/SKILL.md (OpenCode format)
// ~/.claude/commands/*.md (user-level)
// Bundled skills (simplify, debug, commit, verify, stuck, remember, loop)
let skill_tool = SkillTool::new().with_project_root(".");
// skill="list" → lists all available skills
// skill="debug" args="tests are flaky" → expands $ARGUMENTS template
Three observation mechanisms:
// 1. Callback
Agent::builder().on_event(|e| match e {
AgentEvent::TextDelta(t) => print!("{}", t),
AgentEvent::ToolStart { name, .. } => eprintln!("[{}]", name),
_ => {}
})
// 2. Broadcast (multi-consumer)
let agent = Agent::builder().enable_broadcast(256).build()?;
let mut rx = agent.subscribe().unwrap();
tokio::spawn(async move { while let Ok(e) = rx.recv().await { /* ... */ } });
// 3. Stream (bidirectional control)
let mut stream = agent.run_stream("Deploy");
while let Some(e) = stream.next().await {
if let AgentEvent::PermissionRequired(req) = e {
stream.respond_permission(req.id, PermissionDecision::Allow);
}
}
Agent::builder()
.auto_compact(true) // summarize old messages at 90% context usage
.compact_threshold(0.9) // trigger threshold
.tool_result_budget