Skip to content

feat(omp): support OMP (Oh My Pi) as a sixth harness - #85

Merged
avenoxai merged 5 commits into
avenoxai:mainfrom
tahakotil:omp-harness
Sep 23, 2026
Merged

avenoxai merged 5 commits into
avenoxai:mainfrom
tahakotil:omp-harness

Conversation

@tahakotil

Copy link
Copy Markdown
Contributor

Summary

Adds OMP (Oh My Pi) as a sixth harness alongside codex, claude, antigravity, hermes and opencode.

  • Engine: omp joins HARNESSES; --harness omp is accepted for receipts, context and doctor, rejected for prefs-only updates like every other harness.
  • Adapter: template/.claude/scripts/beyin_v3_omp.py generates a single managed TS hook at .omp/hooks/pre/beyin-v3.ts. It pins VAULT and interpreter at install time (the file may be copied into the global agent dir where the vault cannot be derived), honors BEYIN_VAULT/BEYIN_PYTHON, requires an absolute runtime state and fails open on any transport error, mirroring the OpenCode plugin.
  • Lifecycle mapping: session_start→SessionStart, before_agent_start→UserPromptSubmit (only injection channel, so SessionStart context is pinned into the first prompt), tool_result(edit/write/patch)→PostToolUse, session_stop→Stop, session_before_compact→PreCompact, session_shutdown→SessionEnd. Outside-vault sessions register and queue nothing. The first prompt queues both SessionStart and a real UserPromptSubmit, matching Claude.
  • Installer: plans/uninstalls the hook like other managed files.
  • Docs: docs/v3/OMP.md, client lists in README.md and docs/v3/README.md, skill updates (--harness omp receipt guidance, doctor connection check).

Testing

  • tests/v3_omp_test.py (6 tests): installer plan/uninstall, engine context parity with Claude for the same query, receipt/doctor acceptance, Bun-driven lifecycle mapping and fail-open cases (broken runtime variants, missing interpreter). Bun cases skip when bun is absent.
  • Full suite: python -m unittest discover -s tests -p "v3_*test.py" → 394 tests, OK (2 platform skips).
  • One real OMP 18.2.8 session in a temporary synthetic vault returned a canary fact from injected context with tools prohibited, and the queue acknowledged omp SessionStart, UserPromptSubmit, Stop and SessionEnd with no hook error.

tahakotil and others added 5 commits September 23, 2026 03:26
OMP loads project hooks from .omp/hooks/pre/*.ts when a session starts in
the vault. The installer now writes one managed file, beyin-v3.ts, pinned
to the vault and interpreter like the OpenCode plugin; BEYIN_VAULT and
BEYIN_PYTHON override, the runtime file must be absolute and the hook
fails open on any transport error.

before_agent_start is the only injection channel, so the hook pins the
SessionStart context and carries it into the first prompt; later prompts
get their own turn context. tool_result(edit/write/patch), session_stop,
session_before_compact and session_shutdown map to PostToolUse, Stop,
PreCompact and SessionEnd. Outside-vault sessions register nothing.

Tests port the OpenCode suite: installer plans/uninstall, engine parity
with Claude for the same query, receipt/doctor acceptance, and Bun-driven
lifecycle mapping plus fail-open cases (skip when bun is absent). One
real OMP 18.2.8 session in a synthetic vault returned the canary fact and
the queue acknowledged the lifecycle events.
OMP reports ctx.cwd without the macOS /private prefix and does not
resolve symlinks, while the installer pins Path(vault).resolve(). The
plain string comparison therefore missed the vault and the hook silently
did nothing, which also failed the lifecycle test under the default macOS
TMPDIR (/var -> /private/var).

Resolve both sides with realpath (falling back to path.resolve when the
path is missing) before the existing separator and case normalization.
A new Bun case drives the hook through a symlinked cwd so the regression
is caught on Linux too.
The list was copied from OpenCode. OMP 18 has no patch, apply_patch or
multiedit tools (patch and apply_patch are modes of the single edit tool)
and it does ship ast_edit, which rewrites files. Queue PostToolUse for
edit, write and ast_edit, as listed in tools/builtin-names.ts.
OMP task sub-agents reuse the parent's discovered hooks (task/executor.ts
passes preloadedExtensionPaths) and emit their own session_start, so every
sub-agent ran the adapter, got memory context injected and queued events
for a session that never submits a receipt.

The executor appends a session_init entry to the sub-agent session before
emitting session_start, and top-level sessions never carry one. Treat a
session whose entries include session_init as a sub-agent and no-op for
it, the same way the OpenCode plugin skips child sessions. The result is
cached per session id because getEntries() copies the whole session.
…sses

Copying beyin-v3.ts into ~/.omp/agent/hooks/pre adds nothing: outside the
vault the hook does nothing, inside it the project hook of the same name
wins, and the installer never updates or removes the global copy. Replace
that advice in README.md, docs/v3/OMP.md and the hook/installer comments
with a short warning, and document the canonical cwd match and the
sub-agent skip.

List OMP where Hermes and OpenCode are already listed: SETUP-V3.md step 5,
the harness list in docs/v3/PLATFORM-TESTS.md and the client trust
paragraph in beyin.md.
@avenoxai
avenoxai merged commit ecab5d2 into avenoxai:main Sep 23, 2026
24 checks passed
@avenoxai

Copy link
Copy Markdown
Owner

Merge edildi (ecab5d2). Üstüne dört maintainer commit'i eklendi:

  • 3b2161b: vault eşleşmesi iki tarafta da canonical yol üzerinden yapılıyor (macOS /private, symlink, Windows kısa adları). macOS'ta varsayılan TMPDIR altında hook artık sessizce susmuyor; symlink'li klasör için ayrı bir test eklendi.
  • ef6b4c9: yazma araçları OMP 18 yerleşik adlarına göre (edit, write, ast_edit).
  • c02048c: task alt ajan oturumları session_init kaydından tanınıp atlanıyor; OpenCode'daki child session korumasıyla aynı mantık.
  • d87553a: global agentDir'e kopyalama önerisi kaldırıldı (proje kopyası öncelikli olduğu için hiçbir şey eklemiyordu); OMP, kurulum ve platform dokümanlarındaki harness listelerine eklendi.

CI'da Bun kurulu olmadığı için Bun'a bağlı OMP testleri orada atlanıyor; v3.yml'e oven-sh/setup-bun adımı ayrıca eklenecek. Bir sonraki sürümle yayınlanacak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants