instructkr/claw-code: The Self-Compiling AI Engineering Team
How a Rust-based CLI uses the Model Context Protocol and autonomous agents to write, test, and maintain its own repository.

This repo is maintained by lobsters/claws, not by a conventional human-only dev team. The people behind the system are Bellman / Yeachan Heo and friends like Yeongyu, but the repo itself is being pushed forward by autonomous claw workflows
- The repository's most fascinating artifact is its persistent session log, documenting the AI's autonomous maintenance of its own codebase.
- claw-code solves the LLM context window problem by treating agent memory as a rotating, append-only system log using JSONL.
- A strict Model Context Protocol (MCP) bridge acts as a circuit breaker to prevent destructive file system operations.
- The project leverages Rust to bypass heavy Node runtimes, bringing systems-level stability and performance to AI tooling.
The Ghost in the Source Tree
While the tech ecosystem fixates on viral star counts, the actual story of claw-code lies hidden in its architecture. It is a fascinating exercise in extreme dogfooding. The project is an AI agent framework written in Rust that is autonomously maintained by its own AI agents.
These agents are known internally as claws. If you clone this repository, you are downloading the AI's memories of building itself. The .claude/sessions/ directory serves as a permanent, append-only log of the AI's thought process as it designs, refactors, and tests the very repository it lives in.
Memory Management for Infinite Tasks
AI agents usually fail on long-running repository maintenance because they run out of context window. The claw-code system solves this in runtime/src/session.rs.
It introduces a SessionCompaction mechanism. It uses append-only JSONL files to treat agent memory like a robust, rotating system log. When the context fills, the system compresses older messages into summary nodes.
Giving the Agent Hands (and Brakes)
An agent needs to edit files without destroying the workspace. The Model Context Protocol (MCP) bridge provides this capability safely.
The StructuredPatchHunk allows precise file editing. To prevent disaster, a strict PermissionEnforcer acts as a circuit breaker for destructive bash commands.
The Clean-Room Translation
The project originated as an aggressive clean-room rewrite. The team used AI agents to rapidly ingest leaked TypeScript architecture and translate it into a Python validation layer.
From there, they compiled it into a high-performance Rust workspace. A MOCK_PARITY_HARNESS ensured behavioral parity during this rapid translation.
The brilliance: copyright does not protect derived works. Rewriting TypeScript code in Python means copyright no longer applies. The scary thing: it can be done in trivial amount of time, with AI agents.
The Systems-Level Agent
Most AI tooling is written in TypeScript or Python. By choosing Rust, claw-code minimizes runtime overhead.
It relies on Cargo workspaces, tokio async networking for SSE streams, and the forbid(unsafe_code) directive to bring systems-level stability to LLM wrappers.
| Feature | claw-code (Rust/MCP) | Standard TS Agents | Standard Python Agents |
|---|---|---|---|
| Runtime Overhead | Compiled binary | V8/Node | Python Interpreter |
| State Persistence | Append-only JSONL | In-memory/SQLite | In-memory/JSON |
| Tooling Protocol | Standardized MCP | Ad-hoc bindings | Ad-hoc bindings |
| Safety Boundaries | PermissionEnforcer | Docker-dependent | Docker-dependent |