[bug] After /clear the LifeOSHooks plugin keeps the old session id, so…
What happened
After /clear every closer is spoken twice. The LifeOSHooks plugin keeps the session id it read at session.start, so it keeps stamping and speaking under the old id, while VoiceCompletion.hook.ts gets the new id, finds no stamp, and speaks too.
Summary
Repro: start an interactive session with the LifeOSHooks plugin loaded, run /clear, then finish a few turns that end with a 🗣️ closer. The voice server log shows each closer requested twice, about 7 s apart.
What I traced:
sessionStartinskills/LifeOSHooks/hooks/LifeOSHooks.tsreadss.sessionId = await $.session.id()once and stamps it (bridge(..., "stamp", [s.sessionId])). After/clearthe plugin keeps that id: inMEMORY/OBSERVABILITY/function-hook-events.jsonleveryturn.start/turn.complete/tool.callof the cleared conversation is still logged under the pre-clear session id, while the transcript and the command hooks use the new one.turn.completecalls HookBridgeturn-completewithvoice: true, which speaks the closer viaspeakAnswer.hooks/VoiceCompletion.hook.tsstands down only whenhookCovers(input.session_id, 'voice')is true (hooks/lib/function-hooks.ts). With the new id there is no stamp underMEMORY/STATE/function-hooks/, so it speaks as well.
The same mismatch presumably affects every capability the stamp gates (prompt-context, turn-complete, band), not just voice.
Expected: on /clear (Claude Code fires SessionStart with source clear) the plugin re-reads the session id and stamps the new one, or the command hooks recognise the plugin's live stamp regardless of id.
Workaround: quit and relaunch the session instead of /clear.
Version: LifeOS 8.761.0, Claude Code 2.1.312, macOS.
Details
- Kind: bug
- LifeOS version: 8.761.0
Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.
A small fix that covers every capability the stamp gates, not just voice: at the start of prompt.submit, re-read $.session.id(), and when it differs from the stored id, rebind it and write the stamp for the new id before prompt-context runs. prompt-context then merges its caps onto the new id, so the native hooks stand down for the cleared conversation and nothing is composed twice. Covered by a unit test (a changed id is stamped before prompt-context, which composes for the new id); I could not drive a real /clear headlessly.
(Posted by an AI agent on the reporter's behalf, after they read this text.)
[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler
Thanks @IvanLeontev-stack for tracing the double closer to the stale session id. The module now re-reads $.session.id() at the start of every prompt and, when it changed after a /clear, stamps the new id before prompt-context runs, so VoiceCompletion and the other native hooks stand down for the cleared conversation. This lands in the next release.