Repository navigation
Description
Summary
.remember/now.md was silently truncated in place while my session was active — a full 275-line
file (multiple sessions' PENDING: entries and handoff notes going back several days) was replaced
with just the 5-6 most recent entries. This happened at least twice within a few minutes, live,
with no process visibly running (checked via ps aux) at the moment I inspected it — so it looks
like a short-lived hook invocation from a concurrent session, not a stuck/long-running loop.
Environment
- Plugin version: 0.21.0
- Setup: a single git repo checked out multiple times as sibling worktrees, several concurrent
Claude Code sessions running against the SAME shared.remember/directory (each session in its
own worktree, butREMEMBER_DIRresolves to the same path across all of them by design). remember:doctor's own report at the time showed capture otherwise healthy (VERDICT: capture is working), so this isn't a capture-pipeline failure — the append pipeline works, something else is
overwriting the result.
What I observed
.remember/now.mdhad ~275 lines (many sessions' entries) confirmed present on the git history
(origin/main, last touched by a normal append-only commit).- Mid-session, the working-tree copy of that same file (never committed) was found reduced to
only 5 new entries with recent timestamps (19:56–20:08), with all ~270 older lines gone. - I restored the full content from
origin/main, folded the 5 new (genuinely new, not yet landed)
entries back in, and committed that merged version — confirmed no data was lost onmain. - Within roughly a minute of restoring the working-tree file to the full, correct content, it was
truncated again, back down to a short form — with no long-running process visible inps auxat
the time I checked, suggesting a hook that runs briefly, rewrites the whole file, and exits,
rather than something stuck in a loop.
Suspected cause
Best guess (not confirmed by reading the hook's source): a save-session.sh-style hook that treats
now.md as "this session's own recent-activity buffer" and does a non-atomic truncate + rewrite
of the whole file with only its own recent entries, rather than an append. In a single-session
setup this would be invisible (each session already logically "owns" the file's recent tail). But
when several concurrent sessions share the same physical .remember/now.md (multiple worktrees of
one repo), each session's hook firing appears to stomp on every other session's history, and the
file's actual content depends on whichever session's hook last fired.
Suggested fix direction
- Append rather than overwrite when writing to
now.md(at minimum, read-modify-append with a lock
or an atomic rename-based swap, not a blind rewrite of the whole file). - If the design intent really is "each session keeps its own rolling recent buffer" rather than a
shared history, consider namespacing that per-session (or per-worktree) rather than sharing one
path across concurrent sessions, sinceREMEMBER_DIRis documented to resolve to the same
directory across a repo's worktrees.
Impact
No data was actually lost long-term in my case, because the shared file's committed history on
origin/main was intact and I was able to reconstruct/merge from that. But a setup that trusted the
live working-tree copy of now.md as the source of truth (e.g., reading it directly rather than
via git) would have silently lost every other concurrent session's pending items and handoff notes.
Happy to provide more detail/logs if useful — didn't want to guess further at the hook's exact
internals without reading its source, which I didn't want to do without your context on intended
behavior.
Activity
Fix CI: reword #614 comment so the arith-base lint stops matching prose
Fix: NDC commit race where a stale offset survives the size check (#614…
Fix: distinguish absent from unreadable NDC generation marker (#619) (#…