CC Session Bridge
/install cc-session-bridge
CC Session Bridge — CC 会话转 OpenClaw 格式技能
将 Claude Code (CC) 的调用会话转换为 OpenClaw 会话格式,使 AIMA 平台能采集并展示 CC 的会话记录。支持流式写入、自动绑定 AIMA 任务、追加已有会话。
一键安装
# 1. 解压技能包到 skills 目录
mkdir -p ~/.openclaw/skills
unzip -o \x3C技能包路径>/cc-session-bridge.skill -d ~/.openclaw/skills/
# 2. 拷贝脚本和配置到全局目录
mkdir -p ~/.openclaw/scripts
cp ~/.openclaw/skills/cc-session-bridge/scripts/cc-session-bridge.py ~/.openclaw/scripts/
cp ~/.openclaw/skills/cc-session-bridge/scripts/cc-bridge-config.yaml ~/.openclaw/scripts/
chmod +x ~/.openclaw/scripts/cc-session-bridge.py
# 3. 编辑配置文件,添加当前 agent 的信息
# 编辑 ~/.openclaw/scripts/cc-bridge-config.yaml
配置文件格式(~/.openclaw/scripts/cc-bridge-config.yaml):
# 按 agent 目录名配置
# ⚠️ 填小灵自己的工号和名称,不是主人的
xiaoling-qinfang:
chat_id: "WB02521102"
sender_id: "WB02521102"
sender_name: "小灵-财富风控001"
# 其他小灵安装时,替换为自己的身份信息:
# xiaoling-xxx:
# chat_id: "你的工号"
# sender_id: "你的工号"
# sender_name: "小灵-xxx"
验证安装
# 检查依赖
which claude && claude --version # CC CLI
which aima && aima --version # AIMA CLI
which python3 && python3 --version # Python3
# 测试运行
python3 ~/.openclaw/scripts/cc-session-bridge.py \
--agent-name \x3C你的agent目录名> \
--task-id \x3C一个AIMA任务ID> \
--query "你好,这是测试"
预期输出:🆕 新建会话: xxx → ✅ 会话已绑定到任务 xxx → CC 执行 → 🎉 完成
使用方法
基本用法(从配置文件读取 chat_id 等)
python3 ~/.openclaw/scripts/cc-session-bridge.py \
--agent-name xiaoling-qinfang \
--task-id 8700205 \
--query "分析项目结构"
命令行覆盖参数
python3 ~/.openclaw/scripts/cc-session-bridge.py \
--agent-name xiaoling-qinfang \
--task-id 8700205 \
--chat-id WB02521102 \
--sender-id WB02521102 \
--sender-name "小灵🤖财富风控001" \
--query "分析项目结构"
指定工作目录
python3 ~/.openclaw/scripts/cc-session-bridge.py \
--agent-name xiaoling-qinfang \
--task-id 8700205 \
--cwd ~/projects/my-project \
--query "分析项目结构"
CC 会在 ~/projects/my-project 目录下工作,能读取该项目的文件。不传 --cwd 时默认使用当前目录。
指定模型
python3 ~/.openclaw/scripts/cc-session-bridge.py \
--agent-name xiaoling-qinfang \
--task-id 8700205 \
--model opus \
--query "复杂分析任务"
默认 sonnet,可选 opus、haiku 等。
追加会话
同一 task-id 第二次调用时自动追加(append 模式),无需手动操作。
参数说明
| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
--agent-name |
✅ | - | OpenClaw agent 目录名 |
--task-id |
✅ | - | AIMA 任务 ID |
--query |
✅ | - | 传给 CC 的请求内容 |
--model |
❌ | sonnet | CC 模型 |
--chat-id |
❌ | 配置文件 | 小灵 chat_id(填小灵自己的工号) |
--sender-id |
❌ | 配置文件 | 小灵 sender_id(填小灵自己的工号) |
--sender-name |
❌ | 配置文件 | 小灵 sender 名称 |
--cwd |
❌ | 当前目录 | CC 的工作目录,决定 CC 能访问哪些文件 |
优先级:命令行参数 > 配置文件
工作流程
1. 查找 AIMA 任务是否已有绑定会话
├── 有 → APPEND:追加到现有 jsonl
└── 无 → NEW:新建会话 + 绑定到 AIMA 任务
2. 新建模式:
a. 生成 session_id (UUID)
b. 写入 session header
c. bind-session 到 AIMA 任务
d. 写入 user message + custom_message
3. 流式调用 CC (claude -p --output-format stream-json --verbose)
├── assistant 事件 → append jsonl
├── tool_result 事件 → append jsonl
└── 完成 → 输出统计
故障排查
AIMA 看不到会话:
- 检查 jsonl 是否生成:
ls ~/.openclaw/agents/\x3Cagent>/sessions/ - 检查 custom_message 是否含钉钉元数据(chat_id、sender_id、sender)
- AIMA 采集是定时轮询,等几分钟
- 确认绑定:
aima workspace task detail --taskId \x3Cid>
CC 调用失败:检查 which claude,模型名是否正确
绑定失败:检查 which aima,手动绑定:aima workspace task bind-session --taskId \x3Cid> --sessionId \x3Csid>
迁移到其他机器
只需 3 步:
- 拷贝
~/.openclaw/scripts/cc-session-bridge.py - 拷贝
~/.openclaw/scripts/cc-bridge-config.yaml(添加新 agent 配置) - 确保依赖:
claudeCLI +aimaCLI +python3
零 Python 依赖(内置简单 YAML 解析,不需要 pyyaml)。
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install cc-session-bridge - After installation, invoke the skill by name or use
/cc-session-bridge - Provide required inputs per the skill's parameter spec and get structured output
What is CC Session Bridge?
安装和使用 CC Session Bridge 脚本,将 Claude Code (CC) 的调用会话转换为 OpenClaw 会话格式,使 AIMA 平台能采集并展示 CC 的会话记录。支持流式写入、自动绑定 AIMA 任务、追加已有会话。触发场景:(1) 用户要求安装 CC 会话桥接脚本,(2) 用户想让 C... It is an AI Agent Skill for Claude Code / OpenClaw, with 44 downloads so far.
How do I install CC Session Bridge?
Run "/install cc-session-bridge" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is CC Session Bridge free?
Yes, CC Session Bridge is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does CC Session Bridge support?
CC Session Bridge is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created CC Session Bridge?
It is built and maintained by Jiang Shizheng (@steflerjiang); the current version is v1.1.1.