End-of-session context persistence ceremony. Use when wrapping up a session to capture learnings, decisions, conventions, and tasks.
Guide end-of-session context persistence. Gather signal from the
session, propose candidates worth persisting, and persist approved
items via ctx add.
This is a ceremony skill: invoke it explicitly as /ctx-wrap-up
at session end, not conversationally. It pairs with /ctx-remember
at session start.
Check that the context directory exists. If it does not, tell the user:
"No context directory found. Run ctx init to set up context
tracking, then there will be something to wrap up."
check-persistence hook suggests itctx add/ctx-reflect
instead for mid-session checkpointsDo this silently: do not narrate the steps:
git diff --stat
git log --oneline @{upstream}..HEAD 2>/dev/null || git log --oneline -5
Think step-by-step about what is worth persisting. For each potential candidate, ask yourself:
Present candidates in a structured list, grouped by type. Skip categories with no candidates: do not show empty sections.
## Session Wrap-Up
### Learnings (N candidates)
1. **Title of learning**
- Context: What prompted this
- Lesson: The key insight
- Application: How to apply it going forward
### Decisions (N candidates)
1. **Title of decision**
- Context: What prompted this
- Rationale: Why this choice
- Consequence: What changes as a result
### Conventions (N candidates)
1. **Convention description**
### Tasks (N candidates)
1. **Task description** (new | completed | updated)
Persist all? Or select which to keep?
Wait for the user to approve, select, or modify candidates. Wait for the user to approve each item before persisting: candidates proposed by the agent may be incomplete or mischaracterized, and the user is the final authority on what belongs in their context.
For each approved candidate, run the appropriate command:
| Type | Command |
|---|---|
| Learning | ctx add learning "Title" --session-id ID --branch BR --commit HASH --context "..." --lesson "..." --application "..." |
| Decision | ctx add decision "Title" --session-id ID --branch BR --commit HASH --context "..." --rationale "..." --consequence "..." |
| Convention | ctx add convention "Description" |
| Task (new) | ctx add task "Description" --session-id ID --branch BR --commit HASH |
| Task (done) | Edit TASKS.md to mark complete |
Report the result of each command. If any fail, report the error and continue with the remaining items.
After persisting, mark the session as wrapped up so checkpoint nudges are suppressed for the remainder of the session:
ctx system mark-wrapped-up
After persisting, check for uncommitted changes:
git status --short
If there are uncommitted changes, offer:
There are uncommitted changes. Want me to run
/ctx-committo commit with context capture?
Do not auto-commit. The user decides.
details extension wraps content in <details>
tags, breaking <pre><code> rendering in MkDocs": specific
gotcha, actionable for future sessions/ctx-reflect is for mid-session checkpoints at natural
breakpoints. /ctx-wrap-up is for end-of-session: it's more
thorough, covers the full session arc, and includes the commit
offer. If the user already ran /ctx-reflect recently, avoid
proposing the same candidates again.
Before presenting candidates, verify:
After persisting, verify:
ctx add command succeeded/ctx-commit (if applicable)