A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.
Claw Code is an open-source Rust implementation of the claw CLI agent harness — a purpose-built runtime for autonomous AI coding agents that wraps Claude and OpenAI-compatible APIs with everything needed to operate reliably in automated pipelines. Unlike a simple chat wrapper, it treats clawability (machine-operability without human terminal interaction) as a first-class design constraint.
The project’s architecture separates the concern of provider communication (the api crate), conversation lifecycle (the runtime crate), tool execution (the tools crate), and plugin/hook management (the plugins crate) into a Cargo workspace. This layering means each subsystem can evolve independently and be tested in isolation, while the claw binary in rusty-claude-cli wires them together into a coherent CLI experience.
Claw Code ships features that matter specifically to agentic, automated workflows: automatic session compaction when context windows fill, a structured permission model with four tiered access modes, pre/post-tool hooks that can intercept or override tool calls, MCP (Model Context Protocol) server management with lifecycle hardening, and JSON-mode output across all diagnostic verbs for machine-readable health checks. A companion claw-rag-service crate adds a SQLite-backed embedding index with optional Qdrant integration for retrieval-augmented generation workflows.
The repository is itself an artifact of agent-managed development — described by its authors as a ‘museum exhibit’ run by autonomous claws. This gives Claw Code a unique self-referential quality: the harness is built by the same kind of agents it is designed to power, providing a live demonstration of autonomous coding coordination at scale.
claw binary built from a structured Rust workspace with separate crates for API communication, conversation runtime, tool execution, and plugin managementclaw-rag-service crate providing a SQLite-backed embedding index with optional Qdrant vector store support for RAG workflowsdoctor, status, version, sandbox) enabling machine-readable health checks in CI pipelinesArchitecture
Claw Code organizes its Rust workspace into eleven crates with clear boundary responsibilities: rusty-claude-cli is the thin binary entry point that wires runtime, api, commands, plugins, and tools together; runtime owns the conversation lifecycle through ConversationRuntime, session persistence via JSONL rotation, compaction logic in compact.rs, permission enforcement in permissions.rs, hook dispatch in hooks.rs, and MCP lifecycle management in mcp_lifecycle_hardened.rs; api abstracts over Anthropic’s native messages protocol and OpenAI-compatible chat completions through a Provider trait with concrete implementations in providers/anthropic.rs and providers/openai_compat.rs; tools exposes the canonical tool registry and enforces path-scope restrictions; plugins manages hook registration and test isolation. The architecture follows a layered, dependency-injected pattern where ConversationRuntime depends on trait objects (ApiClient, PermissionPrompter, HookProgressReporter) rather than concrete types, enabling the extensive mock infrastructure used in integration tests.
Tech Stack
The canonical runtime is pure Rust on the 2021 edition, compiled with Cargo as a workspace. The rusty-claude-cli binary uses Tokio with rt-multi-thread for async I/O, rustyline for readline-style REPL input, crossterm for terminal control, syntect for syntax-highlighted output rendering, and pulldown-cmark for Markdown streaming. Provider communication uses reqwest with rustls-tls for TLS without OpenSSL. Session files are JSONL with size-based rotation (256 KB threshold, three rotated files). The claw-rag-service crate adds an axum HTTP server, rusqlite with bundled SQLite, blake3 for content hashing, and optional qdrant-client behind a feature flag. The companion Python workspace under src/ provides audit helpers and reference fixtures but is not the primary runtime surface.
Code Quality
The workspace enforces unsafe_code = "forbid" at the workspace level and enables Clippy all warnings, with selective allows for known-acceptable patterns. Tests are comprehensive: rusty-claude-cli has six integration test files covering compaction panic recovery, output format contracts, mock parity harness, resume slash commands, CLI flags, and compact output; runtime has a conformance test suite for the G004 events contract; api has four integration test files for OpenAI compat, client behavior, proxy, and provider client; tools tests path-scope enforcement; plugins has a test isolation module. Error handling uses typed RuntimeError and ApiError variants rather than stringly-typed errors. The codebase carries several workspace-level #[allow(dead_code, unused_imports)] suppressions in the main binary indicating active porting work from the Python reference implementation, which limits the current quality ceiling.
What Makes It Unique
Claw Code’s defining technical contribution is its explicit design for machine operability over human convenience — the project calls this ‘clawability.’ Every diagnostic command emits structured JSON, session state transitions are encoded as typed events (not log lines), the permission system allows hook-level overrides that agent workflows can inject programmatically, and the MCP lifecycle hardening exposes startup, handshake, and degraded-mode failures as distinct classified states rather than opaque errors. The repository is itself developed by autonomous agents using the clawhip event router and Gajae-Code harness, making it a living demonstration of the agent coordination patterns it enables. The included claw-rag-service with optional Qdrant backend and the mock Anthropic service for offline parity testing are uncommon inclusions in CLI AI agent tooling.
Licensing Model MIT licensed — all features available in self-hosted deployments with no restrictions or license keys required.
Self-Hosting Restrictions None. The full workspace including RAG service, MCP integration, plugin hooks, and multi-provider support is available without any license gating.
License Key Required No. Claw Code requires an API key for the upstream AI provider (Anthropic, OpenAI, or compatible), but this is a provider credential — not a Claw Code license requirement.
AI Code Assistants · AI Development
Orchestrate an army of AI coding agents—Claude Code, Codex, Gemini CLI, and more—running simultaneously in isolated git worktrees from a single Electron desktop app.
AI Code Assistants · AI Development
The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.
Developer Tools · AI Development · AI Code Assistants
Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.