claude-agent-rs
A 2.8MB Rust binary that runs Claude as a full coding agent on your Max subscription. Zero API costs.
Live Site · crates.io · Test Results
What is this?
An 11-layer AI coding agent written in Rust. It has a REPL, 7 built-in tools, MCP server integration, skill dispatch, hooks, permissions, and memory — all wired to call Claude via claude -p so it uses your Max subscription instead of API credits.
$ ./claude-agent
claude-agent v0.1.0 (Rust)
claude-opus-4-6 · effort: High · backend: cli (Claude Max)
7 tools · 11 MCP servers · 11 skills · 5 hooks
❯ write a fizzbuzz in Rust, compile it, run it
▸ write: /tmp/fizzbuzz.rs
✓ File written
▸ bash: rustc /tmp/fizzbuzz.rs -o /tmp/fizzbuzz && /tmp/fizzbuzz
✓ 1, 2, Fizz, 4, Buzz...
Architecture
| Layer | Name | File | Purpose |
|---|---|---|---|
| 1 | Crown | skills.rs |
Skill registry + /command dispatch |
| 2 | Skull | hooks.rs |
Lifecycle hooks (pre/post tool use) |
| 3 | Security Cage | permissions.rs |
Permission-gated tool access |
| 4 | Brain Core | inference.rs |
Dual-backend inference (CLI + API) |
| 5 | Frontal Lobe | context.rs |
Context engine + CLAUDE.md injection |
| 6 | Temporal Lobe | (stubs) | Agent spawner (future) |
| 7 | Auth Gate | auth.rs |
Authentication routing |
| 8 | Brainstem | tools/ |
7 built-in tools |
| 9 | Root System | mcp/ |
MCP server discovery + registry |
| 10 | Pedestal | inference.rs |
HTTP client (reqwest) |
| 11 | Workbench | flags.rs, telemetry.rs |
Feature flags + session metrics |
Built-in Tools
- bash — Execute shell commands with timeout and error handling
- read — Read file contents with line numbers
- write — Create or overwrite files
- edit — Exact string replacement in files
- glob — Pattern-based file search
- grep — Regex content search (ripgrep-style)
- web_fetch — HTTP GET requests
Two Inference Backends
CLI Mode (default) — $0/month
Pipes prompts to claude -p --output-format json, which uses your Claude Max subscription's OAuth token. No per-token billing.
API Mode — pay-per-token
Direct POST to api.anthropic.com/v1/messages. Requires ANTHROPIC_API_KEY. Used when no CLI is available or for CI/CD.
Install
Requires:
- Rust 2021 edition
claudeCLI installed (for CLI backend)- Claude Max subscription (for $0 inference)
Test Results
28/28 tests passing against Claude Opus 4.6 on Max subscription:
- Simple math, bash, read, write, edit, glob, grep, web_fetch
- Multi-step tool chains (3-4 tools in sequence)
- Error handling (missing files, zero matches, non-zero exit codes)
- Security (refused
rm -rf /) - Unicode/emoji preservation
- Large stdout handling (500+ lines)
- Skill dispatch, built-in commands
- Write + compile + run Rust code
Full results: gist
Stats
- Binary: 2.8MB (release, LTO, stripped)
- Source: 3,454 lines across 21 files
- Dependencies: 13 crates
- Startup: <100ms
- Response time: 11-160s per turn (depends on task complexity)
License
MIT