-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
Working memory (.docs/WORKING-MEMORY.md) is written by the Stop hook at the end of each session. If two Claude Code sessions are open on the same repo simultaneously, they will overwrite each other's working memory — last writer wins, losing context from the other session.
Scenarios
- Two terminals, same repo — both sessions write WORKING-MEMORY.md on stop, second one clobbers the first
- Session A compacts while Session B is active — PreCompact hook writes backup, but Session B's stop overwrites with stale state
- SessionStart reads stale memory — if Session A wrote memory but Session B already loaded, B operates on outdated context
Possible Solutions
- Session-scoped memory files — each session writes its own file (e.g.,
WORKING-MEMORY-{session-id}.md), SessionStart merges them - Lock file / advisory locking — prevent concurrent writes, queue or skip if locked
- Append-only log — instead of overwriting, append timestamped entries; SessionStart reads the latest
- Accept the limitation — document that working memory is single-session only and warn users
Context
The current hooks: stop-update-memory.sh (writes), session-start-memory.sh (reads + injects), pre-compact-memory.sh (backup). All assume single-session usage.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request