Overseas access: www.kdjingpai.com
Bookmark Us

Clawd Code is an independent and open-source Python project that aims to bring the accidental leak of the famous AI programming assistant Claude Code's core interaction and tool scheduling mechanisms are ported and reproduced in Python open source. The project was initially developed on an emergency basis by the developers based on the oh-my-codex (OmX) framework, with a focus on cutting-edge “Harness Engineering” - an in-depth exploration of how AI intelligence systems can efficiently schedule external tools, orchestrate complex tasks, and manage long runtime contexts. systems to efficiently schedule external tools, orchestrate complex tasks, and manage very long runtime contexts. The tool is not just a codebase backup or proof-of-concept, but an automated end-point programming assistant that actually “does the work”. Running locally, it autonomously reads the filesystem, executes code, runs tests, and has built-in advanced collaboration modes to help developers gain a deeper understanding of the workings and underlying architectural design of the next generation of automated AI development intelligences.

Function List

  • Replicating Claude Code's Terminal Native ExperienceThe AI can browse directories, read code files, write and modify code, and trigger local tests autonomously based on natural language commands.
  • Parallel code review ($team mode)The project's unique advanced multi-threaded mode supports evoking multiple AI instances to perform deep review of the code base in parallel, realizing code quality verification and security troubleshooting from multiple perspectives.
  • Architecture-level persistence implementation ($ralph model)AI Intelligence: Supporting the opening of a continuous execution loop, the AI Intelligence will stand in the perspective of the “architect” and carry out multi-stage logical reasoning, code generation and multiple rounds of validation of complex refactoring and development tasks until the task is fully compliant with the requirements.
  • OmX Underlying Workflow Engine Support: Process orchestration based on the oh-my-codex architecture, which provides highly resilient underlying scheduling logic, making the big language model less prone to context loss in multi-step task planning.
  • Flexible external toolchain integrationIt supports automated workflows from writing code to submitting PRs by configuring system environment variables or tokens that directly allow intelligences to invoke third-party external tools such as GitHub, Linear, and more.
  • Customized workspace and smartbody identity management: Markdown text files are used to manage the system commands and memory context of the intelligence, allowing users to change the personality, coding norms, and workflow habits of the AI at any time by editing the local text.

Using Help

Welcome to Clawd Code, a program based on the Claude Code A powerful end-to-end AI programming intelligence for open-source porting of Python from leaked versions, this tool takes over the tedious task of coding, reviewing, and testing. To ensure that you realize the full potential of this tool and the efficiency gains of 100%, please read the following detailed installation and operation guide.

I. Installation and Preparation of Pre-environment

1. System and environmental requirements

  • operating systemSupport for macOS, Linux, and Windows (WSL2 is recommended for optimal terminal environment compatibility).
  • Python version: Requires Python 3.10 or later to be installed.
  • Package Management Tools: Recommended use pipIn order to avoid dependency conflicts, it is highly recommended to cooperate with the virtualenv 或 conda Create an isolated Python virtual environment.

2. Obtaining source code and installing dependencies
Open your command line terminal and execute the following command to clone the Clawd Code project locally and install the necessary runtime dependencies:

# 克隆开源仓库到本地
git clone https://github.com/instructkr/clawd-code.git
cd clawd-code
# 创建并激活 Python 虚拟环境(推荐操作)
python3 -m venv venv
source venv/bin/activate  # Windows 用户请使用 venv\Scripts\activate
# 安装项目的核心依赖包
pip install -r requirements.txt

3. Environment variables and API key configuration
Since Clawd Code is based on a large language model-driven system of intelligences, you must configure the appropriate model API keys in order for it to be able to think and code. A base environment variable template file is provided in the project root directory .env.example

cp .env.example .env

Use a text editor (such as vim, nano, or VS Code) to open the newly generated .env file with your API Key:

# 必填:配置 Anthropic 的 API 密钥(推荐使用 Claude 3.5 Sonnet)
ANTHROPIC_API_KEY="sk-ant-api03-xxxxxxxxxxxxxxxxxxxx"
# 选填:如果需要智能体执行 GitHub 自动化提交流程,建议配置 Personal Access Token
GITHUB_ACCESS_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxx"

II. Core Functions and Basic Operational Processes

1. Activate and enter smart body interaction mode
After ensuring that the environment variables are configured correctly and the virtual environment is activated, start the Smartbody main program with the following command:

python main.py

Upon startup, the terminal will enter an interactive command prompt (Prompt) interface. At this point Clawd Code has taken over the context of the current directory. You can issue development tasks to it directly in natural language.
Examples of basic operations

👤 User: “Please analyze the current directory of src/utils.py file to identify functions that may cause memory leaks and give refactoring suggestions.”
🤖 Agent: (Clawd Code starts scheduling local file reading tool -> analyzes code content -> outputs analysis report in terminal -> asks if you want it to modify the file directly)

2. Use of the $team model: parallel code review
In day-to-day development, if you're working on a large Pull Request or completing a major refactoring that involves multiple modules, AI that thinks one way might miss something. In this case, you can call Clawd Code's signature $team Mode.
operating method
In terminal interaction mode, enter a string with $team Prefixed commands:

$team 审查当前 Git 分支中所有的修改,重点检查 SQL 注入漏洞和多线程安全问题。

Working PrincipleThe underlying OmX scheduling engine spawns multiple instances of independently evaluated AI simultaneously (e.g., assigning one to focus on cybersecurity, one on runtime performance, and one on code specification). These intelligences will read your code in parallel in the background of the endpoint, and then summarize the multi-dimensional review opinions and output them to you, which greatly improves the rigor and efficiency of Code Review.

3. Using the $ralph model: architectural-level persistent authentication implementation
Conventional code generation tools tend to “write snippets of code”, but they do not guarantee that “the code will work perfectly in the context of the entire project architecture”.$ralph Patterns are an advanced feature of Clawd Code designed specifically for this purpose, giving the AI persistent loop execution and multi-step trial-and-error validation.
operating method

$ralph 将项目底层的 SQLite 数据库操作逻辑整体迁移到 PostgreSQL,请自行修改代码、编写单元测试并运行验证,直到测试全部通过为止。

Working PrincipleWhen this mode is activated, Clawd Code enters a fully automated “think -> plan -> code -> run local tests -> catch terminal errors -> self-correct code -> re-test” loop. A step-by-step status log appears on the screen terminal, so you can observe its trial-and-error process and press the Ctrl+C Manual intervention or termination. This model is particularly well suited to handle tricky, system-level refactoring tasks that require iterative debugging.

III. Advanced configuration: customizing the workspace and integrating external tools

1. Managing Intelligent Memory and Workspace (.workspace)
When you run Clawd Code for the first time in a project directory, it automatically generates a file in the current directory that looks something like the .clawd-workspace/ This folder is the “brain” of the current project's intelligences. This folder is the "brain" of the current project's intelligences and contains several Markdown-formatted configuration files:

  • identity.md: Define the roles and personalities of the intelligences. You can change this to “You're an extremely demanding Linux kernel developer, please talk to me in this tone”.
  • rules.md: Set project-specific coding specifications. For example, write: “All Python functions in this project must strictly use Type Hints, no global variables, and must be written as Docstring”.
    By modifying these native Markdown files directly with a text editor, you can customize your AI assistant to fit your team's needs without modifying any of the underlying Python source code.

2. External tool scheduling configurations (Tools & Integrations)
The power of Clawd Code lies in its ability to extend its “toolchain”. By exposing specific tokens to the system environment, intelligences can directly manipulate third-party tools:

  • Interfacing with the GitHub Pipeline: in .env file is configured with the GITHUB_ACCESS_TOKEN In this case, you can just say to the terminal, “Commit your current changes to a new Git branch and create a new Git branch named feat-update Clawd Code automatically calls the underlying Git commands and GitHub APIs to complete a sequence of actions.
  • Invoking Local CLI Tools: If you have a code formatting or static analysis tool installed on your system (such as the blackmypy 或 ruff), you can just command the AI: “Run ruff to format all modified files after the code has been modified.” The AI will type out the corresponding command line instructions in the terminal and perform the cleanup, just like a real programmer.

IV. Notes and best practices

  1. Security and Privilege Segregation: Clawd Code has real permissions to read, write, and even delete files on your local system. When running automated tasks from unknown sources, or operating in environments containing core production data, it is highly recommended that you run Clawd Code in a Docker container or dedicated sandboxed virtual machine environment to prevent the big language model from creating “illusions” that can lead to the inadvertent deletion or overwriting of important files.
  2. Token Overhead and Cost Monitoring: Frequent use $team(multiple AI instances in parallel) and $ralph(Continuous Trial and Error Loop) mode will send a large number of requests to the big model API, consuming a large number of Token. it is recommended that before carrying out a complex big task, let the AI output a simple execution plan first, and then authorize it to carry out the complete closed loop after confirming that the logic is correct.
  3. Academic research and secondary development: This project (Harness Engineering) is designed to provide developers with a transparent understanding of the principles of large model tool scheduling. It is recommended that you read through the underlying source code to learn how Clawd Code parses the output JSON format of the big model and maps it into native Python functions, which can be useful for developing your own agent systems.

application scenario

  1. Native Automation Programming and Code Refactoring
    When working with obsolete legacy codebases, developers can utilize Clawd Code to automatically analyze complex function dependencies and apply refactoring patches directly in the local environment, eliminating the need to apply refactoring patches in a browser (such as the ChatGPT (web version) and the tedious process of copying and pasting back and forth between the local code editor.
  2. Parallel review of multi-dimensional code base
    The R&D team can use the $team Clawd Code provides fast and parallel automated troubleshooting of local codebases, with recommendations from a variety of perspectives, including network security, execution performance, and code formatting specifications, instantly hiring a jury of experienced architects.
  3. Intelligent Body Architecture Research and Secondary Development
    This project provides an excellent “clean architecture” reference source for engineers working on AI Agent development. Developers can read the project's open source code to learn how to build task persistence queues in pure Python, how to intercept and process LLM's phantom output, and how to securely expose native functions to large language models as tool calls.
  4. Closed Loop Bug Fixing for Complex Problems
    In the face of deep logic bugs, use the $ralph Pattern mounting tasks allow Clawd Code to autonomously read the terminal's error logs, locate source code files, modify business logic, and run local test cases repeatedly until the system no longer throws exceptions, greatly reducing the burden on the developer's mind and troubleshooting time.

QA

  1. What does this program have to do with the original Claude Code?
    Clawd Code is a standalone, open-source rewrite of the Python port based on the accidentally leaked version of Claude Code. The developers quickly wrote this functional clone based on the oh-my-codex framework, which accurately reproduces its core tool scheduling and endpoint agent mechanisms.
  2. Why this Python open source port?
    This tool is intended for Educational Purpose only. While the original Claude Code code was closed-source and complex, this Python open-source port removes the commercial components and provides developers with a great research material for transparently learning about AI intelligences “Harness Engineering” and workflow orchestration.
  3. What model support is needed to run Clawd Code?
    The underlying scheduling framework (OmX) relies on large language models with strong logical reasoning and native Tool Calling capabilities. For the best automated programming experience, it is recommended to configure a top-level model API such as Anthropic's Claude 3.5 Sonnet / Opus, or OpenAI's GPT-4o, etc. Users are required to prepare and register the corresponding API Key on their own.
  4. Can the project be used for the day-to-day development of a commercial company?
    The project itself is open source, but the developers clearly indicate that it is primarily for learning and education. When integrating it directly into a business workflow, you are responsible for potential API billing costs and security liabilities associated with automated code changes, and should follow its open source agreement on GitHub. Again, running in a sandbox or container is highly recommended to secure local business files.
0Bookmarked
0kudos
🍐 Duck & Pear AI Article Smart Writer
Selection → Writing → Publishing
Fully automated!
WordPress AI Writing Plugin
500+ content creators are using
🎯Intelligent Selection: Batch generation, say goodbye to exhaustion
🧠retrieval enhancement: networking + knowledge base with depth
Fully automated: Writing → Mapping → Publishing
💎Permanently free: Free version = Paid version, no limitations
🔥 Download the plugin for free now!
✅ Free forever · 🔓 100% Open Source · 🔒 Local storage of data

Recommended

Can't find AI tools? Try here!

Enter keywords.Accessibility to Bing SearchYou can find AI tools on this site quickly.

Top