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 management
  • commands.py - Command metadata and execution
  • tools.py - Tool integration layer
  • query_engine.py - Porting summary generator
  • main.py - CLI entrypoint
  • port_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

OmX workflow screenshots showing AI-assisted development

Educational Value for Developers

This project serves as a case study in:

  1. Reverse engineering AI agent systems
  2. Clean-room reimplementation ethics
  3. Multi-agent workflow porting
  4. Python CLI tool development
  5. 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!