원클릭으로
maintain-workflow-context-save
// 保存工作上下文。当需要保存当前工作状态供后续 session 恢复,或提到"保存""save""checkpoint""挂起"
// 保存工作上下文。当需要保存当前工作状态供后续 session 恢复,或提到"保存""save""checkpoint""挂起"
结构化脑暴——发散探索 + 收敛评估。当想法模糊、面临开放性问题或需要方案对比,或提到"脑暴""想法""方案对比""怎么办"
恢复保存的工作上下文。当新 session 需要继续之前的工作,或提到"恢复""restore""继续上次"
架构决策记录(ADR)。当面临技术选型、架构决策、方案取舍需要记录,或提到"ADR""决策记录""为什么这样做"
发布或导出检查 → Go/No-Go → 归档。当审查通过后需要上线或交付最终产物,或提到"发布""上线""ship""Go/No-Go"
合并 PR → 等待 CI → 验证生产。当 PR 已创建需要合并到主分支并验证部署,或提到"合并""merge""PR""land"
发布后健康监控。当代码已部署需要持续验证生产健康,或提到"金丝雀""canary""监控""健康检查"
| name | maintain-workflow-context-save |
| description | 保存工作上下文。当需要保存当前工作状态供后续 session 恢复,或提到"保存""save""checkpoint""挂起" |
| argument-hint | [checkpoint-title] |
.claude/checkpoints/ 下的 checkpoint 文件maintain-workflow-context-restore;继续工作流 → build-workflow-execute、verify-workflow-review、ship-workflow-ship 等maintain-workflow-context-restore(下游消费方).claude/checkpoints/YYYYMMDD-HHMMSS-{title-slug}.md → 恢复时由 maintain-workflow-context-restore 消费docs/features/<feature>/state.json 由 hooks 自动维护,用于阶段级恢复:当前 feature、当前阶段、最后阶段文档、下一步命令。
/save 不负责基础阶段连续性。它负责保存 state.json 无法表达的内容:为什么选 A 不选 B、重要取舍、注意事项、阻塞原因、非显而易见的剩余工作。
只读操作。不修改代码,只读 git 状态和写 checkpoint 文件。
违反此 gate = 本技能被滥用为修改代码的借口。
收集当前仓库快照:
git branch --show-current
git status --short
git diff --stat
git log --oneline -5
不需要更多。不需要 diff 全文——统计足够理解变更范围。
从当前会话中提取恢复所需的九类信息:
总结要精炼。checkpoint 不是工作日志——是恢复上下文的最小信息集。
路径:.claude/checkpoints/YYYYMMDD-HHMMSS-{title-slug}.md
若 .claude/checkpoints/ 目录不存在,先创建:mkdir -p .claude/checkpoints
示例文件名:20260424-143052-refactor-auth-module.md
文件格式:
模板起点:templates/maintain/checkpoint.md
---
status: active|paused|blocked
branch: feature/auth-refactor
timestamp: 2026-04-24T14:30:52+08:00
current_objective: migrate auth from session to JWT
next_command: /build
files_modified:
- src/auth/login.ts
- src/auth/session.ts
last_commits:
- a1b2c3d feat: add token signing
---
## Summary
将登录模块从 session-based 重构为 JWT-based。已完成 token 签发,
停在 refresh token 轮换逻辑。
## Current Objective
- Goal: 完成 JWT auth migration
- Stop point: refresh token rotation 未完成
- Feature doc: `docs/features/20260424-auth/03-plan.md`
## Git Snapshot
- Branch: feature/auth-refactor
- Status summary: 2 modified files
- Diff stat: +120/-35 across auth files
- Last commits: `a1b2c3d feat: add token signing`
## Progress State
| Area | Status | Evidence |
|------|--------|----------|
| Token signing | done | unit tests passing |
| Refresh token rotation | in_progress | plan task 2 |
| Session cleanup | pending | plan task 3 |
## Decisions Made
- 选 RS256 不选 HS256 — 多服务场景下公钥分发更安全
- access token 有效期 15min,refresh token 7 天
## Validation State
| Check | Command / Evidence | Result | Notes |
|-------|--------------------|--------|-------|
| Unit tests | `npm test -- auth` | pass | token signing covered |
| Integration tests | `npm test -- auth.integration` | not_run | blocked until rotation exists |
## Remaining Work
- [ ] Refresh token 轮换逻辑
- [ ] 旧 session 清理迁移
- [ ] 集成测试补全
## Blockers
| Blocker | Owner | Needed Decision / Action |
|---------|-------|--------------------------|
| none | | |
## Next Command
- Recommended command: `/build`
- Why: 继续实现 plan 中的 refresh token rotation
- Preconditions: 当前分支保持 feature/auth-refactor
## Handoff Risks
- 不要删除 `src/auth/legacy.ts`;下个迭代才废弃
- production migration 尚未执行
## Notes
- `src/auth/legacy.ts` 不要删,下个迭代才废弃
- DB migration 已在 staging 跑过,production 还没
YAML frontmatter 字段说明:
| 字段 | 类型 | 说明 |
|---|---|---|
status | 枚举 | active(进行中)、paused(暂停)、blocked(阻塞) |
branch | 字符串 | 当前 git 分支 |
timestamp | ISO-8601 | 保存时刻 |
current_objective | 字符串 | 当前 checkpoint 要恢复的目标 |
next_command | 字符串 | 推荐恢复后的下一阶段命令 |
files_modified | 列表 | 已修改但未提交的文件 |
last_commits | 列表 | 最近相关提交,至少 1 条或写 none |
Markdown body 十一个章节不可省略。内容为空(如 ## Notes 下写 无),但章节标题必须存在——恢复时按标题定位信息。
| 说辞 | 现实 | 后果 |
|---|---|---|
| "我还没做完不用保存" | 的保存时机是进行中,不是结束时。完成后再保存 = 只有结果没有决策过程。 | 只存结果不存过程 → 下次 session 不知道为什么选了 A → 重复讨论已做决策,浪费 15-30 分钟。 |
| "下次我会记得" | 上下文窗口有限。书面记录跨 session。记忆不可靠,文件可靠。 | 依赖记忆 → session 切换后丢失 70%+ 上下文细节 → 从零重建上下文 > 30 分钟 vs 从 checkpoint 恢复 < 5 分钟。 |
| "保存太花时间" | 采集 git 状态 + 写总结 < 2 分钟。重新理解上下文 > 30 分钟。 | 省下的 2 分钟在下次 session 翻倍回还:30 分钟重新理解 + 可能重复已做决策。 |
| "内容太少不值得保存" | 一行决策也比从零开始强。没有"太小不值得保存"的上下文。 | 小决策不保存 → 下次 session 重复讨论同一决策 → 每次重复讨论 5-10 分钟,累积浪费 > 30 分钟。 |
| 失败场景 | 处理方式 |
|---|---|
| checkpoint 超 100 行 | 精炼内容:删除重复描述、合并相似条目、只保留恢复所需的最小信息集。不拆分为多个 checkpoint。 |
| 核心章节有遗漏 | 强制补齐。空章节写"无",但不省略章节标题——恢复时按标题定位信息。 |
| git 状态采集失败(非 git 仓库) | 在 frontmatter 中记录 branch: none,Markdown body 中注明"非 git 仓库环境,无法采集 git 状态"。 |
| frontmatter 字段不完整 | 补齐 status、branch、timestamp、current_objective、next_command、files_modified、last_commits。不省略任何一项。 |
| 决策未记录 | 强制列出至少 1 个决策 + 理由。"没有决策"不成立——做了选择就有决策。 |
| Validation State 缺失 | 补已跑、未跑和失败检查;没有验证就写 not_run 和原因。 |
| Next Command 缺失 | 根据 Remaining Work 选择 /build、/review、/ship 或其它明确下一步。 |
---
status: paused
branch: feature/auth-refactor
timestamp: 2026-04-24T14:30:52+08:00
current_objective: migrate auth from session to JWT
next_command: /build
files_modified:
- src/auth/login.ts
- src/auth/session.ts
last_commits:
- a1b2c3d feat: add token signing
---
## Summary
将登录模块从 session-based 重构为 JWT-based。已完成 token 签发,停在 refresh token 轮换逻辑。
## Current Objective
- Goal: 完成 JWT auth migration
- Stop point: refresh token rotation 未完成
- Feature doc: `docs/features/20260424-auth/03-plan.md`
## Git Snapshot
- Branch: feature/auth-refactor
- Status summary: 2 modified files
- Diff stat: +120/-35 across auth files
- Last commits: `a1b2c3d feat: add token signing`
## Progress State
| Area | Status | Evidence |
|------|--------|----------|
| Token signing | done | unit tests passing |
| Refresh token rotation | in_progress | plan task 2 |
## Decisions Made
- 选 RS256 不选 HS256 — 多服务场景下公钥分发更安全
- access token 15min,refresh token 7 天
## Validation State
| Check | Command / Evidence | Result | Notes |
|-------|--------------------|--------|-------|
| Unit tests | `npm test -- auth` | pass | token signing covered |
## Remaining Work
- [ ] Refresh token 轮换逻辑
- [ ] 旧 session 清理迁移
- [ ] 集成测试补全
## Blockers
| Blocker | Owner | Needed Decision / Action |
|---------|-------|--------------------------|
| none | | |
## Next Command
- Recommended command: `/build`
- Why: 继续 plan task 2
- Preconditions: 当前分支保持 feature/auth-refactor
## Handoff Risks
- src/auth/legacy.ts 不要删,下个迭代才废弃
## Notes
- src/auth/legacy.ts 不要删,下个迭代才废弃
→ frontmatter 完整、四章节齐全、决策有理由、行数 < 50
## Summary
今天早上 9 点开始,先读了 spec,然后讨论了方案 A 和 B,
花了一个小时比较,然后写了第一个文件的 100 行代码...
→ 问题: 超 100 行 → 不该是日记
→ 问题: 无 YAML frontmatter → 恢复时无法机器定位 branch 和 status
→ 问题: 决策理由缺失 → 下次 session 不知道为什么选 A
→ 问题: 工作时间线无恢复价值 → 只需要当前状态和剩余工作
---
status: active|paused|blocked
branch: [当前 git 分支]
timestamp: [ISO-8601 保存时刻]
current_objective: [当前目标]
next_command: [/build|/review|/ship|other]
files_modified:
- [已修改未提交文件1]
- [已修改未提交文件2]
last_commits:
- [short-sha message]
---
## Summary
[一句话描述当前进度和停点]
## Current Objective
- Goal:
- Stop point:
- Feature doc:
## Git Snapshot
- Branch:
- Status summary:
- Diff stat:
- Last commits:
## Progress State
| Area | Status | Evidence |
|------|--------|----------|
| | pending / in_progress / done / blocked | |
## Decisions Made
- [决策1] — [理由]
- [决策2] — [理由]
## Validation State
| Check | Command / Evidence | Result | Notes |
|-------|--------------------|--------|-------|
| | | not_run / pass / fail / blocked | |
## Remaining Work
- [ ] [未完成任务1]
- [ ] [未完成任务2]
## Blockers
| Blocker | Owner | Needed Decision / Action |
|---------|-------|--------------------------|
| none | | |
## Next Command
- Recommended command:
- Why:
- Preconditions:
## Handoff Risks
- [下个 session 最容易误判的点]
## Notes
- [注意事项/已知的坑]