Yeachan-Heo 3df5dece39 fix: suppress dead_code warnings for unused file_ops functions 2 сар өмнө
..
.claude 143cef6873 feat: default OAuth config for API endpoint, merge UI polish rendering 2 сар өмнө
.omc 7661af230c feat: allow multiple in_progress todos for parallel workflows 2 сар өмнө
.sandbox-home 7661af230c feat: allow multiple in_progress todos for parallel workflows 2 сар өмнө
crates 3df5dece39 fix: suppress dead_code warnings for unused file_ops functions 2 сар өмнө
scripts 85c5b0e01d Expand parity harness coverage before behavioral drift lands 2 сар өмнө
.clawd-todos.json 143cef6873 feat: default OAuth config for API endpoint, merge UI polish rendering 2 сар өмнө
.gitignore ff26ed10f6 Make the Rust CLI clone-and-run deliverable-ready 2 сар өмнө
Cargo.lock bf5eb8785e Recover the MCP lane on top of current main 2 сар өмнө
Cargo.toml c2e41ba205 fix: post-plugins-merge cleanroom fixes and workspace deps 2 сар өмнө
MOCK_PARITY_HARNESS.md 85c5b0e01d Expand parity harness coverage before behavioral drift lands 2 сар өмнө
PARITY.md 618a79a9f4 feat: ultraclaw session outputs — registry tests, MCP bridge, PARITY.md, cleanup 2 сар өмнө
README.md 953513f12d docs: add a current claw CLI usage guide 2 сар өмнө
TUI-ENHANCEMENT-PLAN.md 7661af230c feat: allow multiple in_progress todos for parallel workflows 2 сар өмнө
USAGE.md 953513f12d docs: add a current claw CLI usage guide 2 сар өмнө
mock_parity_scenarios.json a2351fe867 feat(harness+usage): add auto_compact and token_cost parity scenarios 2 сар өмнө

README.md

🦞 Claw Code — Rust Implementation

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.

Quick Start

# 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"

Configuration

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 -- login

Mock parity harness

The 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:0

Harness coverage:

  • streaming_text
  • read_file_roundtrip
  • grep_chunk_assembly
  • write_file_allowed
  • write_file_denied
  • multi_tool_turn_roundtrip
  • bash_stdout_roundtrip
  • bash_permission_prompt_approved
  • bash_permission_prompt_denied
  • plugin_tool_roundtrip

Primary artifacts:

  • crates/mock-anthropic-service/ — reusable mock Anthropic-compatible service
  • crates/rusty-claude-cli/tests/mock_parity_harness.rs — clean-env CLI harness
  • scripts/run_mock_parity_harness.sh — reproducible wrapper
  • scripts/run_mock_parity_diff.py — scenario checklist + PARITY mapping runner
  • mock_parity_scenarios.json — scenario-to-PARITY manifest

Features

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

Model Aliases

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

CLI Flags

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.

Slash Commands (REPL)

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.

Workspace Layout

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

Crate Responsibilities

  • 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/messages mock for CLI parity tests and local harness runs
  • plugins — Plugin metadata, registries, and hook integration surfaces
  • runtimeConversationRuntime agentic loop, ConfigLoader hierarchy, Session persistence, 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

Stats

  • ~20K lines of Rust
  • 9 crates in workspace
  • Binary name: claw
  • Default model: claude-opus-4-6
  • Default permissions: danger-full-access

License

See repository root.