Repository navigation
Index project_dir → slug at the store root, so the slug record is reachable in the layout we ship (#297) - #299
Merged
Conversation
…d is reachable in the layout we ship #296 wrote the slug to <REMEMBER_DIR>/tmp/session-slug. With {slug} in data_dir, REMEMBER_DIR is itself named by the slug, so a caller had to know the answer to open the file holding it. That was shipped as one documented hole; #297 filed that it is the configuration config.user.example.json recommends, and those are the installs most likely to have a non-bash caller. session-start-hook.sh now also writes <store_root>/tmp/sessions, where the store root is the data_dir template truncated at {slug} — the one path in that layout a caller can name. Rows are tab-separated with project_dir last, matched verbatim: nothing is derived from the project path, because any derived key is a second algorithm over it, which is what #294/#296 delete. base64 does not escape that either — a 260-char path encodes to 348 bytes, past the 255-byte filename limit, and truncating means appending a hash. Written only when the template carries {slug}: elsewhere the store root and REMEMBER_DIR coincide and the record is already nameable, so the default layout pays nothing and no second file can disagree. One store has many writers, so the rewrite is taken under a dedicated lock and published with mv. No timestamps and no expiry, for the reason the record carries none; bounded at 1000 rows, dropped by position. A project_dir carrying a newline or a tab gets no row — a row cannot be keyed by the value it is refusing. Measured: +27 ms min / +28 ms median on a 260 ms session-start hook (macOS, n=25 interleaved), +31 ms at the 1000-row cap. The per-tool-call path is untouched — REMEMBER_STORE_ROOT is resolved by assignment rather than a command substitution, which bootstrap-dirs.sh would have paid as a fork on every tool call. Also excludes /tmp/ at the backup repo root: in external mode that repo IS the store root, so the index sits at its top level (#285). test_session_start_hook_does_not_source_the_lock_library is narrowed, not satisfied: its danger is save.lock specifically, so it now asserts session start may name exactly one lock and it must be its own, plus a new test pinning that lock's timeout as bounded. Closes #297 Co-Authored-By: Max <noreply>
This was referenced Aug 3, 2026
Closed
Merged
Closed
fdaviddpt
added a commit
that referenced
this pull request
Aug 8, 2026
…e sweep (#336) * fix(#326,#332): bound the marker's range, not just its syntax — and let a check do the sweep #326 — the four cooldown guards validate SYNTAX and not RANGE. A digits-only marker ahead of now is accepted, makes ELAPSED negative, and a negative ELAPSED is -lt any cooldown, so the gate takes its `exit 0` — which sits ABOVE the line that rewrites the marker. The self-heal the last three releases rest on is unreachable on exactly the path that needs it: no save, no compression, no git backup, permanently and mutely, until the wall clock catches up. Three states, not two. Out of range now PROCEEDS, resets the marker at the point of rejection where the reset is reachable, and says so once in hook-errors.log via a new report_error() in log.sh. A silent clamp would trade a mute stuck throttle for a mute wrong value. post-tool-hook.sh is deliberately asymmetrical: it declines the cooldown it cannot substantiate and does nothing else — no rewrite (the marker is save-session.sh's), no diagnostic (one per tool call), no added spawn or read (#299/#330). The source comment at save-session.sh:155 asserted the opposite and is corrected here. That comment, not the CHANGELOG, is why the issue was reopened: PR #328 closed it by referencing it. #332 — twelve remaining sites read a case-guarded value into $(( )) with no 10#, not the seven the issue lists. The five extra were found by tests/test_arith_base_lint_332.py, which sweeps scripts/ and hooks.d/ for the shape mechanically and is the part that prevents a sixth issue. ShellCheck does not flag it (koalaman/shellcheck#2679). No shared helper: a helper a new author does not know about cannot stop them writing the sixteenth site. tests/test_ndc_day_boundary.py was suppressing NDC by writing a marker 34,000 years in the future — #326's defect used as an off switch. Switched to _suppress_ndc, the brake the product documents (#159). Targeted RED verified before the fix at all four sites; full suite 1545 passed, 43 skipped. Windows unverified — CI is the authority. Co-Authored-By: Max <noreply> * review(#336): a fifth site the issue never named, and a lint that would have cried wolf Findings from the /code-review pass on PR #336, fixed in the same run. FIFTH SITE (#326). hooks.d/before_session_start/50-git-restore.sh reads `started=` through the same digits-only case. A value ahead of now makes _age negative, so _fetch_health answers "in-flight" — the one state meaning "wait, something is already running" — about nothing, and _spawn_fetch takes its early return so the only writers of the record never run. Same geometry as the four sites #326 enumerates, and not on its list. The harm is worse than a wrong label: the caller then prints "already up to date with origin/main" off refs no fetch refreshed, which is exactly what _fetch_health's own header forbids. Now answers "abandoned" and spawns a real fetch that rewrites the record. _fetch_health stays pure — its stdout is the verdict, read through $( ) — so the diagnostic goes in _spawn_fetch. LINT COULD NOT BE TRUSTED AS A GATE (#332). `case "$1" in` captures the guarded name as the bare string "1", and the matcher did not require the $ sigil, so every `$(( x + 1 ))` in a file guarding a positional parameter was a finding. lib-lock.sh guards two, so the next ordinary arithmetic there would have failed CI for no reason. Numeric names now require the sigil. ITS OWN FIXTURE WAS NOT THE SHAPE IT CLAIMED. `''` inside a single-quoted Python literal closes it and opens another, so the planted guard had silently become `case "$LAST" in |*[!0-9]*)`. A self-test whose fixture is not what it plants still goes green, and green here is supposed to mean "looked, found none". Pinned by a test. STALE LINE-NUMBER CITATIONS. Six comments this PR added cited line numbers; three were already wrong at commit time. All replaced with construct names. A PR that exists because a comment outlived the truth should not add more. Targeted RED verified before each fix — including catching that the first draft of the restore tests passed vacuously, because a doubled backslash put a literal \\n in the state file and the digits-only guard rejected it for the wrong reason. Full suite 1551 passed, 43 skipped. Windows unverified. Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Aug 28, 2026
… budgets (#330) (#380) * test: pin per-tool-call hot path cost with a spawn+read-builtin harness (#330) #329's substring guard in test_case_divergence_298.py checks for three literals; #330 named vectors that reintroduce #298/#299's per-tool-call cost while staying green against it -- a git wrapper spelled through a variable or `command`, and an extra file read or loop that spawns nothing at all. tests/test_hot_path_cost_pin_330.py adds the measured pin the issue asked for: a spawn budget (reusing the existing harness) plus a new bash-builtin-`read` count via `bash -x` tracing, proven non-vacuous against scratch reproductions of each named vector, with the pure-compute boundary neither pin can see stated rather than hidden. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP * test: widen the #330 read pin to mapfile/readarray, cross-reference #298's substring test Self-review findings: the reviewer flagged that #298's substring-test docstring still read as the whole story on hot-path coverage, with no pointer to the new cost pin that closes its gap -- cross-referenced both ways. The auditor flagged that _is_read_builtin only matched the literal word "read", so a rewrite from a `while read` loop to `mapfile`/`readarray` (same file, same cost, zero new spawns) would silently evade the new pin -- widened the match set and named the one vector that remains genuinely unreachable (`x=$(< file)`, invisible to xtrace itself, confirmed locally) in the module docstring instead of leaving it undiscovered. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP * fix: eliminate the same-second cache-tie race in test_hot_path_cost_pin_330.py (#330) CI (macos-latest, 3.11/3.12) went red on the new file's own positive control: "the injected read spawned a process", with a spawn list that was pure cold-path signature (python3 -V, git rev-parse, jq -s, the trap-stripping sed, the temp sweep). ubuntu and windows legs stayed green. Established rather than guessed: the fixture wrote config.json with a plain write_text() instead of tests.env_cache.write_config(), and never verified warmth with EnvCacheProbe. scripts/lib-env-cache.sh refuses its own cache unless it is `-nt` every config layer, and macOS's system bash 3.2.57 -nt compares whole SECONDS (confirmed via tests.env_cache.nt_granularity() == "second" on this platform) -- so a config written in the same wall-clock second as the cache publish TIES rather than loses, the cache is rejected, and every "warm" measurement in this file was silently re-resolving instead. Reproduced deterministically by forcing the tie by hand: identical spawn signature to the CI failure. This is the exact #303 defect class this repo's own tests.env_cache module exists to prevent, already used by the sibling file this one is modeled on (test_post_tool_fast_path_350.py) -- this file simply never adopted it. Fixed with the established pattern rather than a platform skip, since warmth is genuinely reachable everywhere once the race is closed: config.json now goes through write_config() (backdated past any second boundary), and every measured (non-priming) run goes through a new _measure() helper that brackets it with an EnvCacheProbe and fails loudly -- naming which run went cold and why -- instead of silently reporting a cold-path count as the warm one this file claims to pin. Verified stable across repeated local runs on this machine's bash 3.2.57 (matching macOS CI) after the fix; the x=$(< file) boundary this file already names is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Nov 1, 2026
… the byte-pin guard test_the_per_tool_call_path_is_not_touched (#298/#299) byte-pins lib-memory-dir.sh against origin/main; the new _remember_lmd_set_dir_unsafe block is a deliberate addition this guard had no allowance for yet. Red before: 1 failed, 21 passed in tests/test_case_divergence_298.py. Green after: 26 passed (that file plus test_sanctioned_divergence_state_440.py). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Nov 1, 2026
* Fix #920: close three gaps in #902's REMEMBER_DIR safety guard Centralise the unsafe-dir check in lib-memory-dir.sh (new REMEMBER_DIR_UNSAFE flag) and gate every mkdir -p "$REMEMBER_DIR/..." site that was not already covered by #902's own guard -- bootstrap-dirs.sh, three more sites in post-tool-hook.sh, session-start-hook.sh (x3), session-end-hook.sh and write-handoff.sh. Fix log()'s own write-to-sink path so a FATAL logged while the sink is active (an append to /dev/null that always succeeds) reaches stderr instead of vanishing silently. Teach both guard predicates (_remember_dir_is_unsafe, _remember_log_dir_unsafe) to accept a UNC-rooted value as absolute rather than misclassifying it as unsafe. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix #920 self-review: dedupe FATAL line, fix stale comments, pin guard sync Explore review (against commit c15e4f3) found a real regression: lib-memory-dir.sh's new unsafe-dir echo and log.sh's own pre-existing one both fired on every tool call once REMEMBER_DIR went unsafe, doubling hook-errors.log noise. log.sh now reads the already-exported REMEMBER_DIR_UNSAFE flag instead of recomputing and re-announcing it. Also fixes a self-contradictory comment ("above" vs "further down this file" about the same call site) and a fictional intermediate line-number claim in the scanner allowlist's own history comment. Adds a pin that lib-memory-dir.sh's and post-tool-hook.sh's necessarily-duplicated _remember_dir_is_unsafe copies (the latter exists because post-tool-hook.sh's fast path never sources lib-memory-dir.sh) stay byte-identical, so a future edit to one that forgets the other fails loudly. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix #920 CI: rename duplicate top-level function, compact the new guard block CI's test_compile_hooks_900.py failed on ubuntu-latest/3.9: the #900 compiled- hook build inlines every sourced file's top level into one script, and lib-memory-dir.sh's new _remember_dir_is_unsafe collided under the SAME name with post-tool-hook.sh's own pre-existing (#902) copy once both land in the same compiled text. Renamed lib-memory-dir.sh's copy to _remember_lmd_dir_is_unsafe and updated tests/test_remember_dir_guard_920_sync.py to compare the three predicates' LOGIC (not their names) across lib-memory-dir.sh, post-tool-hook.sh and log.sh. Also compacted the new block's if/else/fi into a single && guard, trimming compiled bytes toward session-start-hook.sh's 120 KiB release budget (further addressed in the next commit). Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix #920 CI: shrink the new guard predicate to fit session-start-hook.sh's byte budget check_release_tree.py failed on the compiled session-start-hook.sh (123352 bytes, over the 120 KiB release budget) -- that hook was already within 37 bytes of the budget before this fix (per #1002's own comment), and lib-memory-dir.sh's new _remember_lmd_dir_is_unsafe block alone added 472 bytes to every hook that sources it (unconditionally, at top level, regardless of whether that hook's own code reads REMEMBER_DIR_UNSAFE -- tree-shaking only drops unused FUNCTIONS, not top-level code that runs to set the flag). Rewrote the predicate to the smallest form that still preserves byte-wise (#695) LC_ALL=C matching: two `[[ ]]` tests with early returns instead of a nested `{ } || [[ ]]` combined with a separate if/else/echo block, and a single bracket class `*[$'\n\r']*` for the embedded-control-character case instead of two separate `$'...'` glob tests. Also widens the UNC acceptance from "two backslashes then one non-backslash character" to "two backslashes then any one character", which incidentally narrows (but does not close) the auditor's below-bar bare-backslash finding. Updated tests/test_remember_dir_guard_920_sync.py to assert BEHAVIOURAL agreement across all three predicates (a table of REMEMBER_DIR values, run through each predicate, compared) rather than textual body equality -- the compact rewrite legitimately reads differently from the other two copies while classifying every case the same way, so a body-text diff is no longer the right invariant. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix #920 CI: merge the guard predicate and flag-setter, drop the unneeded export Further shrinks the new lib-memory-dir.sh block toward session-start-hook.sh's 120 KiB compiled-hook budget. Merges the separate predicate function and the if/echo block that called it into one function that sets REMEMBER_DIR_UNSAFE directly (default unsafe=1, cleared to 0 only on a recognised absolute/UNC shape, same as before). Drops `export REMEMBER_DIR_UNSAFE`: nothing reads this variable across a process boundary -- every script that checks it has already sourced lib-memory-dir.sh itself and computed its own copy in its own process, so export was pure overhead paid by every hook that sources this file. Co-Authored-By: Claude Sonnet 5 <[email protected]> * Fix #920: rewrite changelog fragment in plain language for non-technical users Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix #920 CI: sanction lib-memory-dir.sh's new unsafe-dir predicate in the byte-pin guard test_the_per_tool_call_path_is_not_touched (#298/#299) byte-pins lib-memory-dir.sh against origin/main; the new _remember_lmd_set_dir_unsafe block is a deliberate addition this guard had no allowance for yet. Red before: 1 failed, 21 passed in tests/test_case_divergence_298.py. Green after: 26 passed (that file plus test_sanctioned_divergence_state_440.py). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix #920 CI: pass REMEMBER_DIR probe values through env, not argv, on Windows windows-latest's four pytest legs plus the compiled-hook leg failed two tests in TestUncPathIsSafe (test_remember_dir_guard_920.py) and the cross-predicate consistency test (test_remember_dir_guard_920_sync.py): both guard predicates reported a value carrying an embedded newline as SAFE on windows-latest only, never on ubuntu/macos, and only for the two CASES entries containing a raw newline byte -- every newline-free case agreed across all three predicates on every platform. The guard predicates themselves are unchanged, correct POSIX shell. The break is in how the test harness got the probe value into the child bash process: a bare (list2cmdline leaves it unquoted -- no space/tab/quote to force quoting) argv element carrying a raw newline does not reliably survive to the child's own argv on Windows, since a win32 command line is a single string CreateProcess hands the child, which re-tokenizes it itself. An environment variable's value is not re-tokenized the same way, so both helpers now pass the probe value via env instead of argv. Reasoned, not observed: no Windows host available locally to reproduce the original failure or re-run the fix directly. Verified instead that the change does not regress the 22 tests in these two files plus test_remember_dir_guard_902.py on macOS (all still pass), and that the mechanism change is the minimal one that explains an argv-only, platform- only, newline-only failure pattern. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix #920 review round 2: close remaining REMEMBER_DIR-unsafe gaps the first pass missed Seven findings from the scheduler's own review of 5345c9e, all addressed with TDD (red before fix, positive control after): 1. HIGH: capture-gap-check.sh's fast path (inherited PROJECT_DIR/ PIPELINE_DIR/REMEMBER_DIR, #1069/#1079) never re-sources lib-memory-dir.sh, so it could only see REMEMBER_DIR_UNSAFE if the parent exported it -- and lib-memory-dir.sh's own REMEMBER_DIR_UNSAFE=1 was a plain assignment, never exported. Now exported, and all three of this file's own mkdir sites (session-slug, case-divergence, REMEMBER_STORE_ROOT/tmp) gate on the inherited flag. Evidence for the main-regression question: origin/main (no #1064 at all) has ZERO occurrences of REMEMBER_DIR_UNSAFE in lib-memory-dir.sh -- gap 1 was never fixed there; #1067/#1086 added capture-gap-check.sh's own new mkdir sites onto that same pre-existing, still-open gap, not a regression of a working #902 guard. 2. HIGH: session-start-hook.sh:457's tmp/session-started.d mkdir (added by #1084/#1086, after this issue's own 806/1200/1630 gating pass) was never covered. Gated; new full-SessionStart-run test added (not just bootstrap-dirs.sh in isolation). 3. MEDIUM: changelog.d/920.fixed.md's "every memory-folder save site is now covered" overclaimed before round 2 landed the above; reworded to "every ... site this issue found", now true. 4. MEDIUM: doctor.sh's REMEMBER_DIR line printed OK unconditionally even when REMEMBER_DIR_UNSAFE=1 -- the refusal's only other trace is a stderr-only FATAL line Claude Code hides for exit-0 hooks, and user-prompt-hook.sh/capture-gap-check.sh both discard. Now FAILs (human report) and reports remember_dir_unsafe:true/false (--json, always present, never an absent key). 5. LOW: log.sh's _remember_log_dir_unsafe is never called at runtime any more -- documented as deliberately retained (not dead code to delete), since test_remember_dir_guard_920_sync.py extracts and runs it as the "log" arm of the three-way consistency check. 6. LOW: lib-memory-dir.sh's UNC regex accepted a third backslash (`[\\][\\]?*`) where post-tool-hook.sh/log.sh's copies refuse it (`[\\][\\][^\\]*`) -- brought in line with the stricter copies; new sync-test case pins it. 7. LOW: session-end-hook.sh's WARNING said "could not create ... /logs/autonomous" for both an unsafe-dir refusal and an ordinary mkdir failure. Split into two distinct messages. Every fix's test was confirmed red against the unfixed code and green against the fix, including the two-item hazard my own first session-start test initially missed vacuously (see that test's own docstring: an absolute-but-newline-bearing REMEMBER_DIR resolves outside cwd, so "nothing leaked under cwd" alone passes even with the gate fully reverted -- caught by re-deriving against "would this test pass if the code did nothing", fixed by asserting against the actual unsafe path instead). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix #920 CI: triage the new doctor.sh win32-blanket-skip module tests/test_windows_skip_triage_497.py (#497) requires every module with a module-level `pytestmark = pytest.mark.skipif(sys.platform == "win32", ...)` to have a row in docs/windows-skip-triage.md -- the new tests/test_doctor_unsafe_dir_visibility_920.py carries the same bash-subprocess skip reason as its sibling doctor.sh modules and had none. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
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.
Closes #297.
The problem, verified
config.user.example.json:9ships"data_dir": "~/.remember/{slug}", under a_purposethat reads "Copy this file to~/.remember/config.jsonto enable external storage mode".scripts/lib-memory-dir.shsubstitutes that placeholder with the slug, soREMEMBER_DIRis named by the slug — and #296's record lives at<REMEMBER_DIR>/tmp/session-slug. A caller had to know the answer to open the file holding it.I shipped that as "one documented hole" with #296. @jqit-ricky's point stands: it is not an edge, it is the configuration we recommend, and those are the installs most likely to have a non-bash caller at all.
What this does
session-start-hook.shalso writes<store root>/tmp/sessions, where the store root is thedata_dirtemplate truncated at{slug}— the one path in that layout a caller can name from the template alone. Line 1format=1; every later line is one project, tab-separated,project_dirlast:Why an index and not the reporter's option 1
Option 1 — a second copy at
<store root>/tmp/session-slug-<key from project_dir>— needs a key both sides compute the same way. That is a second algorithm over the project path, which is exactly what #294 and #296 exist to delete, re-created one layer down.The escape is a language-neutral encoding, and the arithmetic kills it: base64 of an N-byte path is
4*ceil(N/3), so the 260-character paths #294 was about come out at 348 bytes and the 300-character vector intests/slug_vectors.pyat 400 — past the 255-byte filename limit of every filesystem in play. Truncating to fit means appending a hash, i.e. a slug algorithm under a different name.Matching on
project_dirverbatim asks the caller to compute nothing, and keeps the property the reporter's own directory scan already has: it cannot answer wrongly, only fail to answer.The questions it had to answer
Where it lives when there is no
{slug}. Nowhere — deliberately.REMEMBER_STORE_ROOTis empty unless the template is absolute and carries{slug}. In the default layout and in a single-directory external store, the store root andREMEMBER_DIRare the same directory and<REMEMBER_DIR>/tmp/session-slugis already nameable, so no index is written: the common layout pays nothing, and there are never two files that could disagree about one slug. Pinned bytest_the_default_layout_gets_no_indexandtest_a_store_without_a_slug_placeholder_gets_no_index.Concurrency. One store root, many writers — several projects and several worktrees of one project. The rewrite is taken under
sessions.lock(the plugin's ownlib-lock.shprimitive) and published withmv; a session that cannot take it writes no row rather than racing, because the per-project record stays authoritative.test_concurrent_session_starts_do_not_lose_a_rowstarts six simultaneously.Stale entries. Kept, and never pruned. Same reasoning as #296's no-timestamp comment: the slug is a pure function of the path, so a row for a deleted directory can never be matched by a caller holding a live
project_dir, and if the path is recreated the row is still correct. Pruning by "does the directory exist" would drop correct rows for anything on an unmounted share. The only bound is a 1000-row cap dropping by position, which the rewrite maintains as last-write order — that is not a staleness test and the README says so.Three states, not two. No index / index with no row for your
project_dir/ a row withstatus=okand a non-emptyslug=. The middle state is the one that matters: an empty slug resolves to~/.claude/projects/itself.Unrepresentable paths. A
project_dircarrying a newline or a tab gets no row — the record can takestatus=unavailable, but a row cannot, because it would have to be keyed by the very value it is refusing. The per-project record still saysstatus=unavailablefor that project;test_a_project_dir_the_index_cannot_hold_is_left_out_rather_than_written_wrongasserts both halves.Hot path. Untouched, and this took a second pass worth flagging in review:
REMEMBER_STORE_ROOTwas first resolved with a command substitution inlib-memory-dir.sh— whichbootstrap-dirs.shwould have paid as one fork per tool call, sincepost-tool-hook.shsources it. It assigns instead (the_lock_self_setpattern),test_resolving_the_store_root_costs_no_forksays so, andpost-tool-hook.sh/lib-slug.share byte-identical.Measured, not guessed
Interleaved A/B against
origin/main, macOS, n=25, external{slug}mode:on a ~260 ms session-start hook, once per session. The cost is the lock and the rewrite, not the file size. Sourcing
lib-memory-dir.sh(the per-tool-call path) is indistinguishable from baseline.One guard narrowed rather than satisfied
test_session_start_hook_does_not_source_the_lock_libraryforbade session start from touchinglib-lock.shat all. Its stated danger issave.lock— held for the whole of a save including its Haiku call, which a SessionStart hook waiting on it would put in front of the user's first prompt (#204, #227). That danger is about which lock, not about locking, so the assertion is now the exhaustive form of what it meant: session start may name exactly one lock and it must be its own, plus a new test pinning that lock's timeout as bounded and small. Flagging it explicitly because weakening a guard to make your own change pass is the move that deserves the most suspicion in review.Also
50-git-backup.shexcludes/tmp/at the repository root beside its per-slug rules.REPO_ROOTisdirname "$REMEMBER_DIR", so in external mode the backup repository is the store root and the index sits at its top level. This hook's owngit addis pathspec-limited to$SLUG/and could never take it — but a user'sgit add -Awould push a file naming every project on the machine and its absolute paths, which is remember.delivered is per-machine state but is committed by the git backup: a first delivery on a second machine reports as already-seen, and every concurrent run conflicts #285's subject exactly.config.user.example.jsonkeeps{slug}(it is the right layout) and gains a_notesline saying where the index is.project_diris last because a tab is legal in a POSIX path), and the costs. It also tells anyone currently scanning<store root>/*/tmp/session-slugthat this is that, with a documented path and one file read instead of a directory listing.Tests
tests/test_slug_index_297.py, 26 tests. Full suite: 1411 passed, 43 skipped, coverage 94%.