fix: update session file paths to use the home directory

Updated the documentation for the `/resume-session` and `/save-session` commands to reflect the correct file paths, changing references from `.claude/sessions/` to `~/.claude/sessions/`. This ensures clarity on the global directory used for session management and maintains consistency across commands.
This commit is contained in:
avesh-devx
2026-03-09 13:12:36 +05:30
committed by Affaan Mustafa
parent 6937491d2a
commit 043b3cd9a9
2 changed files with 37 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
---
description: Load the most recent session file from .claude/sessions/ and resume work with full context from where the last session ended.
description: Load the most recent session file from ~/.claude/sessions/ and resume work with full context from where the last session ended.
---
# Resume Session Command
@@ -17,9 +17,9 @@ This command is the counterpart to `/save-session`.
## Usage
```
/resume-session # loads most recent file in .claude/sessions/
/resume-session 2024-01-15 # loads specific date
/resume-session .claude/sessions/foo.md # loads specific file path
/resume-session # loads most recent file in ~/.claude/sessions/
/resume-session 2024-01-15 # loads most recent session for that date
/resume-session ~/.claude/sessions/2024-01-15-abc123-session.tmp # loads specific file path
```
## Process
@@ -27,17 +27,21 @@ This command is the counterpart to `/save-session`.
### Step 1: Find the session file
If no argument provided:
1. List all files in `.claude/sessions/`
1. List all `.tmp` files in `~/.claude/sessions/`
2. Pick the most recently modified file
3. If the folder doesn't exist or is empty, tell the user:
```
No session files found in .claude/sessions/
No session files found in ~/.claude/sessions/
Run /save-session at the end of a session to create one.
```
Then stop.
If an argument is provided:
- If it looks like a date (`YYYY-MM-DD`), look for `.claude/sessions/YYYY-MM-DD.md`
- If it looks like a date (`YYYY-MM-DD`), find all files in `~/.claude/sessions/` matching
`YYYY-MM-DD-session.tmp` (old format) or `YYYY-MM-DD-<shortid>-session.tmp` (new format)
and load the most recently modified variant for that date
- If it looks like a file path, read that file directly
- If not found, report clearly and stop
@@ -50,7 +54,7 @@ Read the complete file. Do not summarize yet.
Respond with a structured briefing in this exact format:
```
SESSION LOADED: .claude/sessions/YYYY-MM-DD.md
SESSION LOADED: ~/.claude/sessions/YYYY-MM-DD-<shortid>-session.tmp
════════════════════════════════════════════════
PROJECT: [project name / topic from file]
@@ -89,14 +93,14 @@ If no next step is defined — ask the user where to start, and optionally sugge
## Edge Cases
**Multiple sessions for the same date** (`2024-01-15.md`, `2024-01-15-2.md`):
Load the highest-numbered file (most recent).
**Multiple sessions for the same date** (`2024-01-15-session.tmp`, `2024-01-15-abc123-session.tmp`):
Load the most recently modified file for that date.
**Session file references files that no longer exist:**
Note this during the briefing — "⚠️ `path/to/file.ts` referenced in session but not found on disk."
**Session file is from a very old date:**
Note the gap — "⚠️ This session is from X days ago. Things may have changed." — then proceed normally.
**Session file is from more than 7 days ago:**
Note the gap — "⚠️ This session is from N days ago (threshold: 7 days). Things may have changed." — then proceed normally.
**User provides a file path directly (e.g., forwarded from a teammate):**
Read it and follow the same briefing process — the format is the same regardless of source.
@@ -109,7 +113,7 @@ Report: "Session file found but appears empty or unreadable. You may need to cre
## Example Output
```
SESSION LOADED: .claude/sessions/2024-01-15.md
SESSION LOADED: ~/.claude/sessions/2024-01-15-abc123-session.tmp
════════════════════════════════════════════════
PROJECT: my-app — JWT Authentication

View File

@@ -1,5 +1,5 @@
---
description: Save current session state to a dated file in .claude/sessions/ so work can be resumed in a future session with full context.
description: Save current session state to a dated file in ~/.claude/sessions/ so work can be resumed in a future session with full context.
---
# Save Session Command
@@ -27,14 +27,14 @@ Before writing the file, collect:
### Step 2: Create the sessions folder if it doesn't exist
```bash
mkdir -p .claude/sessions
mkdir -p ~/.claude/sessions
```
### Step 3: Write the session file
Create `.claude/sessions/YYYY-MM-DD.md` using today's actual date.
Create `~/.claude/sessions/YYYY-MM-DD-<short-id>-session.tmp` using today's actual date and a short random alphanumeric ID (e.g., `2024-01-15-abc123de-session.tmp`).
If a file for today already exists (multiple sessions in one day), name it `YYYY-MM-DD-2.md`, `YYYY-MM-DD-3.md`, etc.
Each session always gets a unique short-id, so multiple sessions on the same day never collide.
### Step 4: Populate the file with all sections below
@@ -45,7 +45,7 @@ Write every section honestly. Do not skip sections — write "Nothing yet" or "N
After writing, display the full contents and ask:
```
Session saved to .claude/sessions/YYYY-MM-DD.md
Session saved to ~/.claude/sessions/YYYY-MM-DD-<short-id>-session.tmp
Does this look accurate? Anything to correct or add before we close?
```
@@ -58,6 +58,7 @@ Wait for confirmation. Make edits if requested.
```markdown
# Session: YYYY-MM-DD
**Started:** [approximate time if known]
**Last Updated:** [current time]
**Project:** [project name or path]
@@ -116,12 +117,12 @@ If nothing is queued: "No specific untried approaches identified."
[Every file touched this session. Be precise about what state each file is in.]
| File | Status | Notes |
|------|--------|-------|
| `path/to/file.ts` | ✅ Complete | [what it does] |
| File | Status | Notes |
| ----------------- | -------------- | -------------------------- |
| `path/to/file.ts` | ✅ Complete | [what it does] |
| `path/to/file.ts` | 🔄 In Progress | [what's done, what's left] |
| `path/to/file.ts` | ❌ Broken | [what's wrong] |
| `path/to/file.ts` | 🗒️ Not Started | [planned but not touched] |
| `path/to/file.ts` | ❌ Broken | [what's wrong] |
| `path/to/file.ts` | 🗒️ Not Started | [planned but not touched] |
If no files were touched: "No files modified this session."
@@ -173,6 +174,7 @@ required, services that need to be running, etc. Skip if standard setup.]
```markdown
# Session: 2024-01-15
**Started:** ~2pm
**Last Updated:** 5:30pm
**Project:** my-app
@@ -220,13 +222,13 @@ refreshes without exposing the token to JavaScript.
## Current State of Files
| File | Status | Notes |
|------|--------|-------|
| `app/api/auth/register/route.ts` | ✅ Complete | Works, tested |
| `app/api/auth/login/route.ts` | 🔄 In Progress | Token generates but not setting cookie yet |
| `lib/auth.ts` | ✅ Complete | JWT helpers, all tested |
| `middleware.ts` | 🗒️ Not Started | Route protection, needs cookie read logic first |
| `app/login/page.tsx` | 🗒️ Not Started | UI not started |
| File | Status | Notes |
| -------------------------------- | -------------- | ----------------------------------------------- |
| `app/api/auth/register/route.ts` | ✅ Complete | Works, tested |
| `app/api/auth/login/route.ts` | 🔄 In Progress | Token generates but not setting cookie yet |
| `lib/auth.ts` | ✅ Complete | JWT helpers, all tested |
| `middleware.ts` | 🗒️ Not Started | Route protection, needs cookie read logic first |
| `app/login/page.tsx` | 🗒️ Not Started | UI not started |
---
@@ -258,4 +260,4 @@ Then test with Postman — the response should include a `Set-Cookie` header.
- The "What Did NOT Work" section is the most critical — future sessions will blindly retry failed approaches without it
- If the user asks to save mid-session (not just at the end), save what's known so far and mark in-progress items clearly
- The file is meant to be read by Claude at the start of the next session via `/resume-session`
- Keep this file in `.claude/sessions/`add that folder to `.gitignore` if session logs shouldn't be committed
- Keep this file in `~/.claude/sessions/`this is a global directory shared across all projects, so session logs are not committed to any repo by default