by GPT-AGI
Clawd Code: Reconstructing Claude Code in Python - 基于Claude Code源码的Python重构实现
# Add to your Claude Code skills
git clone https://github.com/GPT-AGI/claude-code-pythonEnglish | 中文 | Français | Русский | हिन्दी | العربية | Português
A Complete Python Reimplementation Based on Real Claude Code Source
From TypeScript Source → Rebuilt in Python with ❤️
🔥 Active Development • New Features Weekly 🔥
Clawd Code is a complete Python rewrite of Claude Code, based on the real TypeScript source code.
Unlike the leaked TypeScript source, Clawd Codex is a fully functional, runnable CLI tool:
| Core Features Showcase |
|:---:|
|
|
| |
| |
| |
| |
| |
| |
| |
No comments yet. Be the first to share your thoughts!



Real CLI • Real Usage • Real Community
🚀 Try it now! Fork it, modify it, make it yours! Pull requests welcome!
---
description: Explain code with diagrams and analogies
allowed-tools:
- Read
- Grep
- Glob
arguments: [path]
---
Explain the code in $path. Start with an analogy, then draw a diagram.
SKILL.md slash commandsproviders = ["Anthropic Claude", "OpenAI GPT", "Zhipu GLM"] # + easy to extend
>>> Hello!
Assistant: Hi! I'm Clawd Codex, a Python reimplementation...
>>> /help # Show commands
>>> / # Show all commands & skills
>>> /save # Save session
>>> /multiline # Multi-paragraph input
>>> Tab # Auto-complete
>>> /explain-code qsort.py # Run a skill
clawd # Start REPL
clawd login # Configure API
clawd --version # Check version
clawd config # View settings
| Component | Status | Count | | ------------- | ---------- | --------- | | REPL Commands | ✅ Complete | 6+ built-ins | | Tool System | ✅ Complete | 30+ tools | | Automated Tests | ✅ Present | Core suites for skills, providers, REPL, tools, context | | Documentation | ✅ Complete | 10+ docs |
| System | Status | Description |
|--------|--------|-------------|
| CLI Entry | ✅ | clawd, login, config, --version |
| Interactive REPL | ✅ | Rich interactive output, history, tab completion, multiline |
| Multi-Provider | ✅ | Anthropic, OpenAI, GLM support |
| Session Persistence | ✅ | Save/load sessions locally |
| Agent Loop | ✅ | Tool calling loop implementation |
| Skill System | ✅ | SKILL.md-based slash-command skills with args + tool limits |
| Context Building | 🟡 | Initial prompt injection for workspace, git, and CLAUDE.md; deeper project understanding still needed |
| Permission System | 🟡 | Framework exists, needs integration |
| Category | Tools | Status | |----------|-------|--------| | File Operations | Read, Write, Edit, Glob, Grep | ✅ Complete | | System | Bash execution | ✅ Complete | | Web | WebFetch, WebSearch | ✅ Complete | | Interaction | AskUserQuestion, SendMessage | ✅ Complete | | Task Management | TodoWrite, TaskManager, TaskStop | ✅ Complete | | Agent Tools | Agent, Brief, Team | ✅ Complete | | Configuration | Config, PlanMode, Cron | ✅ Complete | | MCP | MCP tools and resources | ✅ Complete | | Others | LSP, Worktree, Skill, ToolSearch | ✅ Complete |
See FEATURE_LIST.md for detailed feature status and PR guidelines.
git clone https://github.com/GPT-AGI/Clawd-Code.git
cd Clawd-Code
# Create venv (uv recommended)
uv venv --python 3.11
source .venv/bin/activate
# Install
uv pip install -r requirements.txt
python -m src.cli login
This flow will:
The configuration file is saved in in ~/.clawd/config.json. Example structure:
{
"default_provider": "glm",
"providers": {
"anthropic": {
"api_key": "base64-encoded-key",
"base_url": "https://api.anthropic.com",
"default_model": "claude-sonnet-4-20250514"
},
"openai": {
"api_key": "base64-encoded-key",
"base_url": "https://api.openai.com/v1",
"default_model": "gpt-4"
},
"glm": {
"api_key": "base64-encoded-key",
"base_url": "https://open.bigmodel.cn/api/paas/v4",
"default_model": "glm-4.5"
}
}
}
python -m src.cli # Start REPL
python -m src.cli --help # Show help
That's it! Start chatting with AI in 3 steps.
| Command | Description |
| ------------ | --------------------- |
| / | Show commands & skills |
| /help | Show all commands |
| /save | Save session |
| /load <id> | Load session |
| /multiline | Toggle multiline mode |
| /clear | Clear history |
| /exit | Exit REPL |
Skills are markdown-based slash commands stored under .clawd/skills. Each skill lives in its own directory and must be named SKILL.md.
1) Create a project skill
Create:
<project-root>/.clawd/skills/<skill-name>/SKILL.md
Example:
---
description: Explains code with diagrams and analogies
when_to_use: Use when explaining how code works
allowed-tools:
- Read
- Grep
- Glob
arguments: [path]
---
Explain the code in $path. Start with an analogy, then draw a diagram.
2) Use it in the REPL
❯ /
❯ /<skill-name> <args>
Example:
❯ /explain-code qsort.py
Notes
~/.clawd/skills/<skill-name>/SKILL.mdallowed-tools controls which tools the skill can use.$ARGUMENTS, $0, $1, or named args like $path (from arguments).$path, not ${path}.clawd login guides youClawd-Code/
├── src/
│ ├── cli.py # CLI entry
│ ├── providers/ # LLM providers
│ ├── repl/ # Interactive REPL
│ ├── skills/ # SKILL.md loading and creation
│ └── tool_system/ # Tool registry, loop, validation
├── tests/ # Core test suite
├── .clawd/
│ └── skills/ # Project-local custom skills
└── FEATURE_LIST.md # Current feature status
We welcome contributions!
# Quick dev setup
pip install -e .[dev]
python -m pytest tests/ -v
See CONTRIBUTING.md for guidelines.