feat(capitalize): merge /close into /capitalize + TODO reconcile

Two-mode capitalize: default pre-wipe flush, --ritual adds the 3-question
end-of-session reflection (now deduped, unlike legacy /close). New STEP 2B
reconciles .claude/tasks/TODO.md — PASS A done-detection (only on an
unambiguous task<->commit map), PASS B explicit-only capture with an
anti-noise filter (never track commit/deploy/push/release/tag) and BDR
routing for orientation directives. STEP 3 gate gains a separate TODO block;
journal/handoff report TODO ops. /close becomes a thin alias for
/capitalize --ritual (zero duplicated logic).

Built via superpowers:writing-skills TDD: RED baseline (no skill) folded a
push/tag parasite into the TODO, invented a subtask, and wrote with no gate;
GREEN re-run on the same fixture stops at the gate, drops both dups (footer
shows existing IDs), logs one learning, checks only the cleanly-done task,
ignores the parasite, and routes the GraphQL directive to BDR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3e8LaH2vymmxyh36h3jFU
This commit is contained in:
Bastien Chanot
2026-06-19 18:00:51 +02:00
co-authored by Claude Opus 4.8
parent a4e0425581
commit 9dc2b83f0e
3 changed files with 209 additions and 263 deletions
+20 -121
View File
@@ -1,13 +1,14 @@
---
name: close
description: |
End-of-session ritual — capitalize the 3 registry questions: what was
decided, what was learned, what was blocked. Writes approved entries
into `.claude/memory/decisions.md`, `.claude/memory/learnings.md`, and
`.claude/memory/blockers.md`, plus a timeline line in `.claude/memory/journal.md`.
Trigger: "close", "end session", "ferme la session", "session close",
End-of-session ritual — flush what was decided, learned, and blocked into
`.claude/memory/`, reconcile `.claude/tasks/TODO.md`, and log a journal line.
Alias for `/capitalize --ritual`: same dedup + TODO-reconcile + approval-gate
pipeline, plus the explicit 3-question reflection. NOT registry curation
(that is /prune-memory).
Triggers: "close", "end session", "ferme la session", "session close",
"checkpoint memory", "what did we learn", "retro rapide", "fin de journée".
argument-hint: (none — operates on the current conversation context)
argument-hint: (none — runs capitalize in ritual mode on the current conversation)
allowed-tools:
- Read
- Edit
@@ -15,124 +16,22 @@ allowed-tools:
- Bash
- Grep
- Glob
- AskUserQuestion
---
# CLOSE — Session-Close Ritual
# /close — Session-close ritual (alias)
Capture the 3 registry-worthy outputs from the current session before losing context. Operates entirely on conversation memory + git state — does NOT re-read code.
`/close` is an alias for **`/capitalize --ritual`**. All logic lives in the
**capitalize** skill — nothing is duplicated here.
## STEP 0 — PRECHECK
Invoke the `capitalize` skill now and run it in **ritual mode**: the full
pipeline (STEP 0 precheck → STEP 1 auto-scan → STEP 2 dedup → STEP 2B TODO
reconcile → STEP 3 approval gate → STEP 4 write → STEP 5 journal → STEP 6
handoff), PLUS STEP 1B's explicit 3-question reflection (what did you decide /
learn / block).
Verify the registry files exist:
Ritual answers are deduped like any other candidate — a dup is dropped and its
existing ID shown, not re-logged. This is the upgrade over the legacy `/close`,
which wrote ritual answers fresh with no dedup.
```bash
ls .claude/memory/decisions.md .claude/memory/learnings.md .claude/memory/blockers.md .claude/memory/journal.md 2>/dev/null
```
- If `.claude/memory/` is missing entirely → print:
```
⚠️ .claude/memory/ absent. Lance d'abord `/onboard` (ou `/init-project` pour un nouveau repo)
pour créer la structure des registres.
```
STOP.
- If some files are missing → print which, create them from `~/.claude/templates/memory/<name>.md`, continue.
## STEP 1 — GATHER SESSION CONTEXT
Collect the raw material without re-reading code:
```bash
git log --oneline -10
git diff HEAD --stat
git status --short
date +%Y-%m-%d
```
Extract from current conversation:
- Any decision made (framework pick, refactor scope, architecture choice, naming convention).
- Any learning surfaced (surprising API behaviour, reusable pattern, gotcha, "don't do X").
- Any blocker encountered (dead end, friction > 15 min wasted, upstream bug).
## STEP 2 — THE 3 QUESTIONS
Present the ritual compactly — one screen, 3 questions, pre-filled draft answers from STEP 1:
```
═══ SESSION-CLOSE RITUAL — 3 QUESTIONS ═══
1️⃣ Qu'est-ce que tu as décidé ?
Proposition BDR-XXX :
Titre : <extrait de la conversation>
Décision: <1 phrase>
Pourquoi: <1-2 phrases>
Alts rejetées: <si captable>
→ (accept / edit / skip / add another)
2️⃣ Qu'est-ce que tu as appris ?
Proposition LRN-XXX :
Pattern : <extrait abstrait>
Contexte: <où/quand>
Future : <quand s'en rappeler>
→ (accept / edit / skip / add another)
3️⃣ Sur quoi es-tu bloqué ?
Proposition BLK-XXX :
Friction : <extrait>
Cause : <si identifiée — sinon "à investiguer">
Solution : <workaround si déjà trouvé — sinon "open">
Statut : open | resolved | upstream
→ (accept / edit / skip / add another)
Action globale ? (all / pick <numbers> / edit / skip-all)
```
If nothing notable to propose for a given question → say `(rien à logger cette session)` for that question.
## STEP 3 — WRITE APPROVED ENTRIES
For each approved entry:
1. Read the target registry file.
2. Append the new entry at the end (never rewrite existing entries).
3. Add a line to the Index table at the top with the new ID, date, short title, status.
4. Generate next sequential ID by scanning existing IDs (e.g., if `BDR-007` exists, next is `BDR-008`).
## STEP 4 — JOURNAL ENTRY
Always write one line in `.claude/memory/journal.md` under today's heading — even if all 3 questions were skipped:
- If today's heading exists → append a new bullet under it.
- If not → create `## YYYY-MM-DD` heading and write 3-5 bullets summarising the session.
Template:
```markdown
## YYYY-MM-DD
- <what was done — 1 line from conversation>
- <what was decided — link to BDR-XXX if logged>
- <what was learned — link to LRN-XXX if logged>
- <what's blocked — link to BLK-XXX if logged>
- <commit hashes if any — `<hash1>..<hashN>`>
```
## STEP 5 — FINAL OUTPUT
```
CLOSE COMPLETE — session <YYYY-MM-DD>
decisions.md : +<N> entries (BDR-XXX, BDR-YYY) | 0 entries
learnings.md : +<N> entries (LRN-XXX) | 0 entries
blockers.md : +<N> entries (BLK-XXX) | 0 entries
journal.md : +1 line under ## <date>
Prochaine session : lire `.claude/memory/` au démarrage pour rappel.
```
---
## RULES
- Never invent content. Every entry must be grounded in the current conversation or git history — no fabricated "lessons".
- Skip silently rather than log a trivial entry. Journal excepted (timeline logging is cheap, noise is fine).
- Never overwrite existing entries — append-only.
- If the user says `skip-all` → still write the journal line and exit.
- If `.claude/memory/` is missing → STOP at STEP 0, do not create it here (onboard / init-project responsibility).
- **Language rule**: written entries are ALWAYS in English (see CLAUDE.md "Memory registries" § Language). The 3-question prompt may mirror the user's language; the appended entries must not.
→ Use the Skill tool to launch `capitalize` with argument `--ritual`.