Cersei — Rust SDK for Coding Agents
Build coding agents as composable library functions: tools, streaming, graph memory, sub-agent orchestration, and MCP in one Rust SDK.
Multiple permission policies (AllowAll/AllowReadOnly/DenyAll/RuleBased/Interactive) and a permission event stream exist, but the quick-start example defaults to AllowAll, and there is no evidence of sandboxing, bash-classifier details, secret storage details, or guards on external effects (shell, cron, web); the 'reverse-engineered Claude Code port' provenance claim weakens source attribution.
Architecture diagram matches the Cargo workspace members, dependencies are centrally versioned with a documented musl static-build workaround, and thiserror/anyhow are used; however, docs contain a 'cercei-tools' typo and no concrete failure-message examples are shown.
Audience is clear (embedders and CLI users), multi-provider support, dual skill formats, and layered CLI config are covered; but capability boundaries rest on README assertions rather than interface-level documentation.
Excellent README information architecture (concepts, architecture, examples, benchmarks, extension points), full MIT text, rich examples; but git-only install, no CHANGELOG, 0.2.x versioning instability, single-author maintenance with no governance or update commitment.
Output usability is decent (JSON mode, NDJSON, broadcast events, reporters), and the SDK fills a real Rust niche; but all performance claims are self-reported benchmarks not independently checkable within the provided files, so cost-benefit claims are discounted.
Benchmark numbers reference a REPORT.md and scripts not included here, and '160 unit tests / 0 failures' cannot be statically confirmed; facts and marketing (77,000x claims) are mostly separated but no third-party corroboration exists — key claims lack in-repo traceability.
- The quick-start example defaults to the AllowAll permission policy; embedders should use Interactive or RuleBased and restrict tool sets explicitly.
- All performance comparisons (e.g., 77,000x memory recall) are self-reported; re-run the bench scripts before relying on them.
- The SDK exposes high-side-effect tools (shell, cron, web); review sandboxing and audit hooks before embedding in production.
- Publisher identity is unverified and the project self-describes as reverse-engineered; assess IP risk for enterprise compliance.
- Version is 0.2.x with no CHANGELOG; APIs may change frequently — pin a specific commit before depending on it.
What does this agent do, and when should you use it?
Cersei (pacifio/cersei) is an MIT-licensed Rust SDK that packages every building block of a production coding agent as composable library functions. It is organized into crates: cersei-provider (Anthropic and OpenAI-compatible backends, including Ollama, Azure, and vLLM), cersei-tools (30+ built-in tools plus a #[derive(Tool)] macro), cersei-agent (builder and agentic loop), cersei-memory (file plus Grafeo graph memory with JSONL session persistence), cersei-hooks, and cersei-mcp (a JSON-RPC 2.0 stdio client). The repo also ships Abstract (abstract-cli), a complete CLI coding agent built on the SDK as a single binary with zero runtime dependencies. Execution is an async agentic loop with three realtime event mechanisms: callbacks, broadcast channels, and a bidirectional stream. The README reports 160 unit tests and 262 stress checks passing, with benchmarks comparing Abstract CLI against Claude Code on startup, memory, and tool dispatch.
Exposes an Agent::builder() API: pick a provider (Anthropic::from_env() or an OpenAi-compatible endpoint), attach tool sets (cersei::tools::coding(), filesystem(), shell(), web(), planning(), scheduling(), orchestration()), set a permission policy (AllowAll, Interactive, etc.), and execute via run_with() or run_stream(). Custom tools are defined in about ten lines with #[derive(Tool)]; AgentTool and Coordinator mode spawn parallel sub-agents with filtered tool sets; MemoryManager provides three-tier memory (md file scanning with frontmatter, CLAUDE.md hierarchy merging, Grafeo graph store with recall queries); SkillTool auto-discovers both .claude/commands and .claude/skills formats; McpManager connects external MCP servers over stdio/SSE. Context management includes auto_compact, thinking budgets, and effort levels, plus Anthropic OAuth PKCE login. The bundled Abstract CLI installs via cargo and supports REPL, --resume, and -- output.
- Rust developers embedding a coding agent inside an existing application rather than shipping a standalone CLI
- Teams building a Claude Code or OpenCode replacement needing multi-provider support and customizable tools/permissions
- Running agents on local models (Ollama, vLLM) to avoid cloud API costs and data egress
- Decomposing large refactors via parallel sub-agent orchestration and the task system (TaskCreate/TaskUpdate, etc.)
- CI pipelines needing a low-overhead agent with NDJSON output (abstract --no-permissions --)
- Long-term memory at low cost: Abstract's graph recall measured at 98μs with no LLM call
What are this agent's strengths and limitations?
- Library form factor, not a CLI — embeddable in any Rust app with in-process tool dispatch (Read measured at 0.09ms)
- Multi-provider: Anthropic (with OAuth) plus OpenAI-compatible endpoints covering Ollama, Azure, and vLLM
- Three-tier memory with an optional Grafeo graph layer; recall at 98μs with no LLM call, versus Claude Code's measured 7.5s LLM-based ranking
- Full extension surface: impl Provider / Tool / PermissionPolicy / Memory / Hook / Reporter, plus the #[derive(Tool)] macro
- Native MCP client (stdio/SSE/remote bridge) and dual-format skill compatibility with Claude Code and OpenCode
- Requires a Rust toolchain; adoption cost is high for non-Rust teams, and #[derive(Tool)] needs extra async-trait and cersei-tools dependencies per the README
- Graph memory depends on the project's own Grafeo storage; ecosystem maturity and long-term maintenance are unverified by third parties
- Abstract-vs-Claude Code numbers come from the project's own run_tool_bench.sh — self-reported benchmarks that should be independently reproduced
- The cersei package is installed as a git dependency; no crates.io publication is shown, complicating version pinning and supply-chain management
- Permission policies must be configured deliberately (AllowAll is unsuitable for production), and detailed behavior of Interactive/RuleBased policies lives only in the site docs
How do you install or deploy this agent?
Add to Cargo.toml:
[dependencies]
cersei = { git = "https://github.com/pacifio/cersei" }
tokio = { version = "1", features = ["full"] }
anyhow = "1"Optional graph memory:
cersei-memory = { git = "https://github.com/pacifio/cersei", features = ["graph"] }Install the Abstract CLI:
cargo install --path crates/abstract-cliHow do you use this agent?
Set the relevant provider credentials (e.g., an Anthropic API key via from_env(), or point OpenAi::builder().base_url("http://localhost:11434/v1") at Ollama). Minimal example:
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());
CLI: abstract launches a REPL; abstract "fix the failing tests" runs single-shot; abstract --resume continues the last session; abstract --no-permissions -- suits CI. Tests: cargo test --workspace (160 unit tests).
How does this agent compare with similar options?
The README compares Cersei directly with Claude Code and OpenCode: both are TypeScript CLI apps, non-embeddable, with ~269–300ms startup and a 174MB binary (Claude Code); Cersei is a Rust library, embeddable, multi-provider, with custom tools via impl Tool / #[derive(Tool)]; Abstract CLI (built on Cersei) starts in 32ms with a ~6MB binary and 4.9MB RSS, and supports both skill formats. It fits Rust-native or embedding-focused teams; if you just want a ready-made CLI and can accept a Node.js runtime, Claude Code itself remains simpler.