Skip to content

mykie2015/claw-code

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rewriting Project Claw Code

⭐ The fastest repo in history to surpass 50K stars, reaching the milestone in just 2 hours after publication ⭐

Star History Chart

Claw

Better Harness Tools, not merely storing the archive of leaked Claw Code

Sponsor on GitHub

Important

The actively usable CLI now lives in the Rust workspace under rust/.

claw v0.1.1 is installable today, defaults to gpt-5.4, and supports:

  • Claude models such as claude-sonnet-4-6
  • OpenAI-compatible models such as gpt-5.4
  • Responses-style gateways through OPENAI_BASE_URL + OPENAI_WIRE_API=responses

If you find this work useful, consider sponsoring @instructkr on GitHub to support continued open-source harness engineering research.


Rust CLI

The Rust workspace under rust/ is the current primary CLI/runtime implementation of the project.

It currently includes:

  • crates/api — provider abstraction, auth, retry policy, and streaming support
  • crates/runtime — session state, compaction, MCP orchestration, prompt construction
  • crates/tools — tool manifest definitions and execution framework
  • crates/commands — slash commands, skills discovery, and config inspection
  • crates/plugins — plugin model, hook pipeline, and bundled plugins
  • crates/compat-harness — compatibility layer for upstream editor integration
  • crates/claw-cli — interactive REPL, markdown rendering, and project bootstrap/init flows

Build or install the CLI:

cd rust
cargo build --release
cargo install --path crates/claw-cli --locked

Run it:

claw --version
claw
claw "summarize this repo"
claw prompt "explain src/main.rs"

For local development:

cd rust
cargo run --bin claw

Provider Setup

Provider Example models Required env Notes
Anthropic / Claw API claude-sonnet-4-6, claude-opus-4-6 ANTHROPIC_API_KEY or claw login Good default if you want Claude behavior
OpenAI-compatible gpt-5.4, gpt-5.4-mini OPENAI_API_KEY Set OPENAI_BASE_URL; use OPENAI_WIRE_API=responses for gateways like FunAI
xAI-compatible grok-* XAI_API_KEY Optional XAI_BASE_URL override

OpenAI-compatible Responses example:

export OPENAI_BASE_URL='https://api.funai.vip/v1'
export OPENAI_API_KEY='YOUR_KEY'
export OPENAI_WIRE_API='responses'

claw --model gpt-5.4

Claude example:

export ANTHROPIC_API_KEY='YOUR_KEY'

claw --model claude-sonnet-4-6

Backstory

At 4 AM on March 31, 2026, I woke up to my phone blowing up with notifications. The Claw Code source had been exposed, and the entire dev community was in a frenzy. My girlfriend in Korea was genuinely worried I might face legal action from the original authors just for having the code on my machine — so I did what any engineer would do under pressure: I sat down, ported the core features to Python from scratch, and pushed it before the sun came up.

The whole thing was orchestrated end-to-end using oh-my-codex (OmX) by @bellman_ych — a workflow layer built on top of OpenAI's Codex (@OpenAIDevs). I used $team mode for parallel code review and $ralph mode for persistent execution loops with architect-level verification. The entire porting session — from reading the original harness structure to producing a working Python tree with tests — was driven through OmX orchestration.

The result is a clean-room Python rewrite that captures the architectural patterns of Claw Code's agent harness without copying any proprietary source. I'm now actively collaborating with @bellman_ych — the creator of OmX himself — to push this further. The basic Python foundation is already in place and functional, but we're just getting started. Stay tuned — a much more capable version is on the way.

The Rust port was developed with both oh-my-codex (OmX) and oh-my-opencode (OmO): OmX drove scaffolding, orchestration, and architecture direction, while OmO was used for later implementation acceleration and verification support.

https://github.com/instructkr/claw-code

Tweet screenshot

The Creators Featured in Wall Street Journal For Avid Claw Code Fans

I've been deeply interested in harness engineering — studying how agent systems wire tools, orchestrate tasks, and manage runtime context. This isn't a sudden thing. The Wall Street Journal featured my work earlier this month, documenting how I've been one of the most active power users exploring these systems:

AI startup worker Sigrid Jin, who attended the Seoul dinner, single-handedly used 25 billion of Claw Code tokens last year. At the time, usage limits were looser, allowing early enthusiasts to reach tens of billions of tokens at a very low cost.

Despite his countless hours with Claw Code, Jin isn't faithful to any one AI lab. The tools available have different strengths and weaknesses, he said. Codex is better at reasoning, while Claw Code generates cleaner, more shareable code.

Jin flew to San Francisco in February for Claw Code's first birthday party, where attendees waited in line to compare notes with Cherny. The crowd included a practicing cardiologist from Belgium who had built an app to help patients navigate care, and a California lawyer who made a tool for automating building permit approvals using Claw Code.

"It was basically like a sharing party," Jin said. "There were lawyers, there were doctors, there were dentists. They did not have software engineering backgrounds."

The Wall Street Journal, March 21, 2026, "The Trillion Dollar Race to Automate Our Entire Lives"

WSJ Feature


Current Status

The repository now has two active implementation surfaces:

  • rust/ contains the main end-user CLI/runtime and is the most complete execution surface today
  • src/ contains the Python porting workspace, inventories, and parity-audit tooling
  • tests/ verifies the Python workspace
  • the exposed snapshot is no longer part of the tracked repository state

Why this rewrite exists

I originally studied the exposed codebase to understand its harness, tool wiring, and agent workflow. After spending more time with the legal and ethical questions—and after reading the essay linked below—I did not want the exposed snapshot itself to remain the main tracked source tree.

This repository now focuses on clean-room Rust and Python harness work instead.

Repository Layout

.
├── src/                                # Python porting workspace
│   ├── __init__.py
│   ├── commands.py
│   ├── main.py
│   ├── models.py
│   ├── port_manifest.py
│   ├── query_engine.py
│   ├── task.py
│   └── tools.py
├── rust/                               # Rust CLI/runtime (current primary surface)
│   ├── 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 specs
├── tests/                              # Python verification
├── assets/omx/                         # OmX workflow screenshots
├── 2026-03-09-is-legal-the-same-as-legitimate-ai-reimplementation-and-the-erosion-of-copyleft.md
└── README.md

Python Workspace Overview

The new Python src/ tree currently provides:

  • port_manifest.py — summarizes the current Python workspace structure
  • models.py — dataclasses for subsystems, modules, and backlog state
  • commands.py — Python-side command port metadata
  • tools.py — Python-side tool port metadata
  • query_engine.py — renders a Python porting summary from the active workspace
  • main.py — a CLI entrypoint for manifest and summary output

Quickstart

Rust CLI

Start the installed CLI:

claw

Run a one-shot prompt:

claw "summarize this repo"
claw prompt "explain src/main.rs"

Inspect commands and version:

claw --help
claw --version

Python Workspace

Render the Python porting summary:

python3 -m src.main summary

Print the current Python workspace manifest:

python3 -m src.main manifest

List the current Python modules:

python3 -m src.main subsystems --limit 16

Run verification:

python3 -m unittest discover -s tests -v
cd rust && cargo test -p api

Run the parity audit against the local ignored archive (when present):

python3 -m src.main parity-audit

Inspect mirrored command/tool inventories:

python3 -m src.main commands --limit 10
python3 -m src.main tools --limit 10

Current Parity Checkpoint

The port now mirrors the archived root-entry file surface, top-level subsystem names, and command/tool inventories much more closely than before. However, it is not yet a full runtime-equivalent replacement for the original TypeScript system; the Python tree still contains fewer executable runtime slices than the archived source.

Built with oh-my-codex and oh-my-opencode

This repository's porting, cleanroom hardening, and verification workflow was AI-assisted with Yeachan Heo's tooling stack, with oh-my-codex (OmX) as the primary scaffolding and orchestration layer.

  • oh-my-codex (OmX) — scaffolding, orchestration, architecture direction, and core porting workflow
  • oh-my-opencode (OmO) — implementation acceleration, cleanup, and verification support

Key workflow patterns used during the port:

  • $team mode: coordinated parallel review and architectural feedback
  • $ralph mode: persistent execution, verification, and completion discipline
  • Cleanroom passes: naming/branding cleanup, QA, and release validation across the Rust workspace
  • Manual and live validation: build, test, manual QA, and real API-path verification before publish

OmX workflow screenshots

OmX workflow screenshot 1

Ralph/team orchestration view while the README and essay context were being reviewed in terminal panes.

OmX workflow screenshot 2

Split-pane review and verification flow during the final README wording pass.

Community

instructkr

Join the instructkr Discord — the best Korean language model community. Come chat about LLMs, harness engineering, agent workflows, and everything in between.

Discord

Star History

See the chart at the top of this README.

Ownership / Affiliation Disclaimer

  • This repository does not claim ownership of the original Claw Code source material.
  • This repository is not affiliated with, endorsed by, or maintained by the original authors.

About

The fastest repo in history to surpass 100K stars ⭐. Better Harness Tools that make real things done. Built in Rust using oh-my-codex.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 93.1%
  • Python 6.9%