Skip to content

fix(install): write standing settings.system.json snapshot on hooks install (#1402)#1432

Open
sauldataman wants to merge 1 commit into
danielmiessler:mainfrom
sauldataman:fix/1402-settings-system-snapshot
Open

fix(install): write standing settings.system.json snapshot on hooks install (#1402)#1432
sauldataman wants to merge 1 commit into
danielmiessler:mainfrom
sauldataman:fix/1402-settings-system-snapshot

Conversation

@sauldataman

Copy link
Copy Markdown
Contributor

Problem

Addresses #1402. MemoryHealthCheck.ts CHECK 3 treats ~/.claude/settings.system.json as the standing source of truth for system hook wiring and requires the four memory hooks to be registered in it. But no
install step ever writes that file:

  • install.sh never touches settings.
  • InstallHooks.ts --apply merges the payload's hooks.json into settings.json, and copies the hook scripts to disk, but never produces the standing settings.system.json.

So on a fresh install the health check fails against a file that no step is responsible for creating:

CRITICAL — settings.system.json not found at ~/.claude/settings.system.json

(This is the "never written" variant of the contract gap in #1402; the "written without hooks" variant is the same missing producer seen from the other side.)

Fix

InstallHooks.ts --apply now also writes the standing snapshot to /settings.system.json:

  • base = install/settings.system.json (the canonical system half — same file SettingsBackport.ts treats as the system layer)
  • hooks = incoming (the payload's own wiring), not merged. Freezing a user's foreign hook entries into "system truth" would make MemoryHealthCheck misreport them as required system hooks.

Write-path (join(configRoot, "settings.system.json")) and the health check's read-path (join(HOME, ".claude", "settings.system.json")) resolve to the same location under a normal install; both use
process.env/os.homedir(), so this is not affected by the literal-$HOME issue in #1404.

Scope / semantics

Verification

Sandbox --config-root, then the real consumer with HOME overridden:

$ bun InstallHooks.ts --config-root $SBX --skill-root $SKILL --apply
$ bun InstallHooks.ts --config-root $SBX --skill-root $SKILL --apply
$ HOME=$SBX_HOME bun LIFEOS/TOOLS/MemoryHealthCheck.ts
CHECK 3 findings: none
ok: settings-hook-present:settings.system.json:MemoryReviewTrigger.hook.ts
ok: settings-hook-present:settings.system.json:MemoryReviewFire.hook.ts
ok: settings-hook-present:settings.system.json:MemoryHealthGate.hook.ts
ok: settings-hook-present:settings.system.json:MemoryDeltaSurface.hook.ts

Dry-run writes no snapshot; second --apply is byte-identical to the first.

…nstall (danielmiessler#1402)

install/settings.system.json is only a merge source; nothing ever wrote a
standing copy to ~/.claude/settings.system.json, while MemoryHealthCheck
CHECK 3 requires that path to exist and to register the four memory hooks.
Every fresh install therefore reported CRITICAL from the first health run.

InstallHooks.ts --apply now writes the snapshot (system half + the
payload's own hooks -- incoming, not merged, so a user's foreign entries
are never frozen into system truth). Dry-run unchanged; idempotent across
re-applies. Both the skill source and the install payload mirror are
updated, plus the Setup.md step-7 doc line.
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