Persist and restore session state for seamless multi-session workflows without re-reading the codebase.
Persist coding session state so that subsequent sessions can resume instantly without re-reading the entire codebase or re-analyzing previous work.
Stored at .session-state.json in the project root:
{
"session_id": "sess_20260416_001",
"project": "my-app",
"timestamp": "2026-04-16T20:00:00Z",
"duration_minutes": 45,
"objectives": {
"primary": "Implement user authentication with JWT",
"secondary": ["Add login page", "Add auth middleware"],
"status": "in-progress"
},
"progress": {
"completed": [
"Created auth middleware",
"Added JWT token generation",
"Created login API endpoint"
],
"in_progress": [
"Login page UI component"
],
"blocked": []
},
"files": {
"created": [
"src/middleware/auth.ts",
"src/routes/auth.ts"
],
"modified": [
"src/routes/index.ts",
"src/types/user.ts"
],
"deleted": []
},
"errors": {
"unresolved": [
{
"file": "src/middleware/auth.ts",
"line": 42,
"error": "Type 'string | undefined' is not assignable to type 'string'",
"attempts": 1,
"fingerprint": "ts2322_auth_42"
}
],
"resolved": [
{
"file": "src/routes/auth.ts",
"error": "Cannot find module 'jsonwebtoken'",
"resolution": "npm install jsonwebtoken @types/jsonwebtoken"
}
]
},
"tests": {
"passing": 24,
"failing": 2,
"failed_paths": [
"src/__tests__/auth.test.ts:login should validate email format",
"src/__tests__/auth.test.ts:login should rate limit attempts"
]
},
"todos": [
"Add password reset endpoint",
"Add email verification flow",
"Write integration tests for auth flow",
"Add refresh token rotation"
],
"context": {
"tech_stack": ["TypeScript", "Express", "Prisma", "PostgreSQL"],
"key_decisions": [
"Using bcrypt for password hashing",
"JWT with 15min access + 7day refresh tokens",
"Rate limiting via express-rate-limit"
],
"architecture_notes": "Auth follows middleware pattern, tokens stored in httpOnly cookies"
},
"next_prompts": [
"Continue implementing the login page UI component in src/components/LoginForm.tsx",
"Fix the TypeScript error in src/middleware/auth.ts line 42",
"Run failing tests and fix: npm test -- --grep 'auth'"
]
}
| Category | What's Saved | Why |
|---|---|---|
| Objectives | Primary and secondary goals | Resume with correct focus |
| Progress | Completed, in-progress, blocked items | Know where to pick up |
| Changed files | Created, modified, deleted file paths | Avoid re-exploring unchanged areas |
| Unresolved errors | Error messages, locations, attempt counts | Don't re-diagnose known issues |
| Failed tests | Test names and file paths | Target fixes immediately |
| TODOs | Pending tasks from the session | Prioritize remaining work |
| Key decisions | Architecture and design decisions made | Maintain consistency |
| Next prompts | Suggested prompts for the next session | Frictionless resume |
.session-state.jsontoken-cache/summaries.md with session summary.session-history/.session-state.json📋 Previous Session Found
Project: my-app
Last active: 2 hours ago
Objective: Implement user authentication with JWT
Status: In progress (60% complete)
Completed:
✅ Auth middleware
✅ JWT token generation
✅ Login API endpoint
Remaining:
🔄 Login page UI component
❌ 2 failing tests
⚠ 1 unresolved TypeScript error
Suggested next action:
→ Continue implementing LoginForm.tsx
Resume this session? (Recommended: yes)
Previous sessions are archived in .session-history/:
.session-history/
├── sess_20260415_001.json
├── sess_20260415_002.json
└── sess_20260416_001.json
This enables:
Errors are fingerprinted to detect duplicates:
fingerprint = hash(error_type + file + line_range + message_pattern)
If a fingerprint matches a previously resolved error, the resolution is suggested automatically:
⚠ This error was seen before (session sess_20260415_002)
Previous resolution: "Added null check on line 40"
→ Apply same fix?
Use session-resume to save current session state before ending.
Use session-resume to check for and restore previous session state.
Use session-resume to show history of past sessions on this project.
Use session-resume to clear saved state and start fresh.
{
"auto_save": true,
"save_on_error": true,
"max_history": 20,
"archive_location": ".session-history/",
"state_file": ".session-state.json",
"include_git_diff": true,
"compress_old_sessions": true
}
.gitignore