← 返回 Skills 市场
steflerjiang

CC Session Bridge

作者 Jiang Shizheng · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ✓ 安全检测通过
44
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install cc-session-bridge
功能描述
安装和使用 CC Session Bridge 脚本,将 Claude Code (CC) 的调用会话转换为 OpenClaw 会话格式,使 AIMA 平台能采集并展示 CC 的会话记录。支持流式写入、自动绑定 AIMA 任务、追加已有会话。触发场景:(1) 用户要求安装 CC 会话桥接脚本,(2) 用户想让 C...
使用说明 (SKILL.md)

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,可选 opushaiku 等。

追加会话

同一 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 看不到会话

  1. 检查 jsonl 是否生成:ls ~/.openclaw/agents/\x3Cagent>/sessions/
  2. 检查 custom_message 是否含钉钉元数据(chat_id、sender_id、sender)
  3. AIMA 采集是定时轮询,等几分钟
  4. 确认绑定:aima workspace task detail --taskId \x3Cid>

CC 调用失败:检查 which claude,模型名是否正确

绑定失败:检查 which aima,手动绑定:aima workspace task bind-session --taskId \x3Cid> --sessionId \x3Csid>

迁移到其他机器

只需 3 步:

  1. 拷贝 ~/.openclaw/scripts/cc-session-bridge.py
  2. 拷贝 ~/.openclaw/scripts/cc-bridge-config.yaml(添加新 agent 配置)
  3. 确保依赖:claude CLI + aima CLI + python3

零 Python 依赖(内置简单 YAML 解析,不需要 pyyaml)。

安全使用建议
Install only if you intentionally want Claude Code activity copied into OpenClaw/AIMA task sessions. Avoid using it with secrets, credentials, regulated data, or confidential repositories unless that storage and AIMA visibility are approved. Use the narrowest practical --cwd and periodically review or purge the generated ~/.openclaw session files.
能力标签
crypto
能力评估
Purpose & Capability
The stated purpose matches the implementation: it runs the local claude CLI, converts streamed messages and tool results into OpenClaw JSONL records, and binds new sessions to AIMA tasks.
Instruction Scope
The docs describe AIMA collection/display, JSONL session writing, append behavior, and that --cwd determines Claude Code file access, but privacy and retention warnings could be more prominent.
Install Mechanism
Installation is manual and transparent: unzip into ~/.openclaw/skills, copy the script and config into ~/.openclaw/scripts, edit config, and chmod the Python script. No hidden installer or autostart behavior was found.
Credentials
Using local claude and aima CLIs plus an optional project working directory is proportionate to the bridge purpose, but users should choose a narrow --cwd because Claude Code may read project files during the run.
Persistence & Privilege
Persistent JSONL sessions under ~/.openclaw/agents/<agent>/sessions and appending to task-linked sessions are core disclosed features, though cleanup, redaction, and file-permission guidance is limited.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cc-session-bridge
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cc-session-bridge 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.1
SKILL.md 添加 --cwd 参数说明和使用示例
v1.1.0
修复配置身份为小灵自身(非主人)、新增 --cwd 参数控制CC工作目录
v1.0.0
Initial release of cc-session-bridge skill. - Provides a script to bridge Claude Code (CC) session records to the OpenClaw session format for AIMA integration. - Supports streaming writes, automatic AIMA task binding, and appending to existing sessions. - Includes installation, configuration, and troubleshooting instructions. - Allows command-line and config file parameter overrides. - No external Python dependencies required; simple YAML parsing is built-in.
元数据
Slug cc-session-bridge
版本 1.1.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

CC Session Bridge 是什么?

安装和使用 CC Session Bridge 脚本,将 Claude Code (CC) 的调用会话转换为 OpenClaw 会话格式,使 AIMA 平台能采集并展示 CC 的会话记录。支持流式写入、自动绑定 AIMA 任务、追加已有会话。触发场景:(1) 用户要求安装 CC 会话桥接脚本,(2) 用户想让 C... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 44 次。

如何安装 CC Session Bridge?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cc-session-bridge」即可一键安装,无需额外配置。

CC Session Bridge 是免费的吗?

是的,CC Session Bridge 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

CC Session Bridge 支持哪些平台?

CC Session Bridge 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 CC Session Bridge?

由 Jiang Shizheng(@steflerjiang)开发并维护,当前版本 v1.1.1。

💬 留言讨论