Feature Request: Native session persistence and context continuity
The Problem
Claude Code excels at complex, multi-session projects—but the infrastructure for maintaining continuity across those sessions remains a DIY exercise that most users discover only after experiencing painful context loss.
Today, preserving session state requires:
- Manually configuring hooks (a feature many users never discover)
- Writing custom checkpoint scripts
- Establishing personal conventions for handoff documents
- Rebuilding context from scratch when compaction occurs mid-task
This creates a paradox: the users who most need session persistence (those tackling large codebases over days or weeks) are forced to build their own persistence layer before they can focus on actual work.
Observed Impact
From direct experience across extended development sessions:
-
Context compaction without warning can erase hours of accumulated understanding. A user mid-way through a complex refactor suddenly faces an assistant with amnesia.
-
Session handoff is fragile. Even with careful documentation, the next session starts cold—requiring the user to re-explain decisions, re-establish preferences, and re-build trust in the assistant's understanding.
-
Hooks are powerful but hidden. The capability exists, but discovery requires documentation diving. Most users learn about hooks only after suffering the problem hooks would have prevented.
-
Institutional knowledge decays. Across 50+ sessions, patterns emerge: the same mistakes recur, the same clarifications are needed, the same ground is re-covered. The assistant learns within a session but forgets between them.
Proposed Solution
Make session continuity a first-class feature rather than a user-configured workaround:
Tier 1: Automatic (No Configuration)
- Pre-compaction checkpoint: Before context compression, automatically preserve current task state, recent decisions, and active file context
- Session summary on exit: Generate structured handoff when session ends (timeout, user departure, or explicit close)
- Warm start: New sessions in the same project directory automatically load the most recent checkpoint
Tier 2: Discoverable (Prompted Setup)
- First-session prompt: Offer to enable cross-session memory on initial project use
- Hooks tutorial: Surface hook configuration when users exhibit patterns suggesting they need it (long sessions, repeated context re-establishment)
Tier 3: Advanced (Power Users)
- Cross-session memory: Persistent store for project-level decisions, user preferences, and established conventions
- Checkpoint management: View, restore, or prune saved session states
- Export/import: Move session context between machines or share with collaborators
The Goal
A user returning to a project after a week should be able to say "continue where we left off" and have the assistant genuinely do so—not perform a forensic reconstruction from file artifacts, but actually resume with preserved understanding.
Session persistence should feel like reopening a document, not like introducing yourself to a stranger who happens to have read your diary.
Filed via Claude Code
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/11455
- https://github.com/anthropics/claude-code/issues/14227
- https://github.com/anthropics/claude-code/issues/18401
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
I am interested in most of this, but...
Warm start: New sessions in the same project directory automatically load the most recent checkpoint
That seems like it could be risky in terms of context pollution:
- I might have multiple claude sessions running simultaneously in the same directory.
- I might finish one claude session and
/clearor exit and start a new one, working on a task that has essentially nothing to do with the previous session.
If this is a prompted ("I noticed there's some warm recent context I can use. Do you want to me to load that in exchange for N tokens (X% of your window being filled)?") or opt-in (cli flag or slash command) capability, then sure. If it's automatic, then I believe it's too dangerous.
^^ only applies to that one quoted point, though, not the rest of this feature request.
I built an open-source tool that addresses this. stato captures agent expertise into validated files on disk (.stato/ directory) and generates platform-specific bridge files (CLAUDE.md, .cursorrules, AGENTS.md) that agents read automatically on session start.
The workflow: stato init stato crystallize # agent writes .stato/ modules stato bridge # generates CLAUDE.md
Next session, Claude Code reads CLAUDE.md and has the expertise from previous sessions. Also works across platforms (Cursor, Codex) from the same .stato/ source.
A/B tested: with .stato/ files, agents answered detailed project-specific questions. Without, they didn't recognize the tools.
pip install stato
GitHub: https://github.com/genecell/stato
This feature request articulates the problem perfectly. Session continuity should be a first-class feature, not a DIY exercise.
The list of manual workarounds (hooks, checkpoint scripts, handoff documents) perfectly describes the current state — it works, but it requires significant effort to set up and maintain. Most developers just accept the context loss and start fresh, which means wasted time and lost decisions.
While we wait for native support, Mantra was built to solve exactly this problem:
- Automatic session capture — no hooks or scripts to configure
- Visual timeline — browse any session, see what happened at each step
- Full-text search — find that decision you made last Tuesday across all sessions
- Restore any point — go back to any checkpoint and branch from there
- Cross-tool support — works with Claude Code, Cursor, Windsurf, Copilot, Aider
It does not replace the need for native persistence in Claude Code — that should absolutely happen. But it fills the gap today without requiring any manual setup or custom scripts.
The "checkpoint on every /compact" suggestion in the OP is especially good — that is when context is most at risk of being lost, and that is exactly when Mantra captures a snapshot.
This resonates — the "DIY exercise" description is spot on. I was spending 15-20 minutes per session re-establishing context on a complex WordPress project (20+ PHP classes, 5 product lines, Stripe billing).
I ended up building a solution around three ideas:
- Ai extraction over raw storage — instead of checkpointing entire conversations, an Ai model analyzes each exchange and extracts only the facts worth keeping (architecture decisions, bug fixes, preferences, patterns). A 2-hour session might produce 5-10 memories instead of thousands of tokens of noise.
- Semantic retrieval — memories get 1536-dim embeddings so "how does auth work?" finds "User auth uses JWT with 24-hour expiry in httpOnly cookies" even without keyword overlap.
- Project scoping via git remote — project-specific memories (file structure, conventions) stay with that repo while global preferences (coding style, tool choices) follow you everywhere. Cloning the same repo on a different machine maps to the same project automatically.
The cross-machine sync point @extemporalgenome raised is real — I work from two machines and before this, each had its own disconnected MEMORY.md. Cloud storage solved that.
This runs as an MCP server: CogmemAi. Free tier, one command setup: npx cogmemai-mcp setup
The three-tier proposal in the OP maps almost exactly to what I've built with https://github.com/louis49/melchizedek:
Tier 1 (automatic): SessionEnd and PreCompact hooks index every conversation automatically - including before /compact, so nothing is lost to context compression. On first install, it backfills your entire ~/.claude/projects/ history.
Tier 2 (discoverable): SessionStart hook injects recent context from past sessions. Claude knows what you discussed yesterday without you re-explaining.
Tier 3 (advanced): 16 MCP tools - m9k_search for hybrid search (BM25 + dual vectors + reranker), m9k_errors for recurring error solutions, m9k_file_history for files touched across sessions, m9k_save for manual notes.
Re @extemporalgenome 's concern about context pollution: Melchizedek uses project affinity (current project results boosted x1.5) so cross-project context exists but doesn't dominate.
Single SQLite file, 100% offline, zero config: npm install -g melchizedek
I've been dealing with this exact problem and built a solution as a Claude Code hook.
Crux is a local Rust daemon that tracks every file read, API call, and shell command as a typed belief in a causal dependency graph. The event log persists across sessions so when you start a new session, the daemon replays the log, re-hashes every file against current disk state, and tells the agent what changed before you type anything.
The part that goes beyond basic persistence: if the agent built a plan based on files that changed overnight, Crux flags the plan itself as stale, not just the files. So the agent doesn't just know "config.json changed", it knows "config.json changed and the refactor plan you made yesterday depends on it."
Check it out here https://github.com/ardey26/crux
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.