close-session

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/close-session — the end-of-session ritual

/close-session — 会话结束仪式

You close the session in four steps. Don't just dump — audit. Everything you write, you announce briefly; anything promoted to rules/concepts needs the user's verbal "yes" first.
你需要通过四个步骤结束会话。不要直接堆砌内容——要审核。你所写的每一项内容都要先简要告知用户;任何要升级为规则/概念的内容都需要用户口头回复“同意”后再进行。

Step 1 — Capture what's new

步骤1 — 记录新增内容

Scan this session for observations worth keeping. Append each to
.claude/memory/MEMORY.md
as a ONE-LINE
[YYYY-MM-DD]
-prefixed entry. Short, scannable, no essays (long rationale belongs in a concept article, step 2).
扫描本次会话,找出值得留存的观察结果。将每条结果以
[YYYY-MM-DD]
为前缀,作为单行条目追加到
.claude/memory/MEMORY.md
中。内容要简短、易于浏览,不要写成长篇大论(详细依据应放在步骤2的概念文档中)。

Step 2 — Audit & promote (the valuable part)

步骤2 — 审核与升级(核心价值环节)

Read the date-tagged entries in MEMORY.md. Look for repetition: did this pattern appear on 3+ different dates? Surface 2-4 candidates, be specific: "noticed [date], [date], [date] you said X — codify as a rule or a concept article?"
  • User says yes → write
    knowledge/concepts/<topic>.md
    (facts + rationale; frontmatter per
    knowledge/index.md
    spec) or
    .claude/rules/<name>.md
    (mechanical always/never constraint; only for patterns stable 6+ months). Update
    knowledge/index.md
    (one line per concept).
  • Promoted or long-absorbed entries get PRUNED from MEMORY.md — that's how it stays under its caps (180 lines / 32 KB / 3000 chars per line).
  • Writing a fact into a second place?
    reference/doc-governance.md
    — one SSOT per fact, and when a fact changes you grep its restatements in the same pass. A product or architecture decision goes to the ledger instead —
    projects/<name>/decisions-log.md
    , format in
    reference/decisions-log.md
    . A plan, a spec, a research finding or a QA record is NOT memory: it belongs in that project's folder, per the map in its
    README.md
    .
阅读MEMORY.md中带日期标签的条目,寻找重复出现的模式:**该模式是否出现在3个及以上不同日期?**筛选出2-4个候选项,表述要具体:“注意到在[日期]、[日期]、[日期]你提到了X——是否要将其整理为规则或概念文档?”
  • 用户回复同意 → 撰写
    knowledge/concepts/<topic>.md
    (包含事实与依据;需遵循
    knowledge/index.md
    规范中的前置内容)或
    .claude/rules/<name>.md
    (机械性的“始终/禁止”约束;仅适用于已稳定6个月以上的模式)。更新
    knowledge/index.md
    (每个概念占一行)。
  • 已升级或已充分吸收的条目需从MEMORY.md中删除——这是保持其容量在限制范围内的方式(最多180行 / 32 KB / 每行3000字符)。
  • 要将同一事实写入第二个位置?请参考
    reference/doc-governance.md
    ——每个事实只能有单一可信来源(SSOT),当事实发生变更时,需同步检查所有重复表述。产品或架构决策应记录在账本中——
    projects/<name>/decisions-log.md
    ,格式遵循
    reference/decisions-log.md
    。计划、规范、研究发现或QA记录不属于记忆范畴:应存放在对应项目的文件夹中,遵循该项目
    README.md
    中的目录结构。

Step 3 — Refresh the MEMORY.md header

步骤3 — 更新MEMORY.md头部内容

The header (everything above the first
---
) is «current state of work», 2-3 sentences, REPLACED every close — never a chronicle of past sessions. Per-session detail lives in the handoff, not stacked in the header.
头部内容(第一条
---
上方的所有内容)是「当前工作状态」,需用2-3句话概括,每次结束会话时都要替换——不要堆叠过往会话的记录。会话的详细内容应放在交接文档中,而非头部。

Step 4 — Write the handoff

步骤4 — 撰写交接文档

Copy
context/handoffs/HANDOFF-TEMPLATE.md
context/handoffs/<topic>-<YYYY-MM-DD>.md
and fill its five sections (what was done · where things stand · memory updates · next steps · opening note). The SessionStart hook injects the newest handoff next time — this file IS the "remember where we left off" mechanism.
复制
context/handoffs/HANDOFF-TEMPLATE.md
context/handoffs/<topic>-<YYYY-MM-DD>.md
,并填写其中的五个部分(已完成工作 · 当前进展 · 记忆更新 · 下一步计划 · 开场提示)。SessionStart钩子会在下次会话时注入最新的交接文档——该文件就是“记住上次进度”的机制。

Also check (30 seconds)

额外检查(30秒)

  • Experiment hygiene: any
    experiments/*-YYYYMMDD/
    older than 30 days → ask: still active or close (distill → delete)?
  • Backlogs:
    projects/*/BACKLOG.md
    task statuses reflect today's reality — a
    DONE
    nobody verified is still
    IN PROGRESS
    .
  • Project map: anything you wrote today into a project folder is a row in that project's
    README.md
    map, and the map's
    Last verified
    is today's date.
  • Caps: if MEMORY.md is near any cap, do a deeper prune now, not "next time".
  • **实验整洁性:**任何创建超过30天的
    experiments/*-YYYYMMDD/
    文件夹 → 询问用户:是否仍在进行中,还是可以关闭(提炼内容后删除)?
  • 待办清单:
    projects/*/BACKLOG.md
    中的任务状态需如实反映今日实际情况——未经验证的“已完成(DONE)”仍需标记为“进行中(IN PROGRESS)”。
  • **项目目录:**今日写入项目文件夹的所有内容都需在该项目的
    README.md
    目录中添加一行,且目录中的“最后验证时间(Last verified)”需更新为今日日期。
  • **容量限制:**如果MEMORY.md接近任何一项容量限制,立即进行深度清理,不要等到“下次”。

What NOT to do

禁止事项

  • Don't promote without the user's yes. Repetition makes a CANDIDATE, not a rule.
  • Don't stack "Prior session" paragraphs in the MEMORY header — replace it.
  • Don't write a handoff longer than ~1 screen. It's a note, not a transcript.
  • 未获得用户同意,不得进行内容升级。重复出现仅代表是候选项,而非直接成为规则。
  • 不要在MEMORY.md头部堆叠“上一次会话”段落——直接替换头部内容。
  • 交接文档长度不要超过约一屏。它是提示笔记,而非会话记录。