Repository navigation
Conversation
…ring each other's remember.md (#363) Two interactive sessions sharing one project store (by design, even across worktrees, #56) both wrote the same fixed remember.md with no namespacing or locking, so the second /remember silently overwrote the first's handoff. Distinct from #221/#222, which protect a pending handoff from a session that never writes one back. Add `handoff_mode` ("single", default, unchanged; "per_session", keyed by the SessionStart payload's own session_id) so each session gets its own remember.<session_id>.md. The delivery record is namespaced the same way to avoid two sessions racing one fingerprint file. A per_session request with no usable session_id withholds the === HANDOFF === hint rather than silently pointing the /remember skill at the shared file under a mode the user believes is isolating them. No pruning ships with this change -- a stale per-session handoff is the user's own writing with no copy anywhere else. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
…363 review) The Explore review of the first commit caught a real regression: when per_session mode degraded to the shared file (no usable session_id), the hint was withheld outright -- including in external storage mode, where that shared path is still the one true handoff location. Withholding it there reintroduced the exact bug the external-mode hint exists to prevent: the /remember skill falling back to its own hardcoded, project-relative default instead of the real external path. The hint now always fires whenever it would have before (external mode, or a resolved per-session path), and a degraded per_session request adds a second, visible line saying the fallback happened, instead of either silence or a misleading absence. Tests, README, config.example.json and the changelog fragment updated to match; the old "withholds the hint" test is replaced with tests asserting the corrected path plus the presence/absence of the notice line (positive control). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two or more interactive Claude Code sessions share one project's
.rememberstore by design, even across git worktrees (_resolve_memory_project_dir, #56). But every session wrote its/rememberhandoff note to the same fixed path,remember.md(session-start-hook.sh:795), with no namespacing or locking -- the second session's/remembersilently overwrote the first's, which then survived only in that session's own transcript. Distinct from #221/#222, which protect a pending handoff from a session that never writes one back; this is two sessions that each do write one, to the same name.Fix
A new
handoff_modeconfig key:single(default, unchanged) -- every session sharesremember.md, byte-identical to every previous release. Off by default like every other behaviour-changing key in this file (data_dir,git_restore.enabled,reject_pattern), so an existing install's disk is unchanged by the upgrade.per_session-- the handoff becomesremember.<session_id>.md, keyed by theSessionStartpayload's ownsession_id(already sanitized against[A-Za-z0-9._-]plus rejection of./../empty, session-start-hook resolves PREV_JSONL by mtime position, so at source=startup it is off by one — #206's fix 2 is still open, and recovery force-saves the wrong session #270). History,recent.md,archive.mdand consolidation are untouched; only the single handoff slot is namespaced.The handoff-delivery/re-delivery-labelling record (
tmp/remember.delivered) is namespaced the same way inper_sessionmode, so two sessions never race one shared fingerprint file; the pre-existing legacy-record migration is correctly skipped in that mode.If
per_sessionis requested but no usablesession_idreaches the hook, the session falls back to the shared file -- the=== HANDOFF ===hint still points at it (that path is still correct, including in external storage mode, where it is the only real path), but a visible second line now says the fallback happened, so it never reads as isolation that never applied.A first version of this fix withheld the hint outright on that fallback -- an
Explorereview caught that this also silently suppressed the pre-existing, correct external-mode hint, reintroducing the exact misdirection bug that hint exists to prevent. Fixed in a follow-up commit; see commit messages for the full account.Scope decision: no automatic pruning of stale
remember.<session_id>.mdfiles ships with this change. A handoff is the user's own writing with no copy anywhere else, and a delete keyed on "the transcript looks gone" can misfire for reasons other than the transcript actually being gone. Stale per-session files accumulate until removed by hand -- a legitimate, deliberately conservative outcome per the brief, not an oversight.Feature scope, not a bugfix -- this does not qualify for auto-merge under this repo's release gates and is expected to wait for a maintainer's manual merge decision.
Below-bar finding, not fixed here: the new degraded-mode notice line contains an em-dash written to stdout, which could raise
UnicodeEncodeErrorunder a Windows console using cp1252 -- reasoned, not observed (no Windows box available). This is not a fresh risk: three pre-existing lines in the same file already print em-dashes to stdout/stderr unconditionally, so fixing only the new line would leave the file's own Unicode-to-stdout convention inconsistent rather than settled. That is a design decision (whether this file should ever print non-ASCII to stdout on a console that may be cp1252) spanning the whole file, not this one new line, so it is filed rather than fixed here.Tests
TDD: red before the fix (
4 failed, 1 passed), green after (5 passed, later7 passedonce the review-driven correction rewrote the withheld-hint test into three: the corrected path, the notice's presence when degraded, and its absence when not -- a positive control). Full suite run once (mandatory: this touches a core shared hook) caught one unrelated cross-cutting guard failure (test_pep604_floor_guard.py, tripped by this PR's own test file usingstr | Nonesyntax below this repo's Python 3.9 floor) and it was fixed.Closes #363