The backstory
At 4 AM on March 31, 2026, the Claude Code source was exposed and the developer community erupted. Rather than retain a copy of the original TypeScript snapshot, the author sat down and ported the core harness features to Python from scratch before sunrise. The session was orchestrated end-to-end using oh-my-codex (OmX), a workflow layer built on top of OpenAI’s Codex.$team mode was used for parallel code review and architectural feedback; $ralph mode for persistent execution loops with architect-level verification. The result is a clean-room Python rewrite that captures the structural patterns of Claude Code’s agent harness.
The repository became the fastest GitHub project in history to surpass 30,000 stars, reaching the milestone within a few hours of publication.
What problems it solves
Tool routing
Routes arbitrary prompts across a mirrored inventory of commands and tools using token-overlap scoring, selecting the best matches by kind.
Session management
Persists and replays conversation sessions, tracks token usage, enforces turn and budget limits, and compacts transcripts automatically.
Command orchestration
Mirrors Claude Code’s full command surface — over 200 entries — with execution shims, plugin filtering, and skill-command filtering.
Parity auditing
Compares the Python workspace against a locally available TypeScript archive snapshot to identify coverage gaps and surface divergences.
Key features
CLI entrypoint
A single
python3 -m src.main entrypoint exposes every subsystem through subcommands with consistent argument parsing.Manifest generation
port_manifest.py scans the src/ tree and generates a live inventory of Python files and top-level modules.Query engine
query_engine.py orchestrates summary rendering, structured output, multi-turn loops, and session persistence on top of the manifest.Remote runtime modes
Simulates remote-control, SSH, Teleport, direct-connect, and deep-link runtime branching — mirroring Claude Code’s connection modes.
Permission gating
permissions.py provides a ToolPermissionContext that blocks tool names and prefixes before routing, mirroring Claude Code’s trust model.Bootstrap graph
bootstrap_graph.py mirrors the startup/runtime graph stages from the original harness, with a Markdown rendering path.Architecture overview
Thesrc/ directory is the active Python porting workspace. Each module corresponds to a distinct concern in the agent harness:
| Module | Role |
|---|---|
main.py | CLI entrypoint; builds the argparse parser and dispatches to all subcommands |
port_manifest.py | Scans src/ and produces a PortManifest with file counts and module notes |
query_engine.py | Summary rendering, session persistence, multi-turn loop, structured output |
runtime.py | PortRuntime — prompt routing, session bootstrapping, turn loop execution |
commands.py | Loads the mirrored command inventory from reference_data/commands_snapshot.json |
tools.py | Loads the mirrored tool inventory from reference_data/tools_snapshot.json |
models.py | Shared dataclasses: Subsystem, PortingModule, PermissionDenial, UsageSummary |
setup.py | WorkspaceSetup and SetupReport — startup steps, prefetch side effects, deferred init |
parity_audit.py | Compares the Python workspace against the local TypeScript archive when available |
session_store.py | Loads and saves StoredSession objects to disk |
permissions.py | ToolPermissionContext — deny-list filtering by tool name and prefix |
command_graph.py | Command graph segmentation report |
tool_pool.py | Assembled tool pool with default permission settings |
bootstrap_graph.py | Mirrored bootstrap/runtime graph stages |
remote_runtime.py | Remote-control, SSH, Teleport runtime branching simulation |
direct_modes.py | Direct-connect and deep-link runtime branching simulation |
transcript.py | TranscriptStore — append, compact, flush, and replay session transcripts |
task.py | Task-level planning structures |
reference_data/ subdirectory holds the JSON snapshots that back the command and tool inventories:
Next steps
Quick Start
Run your first Claw Code command in under a minute.