← 返回 Skills 市场
steflerjiang

ACP Transcript Sync

作者 Jiang Shizheng · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
27
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install acp-transcript-sync
功能描述
ACP 子会话内容自动回写主会话。当 spawn ACP 子 agent(cfuse/claude code/codex/gemini cli 等)完成任务后,将子会话的 transcript 回写到主会话 transcript 文件,使 AIMA 等平台能通过采集主会话看到子 agent 的完整推理过程。触发场...
使用说明 (SKILL.md)

ACP Transcript Sync

ACP 子会话完成后,将子会话内容回写到主会话 transcript,让 AIMA 平台能通过采集主会话看到完整链路。

标准流程

1. Spawn ACP 子会话

sessions_spawn({ runtime: "acp", agentId: "\x3CagentId>", task: "\x3C任务描述>" })

记录返回的 childSessionKey 和完成后的 session_id

2. 等待子会话完成

子会话完成后会自动推送完成通知。收到通知后执行回写。

3. 执行回写脚本

python3 \x3Cskill-dir>/scripts/sync-acp-to-main.py \x3Cacp_session_id> \x3Cacp_agent> [\x3Cmain_session_id>] [\x3Cmain_agent>]

参数说明

参数 必填 说明
acp_session_id ACP 子会话的 UUID(从完成通知或 sessions_list 获取)
acp_agent ACP agent 的 ID,如 cfuseclaudecodex
main_session_id 主会话 UUID,不传则自动找最新的主会话
main_agent 主 agent ID,不传则自动检测

示例

# 指定所有参数
python3 scripts/sync-acp-to-main.py f935963c-b8dd-431c-9d85-85e0e5a41341 cfuse 44c3f987-f9ad-4a02-b107-768ae9f517d3

# 自动检测主会话和主 agent
python3 scripts/sync-acp-to-main.py f935963c-b8dd-431c-9d85-85e0e5a41341 cfuse

4. 验证回写

# 查看主会话最后几条消息
tail -5 ~/.openclaw/agents/\x3Cmain_agent>/sessions/\x3Cmain_session_id>.jsonl | python3 -c "
import sys, json
for line in sys.stdin:
    d = json.loads(line)
    if d.get('type') == 'message':
        msg = d.get('message', {})
        content = msg.get('content', [])
        text = ''.join(c.get('text','') for c in content if c.get('type')=='text')
        print(f'[{msg.get(\"role\")}] {text[:100]}')
"

回写格式

回写内容以 [xxx推理过程] 为前缀标识来源,xxx 是具体的 agent 名称:

  • 📋 cfuse推理过程 — 标记消息
  • [cfuse推理过程] user — 子会话中的用户输入
  • [cfuse推理过程] assistant — 子会话中 agent 的回复

不同 agent 示例:

  • cfuse → [cfuse推理过程]
  • claude code → [claude code推理过程]
  • codex → [codex推理过程]

获取 sessionId 的方法

子会话完成后需要获取其 sessionId,有三种方式:

  1. 完成通知:子会话完成后 OpenClaw 会推送完成事件,其中包含 session_id
  2. sessions_listsessions_list({ label: "acp" }) 过滤 ACP 会话
  3. subagentssubagents({ action: "list" }) 查看子会话状态和 sessionKey

sessionKey(格式 agent:\x3CagentId>:acp:\x3Cuuid>)中,实际的 transcript 文件名(sessionId)可能不同于 key 中的 uuid。需要通过 sessions_list 获取 sessionId 字段。

完整自动化模式

将回写步骤集成到 spawn 流程中:

  1. sessions_spawn({ runtime: "acp", agentId: "cfuse", task: "..." })
  2. 等待完成通知
  3. 从通知中提取 session_idagentId
  4. exec 执行回写脚本
  5. 完成

关键规则:每次 spawn ACP 子会话后,必须执行回写,否则 AIMA 平台无法采集子会话内容。

故障排查

问题 原因 解决
ACP 子会话不存在 sessionId 错误或 transcript 已被清理 检查 sessionId,确认文件存在
主会话为空 主会话 transcript 文件无消息 检查 main_session_id 是否正确
ACP 子会话没有有效消息 子会话未产生有效输出 检查子会话是否真的执行了任务
回写后 AIMA 看不到 AIMA 尚未重新采集 等待 AIMA 下次采集周期
安全使用建议
Review before installing. Use this only when you intentionally want ACP child-session content copied into the main session and collected by systems that read the main transcript. Prefer passing an explicit main_session_id and main_agent, inspect the child transcript for secrets or private data first, and avoid automatic write-back in multi-session environments.
能力评估
Purpose & Capability
The stated purpose matches the implementation: copy ACP child-session user and assistant messages into a main OpenClaw transcript for AIMA collection. The concern is that this intentionally expands visibility and retention of potentially sensitive prompts, outputs, tool-result snippets, and reasoning traces.
Instruction Scope
The instructions make write-back a required step after every ACP spawn and allow automatic detection of the main session, but they do not require preview, redaction, confirmation, or explicit consent for the specific source and destination before copying.
Install Mechanism
The package contains a markdown skill file and one Python script, with no declared dependencies, package install hooks, or hidden installer behavior found in the inspected artifacts.
Credentials
The script reads from and appends to ~/.openclaw/agents/*/sessions/*.jsonl, which is proportionate to transcript sync but high-impact because transcripts may contain private or operationally sensitive data.
Persistence & Privilege
The script persistently appends generated entries to the main transcript without backup, transaction handling, or confirmation, and can select the latest main session automatically when no main_session_id is supplied.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install acp-transcript-sync
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /acp-transcript-sync 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
acp-transcript-sync 1.0.0 - Initial release of acp-transcript-sync. - Enables automatic syncing of ACP sub-session transcripts back to the main session after task completion. - Ensures that platforms like AIMA can capture the complete reasoning process of spawned sub-agents by consolidating transcripts. - Provides a command-line script to manually or automatically sync child session content to the main session, with support for various agents (cfuse, claude code, codex, gemini cli, etc.). - Includes troubleshooting guide and standard operating procedures for reliable session management and transcript merging.
元数据
Slug acp-transcript-sync
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

ACP Transcript Sync 是什么?

ACP 子会话内容自动回写主会话。当 spawn ACP 子 agent(cfuse/claude code/codex/gemini cli 等)完成任务后,将子会话的 transcript 回写到主会话 transcript 文件,使 AIMA 等平台能通过采集主会话看到子 agent 的完整推理过程。触发场... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 27 次。

如何安装 ACP Transcript Sync?

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

ACP Transcript Sync 是免费的吗?

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

ACP Transcript Sync 支持哪些平台?

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

谁开发了 ACP Transcript Sync?

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

💬 留言讨论