feat(omp): run LifeOS hooks in omp via Claude-Code hook contract bridge - #1945
Open
Faizalj wants to merge 3 commits into
Open
feat(omp): run LifeOS hooks in omp via Claude-Code hook contract bridge#1945Faizalj wants to merge 3 commits into
Faizalj wants to merge 3 commits into
Conversation
Adds OmpHooksBridge.ts, an omp extension that shims the Claude Code hook contract (JSON stdin/stdout, settings.json registry) onto the omp event bus: session_start→SessionStart, turn_start→UserPromptSubmit, tool_call→PreToolUse (deny/ask enforcement), tool_result→PostToolUse(Failure), turn_end→Stop, session_shutdown→SessionEnd. additionalContext is injected as a system message before the next LLM call. Verified end-to-end headless: 76 hooks across all six event classes, EventLogger writes tool-activity.jsonl from inside omp, zero hook crashes. Doc: OmpHooksBridge.md.
VoiceCompletion.hook.ts requires a Claude transcript; omp has none. The bridge now extracts the final 🗣️ closer from the session log at turn_end and speaks it through Pulse /notify (ElevenLabs). Same semantics as Claude Code: no voice line means silence. Env: OMP_VOICE=0 disables, OMP_VOICE_ID overrides the voice. Verified headless: voice sent, HTTP 200, ~4s.
- extract the 🗣️ closer from the message that just completed the turn, not the newest session JSONL — with parallel sessions the global scan picked the wrong session's line (or none) and voice silently died - accept both '🗣️ <ZEN>:' and '🗣️ ZEN:' — angle-bracket-only matching dropped every closer written without brackets, so sessions spoke nothing - drop the now-unused statSync import; doc: voice path is turn-scoped
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.
What
Adds
OmpHooksBridge.ts— an omp (Oh My Pi) extension that shims the Claude Code hook contract (JSON on stdin/stdout, registry from${LIFEOS_DIR}/settings.json) onto the omp event bus, so LifeOS hooks run in non-Claude-Code harnesses. This serves LifeOS's stated harness-agnostic goal ("designed to run wherever your AI does").Event mapping
session_startSessionStartturn_startUserPromptSubmittool_callPreToolUsedeny→ block;ask→ UI confirm (fail-closed headless)tool_resultPostToolUsePostToolUseFailure)turn_endStopsession_shutdownSessionEndadditionalContextreturned by hooks is queued and injected as a system message before the next LLM call via omp'scontextevent — the equivalent of Claude Code's implicit injection.Testing evidence
Headless run (
omp -p --auto-approve "run: echo bridge-test", DeepSeek v4 flash via Ollama), audit log:tool-activity.jsonlfrom inside the omp session (observability pipeline live)context_injectfired (118 chars) — delta blocks reach the LLMFull log excerpt in
LifeOS/install/LIFEOS/DOCUMENTATION/OmpHooksBridge.md.Known limitations
transcript_pathempty — transcript-parsing hooks degrade gracefullyinputevent not yet wired)