Claude Code Python Port: Open Source Rewrite
Discover the independent Python port of Claude Code – a from-scratch rewrite using oh-my-codex (OmX). This educational project transforms the original TypeScript codebase into a Python-first workspace with CLI tools, comprehensive tests, and detailed porting manifests. Run `python3 -m src.main summary` to explore the progress, or dive into the ethical essay on AI reimplementation and copyleft erosion. Perfect for developers studying AI agent workflows, tool integration, and ethical open-source practices.
Claude Code Python Port: The Ethical Open Source Rewrite
From TypeScript Snapshot to Python-First Workspace
The GitHub repository instructkr/claude-code has evolved from hosting an exposed Claude Code TypeScript snapshot into a dedicated Python porting workspace. This shift reflects deep consideration of legal and ethical questions surrounding AI source exposure, documented in the project's companion essay.
Current Python Implementation Status
The src/ directory now houses the active Python workspace:
# Quickstart commands
python3 -m src.main summary # Porting progress overview
python3 -m src.main manifest # Complete workspace manifest
python3 -m src.main subsystems # List ported modules
python3 -m unittest discover -s tests # Run verification suite
Core Components Ported:
models.py- Dataclasses for subsystems and state managementcommands.py- Command metadata and executiontools.py- Tool integration layerquery_engine.py- Porting summary generatormain.py- CLI entrypointport_manifest.py- Workspace structure tracking
Why This Rewrite Exists
The project creator studied the original codebase to understand:
- Harness architecture
- Tool wiring patterns
- Agent workflow orchestration
However, after reading the essay "Is legal the same as legitimate: AI reimplementation and the erosion of copyleft", they chose clean-room reimplementation over direct snapshot usage.
AI-Assisted Development with oh-my-codex
Built using Yeachan Heo's oh-my-codex (OmX) with specialized modes:
- $team mode: Parallel architectural review
- $ralph mode: Persistent execution and verification
- Codex workflow: Source tree transformation

Educational Value for Developers
This project serves as a case study in:
- Reverse engineering AI agent systems
- Clean-room reimplementation ethics
- Multi-agent workflow porting
- Python CLI tool development
- Test-driven porting strategies
Quickstart & Contribution
git clone https://github.com/instructkr/claude-code
cd claude-code
pip install -r requirements.txt # if exists
python3 -m src.main summary
Disclaimer: Independent project, not affiliated with Anthropic. Educational purpose only.
Stars: 28.6k | Forks: 39.6k – Join the community studying next-generation AI agent architectures!