Skill v1.0.0
currentLLM-judged scan90/100version: "1.0.0" name: flush description: Save current session context to a resumable document. Use when ending a session, switching tasks, or wanting to preserve context for later continuation.
Flush Context to Resumable Doc
Save all current session context to a per-session file .claude/session-context.<session-id>.md for seamless continuation. Per-session naming means parallel sessions never overwrite each other's flush.
When to Use
- Ending a work session
- Switching to a different task
- Before a long break
- When context is getting complex and you want a checkpoint
- User says "save context", "flush", "checkpoint", or similar
Process
Step 1: Pick the .claude Directory (anchor to the project root)
- Run
git rev-parse --show-toplevelfrom the cwd. If it succeeds, use<repo-root>/.claude/. - If cwd is not in a git repo, use
<cwd>/.claude/(the "working directly in~" case →~/.claude). - Create the dir if it doesn't exist — no prompt, the location is deterministic. Do not offer
/init. Print the resolved absolute path so the location is never a surprise.
Do not walk up the tree looking for an ancestor .claude/: that made flush drift into the nearest ancestor (including the global ~/.claude config dir) instead of the project you're working in.
Step 2: Create Session Summary
Summarize the session:
| Section | Content | |
|---|---|---|
| Task Summary | What the user asked for | |
| Current State | completed / in-progress / blocked | |
| Key Decisions | Important choices and rationale | |
| Files Modified | What was created/changed | |
| Pending Work | What still needs to be done | |
| Important Context | Critical info for continuation |
Step 3: Write to File
Resolve the session id (printenv CLAUDE_CODE_SESSION_ID) and write to .claude/session-context.<session-id>.md in the chosen directory. If the env var is empty, fall back to the legacy global name .claude/session-context.md.
Then reap stale resume prompts (per-session files older than 14 days; the glob skips the legacy global file and won't touch the one just written):
find "<chosen-dir>/.claude" -maxdepth 1 -name 'session-context.*.md' -type f -mtime +14 -delete
Output Format
# Session Context - YYYY-MM-DD## Task Summary[What the user wanted to accomplish]## Current State**[status]**[Brief description]## Key Decisions-**[Decision]**: [Rationale]## Files Modified-`path/to/file` - [what changed]## Pending Work-[ ] Task 1-[ ] Task 2## Important Context[Critical information for continuation]
Notes
- Resume a saved context with
/unflush, which finds the right per-session file (preferring the current session id, else the most recent) and acts on it - Keep summaries concise but complete enough to resume without re-reading code
- Focus on the "why" not just the "what"