Overview
Session context persistence is the practice of systematically saving the knowledge, decisions, and state from one AI session so that the next session can resume from a coherent starting point rather than rebuilding context from scratch.
The core problem: most AI tools (including Claude Code) do not automatically persist what was decided, why it was decided, or what remains to be done. Every new session starts cold. Without explicit persistence, the practitioner must re-explain context, re-discover architectural decisions, and re-derive conclusions already reached in prior sessions.
The actual win is not the commit message — it is forcing the session to leave breadcrumbs for tomorrow. Claude feels way less magical when it has to rebuild context from vibes every morning.
The /close pattern
The /close pattern is a session-ending Claude Code skill that mechanises context persistence in three phases:
Phase 1 — Retrospective
- Scan the session context for: decisions, learnings/inefficiencies, open tasks, references
- Determine the namespace by browsing recent memory (last 30 days) and matching to an existing project
- Capture thoughts via a memory tool for each relevant point (typed as
decision/insight/task/reference/general) - Update memory files in
~~/.claude/projects/.../memory/:- User preferences →
user_*.md - Workflow feedback →
feedback_*.md - Project state/deadlines →
project_*.md - External references →
reference_*.md - New files get an entry in
MEMORY.md
- User preferences →
Phase 2 — Housekeeping
- Check the git repo (
git rev-parse --show-toplevel) - Show git changes (
git status --short,git diff --stat HEAD) - Generate an English imperative commit message (
feat: add /close skill) and ask before committing - Write
SESSION_LOG.md— prepend a new entry at the top with date, title, 1–2 sentence summary, and a pointer to the main artifact
Phase 3 — Close
- Print a rename suggestion in the format
[YYYY-MM-DD] <project-or-topic> - <what-was-done>for copying as the session name - Print a closing line summarising counters:
<N> thoughts → open-brain · <N> memory updates · <N> commits · SESSION_LOG updated
Memory file taxonomy
A recurring pattern in the community is a typed memory file taxonomy stored alongside the project or in a global Claude directory:
| File pattern | Contents |
|---|---|
user_*.md |
User preferences, working style, personal rules |
feedback_*.md |
Workflow corrections and non-obvious confirmations |
project_*.md |
Project state, deadlines, architectural decisions |
reference_*.md |
External references, links, third-party docs |
MEMORY.md |
Index of all memory files; LLM reads this first |
The “why” layer is the most valuable: capturing not just what changed but why it was changed is what saves time when picking up a project after two weeks away.
decisions.md pattern
A simpler variant used on client projects: maintain a decisions.md file that
is updated at the end of each session with what changed and why — not just what.
The “why” part is what saves you when you pick it back up two weeks later and have no memory of why you made a weird architectural choice.
Session 0 / project bootstrapping
The Session 0 skill creates project scaffolding files at the start of a new project:
CLAUDE.md— project constitution for the AIPROGRESS.md— current state and what remainsCHANGELOG.md— history of changes
These serve as the initial context seed that the /close pattern then keeps updated throughout the project’s life.
Context persistence vs meta-skills
The community consensus: get context persistence working first before chasing autonomous self-improving agents.
Context persistence across sessions is the real unlock before you start chasing autonomous skill tuning.
Self-improving agents are cool to watch but add complexity. Reliable session handoffs are foundational and simpler to implement correctly.
Related topics
- Claude Code — the tool this pattern applies to
- Claude Code skills — the skill ecosystem; /close is one skill within it
- Self-improving agents — the meta-skill layer that builds on top of context persistence
- Second Brain — broader knowledge management philosophy; session context persistence is a specialised application
- LLM wiki — related pattern for persisting knowledge across LLM sessions
Resources
- 2026-06-12 ◦ Drop your best Claude skills in here! (Reddit r/ClaudeAI) — community discussion on the /close pattern; SYSWAVE shares a three-phase implementation (retrospective → housekeeping → close); multiple practitioners report it as underrated and foundational