feat(hooks): add OMP (Oh My Pi) agent support - #3151
Closed
DavidHLP wants to merge 5 commits into
Closed
Conversation
Add `rtk init --agent omp` to install RTK transparent rewrite support for OMP (Oh My Pi) coding agent. Same architecture as the Pi extension: TypeScript hook loaded from `hooks/pre/`, intercepts `tool_call` events, calls `rtk rewrite` for command mutation. Install paths: - global: $OMP_AGENT_DIR/hooks/pre/rtk.ts (or ~/.omp/agent/hooks/pre/) - project: .omp/hooks/pre/rtk.ts Changes: - Add OMP constants (OMP_DIR, OMP_PLUGIN_FILE, OMP_AGENT_DIR_ENV, etc.) - Add run_omp_mode/uninstall_omp/resolve_omp_dir to init.rs - Add Omp variant to AgentTarget enum + CLI routing in main.rs - Add hooks/omp/rtk.ts extension (rewriteCommand, signal, killed guard) - Add hooks/omp/README.md - Add 14 integration tests (12 init.rs + 2 main.rs CLI parse) - Update README.md, hooks/README.md, supported-agents.md Signed-off-by: DavidHLP <lysf15520112973@163.com>
DavidHLP
force-pushed
the
feat/hooks-add-omp-agent-support
branch
from
July 22, 2026 14:51
13f9663 to
dbb30e0
Compare
Add two features that competing PRs (rtk-ai#1365, rtk-ai#2166) include and that maintainer KuSh specifically requested in rtk-ai#1365 review: - setLabel('RTK') — set extension label in OMP UI - session_start + ctx.ui.setStatus — show persistent warning in OMP UI when rtk binary is missing or too old Also extends ExtensionAPI interface with setLabel() and session_start event support (optional ui field for backward compatibility). Signed-off-by: DavidHLP <lysf15520112973@163.com>
Two tests had false positive risks where they would pass even if the
code was broken:
1. test_run_omp_mode_local_installs_plugin — only checked file exists,
not content. Added content.contains('rtk rewrite') assertion to
match the global variant.
2. test_omp_local_uninstall_removes_plugin — did not assert plugin
exists before uninstall. If install was a no-op (bug), uninstall
would succeed vacuously and assert!(!exists) would pass on an empty
state. Added assert!(plugin.exists()) guard before uninstall.
Signed-off-by: DavidHLP <lysf15520112973@163.com>
The OMP install line used one extra padding space (comment marker at column 34 instead of 33), misaligning it from all other agents in the Quick Start block. Trimmed one space so 'rtk init -g --agent omp' aligns with the rest. Signed-off-by: DavidHLP <lysf15520112973@163.com>
hooks/omp/README.md previously only had an Uninstall section and a
generic version-guard bullet. Added:
- Install section (project-local + global, matching supported-agents.md)
- OMP_AGENT_DIR override mention
- --dry-run usage
- Specifics: setLabel("RTK") and session_start status-line warning
when rtk binary is missing — both are OMP-exclusive behaviors absent
from the Pi extension
No code changes.
Signed-off-by: DavidHLP <lysf15520112973@163.com>
DavidHLP
force-pushed
the
feat/hooks-add-omp-agent-support
branch
from
July 23, 2026 09:16
f770633 to
e209154
Compare
|
would love to see this! |
|
Nice job, can't wait to see this implementation. |
5 tasks
|
I opened DavidHLP#1 with the OMP hook compatibility fixes: remove unsupported |
Author
|
Closing this in favor of #3707. After reviewing the current state of things, #3707 is the better path forward:
Thanks to @peterrauscher, @aancw and everyone who showed interest here — OMP support |
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.
Summary
rtk init --agent ompto install RTK transparent rewrite support for OMP (Oh My Pi) coding agenthooks/pre/that interceptstool_callevents and callsrtk rewritefor in-place command mutation — same architecture as the existing Pi extensionREADME.md,hooks/README.md, anddocs/guide/getting-started/supported-agents.mdCloses #591.
Install / Uninstall
Both install and uninstall honor the
OMP_AGENT_DIRenvironment variable (mirrorsPI_CODING_AGENT_DIR) for custom install locations.Test plan
cargo fmt --all --check— passcargo clippy --all-targets— no issuescargo test— 2535 passed, 0 failed (14 new OMP tests)rtk init --agent ompinstall/uninstall/dry-run verifiedRuntime evidence
Environment:
rtk 0.42.4,omp 17.0.8, Linux x86_64.1.
rtk rewriteon OMP-rewritable commands:Exit code 1 (passthrough) for unsupported commands — correct.
2. Install (dry-run → real → file identity check):
3. Uninstall + idempotency:
4. OMP loads the extension end-to-end:
OMP called the extension,
rtk rewriteturnedgit status→rtk git status, and the agent received compact filtered output instead of rawgit status.Changes (8 files)
src/hooks/constants.rsOMP_DIR,OMP_LOCAL_DIR,OMP_HOOKS_PRE_SUBDIR,OMP_PLUGIN_FILE,OMP_AGENT_DIR_ENVsrc/hooks/init.rsresolve_omp_dir(),omp_plugin_path_for_scope(),ensure_omp_plugin_installed(),uninstall_omp(),run_omp_mode(),print_omp_result()src/main.rsOmpvariant inAgentTarget, install/uninstall routinghooks/omp/rtk.tshooks/omp/README.mdREADME.mdhooks/README.mddocs/guide/getting-started/supported-agents.mdDesign notes
tool_callevent + in-place mutation as Pi — shared extension API lineage (Earendil Works)interfacedeclarations (no SDK import) for portability across OMP versionssetLabel("RTK")+session_startstatus — persistent warning when rtk missing/too old (requested in feat(omp): add extension-based rewrite integration for Oh My Pi #1365)