← 返回 Skills 市场
bayllech

Context Handoff

作者 bayllech · GitHub ↗ · v0.1.2 · MIT-0
cross-platform ✓ 安全检测通过
167
总下载
0
收藏
1
当前安装
3
版本数
在 OpenClaw 中安装
/install context-handoff
功能描述
保存和恢复聊天上下文到本地文件。用于用户想在切换账号、清空 session、重新开会话、跨会话延续项目时,把当前会话级上下文或项目级摘要落盘并在之后恢复。也用于列出已有的会话上下文槽位或项目摘要,并按更新时间排序返回最近使用项。触发词包括:保存当前上下文、保存会话摘要、保存项目摘要、记下这次讨论、切号前保存、恢复...
使用说明 (SKILL.md)

Context Handoff

把“账号切换 / session 清理”和“项目上下文延续”拆开处理。 不要依赖聊天窗口历史天然保留;需要延续的内容必须落盘到本地文件。

使用目标

支持两类本地文件:

  1. 会话级上下文:绑定某个具体聊天窗口/对话用途
  2. 项目级摘要:绑定某个项目本身,与具体聊天窗口解耦

推荐目录:

  • 会话级:/root/.openclaw/workspace/handoffs/sessions/
  • 项目级:/root/.openclaw/workspace/projects/

何时使用哪一种

会话级上下文

当用户表达下面这些意思时,保存到:

  • “保存当前对话摘要”
  • “把这个会话记下来”
  • “切号前保存一下上下文”
  • “下次回这个聊天框继续”

会话级文件建议命名:

  • handoffs/sessions/\x3Cslot>.md

如果拿不到系统级 session id,不要假装知道“当前聊天窗口是谁”。 让用户自己给一个 上下文槽位名,例如:

  • main-chat
  • oauth-switch-chat
  • project-a-thread

项目级摘要

当用户表达下面这些意思时,保存到:

  • “保存这个项目的进展”
  • “记一下这个项目目前做到哪了”
  • “以后恢复这个项目”
  • “做个项目摘要”

项目级文件建议命名:

  • projects/\x3Cproject-name>.md

项目名由用户指定;如果没有指定,先问。

执行动作

A. 列出会话级上下文槽位

当用户要求列出已有会话级上下文时:

  1. 查看目录:
    • /root/.openclaw/workspace/handoffs/sessions/
  2. 列出其中所有 .md 文件
  3. 按文件最后修改时间倒序排序(最近更新的放前面)
  4. 返回时优先给出:
    • 槽位名
    • 最后更新时间
    • 文件路径
  5. 如果目录不存在或为空,明确告诉用户还没有已保存的会话级上下文

实现时优先使用能直接读到文件 mtime 的方式;不要按文件名排序来冒充“最近更新”。

B. 保存会话级上下文

当用户要求保存会话级上下文时:

  1. 如果用户没有给 slot 名,先问一个简短问题:
    • “要保存到哪个上下文槽位名?例如 main-chat / oauth-switch-chat
  2. 生成结构化摘要,不要直接整段复制聊天记录
  3. 写入:
    • /root/.openclaw/workspace/handoffs/sessions/\x3Cslot>.md
  4. 如果目录不存在,先创建
  5. 覆盖写入为最新版本(默认不做历史堆叠,除非用户明确要求追加)

推荐内容结构:

# 会话级上下文

- 槽位名:
- 保存时间:
- 当前讨论主题:
- 已完成:
- 当前决定:
- 未完成 / 下一步:
- 关键文件:
- 关键命令:
- 备注:

C. 恢复会话级上下文

当用户要求恢复会话级上下文时:

  1. 如果没有给 slot 名,先问
  2. 读取:
    • /root/.openclaw/workspace/handoffs/sessions/\x3Cslot>.md
  3. 用简洁方式把内容总结给用户
  4. 不要把整份 markdown 原样全贴,除非用户要求“完整显示”

D. 列出项目级摘要

当用户要求列出已有项目摘要时:

  1. 查看目录:
    • /root/.openclaw/workspace/projects/
  2. 列出其中 .md 文件
  3. 排除明显不是项目摘要的全局说明文件(例如通用 README,可按上下文判断)
  4. 按文件最后修改时间倒序排序(最近更新的放前面)
  5. 返回时优先给出:
    • 项目名
    • 最后更新时间
    • 文件路径
  6. 如果没有合适结果,明确告诉用户还没有已保存的项目摘要

实现时优先使用能直接读到文件 mtime 的方式;不要按文件名排序来冒充“最近更新”。

E. 保存项目级摘要

当用户要求保存项目级摘要时:

  1. 如果没有给项目名,先问
  2. 生成结构化项目摘要
  3. 写入:
    • /root/.openclaw/workspace/projects/\x3Cproject-name>.md
  4. 默认覆盖更新为“当前项目最新状态”

推荐内容结构:

# \x3C项目名>

- 更新时间:
- 项目目标:
- 当前进展:
- 已完成:
- 关键决定:
- 风险 / 注意事项:
- 关键文件:
- 关键命令:
- 下一步:

F. 恢复项目级摘要

当用户要求恢复项目级摘要时:

  1. 如果没有给项目名,先问
  2. 读取:
    • /root/.openclaw/workspace/projects/\x3Cproject-name>.md
  3. 优先返回:
    • 当前进展
    • 已完成
    • 下一步
    • 风险 / 注意事项

写作要求

  • 用中文写摘要
  • 以“恢复工作状态”为目标,不要写成长篇会议纪要
  • 重点保留决定、文件、命令、下一步
  • 不要把敏感 token、密钥、cookie、完整账号凭据写进去

回答风格

保存成功时

告诉用户:

  • 已保存什么类型(会话级 / 项目级)
  • 保存到哪个文件
  • 后续恢复该用什么关键词

例如:

  • “已把当前会话上下文保存到 handoffs/sessions/main-chat.md。下次你说‘恢复 main-chat 上下文’就行。”
  • “已把项目摘要保存到 projects/oauth-switch.md。下次你说‘恢复 oauth-switch 项目摘要’即可。”

恢复时

优先给用户一个压缩版恢复结果,例如:

  • 当前在做什么
  • 已完成什么
  • 下一步是什么

必要时再补充文件路径和命令。

重要约束

  • 不要假设终端脚本知道“当前聊天窗口”是谁
  • 如果用户没有提供槽位名或项目名,先问
  • 默认覆盖更新,不要无限追加导致文件越来越乱
  • 如果文件不存在,明确告诉用户“还没有保存过这份上下文”
安全使用建议
This skill is coherent with its purpose (saving/restoring chat or project summaries to local markdown files) and does not request credentials or perform network installs. Before installing: (1) verify or change the storage path — hard-coded /root/.openclaw/... may be inappropriate; prefer a per-user data directory or configurable path; (2) check file system permissions and who/what can read those files; consider encrypting sensitive summaries at rest; (3) be careful not to instruct the agent to save secrets — the skill warns about this but cannot enforce it; (4) test in a safe environment to confirm behavior (creation, listing, mtime sorting, overwrite semantics) and adjust paths/config as needed; (5) if you want stricter control, require an explicit confirmation step before any write/overwrite operation.
功能分析
Type: OpenClaw Skill Name: context-handoff Version: 0.1.2 The skill bundle provides instructions for an AI agent to save and restore session or project context to local markdown files within the `/root/.openclaw/workspace/` directory. It includes explicit safety constraints, such as instructing the agent not to include sensitive tokens or credentials in the summaries (SKILL.md). The file operations (read, write, list) are consistent with the stated purpose of context management and do not exhibit signs of malicious intent or data exfiltration.
能力评估
Purpose & Capability
Name and description match the instructions: the skill's runtime behavior is limited to listing, reading, creating, and updating local markdown files representing session or project summaries. No unrelated credentials, binaries, or network access are requested.
Instruction Scope
SKILL.md explicitly tells the agent to read directory listings and file mtimes and to create/overwrite files under /root/.openclaw/workspace/handoffs/ and /root/.openclaw/workspace/projects/. That is within the stated purpose, but the file paths are absolute and point to /root, and the guidance relies on the agent not writing sensitive tokens (a human-facing instruction that cannot be enforced). Confirm whether the agent runtime has appropriate file permissions and whether summaries may include secrets.
Install Mechanism
Instruction-only skill with no install spec and no code files — nothing is written to disk by an installer. Lowest install risk.
Credentials
The skill requires no environment variables or credentials (proportional). However, it performs filesystem I/O in an absolute root-owned path; that may require elevated permissions and could expose saved chat content. The SKILL.md warns not to save tokens, but there is no technical control to prevent accidental saving of sensitive data.
Persistence & Privilege
always:false and no requests to modify other skills or global agent configs. Autonomous invocation is allowed (platform default) but not combined with other high-risk entitlements.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context-handoff
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context-handoff 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.2
Add search keyword strategy, tags, and fuller OpenClaw install instructions
v0.1.1
Improve search triggers and add real conversation examples
v0.1.0
Initial public release with updated-time sorting and bilingual README
元数据
Slug context-handoff
版本 0.1.2
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 3
常见问题

Context Handoff 是什么?

保存和恢复聊天上下文到本地文件。用于用户想在切换账号、清空 session、重新开会话、跨会话延续项目时,把当前会话级上下文或项目级摘要落盘并在之后恢复。也用于列出已有的会话上下文槽位或项目摘要,并按更新时间排序返回最近使用项。触发词包括:保存当前上下文、保存会话摘要、保存项目摘要、记下这次讨论、切号前保存、恢复... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 167 次。

如何安装 Context Handoff?

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

Context Handoff 是免费的吗?

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

Context Handoff 支持哪些平台?

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

谁开发了 Context Handoff?

由 bayllech(@bayllech)开发并维护,当前版本 v0.1.2。

💬 留言讨论