Repository navigation
Description
Description
scripts/lib-memory-dir.sh writes a per-invocation merged-config file at $SYS_TMPDIR/remember-config-$$.json (line ~274) and relies solely on an EXIT trap (line ~336-344) to remove it. On Windows / Git Bash, that trap does not reliably fire for the short-lived hook processes this plugin spawns (user-prompt-hook.sh, post-tool-hook.sh, etc.), so the file is never cleaned up. Over time this leaves tens of thousands of stale remember-config-*.json files sitting directly in the OS temp directory.
Reproduction
- On Windows, use Claude Code with this plugin installed and Git Bash as the shell, for normal interactive sessions over several days (the hook fires on every tool call per post-tool-hook.sh: apply the #227 env-cache fast path to PostToolUse (~0.75-1.0 s per tool call on Windows) #350's description of
post-tool-hook.sh). - Watch
$TEMP(C:\Users\<user>\AppData\Local\Temp) accumulateremember-config-<pid>.jsonfiles that are never removed.
Actual behavior
Observed on a live machine: 23,908 leaked remember-config-*.json files in %TEMP%, accumulating at roughly one every ~13 seconds during active use, with the oldest dated 12 days prior to observation. Each file is tiny ({}, ~2 bytes), so this isn't a disk-space problem, but the sheer directory-entry count (this alone was ~42% of ~57k total items in the user's %TEMP% root) makes any tool that enumerates that directory (Get-ChildItem, antivirus scans, backup software) measurably slower — a plain non-recursive Get-ChildItem $env:TEMP took multiple minutes and had to be killed.
Expected behavior
The merged-config temp file should be removed regardless of how the hook process's lifetime ends on Windows — i.e. cleanup shouldn't depend solely on a bash EXIT trap firing, since on this platform the hook process appears to often not exit through a path that runs it (most likely: the harness terminates/kills the short-lived hook process after collecting its output rather than letting it exit normally).
Notes / possible directions
- Confirmed the same trap-only cleanup is still present on
main(checked via the GitHub API againstscripts/lib-memory-dir.sh), so this isn't fixed by picking up a newer release. - A defensive fix might pair the
EXITtrap with an opportunistic sweep: on each new invocation, delete anyremember-config-*.jsonin$SYS_TMPDIRwhose mtime is older than some small threshold (e.g. a few minutes) before writing the new one. That bounds the leak regardless of why individual traps fail to fire, without needing to root-cause the Windows process-termination path. - Happy to test a fix against this machine if useful — the leak reproduces readily here.
Environment
- claude-remember version: 0.7.3 (as cached under
claude-plugins-official; confirmed same code path present on currentmain) - Claude Code version: 2.1.173
- Shell: bash 5.3.15 (Git for Windows / MINGW64)
- OS: Windows 10 Pro 10.0.19045
Activity
fix: bound and sweep the merged-config temp file leak on Windows (#362)…
fix: quote bootstrap-dirs.sh's EXIT-trap path so an apostrophe cannot…
release 0.22.0 — guards that were written next door
fdaviddpt commentedon Aug 27, 2026
Thank you for this — and for the measurement. "23,908 files, ~42% of the temp root, oldest 12 days old, a non-recursive
Get-ChildItemhad to be killed" is what turned this from a theoretical trap-may-not-fire note into something with an obvious cost. Noting that the file itself is ~2 bytes so it isn't a disk problem, it's a directory-entry problem, aimed the fix correctly.Your suggested direction is what shipped in v0.22.0 (#371): the
EXITtrap stays, paired with an opportunistic sweep of staleremember-config-*.jsonon each invocation, so the leak is bounded regardless of why an individual trap fails to fire — no need to root-cause the Windows termination path first. Fixing it also surfaced a path-normalization mismatch betweenresolve-paths.shandbootstrap-dirs.shon Windows separators, which is fixed as well.One follow-up worth flagging: the first cut of the sweep introduced a quoting bug in the trap path, filed and fixed as #375 before the release, so v0.22.0 is the version to take.
If you do get a chance to check
%TEMP%on that machine after a few days on v0.22.0, I'd be glad to hear the count held flat.Unrelated, but since you were digging through
%TEMP%and hook internals anyway: two sibling plugins from the same shelf —Both are in the same marketplace:
/plugin marketplace add Digital-Process-Tools/claude-marketplace. Both are shell-and-Windows-sensitive in the same ways this plugin is, so if you hit anything like #362 there, that report would be just as welcome.Prune stale per-session delivery records; keep session-start-hook.sh'…
fix: ten stale "0600 per PID" comments/docstrings, made false by #429'…
Fix #1079, #1060: stop re-bootstrapping config on every SessionStart …