Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

[bug] After /clear the LifeOSHooks plugin keeps the old session id, so…

Open IvanLeontev-stack opened this issue 1 month ago • 2 comments

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:

  1. sessionStart in skills/LifeOSHooks/hooks/LifeOSHooks.ts reads s.sessionId = await $.session.id() once and stamps it (bridge(..., "stamp", [s.sessionId])). After /clear the plugin keeps that id: in MEMORY/OBSERVABILITY/function-hook-events.jsonl every turn.start / turn.complete / tool.call of the cleared conversation is still logged under the pre-clear session id, while the transcript and the command hooks use the new one.
  2. turn.complete calls HookBridge turn-complete with voice: true, which speaks the closer via speakAnswer.
  3. hooks/VoiceCompletion.hook.ts stands down only when hookCovers(input.session_id, 'voice') is true (hooks/lib/function-hooks.ts). With the new id there is no stamp under MEMORY/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.

IvanLeontev-stack avatar Oct 29 '26 17:10 IvanLeontev-stack

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.)

nbost130 avatar Nov 05 '26 11:11 nbost130

[!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.

danielmiessler avatar Nov 06 '26 13:11 danielmiessler