How Claw Code Rewrites Claude Code: A Clean‑Room, Open‑Source AI Agent Framework

This article dissects the open‑source Claw Code project—its clean‑room development origins, three‑layer architecture, Python‑and‑Rust implementation, rapid‑start commands, legal compliance advantages over Claude Code, and the scenarios where developers can adopt this lightweight AI agent framework.

AI Architecture Path
AI Architecture Path
AI Architecture Path
How Claw Code Rewrites Claude Code: A Clean‑Room, Open‑Source AI Agent Framework

Project Background

Claw Code was initiated by Korean developer Sigrid Jin, a heavy user of Claude Code who consumed 25 billion Claude tokens in a year, giving deep insight into Claude Code’s logic and interaction patterns. After the Claude Code source leak, many community forks risked DMCA infringement, prompting the need for a legally safe alternative.

Claw Code follows strict clean‑room principles:

No reference to or use of leaked source snapshots.

Reverse‑engineered from publicly observable product features and behavior.

Developed with AI assistance (oh‑my‑codex) using parallel team reviews and a persistent "ralph" execution model.

Core functionality first prototyped in Python, then re‑implemented in Rust for performance.

Core Technology

The architecture is divided into three layers:

Auth & Access Layer: Implements Claude.com OAuth for identity verification, with configuration‑file key management and no user data collection.

Command Parsing & Execution Layer: Transforms natural‑language instructions into tool‑call logic, supporting code generation, file operations, and command execution while remaining independent of Claude’s proprietary code.

Extension & Runtime Layer: Provides plugin interfaces for custom toolchains and workflow orchestration, with future plans to support multiple model back‑ends such as Grok.

The design emphasizes engineering‑level harnessing of AI agents rather than UI imitation, making it suitable for developer‑centric extensions.

## Project Structure
├── src/                 # Python workspace
│   ├── __init__.py
│   ├── commands.py
│   ├── main.py
│   ├── models.py
│   ├── port_manifest.py
│   ├── query_engine.py
│   ├── task.py
│   └── tools.py
├── rust/                # Rust CLI implementation
│   ├── crates/api/      # API client + streaming
│   ├── crates/runtime/  # Session, tools, MCP, config
│   ├── crates/claw-cli/ # Interactive CLI binary
│   ├── crates/plugins/  # Plugin system
│   ├── crates/commands/ # Slash commands
│   ├── crates/server/   # HTTP/SSE server (axum)
│   ├── crates/lsp/      # LSP client integration
│   └── crates/tools/    # Tool specifications
├── tests/               # Python test suite
├── assets/omx/          # Workflow screenshots
└── README.md

Quick Start

Run the following commands to clone, explore, and test the project:

git clone https://github.com/instructkr/claw-code.git && cd claw-code
python3 -m src.main summary

– Show a concise development progress summary. python3 -m src.main manifest – List the full workspace. python3 -m src.main subsystems --limit 16 – Display up to 16 subsystem modules. python3 -m unittest discover -s tests -v – Execute the official test suite. python3 -m src.main parity-audit – Perform a local parity audit when reference files are present. python3 -m src.main commands --limit 10 – Show the first 10 commands. python3 -m src.main tools --limit 10 – Show the first 10 tools.

Difference Comparison

Legal & Compliance: Claude Code is a commercial, closed‑source TypeScript product protected by copyright; Claw Code is a clean‑room, fully open‑source project that avoids DMCA risks.

Tech Stack & Performance: Claude Code relies on an enterprise‑grade TypeScript stack for cloud collaboration; Claw Code uses a Python rapid‑prototype layer combined with a Rust high‑performance rewrite, prioritizing lightweight, portable, and fast execution.

Openness & Extensibility: Claw Code publishes complete architecture docs, command lists, and tool specifications, supports native Claude OAuth, plans multi‑model extensions, and offers executable runtime slices to lower integration costs.

Target Users & Scenarios

Developers who need Claude‑like capabilities but require open‑source, compliance‑safe solutions.

Technical teams that want to customize AI‑assisted workflows or integrate internal tools.

Learners interested in agent design and large‑model backend integration.

Users seeking a lightweight, unbundled, locally runnable AI programming assistant.

Claw Code is positioned as a modifiable, extensible, and privately deployable framework with production‑grade potential.

Conclusion

Clean‑room development provides a safe path to open‑source equivalents of closed‑source AI tools.

AI‑assisted parallel development dramatically shortens core‑feature iteration cycles.

The Python‑plus‑Rust stack balances rapid development with high runtime performance.

Open architecture and multi‑model design align with current trends in AI tooling.

Standardized command interfaces enable zero‑barrier deployment, verification, and debugging.

The project not only delivers a ready‑to‑use lightweight agent tool but also offers a reproducible technical solution for the industry to address source‑leak and closed‑source challenges, making it valuable for AI tool development and agent architecture research.

https://github.com/ultraworkers/claw-code
PythonAI agentsRustopen-sourceClaude CodeClaw Codeclean room development
AI Architecture Path
Written by

AI Architecture Path

Focused on AI open-source practice, sharing AI news, tools, technologies, learning resources, and GitHub projects.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.