Feature Request: Session Templates / Forking - Save compressed state as starting point for new sessions
Resolved 💬 2 comments Opened Apr 22, 2026 by 78Spinoza Closed Jun 18, 2026
Feature Request: Session Templates / Forking
Summary
Ability to save a session's compressed context state as a template, then spawn multiple new sessions that start from that frozen state (not resuming the original session).
Problem Statement
Current Limitation:
- Each new session starts with minimal context
- Must re-read files, re-learn project structure every time
- Cannot share "rich context" across multiple parallel sessions
- Session resume only allows ONE continuation, not forking
Real-World Pain Point:
Session 1: Read 50 files → /compact → [Rich Context]
Now I want:
- Session 2: Start from Session 1's state (work on feature A)
- Session 3: Start from Session 1's state (work on feature B)
- Session 4: Start from Session 1's state (fix bug)
Currently: IMPOSSIBLE
Each session must re-read files = wasted time + tokens
Proposed Solution
CLI Commands
# Save current session as template
/session save --name "sprint-5-context" --description "Sprint 5.2 with all domain rules read"
# List available templates
/session list --templates
# Create NEW session from template (NOT resume)
/session new --template "sprint-5-context" --name "Implementing US-53"
# Delete old template
/session delete-template "sprint-5-context"
# Auto-save after file-reading heavy sessions
/session save --name "backend-context" --if-files-read-greater 20
UI/UX
In VS Code extension:
- Right-click session → "Save as Template"
- New Session → "Start from Template" dropdown
- Template manager (view/delete/update)
In CLI:
- Template names with tab completion
- Show template size/age
- Validate template integrity
Use Cases
1. Project Onboarding
# Senior dev: Read entire codebase once
Session 1: Read 100 files → /compact → /session save --name "njordbok-full"
# Junior devs: Start from that context
Session 2: /session new --template "njordbok-full" --name "Feature X"
Session 3: /session new --template "njordbok-full" --name "Bug Y"
2. Parallel Feature Development
# After sprint planning meeting
Session 1: Read all sprint docs + domain rules → /session save --name "sprint-6-kickoff"
# Parallel work
Session 2: /session new --template "sprint-6-kickoff" # US-101
Session 3: /session new --template "sprint-6-kickoff" # US-102
Session 4: /session new --template "sprint-6-kickoff" # US-103
3. Knowledge Reuse
# Deep dive into auth system once
Session: Read auth/ → /session save --name "auth-expert-context"
# Reuse for all auth-related work
Session: /session new --template "auth-expert-context" # Work on auth bug
Session: /session new --template "auth-expert-context" # Work on RBAC feature
4. Team Collaboration
# Tech lead creates template
/session save --name "team-shared-context" --description "Q2 architecture decisions"
# Team members use it
/session new --template "team-shared-context" # Everyone starts aligned
Technical Considerations
Storage Location
- Local:
.claude/templates/(project-specific) - Global:
~/.claude/templates/(shared across projects) - Cloud: (future) Sync templates across devices
Template Contents
Should include:
- ✅ Compressed message history
- ✅ Files read (with checksums for validation)
- ✅ Learnings/context from conversation
- ❌ Sensitive data (API keys, secrets - auto-filter)
- ❌ Task state (start fresh for new sessions)
Validation
# Check if template is still valid
/session validate-template "sprint-5-context"
# Warns if:
# - Files have changed (git diff)
# - Project structure changed
# - Template is > 30 days old
Size Management
# Show template sizes
/session list --templates --sizes
# Auto-cleanup
/session cleanup --templates --older-than 90days
Alternative Names
- Session Templates
- Session Forking
- Session Snapshots
- Context Templates
- Saved States
Priority
High - Would significantly improve workflow for:
- Large codebases (read files once, reuse everywhere)
- Teams (shared starting points)
- Parallel work (multiple sessions from same context)
- Token efficiency (avoid re-reading same files)
Related Features
- Memory files (auto-loaded, but manual)
- Session resuming (continuation, not forking)
Implementation Ideas
Option 1: Full Context Clone
- Save entire compressed conversation
- New sessions load this as initial messages
- Simpler but larger storage
Option 2: Structured Snapshot
- Extract key learnings, files, context
- Store as structured JSON
- More efficient, but complex extraction
Option 3: Hybrid
- Save summary + file list + key decisions
- New sessions read files from list (fast, current)
- Best balance of size/accuracy
---
Would greatly improve productivity for teams working with large codebases!
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗