← Back to Skills Marketplace
steflerjiang

CC Session Bridge

by Jiang Shizheng · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ✓ Security Clean
44
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install cc-session-bridge
Description
安装和使用 CC Session Bridge 脚本,将 Claude Code (CC) 的调用会话转换为 OpenClaw 会话格式,使 AIMA 平台能采集并展示 CC 的会话记录。支持流式写入、自动绑定 AIMA 任务、追加已有会话。触发场景:(1) 用户要求安装 CC 会话桥接脚本,(2) 用户想让 C...
README (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)。

Usage Guidance
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.
Capability Tags
crypto
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install cc-session-bridge
  3. After installation, invoke the skill by name or use /cc-session-bridge
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug cc-session-bridge
Version 1.1.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

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.

💬 Comments