A high-performance Rust rewrite of the Claw Code CLI agent harness. Built for speed, safety, and native tool execution.
For a task-oriented guide with copy/paste examples, see ../USAGE.md.
# Inspect available commands
cd rust/
cargo run -p rusty-claude-cli -- --help
# Build the workspace
cargo build --workspace
# Run the interactive REPL
cargo run -p rusty-claude-cli -- --model claude-opus-4-6
# One-shot prompt
cargo run -p rusty-claude-cli -- prompt "explain this codebase"
# JSON output for automation
cargo run -p rusty-claude-cli -- --output-format json prompt "summarize src/main.rs"Set your API credentials:
export ANTHROPIC_API_KEY="sk-ant-..."
# Or use a proxy
export ANTHROPIC_BASE_URL="https://your-proxy.com"Or authenticate via OAuth and let the CLI persist credentials locally:
cargo run -p rusty-claude-cli -- loginThe workspace now includes a deterministic Anthropic-compatible mock service and a clean-environment CLI harness for end-to-end parity checks.
cd rust/
# Run the scripted clean-environment harness
./scripts/run_mock_parity_harness.sh
# Or start the mock service manually for ad hoc CLI runs
cargo run -p mock-anthropic-service -- --bind 127.0.0.1:0Harness coverage:
streaming_textread_file_roundtripgrep_chunk_assemblywrite_file_allowedwrite_file_deniedmulti_tool_turn_roundtripbash_stdout_roundtripbash_permission_prompt_approvedbash_permission_prompt_deniedplugin_tool_roundtrip
Primary artifacts:
crates/mock-anthropic-service/— reusable mock Anthropic-compatible servicecrates/rusty-claude-cli/tests/mock_parity_harness.rs— clean-env CLI harnessscripts/run_mock_parity_harness.sh— reproducible wrapperscripts/run_mock_parity_diff.py— scenario checklist + PARITY mapping runnermock_parity_scenarios.json— scenario-to-PARITY manifest
| Feature | Status |
|---|---|
| Anthropic API + streaming | ✅ |
| OAuth login/logout | ✅ |
| Interactive REPL (rustyline) | ✅ |
| Tool system (bash, read, write, edit, grep, glob) | ✅ |
| Web tools (search, fetch) | ✅ |
| Sub-agent orchestration | ✅ |
| Todo tracking | ✅ |
| Notebook editing | ✅ |
| CLAUDE.md / project memory | ✅ |
| Config file hierarchy (.claude.json) | ✅ |
| Permission system | ✅ |
| MCP server lifecycle | ✅ |
| Session persistence + resume | ✅ |
| Extended thinking (thinking blocks) | ✅ |
| Cost tracking + usage display | ✅ |
| Git integration | ✅ |
| Markdown terminal rendering (ANSI) | ✅ |
| Model aliases (opus/sonnet/haiku) | ✅ |
| Slash commands (/status, /compact, /clear, etc.) | ✅ |
| Hooks (PreToolUse/PostToolUse) | 🔧 Config only |
| Plugin system | 📋 Planned |
| Skills registry | 📋 Planned |
Short names resolve to the latest model versions:
| Alias | Resolves To |
|---|---|
opus |
claude-opus-4-6 |
sonnet |
claude-sonnet-4-6 |
haiku |
claude-haiku-4-5-20251213 |
claw [OPTIONS] [COMMAND]
Options:
--model MODEL Override the active model
--dangerously-skip-permissions Skip all permission checks
--permission-mode MODE Set read-only, workspace-write, or danger-full-access
--allowedTools TOOLS Restrict enabled tools
--output-format FORMAT Non-interactive output format (text or json)
--resume SESSION Re-open a saved session or inspect it with slash commands
--version, -V Print version and build information locally
Commands:
prompt <text> One-shot prompt (non-interactive)
login Authenticate via OAuth
logout Clear stored credentials
init Initialize project config
status Show the current workspace status snapshot
sandbox Show the current sandbox isolation snapshot
agents Inspect agent definitions
mcp Inspect configured MCP servers
skills Inspect installed skills
system-prompt Render the assembled system prompt
For the current canonical help text, run cargo run -p rusty-claude-cli -- --help.
Tab completion expands slash commands, model aliases, permission modes, and recent session IDs.
| Command | Description |
|---|---|
/help |
Show help |
/status |
Show session status (model, tokens, cost) |
/cost |
Show cost breakdown |
/compact |
Compact conversation history |
/clear |
Clear conversation |
/model [name] |
Show or switch model |
/permissions |
Show or switch permission mode |
/config [section] |
Show config (env, hooks, model) |
/memory |
Show CLAUDE.md contents |
/diff |
Show git diff |
/export [path] |
Export conversation |
/resume [id] |
Resume a saved conversation |
/session [id] |
Resume a previous session |
/version |
Show version |
See ../USAGE.md for examples covering interactive use, JSON automation, sessions, permissions, and the mock parity harness.
rust/
├── Cargo.toml # Workspace root
├── Cargo.lock
└── crates/
├── api/ # Anthropic API client + SSE streaming
├── commands/ # Shared slash-command registry
├── compat-harness/ # TS manifest extraction harness
├── mock-anthropic-service/ # Deterministic local Anthropic-compatible mock
├── plugins/ # Plugin registry and hook wiring primitives
├── runtime/ # Session, config, permissions, MCP, prompts
├── rusty-claude-cli/ # Main CLI binary (`claw`)
├── telemetry/ # Session tracing and usage telemetry types
└── tools/ # Built-in tool implementations
- api — HTTP client, SSE stream parser, request/response types, auth (API key + OAuth bearer)
- commands — Slash command definitions and help text generation
- compat-harness — Extracts tool/prompt manifests from upstream TS source
- mock-anthropic-service — Deterministic
/v1/messagesmock for CLI parity tests and local harness runs - plugins — Plugin metadata, registries, and hook integration surfaces
- runtime —
ConversationRuntimeagentic loop,ConfigLoaderhierarchy,Sessionpersistence, permission policy, MCP client, system prompt assembly, usage tracking - rusty-claude-cli — REPL, one-shot prompt, streaming display, tool call rendering, CLI argument parsing
- telemetry — Session trace events and supporting telemetry payloads
- tools — Tool specs + execution: Bash, ReadFile, WriteFile, EditFile, GlobSearch, GrepSearch, WebSearch, WebFetch, Agent, TodoWrite, NotebookEdit, Skill, ToolSearch, REPL runtimes
- ~20K lines of Rust
- 9 crates in workspace
- Binary name:
claw - Default model:
claude-opus-4-6 - Default permissions:
danger-full-access
See repository root.