A Claude Code skill that saves unsaved session context before /clear, so nothing important is lost when you start a new task.
一个 Claude Code skill,在
/clear前抢救尚未落盘的 session 上下文,避免开新任务时丢失重要信息。
Long sessions accumulate context that never lands in a file: decisions and their reasons, bug root causes, offhand TODOs, half-finished approaches. /clear wipes it. Git captures committed code, CLAUDE.md captures curated docs — neither captures the session itself.
长 session 里会积累一堆从未写入文件的上下文:做过的决策和原因、查到的 bug 根因、随口提的 TODO、半成品方案。
/clear会把这些全部清掉。Git 记录已提交代码,CLAUDE.md记录沉淀文档,但没有任何东西记录 session 本身。
Run /save-context before /clear. Claude will scan .md docs in the project, summarize non-trivial context from the session (decisions, TODOs, RCAs, references), propose Edits where info fits an existing doc, otherwise stage it for TempContext.md at the project root, then show a review panel before writing anything. On approval, edits are applied and a structured entry is appended to TempContext.md (append-only).
在
/clear之前运行/save-context,Claude 会扫描项目里的.md文档,总结 session 里非琐碎的上下文(决策、TODO、根因分析、引用),能归到现存文档的就生成Edit提案,归不到的就堆到项目根的TempContext.md,所有改动先在 review 面板里展示。你确认后才落盘:现存文档应用 edits,TempContext.md追加一条结构化条目(仅追加、不覆盖)。
The skill never runs /clear itself — Claude Code doesn't expose that to skills. After saving, it tells you it's safe to clear.
Skill 不会替你执行
/clear(Claude Code 不允许 skill 这么做)。落盘完后它会提示你「可以安全 /clear 了」。
Clone this repo and symlink it into your user-level Claude Code skills directory. The trigger name comes from the symlink target's directory name.
克隆仓库并 symlink 到用户级 skills 目录。触发名(
save-context)由 symlink 目标目录名决定。
git clone https://github.com/wheam/save-context.git
ln -s "$(pwd)/save-context" ~/.claude/skills/save-contextSee spec.md for the full design doc, decision log, TempContext.md schema, and edge cases.
完整设计文档、决策日志、
TempContext.md格式与边界 case 见spec.md。
MIT