Debrief — clean session ends save next-session context
End of session ritual: summarize done / open / blocked / decisions. The /debrief slash command plus optional Stop hook so it runs automatically.
Debrief
A clean session end is half of having a useful memory. Without one, the model walks out of a 90-minute session having shipped two features and made three decisions, and none of it is searchable next session. With a debrief, each of those things lands as a memory entry and the next session resumes with full context.
The mechanic is three tool calls in a row: summarize → reflect → session_end. The skill bundles them so you do not type three prompts. The optional Stop hook fires the skill automatically when you close a Claude Code session. Either way, the cost is one prompt at end-of-day.
Step 1: Install the debrief skill
Install the debrief skill from aiguide
aiguide_install_skill { slug: "debrief" } returns the SKILL.md and the copy-paste command. Run the command, restart Claude Code, the skill is live.
If aiguide is not connected, write the file by hand (Step 6).
Step 2: What the skill does
The default debrief calls three tools, in order, with output rolled up:
nex_summarize— generates a session summary. What got done, what is open, what is blocked, what decisions were made.nex_reflect— reflects on the session. Flags things that deserve a learning, surfaces patterns that emerged, identifies anything that should be promoted from a flat learning to an entity. Optional: passdays: 1for a one-day reflection (broader than just this session).nex_session_end— closes the session cleanly. The summary becomes a session entry, the reflections become learnings, the open/blocked items become next-session pickup points.
Output is compact. You should see the summary echoed at the end so you can confirm it captured what mattered.
Step 3: Trigger phrases
Default triggers in the skill:
- "debrief"
- "/debrief" (if you also have it as a slash command)
- "session ende" (German shortcut)
- "wrap up the session"
Pick what feels natural. Skills accept multiple triggers — the model picks the skill up if any one of them appears in the prompt.
Step 4: Verify
Run aiguide_validate_step. The validator confirms ~/.claude/skills/ exists with at least one entry. After you install debrief that is automatic.
ls -1 ~/.claude/skills/ 2>/dev/null | head -20
Step 5: Use it at the end of a session
Last thing you do before closing Claude Code:
Debrief
You see the model call the three tools. The summary appears. Close the session.
Tomorrow morning your next session starts with nex_session_start (Recipe 4.5 has the standing rule for this). The previous session's summary, reflections, and open items show up in the context. You pick up where you left off without "what was I doing?".
Step 6: Optional — Stop hook to fire it automatically
If you want debrief to run even when you forget to call it, wire a Stop hook in ~/.claude/settings.json (merge with any existing hooks):
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "bash -c 'echo debrief | claude --headless --no-tty'"
}
]
}
]
}
}
Note the "hooks": [{ "type": "command", "command": "..." }] nesting under each Stop entry — same shape as the safety guard from Recipe 1.3. Flat { "command": "bash", "args": [...] } entries silently do nothing.
The Stop event fires when a Claude Code session is closed (Cmd+Q, terminal exit, etc). The hook spawns a one-shot headless Claude with the prompt "debrief", which triggers the skill. The previous session's tools are still warm in memory, so the call is fast.
Caveats:
- Headless mode does not use your same context window — it starts a fresh session. The debrief still works because all the data lives in the memory MCP, not in the closing session's context.
- Some hook setups race against the session-close cleanup. If you see "session not found" errors, switch to triggering debrief manually instead.
For most people, manual is fine. The hook is for the "I always forget" personality.
Step 7: Write your own (if the default is not your shape)
The skill is one Markdown file at ~/.claude/skills/debrief/SKILL.md:
---
description: Debrief — clean session end. Summarize done plus open plus blocked plus decisions. Calls nex_summarize then nex_reflect then nex_session_end. Use when user says "debrief", "wrap up", "session ende", or end of long sessions before closing.
---
When triggered:
1. Call nex_summarize for a clean done/open/blocked/decisions breakdown.
2. Call nex_reflect (without days param for session-only reflection, or with days=1 for full-day).
3. Call nex_session_end with the summary.
Output the rolled-up result. Lead with the summary, then list reflections, then any open follow-ups for next session.
Keep it under 15 lines. The full state is in memory now — do not duplicate it in the chat.
Reasonable customizations:
- Add a
nex_chronicle createcall if the session was bookworthy (a milestone, a real launch, an outage post-mortem). Chronicles are higher-weight than learnings — they show up in long-term retrieval. - For a project-tagged debrief (Recipe 4.2), pass
project: "<slug>"to summarize and reflect so the entries are scoped. - For a contradiction sweep at session end, add
nex_contradictions scan_learnings— useful if you make many factual statements per session and want to catch self-contradictions early.
When NOT to debrief
Three minutes of "let me ask one quick question" is not a session that needs a debrief. The overhead is not worth the gain. Reserve debrief for sessions long enough to have actual decisions or shipped work — usually 30 minutes plus.
For a quick lookup that did not produce anything new, just close the session. The memory you would write would be a duplicate of "asked about X, answer was Y" which is not useful three days from now.