55/55 TESTS PASSING · BUILT BEFORE THE LEAK

AI Coding Agent
in Rust

A 5.4MB binary that runs Claude as a full coding agent on your Max subscription. Zero API costs. 8 tools. MCP client. Prompt caching. Semantic compaction. 19-event hook system. Ships as a single binary.

5.4MB
Binary Size
55/55
Tests Passing
9,390
Lines of Rust
$0
API Cost
claude-agent
$ ./claude-agent
  claude-agent v1.1.0 (Rust)
  claude-opus-4-6 · backend: cli (Claude Max)
  8 tools · 50 MCP servers · 8 skills · 19 hook events
 
agent> write a fizzbuzz in Rust, compile it, run it
  [write] /tmp/fizzbuzz.rs
  [bash] rustc /tmp/fizzbuzz.rs -o /tmp/fizzbuzz && /tmp/fizzbuzz
  1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz...
  Done in 21s · 0 API tokens billed

11 Layers, 27 Source Files

A complete agent architecture in Rust — dual inference backends, prompt caching, semantic compaction, 19-event hook system, MCP client, and interactive tool confirmation.

01
Inference Engine
Dual backend: CLI (claude -p, $0) or direct API with SSE streaming. Prompt cache breakpoints for API mode.
src/inference.rs
02
Tool System
8 built-in tools: bash, read, write, edit, glob, grep, web_fetch, agent. Trait-based dispatch with interactive confirmation.
src/tools/
03
MCP Integration
Full JSON-RPC 2.0 client with stdio transport. Auto-discovery from ~/.mcp.json. 5s init timeout.
src/mcp/
04
Skills & Hooks
8 built-in skills + user skills. 19-event hook system with priority ordering, glob matchers, and user-configurable hooks from JSON.
src/skills.rs, src/hooks.rs
05
Permissions
Controls which tools and paths the agent can access. Sandboxing for safe execution.
src/permissions.rs
06
Context Manager
Static/dynamic prompt split for cache optimization. Semantic compaction extracts files, commands, errors, and key points.
src/context.rs
07
Memory System
Persistent memory backed by file system. Reads/writes memory across sessions.
src/memory.rs
08
Auth Layer
Handles authentication. Strips ANTHROPIC_API_KEY to use subscription auth.
src/auth.rs
09
Type System
Message types, tool schemas, API response structs. serde-powered (de)serialization.
src/types.rs
10
Telemetry
Tracks token usage, response times, tool call counts. Session metrics.
src/telemetry.rs
11
CLI & REPL
Interactive REPL with rustyline. Flag parsing, colored output, status display.
src/main.rs, src/flags.rs

8 Native Tools

Each tool is a separate Rust module with async execution, permission guards, hook dispatch, and optional interactive confirmation.

$_
bash
Execute shell commands
📄
read
Read file contents
✏️
edit
String replacements
📝
write
Create/overwrite files
🔍
glob
Pattern file search
🔎
grep
Content search (regex)
🌐
web_fetch
HTTP requests
🤖
agent
Spawn sub-agents

55/55 Tests Passing

Unit tests + integration tests covering all tools, permissions, hooks, compaction, prompt caching, and session persistence.

Simple math (2+2)PASS11s
Bash tool (ls)PASS13s
Read tool (Cargo.toml)PASS17s
Grep tool (async fn)PASS20s
Write + Read chainPASS16s
Multi-step (Python)PASS18s
Built-in commandsPASS<1s
Edit toolPASS39s
Glob tool (*.toml)PASS13s
Empty promptPASS<1s
Error: missing filePASS27s
Special charactersPASS13s
Complex bash (find+wc)PASS25s
3-step tool chainPASS107s
Deep analysisPASS160s
Error propagationPASS12s
Security: rm -rf /REFUSED13s
WebFetch (httpbin)PASS15s
Unicode + emojiPASS31s
Non-zero exit codePASS18s
Read missing filePASS11s
Grep zero matchesPASS17s
Write+compile RustPASS21s
Skill dispatchPASS<1s
Glob + line countPASS22s
Read-edit-verify-undoPASS48s
Bash with sleepPASS17s
Large stdout (500 lines)PASS41s

Claude Code Alternative, Built in Rust

Clean-room Rust implementation that predates the OpenClaude leak. 40x smaller, 20x faster startup, dual-backend.

$0 / month

Zero API Cost

Calls claude -p under the hood, which uses your Max subscription's OAuth token. No per-token billing. Run it all day — same flat rate.

FULLY MODIFIABLE

You Own the Code

9,390 lines of Rust you can read, modify, extend. Add tools, change behavior, strip telemetry — it's yours. Published on crates.io as both a binary and a library.

5.4MB BINARY

Single Binary Deploy

No Node.js runtime, no npm install, no dependency tree. One cargo install claude-agent-rs and you have a self-contained binary with SQLite bundled.

EXTENSIBLE

MCP + Skills + Hooks

Automatically discovers your MCP servers, skills, and hooks from Claude config. Extends the tool surface without modifying the agent.

Feature Claude Code claude-agent-rs
Source Code Leaked / OpenClaude fork Clean-room Rust (MIT)
Binary Size ~200MB (Node.js) 5.4MB
API Cost Subscription or API Subscription only ($0 extra)
Custom Tools MCP only Native Rust + MCP
Modify Behavior Config only Full source access
Startup Time ~2s <100ms
Embeddable No Library or binary

All Milestones Shipped

v1.1.0 live on crates.io. View releases

v1.0.0 SHIPPED
Production Ready
11 layers, 8 tools, dual backends (CLI + API), SSE streaming, MCP client, SQLite sessions, sub-agents with worktree isolation, plugins, skills, 55 tests.
v1.1.0 SHIPPED
OpenClaude Features
Prompt cache breakpoints, semantic compaction, 19-event hook system with priority ordering, interactive tool confirmation, NIM security audit.
v1.2.0
Cross-Platform
Windows support, Homebrew formula, Docker (scratch), GitHub Actions release pipeline, CI/CD.
v1.3.0
Deep Integration
OpenTelemetry, TUI dashboard, native inference (bypass CLI), WebSocket backend, WASM target.

Install in 30 Seconds

install
# From source
$ git clone https://github.com/ExpertVagabond/claude-agent-rs
$ cd claude-agent-rs && cargo build --release
$ ./target/release/claude-agent
 
# From crates.io
$ cargo install claude-agent-rs
 
# As a library
$ cargo add claude-agent-rs