Quick session save before compact — scan conversation, extract decisions/discoveries/patterns, save to brain. Use when Hải says 'wrap', 'save session', or is about to compact/clear.
Fast, non-interactive session save. Scan conversation → extract learnings → save to brain → report. No questions, no confirmation.
Use before /compact or /clear to capture what the PreCompact hook's regex can't: nuanced decisions, context behind choices, and cross-cutting patterns.
Review the full conversation and extract:
Quality bar: only extract what would be useful 30+ days from now. Skip ephemeral details, debugging steps, and anything obvious from code/git history.
Check the conversation for existing brain_save calls. If a learning was already saved during the session (same topic, same conclusion), skip it. Don't duplicate.
Detect project from cwd (the project name under ~/Projects/).
Call brain_session("save") with:
brain_session(
action: "save",
summary: "Session [date]: [1-line summary of main work done]",
decisions: [...extracted decisions...],
discoveries: [...extracted discoveries...]
)
For patterns (if any), use brain_save separately since brain_session doesn't have a patterns field:
brain_save(content: "...", type: "pattern", tags: [...], project: "...")
Print a concise summary:
Wrapped: [N] decisions, [N] discoveries, [N] patterns saved.
Ready to /compact.