Claude Code Collaboration
简介
Claude Code Collaboration
原始描述
Integrates OpenClaw with Claude Code CLI to delegate coding tasks via JSON queues for advanced multi-turn code collaboration and analysis.
通过你的 Agent 添加
安装目录:claude-code-collaboration/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
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
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
1. Install Claude Code CLI
# macOS
brew install anthropic/claude-code/claude-code
# Or via npm
npm install -g @anthropic/claude-code
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
mkdir -p ~/.openclaw/agents/main/workspace/.oc-cc-in
mkdir -p ~/.openclaw/agents/main/workspace/.oc-cc-out
python3 agent.py &
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.json for agent state
- Logs: Conversation log at
.oc-cc-chat.log
- View Results: Read JSON files in
.oc-cc-out/
Configuration
.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
- 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
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。