AB
AiBoss
project

claw-code - an open-source Claude Code source code rewrite project

Claw-code is a Clean-room Rewrite project launched after the Claude Code source code was leaked. To avoid legal risks, the authors used OpenAI Codex's OmX workflow orchestration, refactoring the core architecture from Typ...

What is claw-code?

claw-code is a Clean-room Rewrite project launched after the Claude Code source code leak. To avoid legal risks, the authors used OpenAI Codex's OmX workflow orchestration, porting the core architecture from TypeScript to Python in just a few hours. The project is an open-source alternative that retains the original Agent workflow and tool orchestration capabilities, and is currently being further ported to Rust to provide a more efficient runtime. The project emphasizes "Better Harness Tools," aiming to create a truly usable open-source Agent development framework.

Main functions of claw-code

  • Agent workflow orchestrationThe core architecture of the Agent system, responsible for tool connectivity, task orchestration, and runtime context management.
  • Tool System: Provides a modular tool framework for managing tool call chains and defining tool port metadata.
  • Command Management: A modular command system and port metadata management that encapsulates various development operations.
  • Task schedulingA task status management and scheduling system that supports asynchronous processing and execution loops.
  • Query engineA query processing engine that supports code understanding, contextual retrieval, and codebase analysis.
  • CLI (Contact Interface)Provides a command-line entry point for viewing migration summaries, lists, and interactive operations.
  • Runtime context managementA persistent context management system for maintaining dialogue history and execution state.
  • Code automation generation: Automated development capabilities for code understanding, generation, and refactoring based on AI.

How to use claw-code

  • Environmental preparationYou need to ensure that Python 3 is installed locally. After cloning the project repository to your local machine, go to the root directory.
  • View OverviewBy executing the main module command, you can view the summary information of the current Python porting work and the complete list of workspace structures.
  • Exploration ModuleThe corresponding command can be used to list the system submodules, available command interfaces, and a list of supported tools.
  • Run test: Execute test discovery commands to run verification test suites to ensure the correctness of ported code.
  • Comparative auditWhen the original archive exists locally, a consistency audit can be run to check the functional alignment between the ported version and the original code.

Key information and usage requirements of claw-code

  • Project natureThis is an unofficial archive of the clean-room rewrite following the leak of Claude Code's source code.
  • technology stackCurrently implemented in Python (src/ Table of Contents), Rust Versions (dev/rust The branch is about to be merged, pursuing memory safety and high performance.
  • Core positioning: Agent development framework, providing Harness capabilities such as tool orchestration, command management, task scheduling, and query engine.
  • Development MethodThe entire process utilizes oh-my-codex (OmX) AI workflow orchestration. Ralph pattern persistent verification.
  • Current statusThe basic Python framework is available, but it is not yet fully equivalent to the original TypeScript system runtime. The Rust version will be the final form.
  • environmentRequires Python 3 to be installed. Run the program after cloning the repository.

Claw-code's core advantages

  • Legal securityIt adopts a cleanroom rewrite method to achieve independent implementation from scratch, completely avoiding the risks of copyright infringement and legal proceedings caused by using leaked source code.
  • Open source freedomAs a completely open-source project, it is not restricted by commercial software, and developers can freely modify, extend, and deeply customize the Agent workflow and toolchain.
  • Technological advancementIt is being ported to the Rust language and offers memory safety, higher runtime performance, and system-level stability compared to the original TypeScript implementation.
  • AI native developmentThe entire development process utilizes the oh-my-codex AI workflow orchestration, representing the future engineering paradigm and automated build capabilities for AI-assisted programming.
  • Functional completenessIt fully retains Claude Code's core Harness capabilities, including key functions such as Agent workflow orchestration, tool systems, command management, and task scheduling.

The project address for claw-code

  • GitHub repositoryhttps://github.com/instructkr/claw-code

Comparison of claw-code with similar competing products

Comparison Dimensions claw-code Claude Code Aider
Core positioning Claude Code, an open-source alternative framework for cleanroom rewriting, provides complete Agent Harness workflow orchestration capabilities. Anthropic's official closed-source AI programming agent provides end-to-end code generation and task execution. An open-source, AI-powered pair programming assistant for end-users, focusing on code editing and Git integration.
Open source license Fully open source (GitHub public repository), supporting free modification, secondary development, and private deployment. Closed-source commercial software, usable only through the official client or API, with no source code available for customization. Open source (GitHub public repository), supports multi-model configuration and terminal integration.
Legal compliance Implemented from scratch using a clean-room rewrite method, completely avoiding the risks of copyright infringement and legal proceedings caused by source code leaks. The source code has been leaked, and using the leaked code poses potential legal risks and compliance disputes. Independently developed open-source project, no copyright disputes, compliant and secure.
Technical Architecture The current Python implementation is being ported to Rust to prioritize memory safety and high performance, providing a modular Harness runtime. The official implementation is built on TypeScript and has a closed architecture, making it impossible to optimize independently or deploy locally. Python-based terminal tools, which integrate with editors for code modification, lack a systematic agent runtime.
Workflow capabilities Provides complete Harness workflow orchestration, tool system, command management and task scheduling, supporting complex multi-step automation. It provides end-to-end agent capabilities, but is limited to the official preset functions and does not allow for customization of workflow orchestration logic. It supports conversational code editing and Git commits, but lacks the ability to orchestrate multiple toolchains and schedule complex tasks.
Context Management Supports persistent execution loops and long-term context maintenance, making it suitable for handling large-scale project understanding and refactoring across sessions. It boasts robust context window management, but is limited by the session and rate constraints of commercial services. It is difficult to maintain long-term execution state and complex project-level memory based on the context of the current session.
Toolchain Integration Modular design supports deep customization of tool call chains and can integrate any third-party development tools with internal systems. A closed ecosystem that only supports officially integrated tools and cannot extend to enterprise-owned toolchains. It primarily integrates Git and an editor, but has limited toolchain extensibility.

Application scenarios of claw-code

  • AI-assisted programmingAs an open-source alternative to Claude Code, it provides intelligent programming assistant capabilities such as automatic code generation, completion, refactoring, and bug fixing.
  • Intelligent codebase analysis: Use query engines to deeply understand the structure of large code bases, enabling cross-file semantic retrieval, architecture analysis, and automatic document generation.
  • Automated workflow orchestrationHarness system orchestrates complex, multi-step development tasks, such as automated builds, deployment pipelines, and continuous integration script management.
  • Toolchain Integration ExtensionAs a modular agent framework, it integrates various development tools (Git, testing frameworks, Linter) to achieve unified command scheduling and tool invocation.
  • Code migration and refactoringIt supports automated refactoring of large-scale codebases, language porting (such as Python to Rust), and architecture modernization.