Keeping a record: working across many sessions
Description and use
A system for preserving and restoring context across Claude Code sessions: naming convention, index, automated hooks, and metadata enable easy continuation without losing information.
Problem
Maintaining continuity across multiple Claude Code sessions without losing decisions or context.
Outcome
A robust, repeatable workflow that preserves session continuity, enabling the author to write posts and manage work across many sessions without losing context.
Workflow
- Define a naming format YYYYMMDD-VNN_name for each session.
- Create an index file docs/sessions.md with a Markdown table of sessions.
- Add a closing hook script that updates end time and status when Claude finishes.
- Determine the session UUID by selecting the most recent file in Claude’s internal sessions directory.
- Create a per-session file with metadata header and fixed sections (goal, decisions, work done, next steps).
- Implement list_sessions.py to read headers and display sessions ordered by activity.
- Add a start hook that injects data (tickets, long‑open sessions, alerts) and prompts to resume or start a new session.
- Move the closing hook into each project’s folder so it travels with the project.
- Apply the same template across all projects to keep naming and structure consistent.
- Iteratively patch and refine the system as new edge cases arise.
Evidence
A naming format, YYYYMMDD-VNN_nombre: the date, a counter that restarts at V01 every day, and a goal in two or three words.
An index, docs/sessions.md, a Markdown table.
A closing hook —a script Claude Code runs on its own every time the model finishes responding— that updates the end time and the status.
list_sessions.py appeared, which reads those headers and shows the sessions ordered by activity.
- Record date: 2026-09-18T05:45:18.181Z