LifeOSHooks stamp ages out in a live session: native hooks run beside the plugin again after 7 days
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 92/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bun, json, typescript
Research direction
Start with mergeStampCaps in LIFEOS/TOOLS/HookBridge.ts and its use of the stamp mtime, then inspect the TTL check in hooks/lib/function-hooks.ts. Reproduce with the issue’s 8-day stamp and run the bridge followed by hooks/MemoryTurnStart.hook.ts. Done means the stamp is refreshed, the native memory hook stays silent, and a regression test verifies both the TTL behavior and preservation of the bridge’s emission ID.
Written by the indexing model from the issue text.
Description
What happens
In an interactive session armed by the LifeOSHooks plugin, the native command hooks stand down only while hookCovers(sid, cap) is true (hooks/lib/function-hooks.ts). That needs the session stamp's file mtime to be younger than STAMP_TTL_MS (7 days).
LIFEOS/TOOLS/HookBridge.ts prompt-context calls mergeStampCaps(sid, PROMPT_MODULE_CAPS) on every covered prompt, but mergeStampCaps returns early when the caps are unchanged:
if (merged.length === have.length && merged.every((c, i) => have[i] === c)) return; // unchanged: leave the file alone
So the mtime freezes at the session's first prompt, which contradicts the function's own docstring ("mtime is refreshed (the TTL clock)"). Seven days after a session arms, in a session that stays open or is resumed, hookCovers goes false. From then on, every native hook that checks it runs again beside the plugin, which is the double path the stamp exists to prevent. For memory, the native MemoryTurnStart composes a second emission on each prompt, about 150 ms after the plugin's, and overwrites the memory queue's emissionId. An ack keyed to the plugin's emission then never matches, so the queue stops draining and re-sends its first chunks on every prompt.
Seen on v8.761.0; main at 94bd8f25 has the same code. On one install, three long-lived sessions stalled this way, each starting after its 7-day mark and not before.
Repro
With a temp config dir (CLAUDE_CONFIG_DIR=$(mktemp -d)):
- Write
LIFEOS/MEMORY/STATE/function-hooks/S.jsonfor sessionSwithcaps: ["prompt-context","turn-complete","band","voice"], andtouch -tit 8 days back. - Pipe a
UserPromptSubmitinput forSintobun LIFEOS/TOOLS/HookBridge.ts prompt-context. It exits 0 withcovered: true, and the stamp's mtime is unchanged. - Pipe the same input into
bun hooks/MemoryTurnStart.hook.ts. It prints a full<lifeos-memory>block where it should print nothing, andMEMORY/STATE/memory-inject/S.queue.jsonnow carries the native emission's id.
Suggested fix
Refresh the mtime on the unchanged path:
if (merged.length === have.length && merged.every((c, i) => have[i] === c)) {
const now = new Date();
utimesSync(p, now, now); // the bridge calls this every covered prompt, so a live session never ages out
return;
}
A dead session or a crashed plugin stops calling the bridge, so the TTL still hands the work back to the native hooks for them. With this change step 2 refreshes the stamp and step 3 prints nothing. A test that plants an 8-day stamp, runs one turn through the bridge and then the native hook, and asserts the native hook stays silent and the queue keeps the bridge's emission fails without the line and passes with it.
Side note
The native hooks are covered even on the first prompt after a long idle: the plugin awaits prompt-context before next() runs them, and the bridge refreshes the stamp before it returns. The composers inside prompt-context run before that refresh, though, so on the first prompt after a lapse they still read the stale stamp and emit their fallback form once (for example the memory-delta block that asks the model to type the line). The next prompt is normal.
- Dominant language
- TypeScript
- Stars
- 20k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from danielmiessler/LifeOS
-
[bug] Socrates launchd-path adapter throws EISDIR when an import names a folder beside its .ts fileOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
danielmiessler/LifeOS#3123 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
danielmiessler/LifeOS#3122 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
danielmiessler/LifeOS#3121 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
danielmiessler/LifeOS#3120 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
danielmiessler/LifeOS#3055 ·
Maintainers usually reply within 5 days
All issues in danielmiessler/LifeOS
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug P3
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day