clawd-code Python Port
Skill by ara.so — Daily 2026 Skills collection.
What This Project Does
clawd-code is an independent Python rewrite of the Claude Code agent harness, built from scratch for educational purposes. It captures the architectural patterns of Claude Code — tool wiring, command dispatch, task orchestration, and agent runtime context — in clean Python, without copying any proprietary TypeScript source.
The project is orchestrated end-to-end using oh-my-codex (OmX), a workflow layer on top of OpenAI Codex. It is not affiliated with or endorsed by Anthropic.
Installation
No API keys are needed for the manifest/summary/CLI commands. If you extend the query engine to call a live model, set your key via environment variable:
Repository Layout
Key CLI Commands
All commands run via python3 -m src.main <subcommand>.
Core Data Models (src/models.py)
The dataclasses define the shape of the porting workspace:
Tools System (src/tools.py)
Tools are the callable units in the agent harness. Each tool entry carries metadata for dispatch:
Commands System (src/commands.py)
Commands are higher-level agent actions, distinct from raw tools:
Task Orchestration (src/task.py)
Tasks wrap a unit of agent work — a goal, a set of tools, and a result:
Query Engine (src/query_engine.py)
The query engine renders a porting summary from the active manifest:
You can also invoke it from the CLI:
Port Manifest (src/port_manifest.py)
Build and inspect the current workspace manifest programmatically:
Adding a New Tool
- Define a handler function in
src/tools.py. - Create a
Tooldataclass instance. - Register it in
TOOL_REGISTRY. - Write a test in
tests/.
Adding a New Command
Running Tests
Example test pattern:
Parity Audit
When a local ignored archive of the original snapshot is present, run:
This compares the current Python workspace surface against the archived root-entry file surface, subsystem names, and command/tool inventories, reporting gaps.
Common Patterns
Chaining tools in a task loop
Using the manifest in automation
Troubleshooting
Key Links
- Repository: https://github.com/instructkr/clawd-code
- oh-my-codex (OmX): https://github.com/Yeachan-Heo/oh-my-codex
- Related essay: Is legal the same as legitimate?
- Not affiliated with Anthropic.


