session-checkpoint
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSession Checkpoint
会话检查点
Commands
命令
- Save: ,
save checkpoint {name}(prompts for descriptive name)save checkpoint - Resume: ,
continue,continue {name}(auto-select if one checkpoint, list if many)resume - Cleanup: ,
clear checkpoint {name}clear all checkpoints
- 保存: 、
save checkpoint {name}(会提示输入描述性名称)save checkpoint - 恢复: 、
continue、continue {name}(如果只有一个检查点则自动选择,多个则列出选项)resume - 清理: 、
clear checkpoint {name}clear all checkpoints
Save Procedure
保存流程
1. Determine Name
1. 确定名称
If user gave a name, use it (lowercase, sanitize: replace with ).
/-If no name given:
- Pick a short name from the current work (2-4 words, e.g., "my-feature")
- Confirm with , options:
AskUserQuestion- "Use '{suggested-name}' (Recommended)"
- "Provide different name" (user types via Other)
Sanitize final name: lowercase, replace spaces/ with , strip leading .
/--如果用户提供了名称,直接使用(转为小写,清理格式:将替换为)。
/-如果未提供名称:
- 从当前工作内容中选取一个短名称(2-4个词,例如"my-feature")
- 通过确认,选项如下:
AskUserQuestion- "使用'{suggested-name}'(推荐)"
- "提供其他名称"(用户通过“其他”输入)
最终名称清理规则:转为小写,将空格和替换为,去除开头的。
/--2. Locate Memory Directory
2. 定位内存目录
Find the auto memory directory path from the system prompt line:
You have a persistent auto memory directory at <path>从系统提示行中找到自动内存目录路径:
You have a persistent auto memory directory at <path>3. Gather State
3. 收集状态
Run in a single bash call:
bash
git branch --show-current && git status --short | head -10 && date '+%Y-%m-%d %H:%M'From conversation context, determine:
- What was accomplished this session
- What failed or was abandoned (and why)
- Where work left off — don't infer next steps, but DO capture all actionable context the next session needs: pending decisions, proposed options, open questions
- Which files were modified
在一次bash调用中执行以下命令:
bash
git branch --show-current && git status --short | head -10 && date '+%Y-%m-%d %H:%M'从对话上下文确定:
- 本次会话已完成的内容
- 失败或放弃的尝试(以及原因)
- 工作中断的位置——不要推断下一步,但必须记录下一次会话所需的所有可操作上下文:待决策事项、提议的选项、未解决的问题
- 哪些文件被修改
4. Find Active Plan
4. 查找活跃计划
A plan file exists whenever the session involved plan mode or "implement this plan." Look for it in this order:
- System prompt: When plan mode is active, the system prompt contains the plan file path (e.g., ). Check for it.
~/.claude/plans/{name}.md - Conversation context: The user's message may reference or paste a plan, or mention "implement the following plan." The plan file path may also appear in an result or plan-related system message.
ExitPlanMode - Fallback: If the session clearly involved executing a multi-step plan but no file path was found, check for the most recently modified
~/.claude/plans/file, read its first lines, and confirm it matches the work being done..md
If a plan is found, read it to determine step N of M (count total tasks/steps, identify which one work stopped at).
Default: include the Plan line. Only omit it if the session genuinely had no plan — a simple task, a one-off question, etc. Err on the side of including it.
当会话涉及计划模式或"implement this plan"时,会存在一个计划文件。按以下顺序查找:
- 系统提示: 当计划模式激活时,系统提示中会包含计划文件路径(例如),请检查该路径。
~/.claude/plans/{name}.md - 对话上下文: 用户的消息可能引用或粘贴了计划,或者提到"implement the following plan"。计划文件路径也可能出现在结果或与计划相关的系统消息中。
ExitPlanMode - 备选方案: 如果会话明显涉及执行多步骤计划但未找到文件路径,请检查目录中最近修改的
~/.claude/plans/文件,读取其前几行并确认是否与当前工作匹配。.md
如果找到计划文件,读取它以确定当前是第N步(共M步):统计总任务/步骤数,确定工作中断在哪个步骤。
默认规则:包含计划行。 只有当会话确实没有计划时(例如简单任务、一次性问题等)才省略该行。尽量优先包含计划行。
5. Write Checkpoint File
5. 写入检查点文件
If already exists, use to confirm — show the existing checkpoint's Saved date and Left Off summary, with options: "Overwrite" / "Different name" (user provides new name via "Other"). If they choose a different name, continue from this step with the new name.
checkpoint-{name}.mdAskUserQuestionWrite :
<memory_dir>/checkpoint-{name}.mdmarkdown
undefined如果已存在,使用确认——显示现有检查点的保存日期和中断位置摘要,提供选项:“覆盖” / “使用其他名称”(用户通过“其他”输入新名称)。如果用户选择其他名称,则使用新名称重新执行此步骤。
checkpoint-{name}.mdAskUserQuestion写入文件:
<memory_dir>/checkpoint-{name}.mdmarkdown
undefinedCheckpoint: {name}
Checkpoint: {name}
- Branch:
{branch} - Saved: {YYYY-MM-DD HH:MM}
- Plan: (step N of M)
~/.claude/plans/{file}
- Branch:
{branch} - Saved: {YYYY-MM-DD HH:MM}
- Plan: (step N of M)
~/.claude/plans/{file}
Left Off
Left Off
{1-3 lines describing where work stopped}
{1-3 lines describing where work stopped}
Done This Session
Done This Session
- {accomplishments}
- {accomplishments}
Failed Approaches
Failed Approaches
- {what + why — or "None"}
- {what + why — or "None"}
Modified Files
Modified Files
- {list}
Omit the **Plan:** line if no plan file exists.- {list}
如果没有计划文件,则省略**Plan:**行。6. Update MEMORY.md Index
6. 更新MEMORY.md索引
Read MEMORY.md. Find the section.
## Active Checkpoints- If checkpoint name already in index: update its line.
- If not: add a new bullet.
- If no section exists: insert it after the first
## Active Checkpointsheading. If MEMORY.md doesn't exist, create it with#as the heading.# Project Memory
Bullet format:
- **{name}** ({branch}, {Mon DD}) — {one-line summary}Keep the line after the bullets.
Resume any: `continue` or `continue {name}` Do NOT touch any other sections in MEMORY.md.
读取MEMORY.md文件,找到部分:
## Active Checkpoints- 如果检查点名称已在索引中:更新对应的行。
- 如果不存在:添加一个新的项目符号。
- 如果没有部分:在第一个
## Active Checkpoints标题后插入该部分。如果MEMORY.md不存在,则创建该文件并将#作为标题。# Project Memory
项目符号格式:
- **{name}** ({branch}, {Mon DD}) — {one-line summary}在项目符号后保留这一行。
Resume any: `continue` or `continue {name}` 不要修改MEMORY.md中的其他部分。
7. Output
7. 输出内容
Keep output minimal — this often runs near end of context window.
Checkpoint "{name}" saved. Resume anytime: `continue {name}`That's it. Don't ask follow-up questions. Don't suggest or — the user manages their own context window.
/compact/clear输出内容应尽量简洁——因为此操作通常在上下文窗口接近满时执行。
Checkpoint "{name}" saved. Resume anytime: `continue {name}`操作完成。不要提出后续问题,不要建议使用或——用户会自行管理其上下文窗口。
/compact/clearResume Procedure
恢复流程
1. Determine Name
1. 确定名称
If user gave a name, use it.
If no name given:
- List files in memory directory
checkpoint-*.md - If exactly one: use it automatically
- If multiple: use with checkpoint names as options (include branch and date in each option's description)
AskUserQuestion - If none: report "No saved checkpoints found." and stop
如果用户提供了名称,直接使用。
如果未提供名称:
- 列出内存目录中的文件
checkpoint-*.md - 如果只有一个:自动选择该文件
- 如果有多个:使用,将检查点名称作为选项(每个选项的描述中包含分支和日期)
AskUserQuestion - 如果没有:提示“No saved checkpoints found.”并停止操作
2. Read Checkpoint File
2. 读取检查点文件
Read .
If file missing: remove the orphaned bullet from MEMORY.md's , report "Checkpoint file missing (cleaned up stale entry)", and stop.
<memory_dir>/checkpoint-{name}.md## Active Checkpoints读取文件。
如果文件不存在:从MEMORY.md的中移除对应的孤立项目符号,提示“Checkpoint file missing (cleaned up stale entry)”并停止操作。
<memory_dir>/checkpoint-{name}.md## Active Checkpoints3. Check Branch
3. 检查分支
bash
git branch --show-currentIf current branch differs from checkpoint's branch, warn:
Warning: You're on `{current}` but checkpoint was saved on `{saved}`. Switch with: git checkout {saved}Continue regardless — user decides.
bash
git branch --show-current如果当前分支与检查点的分支不同,发出警告:
Warning: You're on `{current}` but checkpoint was saved on `{saved}`. Switch with: git checkout {saved}无论如何继续操作——由用户决定是否切换分支。
4. Load Plan
4. 加载计划
If checkpoint references a plan file, read it.
如果检查点引用了计划文件,则读取该文件。
5. Present and Begin
5. 展示内容并开始
Output the checkpoint summary and last context. If Failed Approaches is non-empty, include them:
⚠ Previously failed: {approach} — {why}输出检查点摘要和最后的上下文。如果Failed Approaches非空,则包含以下内容:
⚠ Previously failed: {approach} — {why}6. Auto-Clear
6. 自动清理
The checkpoint is now consumed — context is live. Delete the checkpoint file and remove its bullet from MEMORY.md's (same as Cleanup steps 1-2). If no bullets remain, remove the entire section.
## Active CheckpointsDo NOT mention the cleanup to the user. They see only the summary from step 5, then wait for their direction.
检查点已被使用——上下文已激活。删除检查点文件,并从MEMORY.md的中移除对应的项目符号(与清理流程的步骤1-2相同)。如果没有剩余的项目符号,则移除整个部分。
不要向用户提及清理操作。用户只会看到步骤5中的摘要,然后等待他们的指示。
## Active CheckpointsCleanup Procedure
清理流程
1. Delete File
1. 删除文件
Remove the checkpoint file via Bash:
bash
rm <memory_dir>/checkpoint-{name}.md通过Bash删除检查点文件:
bash
rm <memory_dir>/checkpoint-{name}.md2. Update MEMORY.md
2. 更新MEMORY.md
Remove the bullet for from .
If no bullets remain, remove the entire section (header + resume line).
{name}## Active Checkpoints从中移除对应的项目符号。
如果没有剩余的项目符号,则移除整个部分(标题+恢复提示行)。
## Active Checkpoints{name}3. Output
3. 输出内容
Cleared checkpoint "{name}"Cleared checkpoint "{name}"clear all checkpoints
clear all checkpointsclear all checkpoints
命令
clear all checkpointsGlob in memory directory. Delete all matches. Remove the entire section (header + bullets + resume line) from MEMORY.md. Output:
checkpoint-*.md## Active CheckpointsCleared {N} checkpoint(s)匹配内存目录中的文件,删除所有匹配项。从MEMORY.md中移除整个部分(标题+项目符号+恢复提示行)。输出:
checkpoint-*.md## Active CheckpointsCleared {N} checkpoint(s)