Skip to content

fix: init seeds the store the server reads; repo keeps config + hooks (GIT-115) - #57

Merged
1 commit merged into
mainfrom
bugfix/GIT-115-store-root
Sep 23, 2026
Merged

1 commit merged into
mainfrom
bugfix/GIT-115-store-root

Conversation

@nTEG-dev

Copy link
Copy Markdown
Member

GIT-115: init writes the store where the server reads it; the repo keeps config + hooks

Just upgrade the package. Nothing to change on your database. Local files only.

Implements Chris's ruling: move only the store. config.json and the hook scripts stay in the repo's .gitmem/.

What was wrong

  • init seeded <cwd>/.gitmem, but the server has read ~/.gitmem since GIT-91. A fresh install found no starter lessons.
  • session_start then reported the repo's .gitmem/ as "Memory store found but NOT being read", because config.json alone counted as a live store.
  • The SessionStart hook read the repo's project name only with jq.
  • uninstall and the telemetry commands used <cwd>/.gitmem.
  • The wizard and gitmem uninstall matched hooks by the bare word "gitmem".

Fix

  • bin/gitmem-root.js resolves the store the way gitmem-dir.ts does: GITMEM_DIR, then GITMEM_HOME/.gitmem, then ~/.gitmem.
  • The wizard and init-scars seed learnings, threads, sessions, decisions, scar-usage, closing-payload.json and its template into that root.
  • The repo's .gitmem/ holds only config.json with { project } and hooks/.
  • feedback_enabled is written to the store's config.json, because the server reads it there. It is written only on opt-in.
  • The stranded-store check no longer counts config.json, starter lessons or the welcome thread as evidence. A learning, thread or decision of the user's own does count now; main ignored those entirely.
  • session-start.sh reads the project name with node when jq is absent.
  • uninstall removes only the repo's config.json and hooks/, and leaves anything else in the repo's .gitmem/ alone. The store is shared by every project, so it is kept unless --all is given or the user declines the keep prompt.
  • Wizard hook merge and uninstall hook removal use GIT-120's bin/hooks-merge.js. The file is identical to the one in fix: install/uninstall-hooks merge per event, keep foreign hooks (GIT-120) #55, so the two branches stack without a conflict.
  • gitmem telemetry uses the server's root.

Evidence

Fresh-install e2e tests/e2e/git-115-fresh-install.test.ts uses a clean HOME and clean repo. It runs init, the real SessionStart hook, then the built server with session_start and recall, then uninstall.

  • Branch: 9/9 pass.
  • Main: 9/9 fail. Main has no ~/.gitmem/learnings.json, recall returns "No relevant scars found", session_start shows "NOT being read", and the hook gives no project hint without jq.

session_start does not list scars on any install. The test checks it two ways: session_start shows the welcome thread that init seeded into the store under the repo's project, and a recall in that session returns the starter scar "Database Migration Without Rollback Plan".

Check Branch Main
Unit 1362 (+5) 1357; the 6 new root-evidence cases fail
Hook suite, stock macOS PATH and slim PATH, scratch HOME 47/47 each new project-hint test fails without jq
cli-fresh-install.test.ts 27/27 3 failing, stale since GIT-91/99
tsc clean

Both e2e files are now wired into CI.

Old tests changed

  • gitmem-root-resolution.test.ts: "counts a deliberate project-scoped install (config.json)" now asserts the opposite, per the ruling.
  • gitmem-root-symlink.test.ts: the live-store fixture now holds a learning instead of config.json.
  • cli-fresh-install.test.ts: every CLI call now runs with a scratch HOME. It used the developer's real HOME, so with this change init wrote into the real ~/.gitmem. The init assertions now expect the new layout. The Stop-hook wording test names its registry through GITMEM_DIR, as GIT-99 requires.

🤖 Generated with Claude Code

…ig + hooks (GIT-115)

init seeded <cwd>/.gitmem while the server reads ~/.gitmem (GIT-91), so a
fresh install had no starter lessons and was told its store was "NOT being
read". The wizard and init-scars now seed learnings, threads, collections
and the closing payload + template into the root the server reads
(GITMEM_DIR, then GITMEM_HOME/.gitmem, then ~/.gitmem). The repo's .gitmem/
keeps only config.json (project name) and the hook scripts.

- A repo .gitmem/ with only config.json and hooks, or only what an older init
  seeded, is not a stranded store. Real records (a user's learning, thread or
  decision) now count, which main did not check at all.
- The SessionStart hook reads the repo's project name without jq (node).
- uninstall removes the repo's config.json and hooks; the shared store is
  kept unless --all or the user says delete. Hook removal and the wizard's
  hook merge use the GIT-120 module (bin/hooks-merge.js, identical to #55).
- telemetry commands use the server's root.

Tests: fresh-install e2e in a clean HOME (9, all fail on main), unit +5,
hook suite +1. cli-fresh-install made hermetic (scratch HOME) and repaired;
both e2e files wired into CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nTEG-dev nTEG-dev closed this pull request by merging all changes into main in 60a990e Sep 23, 2026
@nTEG-dev
nTEG-dev deleted the bugfix/GIT-115-store-root branch September 23, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant