clawcodex:基于 Python 的生产级 CLI 代理项目

用户可借助该项目实现高效的代码解释、工具调用及多轮任务执行。它是 Claude Code 的 Python 重构版,具备真实代理运行时、多 LLM 提供商支持、可编程技能系统及交互式 REPL/TUI,且在 SWE-bench 验证中表现优于同类工具。【此简介由AI生成】

分支19Tags0
文件最后提交记录最后更新时间
1 个月前
1 个月前
1 个月前
1 个月前
1 天前
1 个月前
23 天前
1 个月前
1 个月前
1 天前
23 天前
3 天前
26 天前
18 天前
13 天前
3 天前
24 天前
3 天前
1 个月前
3 天前
1 个月前
30 天前
1 个月前
1 个月前
1 个月前
1 个月前
1 个月前
3 天前
1 个月前
24 天前
1 个月前
1 个月前
3 天前
1 个月前
23 天前
1 个月前
3 天前

ClawCodex DevMind

clawcodex 的下游 fork,可将代理转化为自主工程团队 — Orchestrator + SOP Compiler + Cron + Bridge + LiteLLM。 基于上游对 Claude Code 的 Python 重构版构建。本仓库新增多代理编排、调度与 LLM 路由层,这些能力上游并未提供。

📍 仓库位置: https://gitcode.com/chadwweng/clawcodex — 该项目现已以 MIT 许可证开源。欢迎公开贡献、提交 issue 和参与讨论。

英文 · 中文 · 原始上游 README

Python 3.11+ 许可证 MIT 状态:活跃开发中 4 个问题跟踪器适配器 100+ LLM 后端 通过开源替代减少 4,530 行代码 270+ 编排测试通过


为什么需要这个 Fork?

上游 clawcodex 已经提供了 Claude Code 的忠实 Python 移植版:代理循环、工具体系、MCP、hooks、权限、记忆、多提供商聊天、TUI/REPL。这个 Fork 是在其之上的一层——它补充了将代理纳入真实工程工作流所需的各项能力,而不仅仅是交互式聊天。 具体而言,本仓库提供:

  • 🤖 Orchestrator —— 守护进程,轮询 Issue 跟踪器,为工作区创建分支,运行代理,并无人值守地创建 PR
  • 💬 IM Message Gateway —— 在运行时将 REPL 和 Orchestrator 接入微信/飞书私信,使代理控制与回复可通过 IM 渠道进行
  • 🧩 SOP Compiler —— 将 workflow.md 流程规格转换为协同多代理系统
  • Cron System —— 支持抖动机制的分布式锁调度,并记录 NDJSON 运行历史
  • 🌉 Bridge Daemon 扩展 —— 多会话桥接、远程运行时、REPL/headless 适配器
  • 🔌 LiteLLM Provider —— 通过 --provider litellm 以单一接口接入 100 多个 LLM 后端
  • 👥 Coordinator / Team —— 通过 TeamCreate/TeamDelete 创建 worker 集群,并使用 SendMessage 进行同级 DM
  • 🩹 PR Review Auto-Fix (F-37) —— 读取评审评论和 CI 日志,并在同一分支上迭代修复
  • Verification Gate (F-38) —— 在 pre-commit / pre-push / post-sync 阶段设置 pytest 门禁,并生成 Markdown + JSON 报告
  • 🔁 Issue Re-run (F-39) —— 由 agent:retry/agent:follow-up/agent:blocked 标签驱动重跑
  • 🧭 Logical Kanban (LKB) —— 可选启用、以工作区为作用域的持久化任务图,作为现有 Task-v2 工具的底层支撑

上游的 REPL、TUI、工具体系、MCP、hooks、记忆、权限和 provider 层仍然保留——本 Fork 接入它们,而不是替换它们。


演示

$ clawcodex-dev orchestrator server start --workflow ./workflow.md
✓ orchestrator daemon started · pid 18432 · tracker=gitcode · repo=chadwweng/AgentSDK
✓ max_concurrent_agents=3 · permission_mode=bypassPermissions
$ clawcodex-dev orchestrator issue list
ID                STATUS      BRANCH                     ATTEMPTS  PR
gitcode/AGENTSDK-7   done     clawcodex/AGENTSDK-7     1         https://gitcode.com/.../pulls/7
gitcode/AGENTSDK-12  running  clawcodex/AGENTSDK-12    1         -
gitcode/AGENTSDK-15  paused   clawcodex/AGENTSDK-15    2         https://gitcode.com/.../pulls/15
linear/PROJ-128      running  clawcodex/PROJ-128       1         -
$ clawcodex-dev orchestrator issue tail --id gitcode/AGENTSDK-15
14:02:11  ◐ Read src/services/lock.py · 132 lines
14:02:13  ◐ Grep "asyncio.Lock" · 3 hits
14:02:18  ◐ Edit src/services/lock.py · +18 -4
14:02:24  ◐ Bash pytest tests/test_lock.py · 4 passed
14:02:24  ✓ Verification gate OK (pytest -x)
14:02:25  ◐ Git commit -m "fix: per-key lock granularity in flush_batch"
14:02:26  ◐ Git push origin clawcodex/AGENTSDK-15
14:02:31  ✓ PR opened · auto-review-loop subscribed
# 4 hours later, after review comments land
$ clawcodex-dev orchestrator issue inject --id gitcode/AGENTSDK-15 "address review comments"
✓ agent resumed · re-reading PR comments · pushing fix commits

🎬 视频演示

1 分钟看看 clawcodex-dev 能做什么 — 视频胜过千言万语。

本项目内置一个四章节交互式视频演示(coldopen · orchestrator · sop-compiler · install),打包为约 238 KB 的自包含单文件 React SPA(通过 vite-plugin-singlefile 构建,所有 JS/CSS 均已内联——双击即可在任意浏览器中打开)。

观看

渠道 链接 备注
📺 GitCode Pages https://chadwweng.gitcode.com/clawcodex/assets/video-b/presentation/dist/index.html 启用仓库 Pages 后可用
📺 GitHub Pages https://peroxider.github.io/clawcodex/assets/video-b/presentation/article.html 镜像仓库可同步
🏃 本地预览 cd assets/video-b/presentation && npm install && npm run devhttp://localhost:5174 需要 Node 18+
📦 单文件 assets/video-b/presentation/article.html 离线 / 静态托管,238 KB

GitHub / GitCode 的 README 会因清理策略移除 <script> 标签,因此使用外部链接,而不是内联嵌入。 静态截图缩略图可通过 python3 scripts/capture_video_b_screenshots.pyassets/video-b/screenshots/ 重新生成。


快速开始

一键安装(Linux / macOS / Git Bash / WSL)

curl -fsSL https://raw.githubusercontent.com/peroxider/clawcodex/main/install.sh | bash
source ~/.bashrc                     # or: source ~/.zshrc (or open a new terminal)
clawcodex-dev --version              # verify the install

常用标志:

bash install.sh doctor               # diagnose environment without installing
bash install.sh --dry-run            # preview every step without applying changes
bash install.sh --no-venv --no-setup --yes --log-file /tmp/install.log  # CI / Docker

💡 Windows 用户: 若使用原生 PowerShell 5.1+ 或 pwsh,请改用下方的 PowerShell 一键安装 —— 无需 Git Bash 或 WSL。

一键安装(PowerShell / Windows)

powershell -NoProfile -ExecutionPolicy Bypass -Command "iwr https://raw.githubusercontent.com/peroxider/clawcodex/main/install.ps1 -UseBasicParsing -OutFile $env:TEMP\cc.ps1; & $env:TEMP\cc.ps1"
clawcodex-dev --version              # verify the install (open a new shell first if needed)

常用标志:

.\install.ps1 doctor                 # diagnose environment
.\install.ps1 -DryRun                # preview without applying
.\install.ps1 -NoVenv -NoSetup -Force -LogFile C:\Temp\install.log  # CI / Docker
.\install.ps1 uninstall              # uninstall

手动安装(备选方案)

当你在项目本身上进行开发,或安装脚本不可用时,请使用此方式:

git clone https://gitcode.com/chadwweng/clawcodex.git
cd clawcodex
uv venv --python 3.11
source .venv/bin/activate
uv pip install -e ".[dev]"
python scripts/ci/dev_setup.py
clawcodex-dev login                  # configure providers (one-time)
clawcodex-dev                        # REPL (same as upstream, plus orchestrator subcommands)
clawcodex-dev orchestrator --help    # see all orchestrator commands

前置要求

操作系统 状态
Linux (Debian, Ubuntu, Fedora, RHEL, Arch, …) ✅ 已支持
macOS 12+ (Monterey and newer) ✅ 已支持
WSL2 (Ubuntu / Debian inside Windows) ✅ 已支持
Windows: native PowerShell 5.1+ / pwsh ✅ 已支持 — 无需 Git Bash 或 WSL
工具 最低版本 是否自动配置?
Git 任意 2.x 通过操作系统包管理器安装
Python 3.11 - 3.13 uv 按需安装
uv 任意 0.5+ ✅ 首次运行时从 astral.sh 下载
curlwget 任意 用于 uv 安装和仓库克隆

安装过程完全在用户本地进行(无需 sudo),并写入 $HOME/.clawcodex/$HOME/.local/bin/ 以及你的 shell 配置文件。需要约 500 MB 的可用磁盘空间。重复运行安装脚本是安全的——它会快进现有仓库并复用现有 venv。


Fork 特性

Orchestrator — 自主 issue → PR 流水线

核心功能。一个长期运行的守护进程,会轮询任务跟踪器,领取 issue,创建分支工作区,运行 agent,验证、提交、推送并打开 PR——每个步骤都支持操作者覆盖。

配置(3 分钟):

cp extensions/orchestrator/templates/workflow.template.md ./workflow.md
$EDITOR workflow.md    # set tracker, repo, branch_prefix, provider, permission_mode
clawcodex-dev orchestrator server start --workflow ./workflow.md
clawcodex-dev orchestrator issue list
clawcodex-dev orchestrator issue tail --id <id>
clawcodex-dev orchestrator dashboard  # HTTP/SSE on :8080

Issue 状态: pending · running · synced · completed · failed · abandoned

F 特性新增:

特性 描述
F-37 — PR 评审自动修复 订阅 PR 评审评论与 CI 日志;在同一分支上重新运行代理(不新建 PR),持续推送修复提交直至问题解决。
F-38 — 验证门禁 在 pre-commit / pre-push / post-sync 检查点运行 test_command(默认 pytest -x)。校验失败将阻止推送,并自动将 Markdown + JSON 报告插入 PR 正文。
F-39 — Issue 重跑 agent:retry(重置 + 关闭旧 PR + 重跑)、agent:follow-up(保留 PR,追加提交)、agent:blocked(永久跳过)。也可通过 /agent retry / /agent follow-up 评论命令或 clawcodex-dev orchestrator issue retry --id <id> --mode reset 执行。

子命令:

clawcodex-dev orchestrator server {start,status,stop} --workflow <file>
clawcodex-dev orchestrator issue list [--status <state>]
clawcodex-dev orchestrator issue show --id <id>
clawcodex-dev orchestrator issue tail --id <id>
clawcodex-dev orchestrator issue stop --id <id>
clawcodex-dev orchestrator issue pause --id <id> [--reason <text>]
clawcodex-dev orchestrator issue resume --id <id>
clawcodex-dev orchestrator issue takeover --id <id>
clawcodex-dev orchestrator issue clarify --id <id> --answer <text>
clawcodex-dev orchestrator issue inject --id <id> [hint]
clawcodex-dev orchestrator issue feedback --id <id> (--list|--approve|--dismiss)
clawcodex-dev orchestrator issue review --id <id> (--approve|--reject --feedback <text>)
clawcodex-dev orchestrator issue retry --id <id> --mode reset|followup|unblock
clawcodex-dev orchestrator issue workspace --id <id>
clawcodex-dev orchestrator dashboard [--port 8080]

extensions/orchestrator/ 模块: tracker.py + linear/gitcode/gitee/github 适配器,issue_registry.pyclarification.py/clarification_queue.pyagent_runner.pygit_sync.pystatus_dashboard.pyworkspace.py/workspace_locator.pyreview_feedback.pyprogress_reporter.pyapproval_policy.pyorchestrator.pyworkflow.py/workflow_store.py + 模板。


IM 消息网关

统一的 IM 入口,将微信(个人 / Weixin iLink)与飞书 App WebSocket 双向消息,以及旧版飞书/Slack/Discord 推送,汇聚到一个能力门控网关中。

  • 当前支持 飞书微信 连接渠道。推荐飞书;微信暂不推荐,因为它限制主动外发消息。
  • 独立守护进程 形式运行(extensions/im_gateway/);REPL/orchestrator 通过 POSIX UDS 接入。
  • 仅支持 POSIX/WSL/Git Bash 运行时(Unix 域套接字)。

快速开始:

clawcodex-dev gateway start|stop|status|restart # IM gateway lifecycle control
clawcodex-dev gateway setup # IM gateway quick setup; restarts the daemon automatically

# Feishu setup (recommended)
uv sync --locked --extra feishu # install Feishu App SDK + terminal QR deps; included by --extra dev
clawcodex-dev gateway status feishu # show Feishu connection mode, health, and approval-card support

# WeChat setup (currently not recommended; proactive outbound messages are limited)
clawcodex-dev gateway restart wechat # restart WeChat IM channel
clawcodex-dev gateway status wechat # show WeChat login health and REPL/orchestrator connection status

在网关守护进程正在运行且双向应用通道已登录的情况下,正常启动 REPL 或 Orchestrator,然后将该运行时连接到 IM 通道。微信直接/私聊消息或飞书 P2P 消息都能驱动代理,回复会返回给实际发送者。飞书配置在可用时会使用二维码扫码创建注册;如果扫码被拒绝、过期或无法完成,则回退为手动填写应用凭据。设置向导成功退出时,会自动重启整个网关守护进程,以便所有通道变更都在全新进程中加载。

在处理飞书消息期间,ClawCodex 会在原始消息上添加 Typing 表情回应。成功或取消后,它会移除该回应;失败后,会将其替换为 CrossMark。设置 FEISHU_REACTIONS=false,或将飞书通道的 extra.reactions 设为 false,即可禁用此行为。手动创建的应用需要飞书 Send and delete message reactions 权限(im:message.reactions:write_only)。

连接到网关:

# REPL: connect at startup
clawcodex-dev --gateway

# REPL: or resume/start normally and connect later
clawcodex-dev
clawcodex-dev --resume <session-id>
/gateway connect
/gateway status
/gateway disconnect

# Orchestrator: connect at startup
clawcodex-dev orchestrator server start --workflow path/to/workflow.md --gateway

# Orchestrator: or connect an already-running daemon later
clawcodex-dev orchestrator server start --workflow path/to/workflow.md
clawcodex-dev orchestrator server connect-gateway
clawcodex-dev orchestrator server disconnect-gateway

启动 --gateway 和运行时连接默认都会绑定所有已启用的双向 IM 应用渠道中的直接/私聊发送者。WeChat 和 Feishu WebSocket 可并行运行。同一时刻只能有一个运行时持有共享绑定:连接 REPL 绑定会断开 orchestrator 绑定,连接 orchestrator 绑定会断开 REPL 绑定。传统 Feishu/Slack/Discord webhooks 仍仅限出站。CLAWCODEX_GATEWAY_SOCK 可覆盖守护进程套接字;指定来源绑定仍仅可用于针对性调试或未来的多来源自动化。

命令控制:

运行时 白名单 IM 命令
REPL /stop, /clear, /reset, /new, /goal, /help, /?, /cost, /history, /context, /recap, /btw, /cron-list, /cron-status, /cron-runs, /tools, /skills, /diff, /mcp, /tasks, /idle, /doctor, /release-notes
Orchestrator /server status; /issue list, /issue show, /issue tail, /issue stop, /issue pause, /issue resume, /issue clarify, /issue inject, /issue feedback, /issue review, /issue retry, /issue workspace

编辑 ~/.clawcodex/gateway/channels.yaml 中的 command_allowlists.replcommand_allowlists.orchestrator,然后重启网关来自定义这些列表;若省略某个列表,则保留其默认值,而显式空列表会禁用该运行时的所有斜杠命令。

对于 Orchestrator IM 命令,/issue inject 是在代理持续运行期间提供的实时、非阻塞操作者提示;/issue clarify 用于回答代理因等待输入而暂停的澄清请求;/issue feedback/issue review/issue retry 属于 issue 生命周期变更,可调度另一次代理运行。

未列入白名单的 Orchestrator 斜杠命令会被拒绝,并返回“命令不支持”错误信息。

故障排查:

使用 INFO 日志级别重启守护进程,并跟踪网关日志:

clawcodex-dev gateway restart --verbose
clawcodex-dev gateway status
tail -f ~/.clawcodex/gateway/gateway.log

SOP 编译器

workflow.md 中的流程规范转换为协同多智能体系统。

clawcodex-dev sop convert examples/sop/order_processing.md --out ./.clawcodex

产出:代理定义(每个角色一个)、入口技能、编排图。生成的代理可以互相 SendMessage,并借助上游任务通知的路由机制在崩溃后恢复运行。

模块: sdk_parser.py, skill_grouper.py, agent_builder.py, templates.py.


协调器 / 团队工作者

将上游的团队原语封装为可用的工作集群模型:

clawcodex-dev coordinator team create --name build-team --members agent-1,agent-2,agent-3
clawcodex-dev coordinator team list
clawcodex-dev coordinator team delete --name build-team

TeamCreate/TeamDelete 工具在代理循环中暴露。工作者通过 SendMessage 发送同侪私信。任务通知 XML 路由将工作者事件回传至管理器。


逻辑看板(LKB)

当前状态: 实验性且需手动启用。所需功能标志默认关闭。

LKB 仍会向模型暴露熟悉的 Task-v2 工具名称。当其持久化 Plan Graph 模式生效时,宿主适配器会将受支持的 Task-v2 调用路由至工作区范围内的 Graph Store 中当前会话的 Plan,而非仅限会话的原生任务字典。

  • 启用 LKB 并不会强制模型创建任务计划。代理仍必须调用 Task 工具。
  • 交互式 REPL/TUI 会话默认暴露 Task-v2。无头/SDK 会话通常使用 TodoWrite;启用 LKB_PLAN_GRAPH 也会在无头会话中启用 Task-v2 工具集,因此无头 LKB 只需开启这一个标志。CLAUDE_CODE_ENABLE_TASKS=1 仍可独立强制启用 Task-v2。TodoWrite 本身不使用持久化 Plan Graph。
  • 当父运行时具备这些工具时,后台代理可以使用 TaskCreateTaskGetTaskListTaskUpdateLkb。查询执行器还会在通过共享注册表分发之前,强制应用每个代理的过滤后工具集。
  • Textual TUI 会在状态行上方持续挂载任务进度面板,并在 Task、Agent 和 Lkb 结果返回后刷新该面板。在会话活动期间,它还会定期从 Graph Store 重新加载当前 Plan 投影,因此子代理上下文中完成的进度会出现在固定面板中。

启用 LKB:

在交互式会话中,仅输入 /lkb,即可打开一个交互式开/关选择器(类似于 /effort),并显示当前状态。按 Enter 可切换该标志并保存选择。

如需持久化、用户级启用:

clawcodex-dev feature set LKB_PLAN_GRAPH --on
clawcodex-dev feature get LKB_PLAN_GRAPH
  • 该值会保存在 ~/.clawcodex/features.json 中。更改后,请启动新的 ClawCodex 进程。

对于无头模式的 Task-v2 运行,仅需一个标志即可——它还会启用 Task-v2 工具接口:

CLAWCODEX_FEATURE_LKB_PLAN_GRAPH=1 \
clawcodex-dev -p "Use LKB to plan and implement this change: ..."

特性状态优先级依次为:运行时 CLI 覆盖、环境变量、已持久化的特性配置,以及注册的默认值。

交互式 REPL/TUI 会话提供以下本地命令:

/lkb                       # Open the interactive on/off picker (shows state; Enter toggles and persists)
/lkb board                 # Show the Logical Kanban Board panel
/lkb board --compact       # Show the compact Board
/lkb status                # Show derived status; equivalent to compact Board in Plan Graph mode
/lkb explain <task_id>     # Explain blockers, invalidation, and latest validation
/lkb audit <task_id>       # Show recent Audit Events for one task
/lkb revalidate <task_id>  # Revalidate one needs_recheck task
/lkb plan current          # Show this session's current Plan
/lkb plan list             # List Plans in the workspace Board
/lkb plan new [title]      # Create and bind a new Plan
/lkb plan use <plan_id>    # Explicitly bind an existing Plan
/lkb plan suspend          # Suspend the current Plan and release its claims
/lkb plan complete         # Complete the current Plan
/lkb plan abandon          # Abandon the current Plan
/lkb plan archive          # Archive the current Plan
/lkb plan reopen <plan_id> # Reopen and bind a stopped Plan

内置长期记忆

可选启用的被动记忆集成现已随附 Mem0 兼容后端以及嵌入式 Qdrant 存储。无需外部仓库、Docker 服务或原生 Qdrant 二进制文件。

uv sync --extra dev --extra memory
export OPENAI_API_KEY=...
clawcodex-dev memory enable
clawcodex-dev memory status
clawcodex-dev

使用 clawcodex-dev memory logs -f 用于后端诊断,并使用 clawcodex-dev memory disable 停止托管进程、移除项目本地的记忆集成。memory enable 会创建一个被 Git 忽略的 .mcp.json 条目,并在项目的 .env 中启用被动记忆。数据默认存储在 ~/.clawcodex/memory/ 下;外部 Qdrant 仍可通过 QDRANT_HOST/QDRANT_PORT 使用。


架构(仅适用于此 fork)

              ┌──────────────────────────────────────────────┐
              │   clawcodex_ext/cli (clawcodex-dev entry)    │
              │   parser · dispatch · runners · permissions  │
              └──────────┬──────────────┬─────────────┬──────┘
                         │              │             │
              ┌──────────▼────┐  ┌──────▼─────┐  ┌────▼────────────┐
              │ Orchestrator  │  │ Cron System │  │ SOP Compiler    │
              │  + Dashboard  │  │ + Lock+     │  │ + SDK parser    │
              │  + LiveView   │  │   Jitter    │  │ + Agent builder │
              │  + Takeover   │  │ + Status    │  │ + Skill grouper │
              │  + Review FB  │  │ + Notify    │  │                 │
              └──────┬────┬───┘  └─────────────┘  └─────────────────┘
                     │    │ events + commands
                     │    ▼
                     │  ┌─────────────────────────────────────┐
                     │  │ IM Gateway / MessageGateway         │ ◄── CLI / REPL opt-in
                     │  │ bidirectional IM · approval prompts │
                     │  │ command dispatch (/stop, /pause)    │
                     │  └──────────────────┬──────────────────┘
                     │                     ▼
                     │  ┌─────────────────────────────────────┐
                     │  │ Upstream IM provider: WeChat        │
                     │  └─────────────────────────────────────┘
                     │
       ┌─────────────┼─────────────┐
       │             │             │
┌──────▼─────┐ ┌─────▼──────┐ ┌────▼──────────┐
│ Trackers   │ │  Bridge    │ │  Coordinator  │
│ · Linear   │ │  Daemon    │ │  · TeamCreate │
│ · GitHub   │ │  Phases    │ │  · TeamDelete │
│ · Gitee    │ │  3,4,5,8,11│ │  · SendMessage│
│ · GitCode  │ │  + Remote  │ │  · Workers    │
└────────────┘ └────────────┘ └───────────────┘
                     │
                     ▼
       ┌─────────────────────────────────────┐
       │         Upstream clawcodex          │
       │  query() · tool_system · providers  │
       │  TUI · REPL · MCP · Hooks · Memory  │
       │  (see README.md.raw for full map)   │
       └─────────────────────────────────────┘

MessageGateway 是本分支共用的 IM 边界:CLI/REPL 与 Orchestrator 通过网关 IPC 接入,而 Provider 投递仍由 WeChat 适配器承担。


项目结构(仅本分支)

extensions/                          # all downstream additions live here
├── orchestrator/                    #   - autonomous issue handler
│   ├── orchestrator.py              #   - daemon main loop
│   ├── tracker.py                   #   - tracker ABC
│   ├── linear/                      #   - Linear adapter
│   ├── issue_registry.py            #   - JSON registry
│   ├── clarification.py             #   - 3-channel resolver
│   ├── clarification_queue.py       #   - 13-state queue
│   ├── agent_runner.py              #   - per-issue agent execution
│   ├── git_sync.py                  #   - commit / push / sync + verification gate
│   ├── review_feedback.py           #   - F-37 PR review auto-fix
│   ├── status_dashboard.py          #   - HTTP/SSE LiveView
│   ├── workspace.py                 #   - worktree lifecycle
│   ├── workspace_locator.py
│   ├── progress_reporter.py
│   ├── approval_policy.py
│   ├── workflow.py + workflow_store.py
│   ├── templates/workflow.template.md
│   └── cli/                         #   - server, issue, dashboard subcommands
├── sop_converter/                   #   - SOP compiler
│   ├── sdk_parser.py
│   ├── skill_grouper.py
│   ├── agent_builder.py
│   └── templates.py
├── providers_ext/
│   └── litellm_provider.py          #   - LiteLLM catch-all
├── tool_system_ext/                 #   - tool bundles + registry ext
│   ├── bundles.py
│   ├── registry_ext.py
│   └── agent_config.py
├── capabilities/                    #   - cross-cutting protocols
└── api/                             #   - orchestration + query public API
clawcodex_ext/                       # downstream CLI + services
├── cli/                             #   - clawcodex-dev entry
├── cron_system/                     #   - distributed cron scheduler
├── frontend/                        #   - headless frontend
├── runtime/                         #   - RuntimeContext factory
└── tui/                             #   - extended Textual TUI (8 hook points)

所有 src/ 中的内容均属于上游项目——有关上游架构地图,请参阅 README.md.rawdocs/ARCHITECTURE.md

开发

git clone https://gitcode.com/chadwweng/clawcodex.git
cd clawcodex
pip install -e ".[dev]"
python scripts/ci/dev_setup.py
# Run only the fork's own tests
pytest tests/test_orchestrator.py -v
pytest tests/test_cron_system.py -v
pytest tests/test_sop_converter.py -v
pytest tests/test_bridge.py -v
# Or everything except upstream integration tests
pytest tests/ -m "not integration" -v

Git 钩子不会仅仅因为在克隆的仓库中存在 .pre-commit-config.yaml 就自动启用。scripts/ci/dev_setup.py 会安装本地 pre-commit 钩子,并在缺失时创建 .env 模板。

  • GitCode CI/CD 门禁可以在本地模拟:
    python scripts/ci/local_ci.py --base "the fork's remote dev branch" --ui plain --failure-lines 120
    python scripts/ci/local_ci.py --base upstream/dev
    
  • 未指定 --all 时,门禁仅对比 HEAD~1..HEAD 的差异。如需覆盖相对于合并基点的完整 PR 差异,请使用 --base <ref>
  • Pytest 门禁使用固定的冒烟测试套件,以及当前范围内已变更的 tests/**/test_*.py 文件。

详细门禁映射参见 docs/cicd/CICD_GATE.md;PR 规范详见 CONTRIBUTING.md


许可证

MIT — 与上游 clawcodex 一致。extensions/clawcodex_ext/ 中的下游新增内容同样以 MIT 条款发布。


致谢

  • clawcodex — 本 fork 所基于的 Claude Code 上游 Python 移植版
  • Claude Code(Anthropic)— 原始 TypeScript 架构
  • Aider · Cline · Continue · OpenHands — CLI / TUI 模式参考
  • LiteLLM — 全兼容提供商层

如果此项目对您有用,欢迎为本仓库点 Star ⭐。 ⬆ 返回顶部

项目介绍

用户可借助该项目实现高效的代码解释、工具调用及多轮任务执行。它是 Claude Code 的 Python 重构版,具备真实代理运行时、多 LLM 提供商支持、可编程技能系统及交互式 REPL/TUI,且在 SWE-bench 验证中表现优于同类工具。【此简介由AI生成】

定制我的领域