Claude Code Collaboration
/install claude-code-collaboration
Claude Code Collaboration
Enable OpenClaw to delegate tasks to Claude Code CLI for collaborative discussions and complex task execution. When OpenClaw needs deeper analysis, coding assistance, or multi-turn discussions with a powerful code-generation model, it writes tasks to a queue and Claude Code Interface Agent executes them.
Architecture
OpenClaw (main agent)
↓ writes task .json
Claude Code Interface Agent (polling loop)
↓ calls claude CLI with env vars
Claude Code CLI →阿里云 API (qwen3.5-plus)
↓ returns result .json
OpenClaw reads result and continues
Setup Requirements
1. Install Claude Code CLI
# macOS
brew install anthropic/claude-code/claude-code
# Or via npm
npm install -g @anthropic/claude-code
2. Configure Environment Variables
The agent requires these environment variables:
export ANTHROPIC_AUTH_TOKEN="your-api-token"
export ANTHROPIC_BASE_URL="https://coding.dashscope.aliyuncs.com/apps/anthropic"
export ANTHROPIC_MODEL="qwen3.5-plus" # or your preferred model
3. Start the Interface Agent
mkdir -p ~/.openclaw/agents/main/workspace/.oc-cc-in
mkdir -p ~/.openclaw/agents/main/workspace/.oc-cc-out
python3 agent.py &
Usage
Sending a Task
Create a JSON file in .oc-cc-in/ with:
{
"task_id": "unique-task-id",
"prompt": "Your question or task for Claude Code",
"priority": "normal"
}
The interface agent polls the directory, executes via Claude Code CLI, and writes results to .oc-cc-out/{task_id}.json.
Reading Results
Results are JSON files with:
task_id: Task identifierstatus: "completed" or "failed"prompt: Original promptstdout: Claude Code's responsestderr: Error output if anyreturncode: Exit codecompleted_at: ISO timestamp
Example: Collaborative Discussion
OpenClaw sends:
{
"task_id": "discuss-01",
"prompt": "Analyze the pros and cons of microservices vs monolith for a small startup. Provide concrete recommendations.",
"priority": "high"
}
Claude Code returns detailed analysis in stdout, OpenClaw reads it and continues the conversation with the user.
Directory Structure
.oc-cc-agent/
├── agent.py # Interface agent (polling loop)
.oc-cc-in/ # Input queue (tasks to process)
.oc-cc-out/ # Output queue (results)
.oc-cc-chat.log # Conversation log
.oc-cc-status.json # Agent status
Monitoring
- Status: Check
.oc-cc-status.jsonfor agent state - Logs: Conversation log at
.oc-cc-chat.log - View Results: Read JSON files in
.oc-cc-out/
Configuration
Key settings in agent.py:
WORK_DIR = "/path/to/workspace" # Claude Code's working directory
IN_DIR = f"{WORK_DIR}/.oc-cc-in"
OUT_DIR = f"{WORK_DIR}/.oc-cc-out"
LOG_FILE = f"{WORK_DIR}/.oc-cc-chat.log"
PORT = 18790 # Optional HTTP server port
TIMEOUT = 120 # seconds
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install claude-code-collaboration - 安装完成后,直接呼叫该 Skill 的名称或使用
/claude-code-collaboration触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Claude Code Collaboration 是什么?
Integrates OpenClaw with Claude Code CLI to delegate coding tasks via JSON queues for advanced multi-turn code collaboration and analysis. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 145 次。
如何安装 Claude Code Collaboration?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install claude-code-collaboration」即可一键安装,无需额外配置。
Claude Code Collaboration 是免费的吗?
是的,Claude Code Collaboration 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Claude Code Collaboration 支持哪些平台?
Claude Code Collaboration 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Claude Code Collaboration?
由 gesilajerry(@gesilajerry)开发并维护,当前版本 v1.0.0。