context-restore

其他 社区 v1.0.0
解读按原文结构重写,命令、链接、术语均保留;右侧可核对作者原始 SKILL.md

设计思路

context-restorecontext-save 的对偶——把之前写到 ~/.gstack/checkpoints 的 markdown 上下文文件捡回来读到当前 session 里,让你可以无缝续接昨天 / 上周 / 上个 worktree 的工作。设计上有两个关键决定:跨分支默认搜索(Conductor workspace handoff 的核心场景),用文件名时间戳排序而不是 ls -t(filesystem mtime 不稳定,文件操作会改 mtime;文件名 YYYYMMDD-HHMMSS 才稳)。

工作流

Step 1:列候选 find$CHECKPOINT_DIR 里所有 .mdsort -r 后取前 20 条;不展开内容,避免 context window 灌满。空目录返回 NO_CHECKPOINTS

Step 2:定位目标文件

  • 用户给了标题片段或编号——按片段匹配。
  • 否则——直接拿 sort -r 的第一个,即最新的 YYYYMMDD-HHMMSS 前缀。

读出文件后呈现统一的 RESUMING CONTEXT 块:标题 / 分支 / 保存时间 / 上次会话时长 / 状态 / Summary / Remaining Work / Notes。如果保存时分支和当前分支不一致,会主动提示「这是在 <branch> 上保存的,你现在在 <current>,要不要先切分支再继续」。

Step 3:下一步选项 通过 AskUserQuestion 给三个选项:

  • A) 接着把剩余 work item 做完
  • B) 把整份保存文件展开看
  • C) 我只是要拿个上下文,谢谢

选 A 时会把第一项 remaining work 摘要出来,建议从那里开始。

重要规则

  • 绝不改代码——只读、只展示。
  • 默认跨分支——除非用户用了 branch-specific 的标题片段。
  • 「最新」按文件名前缀算——不是 ls -1t
  • 是 gstack skill,不是 Claude Code 内置——用户输入 /context-restore 时通过 Skill tool 调用本 skill。

适合谁

  • 长任务跨天 / 跨 session 工作的人
  • 用 git worktree 同时开多个分支的开发者
  • 经常被中断(开会、上下班切换)需要「合上盖子接回」的人

不适合

  • 任务一两小时就能做完——context-save 的 ROI 还没到
  • 你想跨电脑同步——这个 skill 只读本地 ~/.gstack/,不是云端

配套

context-save(写入端)、using-git-worktrees(多 worktree 协作时跨 worktree handoff 的真正用法)、landing-report(上一阶段的总结报告)。

流狐档案 作者与许可取自来源;运行、权限和网络为流狐检测或估算
流狐分类
通用
作者声明 Agent
未找到明确声明;不据此推断已兼容或已测试
静态检查
92 / 100 · 启发式扫描,不代表运行安全
作者 / 版本 / 许可
@garrytan · v1.0.0 · 未声明 license
流狐 Token 估算
较高消耗
流狐接入估算
需简单配置
是否需要外部 API Key
未发现要求
检测到的系统要求
macOS
底层运行要求
Bun
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • Shell 执行
检测到的网络行为
允许外网请求
安装命令数
无(仅作为资料)

档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。

需要注意: 未限定 allowed-tools,默认拥有全部工具权限。

输出预览 context-restore.preview
# Writing Style (skip entirely if EXPLAINLEVEL: terse appears in the preamble echo OR the user's current message explicitly requests terse / no-explanations output)

- Gloss curated jargon on first use per skill invocation, even if the user pasted the term.
- Frame questions in outcome terms: what pain is avoided, what capability unlocks, what user experience changes.
- Use short sentences, concrete nouns, active voice.
- Close decisions with user impact: what the user sees, waits for, loses, or gains.
- User-turn override wins: if the current message asks for terse / no explanations / just the answer, skip this section.
- Terse mode (EXPLAIN_LEVEL: terse): no glosses, no outcome-framing layer, shorter responses.

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。