Restore hook registrations dropped in the 2026-07-11 consolidation (LoopDetector / DriftReminder / AlgorithmNudge)#1585
Open
elhoim wants to merge 1 commit into
Open
Conversation
…tions The 2026-07-11 hooks-BPE consolidation created per-event dispatcher hooks but never registered three of them in the shipped install payload, even though LIFEOS/DOCUMENTATION/Hooks/HookSystem.md documents all three as registered: - PostToolObserver.hook.ts was missing from the PostToolUse catch-all group (HookSystem.md:322 documents it there, sync, timeout 5, ahead of EventLogger.hook.ts). Unregistered, LoopDetector.run() (folded into PostToolObserver per HookSystem.md:22) never runs. - DriftReminder.hook.ts was missing from UserPromptSubmit (HookSystem.md:142, timeout 5, async). Voice/format drift nudges never fire. - AlgorithmNudge.hook.ts was missing its UserPromptSubmit registration (HookSystem.md:144, timeout 5, async) — it remains registered on PostToolUseFailure, unchanged. HookSystem.md:1562 documents the UserPromptSubmit chain as 6 hooks ending in AlgorithmNudge; the shipped payload only had 4. Missing this drops the always-on skill-routing and principal-message nudges and leaves state.primaryTranscript unset, which HookSystem.md documents as gating subagent-noise suppression for AlgorithmNudge's other branches. This restores config to match what HookSystem.md already documents as live, using the exact registration shapes and UserPromptSubmit fire order given there (PromptProcessing, SatisfactionCapture, ReminderRouter, DriftReminder, MemoryTurnStart, AlgorithmNudge).
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.
The 2026-07-11 "hooks-BPE consolidation" (per
LIFEOS/DOCUMENTATION/Hooks/HookSystem.md) built per-event dispatcher hooks but never registered three of them in the shipped install payload (LifeOS/install/hooks/hooks.json, the sole sourceTools/InstallHooks.tsmerges into a user'ssettings.json), even thoughHookSystem.mddocuments all three as registered and live. This PR brings the shipped config back in line with the docs.1.
PostToolObserver.hook.ts— missing fromPostToolUseHookSystem.md:322documents it in thePostToolUsecatch-all group (sync,timeout: 5, ahead ofEventLogger.hook.ts).HookSystem.md:343-345describes it as the dispatcher that bundlesLoopDetector.run()(exact-repeat / oscillation / hammering detection) and the PostToolUse branch ofAlgorithmNudge.run().User-visible effect of the gap: unregistered,
LoopDetectornever runs — no detection of repeat/oscillation/hammering tool-call patterns.Fix: added to the existing
matcher:""catch-all group inPostToolUse(not a new group — a second empty-matcher group would cause a merge dupe onInstallHooks.ts's idempotent-merge), ahead ofEventLogger.hook.ts, matching the documented order exactly.2.
DriftReminder.hook.ts— missing fromUserPromptSubmitHookSystem.md:142documents it registered onUserPromptSubmit(timeout: 5,async: true).HookSystem.md:168-170describes it as the deterministic voice/format drift nudge (banned-vocab regex, banner-presence check, em-dash count against the Stop-hook last-response cache; no LLM calls).User-visible effect of the gap: the voice/format drift check other live hooks and the system prompt assume is running never fires.
Fix: added to
UserPromptSubmit, positioned per the documented fire order.3.
AlgorithmNudge.hook.ts— missing itsUserPromptSubmitregistrationHookSystem.md:144documents it registered onUserPromptSubmit(timeout: 5,async: true) in addition to its existingPostToolUseFailureregistration (unchanged by this PR — still present, not duplicated).HookSystem.md:1562states explicitly: "the UserPromptSubmit chain is 6 hooks (PromptProcessing,SatisfactionCapture,ReminderRouter,DriftReminder,MemoryTurnStart,AlgorithmNudge)" — the shipped payload only had 4.User-visible effect of the gap: per
HookSystem.md:178-183, theUserPromptSubmitbranch is what fires the always-on skill-routing nudge ("prompt matches a skill's USE WHEN → invoke, don't handroll") and, in a live Algorithm run, the principal-message nudge — both dead without this registration. It is also documented as the sole writer ofstate.primaryTranscripton this path, which otherAlgorithmNudgebranches use to gate subagent-noise suppression — missing it leaves that gate failing open.Fix: added to
UserPromptSubmitat the positionHookSystem.md:1562documents (last in the chain), leaving thePostToolUseFailureregistration untouched.Scope note: only
LifeOS/install/hooks/hooks.jsonneeded changes — it is the single authoritative hook-registration payload (InstallHooks.tsmerges only this file intosettings.json;settings.system.json/settings.enhancements.jsoncarry nohookskey, and there is no second copy ofhooks.jsonelsewhere in the tree, so no parallel mirror needed updating).Diff is additive-only: three new hook entries, no existing entries removed, reordered, or duplicated.