claude-code - 💡(How to fix) Fix UserPromptSubmit hooks enable cross-session continuity — this should be native [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52238Fetched 2026-04-24 06:12:29
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Root Cause

I built it myself using UserPromptSubmit hooks + structured session summaries + TF-IDF retrieval over past .tok files. ~400 lines total. It works because the primitives are already there.

RAW_BUFFERClick to expand / collapse

I spent four months losing context every time a Claude Code session ended or crashed. Today my SSH session dropped mid-work. I reconnected, typed session start, and got:

"Last session: schema compression — recommendation still pending."

That's it. That's what I'd been missing.

I built it myself using UserPromptSubmit hooks + structured session summaries + TF-IDF retrieval over past .tok files. ~400 lines total. It works because the primitives are already there.

What would make this native and zero-effort:

  1. Write a session summary on conversation end (last 3 topics + unfinished items)
  2. Retrieve relevant past summaries on session start
  3. Inject as system context before the first prompt

Every power user is either suffering this or reinventing the wheel. The hook system proves it's possible. Close the loop.

Full implementation available on request.

extent analysis

TL;DR

Implementing a native session summary and context retrieval feature would likely resolve the issue of lost context in Claude Code sessions.

Guidance

  • The current implementation using UserPromptSubmit hooks and TF-IDF retrieval over past .tok files is a good starting point, but making it native would require integrating it into the core system.
  • To achieve a zero-effort solution, the system should automatically write a session summary on conversation end, including the last 3 topics and unfinished items.
  • Retrieving relevant past summaries on session start and injecting them as system context before the first prompt would also be necessary.
  • The full implementation details, available on request, could provide further insight into the required changes.

Notes

The proposed solution relies on the existing hook system and primitives, which have already been proven to work in the custom implementation.

Recommendation

Apply workaround: The custom implementation, although not native, has been shown to be effective and could be used as a temporary solution until a native feature is developed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING