Repository navigation
feat(omp)!: add Oh My Pi (OMP) support - #3707
Conversation
Add `--agent omp` to `rtk init` (with `-g`, `--uninstall`, `--show`) for the Oh My Pi coding agent (https://github.com/can1357/oh-my-pi). OMP loads the same `hooks/pi/rtk.ts` extension via its built-in legacy-pi-compat layer, which remaps the Pi package imports to OMP's bundled equivalent — so no separate OMP implementation is needed and the rewrite behavior stays byte-identical (mutualization). - Local scope: <project>/.omp/extensions/rtk.ts - Global scope: ~/.omp/agent/extensions/rtk.ts - `--uninstall` is three-way safe: missing → no-op, stock content → removed, modified RTK content → bail with manual-removal guidance - `--show` reports both scopes (installed / stock / modified / absent) Co-authored-by: makoMakoGo <[email protected]>
The extension is shared with OMP via its legacy-pi-compat layer. Add
guarded helpers that are strict no-ops on Pi: a persistent
"RTK disabled: <reason>" session status registered on session_start
(OMP wipes one-shot notify toasts on the initial render) and a
setLabel("RTK") UI label set before the version probe, so the
extension is identifiable in the session UI even when rtk is missing
or too old.
Co-authored-by: makoMakoGo <[email protected]>
There was a problem hiding this comment.
Reviewed at high effort, cross-checked against #1365 (this PR's predecessor thread) and the actual Pi/OMP SDKs upstream rather than just this PR's own claims. Inline comments on specific lines below; general notes here.
Comment coverage from #1365: all five of the original inline review comments are addressed in this PR's current shape.
Design questions raised in #1365, still open here:
- 3-way-safe uninstall not duplicated to
uninstall_pi(src/hooks/init.rs:3421, unchanged by this PR — outside this diff's hunks so I can't anchor a line comment on it).uninstall_ompgot the missing/exact-match/modified split;uninstall_piis still an unconditional delete for what's now the identical shared file. Since both install locations are equally user-editable global dirs, there's no principled reason to leave Pi unconditional — recommend makinguninstall_pi3-way safe too, in this PR or a fast follow-up. - Guarded additions to the shared file: This seems reasonable as long as the additions remain lightweight. We can always split the file later if it becomes too cluttered.
|
Addressed the review feedback in
Verification: Please re-review. |
# Conflicts: # hooks/README.md
|
Resolved the branch conflict by merging the latest GitHub now reports the PR as mergeable. Validation after the merge: Ready for re-review. |
|
Following up on the review-level design note: This is included in |
KuSh
left a comment
There was a problem hiding this comment.
Re-reviewed at high effort against 12a7cf0. Verified each of the three earlier threads against the new code rather than the commit messages — two are genuinely fixed and I've resolved them:
setLabel— call removed entirely, so the arity/runtime-detection problem can't fire on either runtime. Understood on not having a live Pi host; removing the API instead of guessing its contract makes that check moot. The replacement is correct on the same axis:ctx.ui.setStatus("rtk", text)matches Pi's documented two-argumentsetStatus(key, text).session_startrace —registerRtkUnavailableNotice(pi)now runs beforeawait pi.exec(...), and the retainedsessionContext+applyStatus()covers both orderings. Fail-opentry/catcharoundpi.onis right. Accepted thesetStatus-over-notifydecision given you checked OMP 18.0.4's source directly.
Also confirmed uninstall_pi is now three-way safe, and OMP's global path is corroborated by OMP's own SDK docs (agentDir: ~/.omp/agent).
The stock-hash thread stays open — details in that thread, but the short version is the allowlist is missing the revision that is stock today, and it's shipped: dev-0.46.1-rc.367 (published 2026-08-26, seven minutes after #2938 merged) contains hooks/pi/rtk.ts hashing to 3eb16108f51a29c2a62a453d5c97a6ea2da8aea1061da34c50fdcfaa32dc0ff7, which is not in the list.
New findings from this pass are inline below. One that isn't anchorable because the file isn't in the diff:
hooks/pi/README.md is now stale in two ways. hooks/README.md was updated to say the pi/ entry documents the file as "shared with Oh My Pi (OMP)", but hooks/pi/README.md itself never mentions OMP and still lists only the .pi/-scoped install paths. It also still states at line 36 that "Uninstall is idempotent", which is no longer true given the new hard-fail path (see the inline comment on uninstall_pi).
|
Follow-up fixes are pushed in
Validation: |
KuSh
left a comment
There was a problem hiding this comment.
Re-reviewed at high effort against d268e8f. Verified all five open threads against the code rather than the commit message — four are genuinely fixed and resolved, and I've reopened one that I closed too eagerly on my side.
I re-verified the hash work independently: the current hooks/pi/rtk.ts trims-and-hashes to 5e80e811…, matching the new first entry, 3eb16108… (the revision shipped in dev-0.46.1-rc.367) and 628308… are both present, and the never-shipped 2cbb2a7a… entry is gone. The new test is the invariant asked for. I also checked the PI_CODING_AGENT_DIR claim upstream rather than taking it on trust — OMP's own packages/utils/src/dirs.ts and docs/extension-loading.md confirm it, and that same doc independently confirms both install paths.
Reopened: the dry-run footer thread. My confirmation was wrong — I checked the two edge branches and not the main one. uninstall_omp's stock-content + dry_run branch prints [dry-run] would remove OMP extension: … and returns without print_dry_run_footer(), while uninstall_pi prints both. Details in that thread.
New findings from this pass are inline below. The two mediums are worth resolving before merge; the rest are judgement calls.
|
Follow-up fixes for the latest re-review are pushed in Addressed:
Validation is clean: Ready for re-review. |
KuSh
left a comment
There was a problem hiding this comment.
Re-reviewed at high effort against 0022488. All six previous threads verified fixed against the code and resolved — the new tests/omp_init_test.rs end-to-end coverage (driving the built binary and asserting on real stdout/stderr) is a genuine improvement over the unit tests that missed the earlier dry-run gaps.
I also independently re-verified the hash work: every revision of hooks/pi/rtk.ts reachable from develop, plus the current embedded file, is present with a matching digest. That table is complete.
Five new findings inline. One of them is a correction of my own earlier judgement: I previously waved off the line-ending concern as low-risk, reasoning about the global ~/.pi path. That was wrong — project-local is the default scope, which puts the file inside the user's repository. Details in the comment on is_known_stock_pi_plugin; I'd treat it as the blocker of this round.
Design suggestion that ties several of these together. Two of the remaining problems — the hard refusal on non-stock content at install, and the shared-path deletion at uninstall — are both cases where RTK detects something surprising and then either aborts or proceeds anyway, with no way for the user to decide. RTK already has the right mechanism for exactly this: PatchMode::Ask (src/hooks/init.rs:4258), which prompts [y/N], prints [dry-run] would prompt ... instead of blocking under --dry-run, and is skippable via --auto-patch.
Reusing that shape rather than inventing a second confirmation mechanism would resolve both:
- Install, content differs from stock — prompt
Overwrite? [y/N]instead ofbail!. This is the--forceescape hatch that's currently missing, and becauseread_linehits EOF on a non-TTY it fails closed, so scripted and hook-driven installs behave exactly as they do today. It also gives the CRLF case below a supported recovery path. - Uninstall, path shared via
PI_CODING_AGENT_DIR— prompt before deleting. Today it prints aneprintln!warning and deletes anyway, which gives the user the information at the moment it's already too late to act on.
No prompt is warranted for the ordinary upgrade path (older stock → current stock); that's what running rtk init asked for.
|
Addressed the latest re-review in In addition to the four inline fixes:
Validation remains clean: Ready for re-review. |
|
Verified this implementation against a real omp install — supporting merge. Path correctness confirmed. I checked omp's actual extension discovery:
I tested the shared extension end-to-end: the exact The shared-path protection (asking before overwriting/removing the Pi/OMP aliased file when For maintainers: this PR is more complete and correct than the other open omp attempts (#1827, #2166, #3151) — it targets the right directories, protects shared state, and is currently MERGEABLE. Recommend accepting this one. |
KuSh
left a comment
There was a problem hiding this comment.
Re-reviewed at high effort against 256d4a7. All four previous threads verified fixed against the code and resolved — the CRLF normalisation is applied consistently (comparison, hashing, and the invariant test), the dry-run halves of install and uninstall finally agree, the unreadable-file path degrades instead of erroring, and PiCompatibleAgent makes the branch exhaustive at compile time.
The prompt work is a better implementation than I suggested: extracting prompt_user_confirmation with an explicit IsTerminal check and routing the pre-existing settings-patch prompt through it improves that older call site too, and reusing --auto-patch / --no-patch avoids inventing a second flag vocabulary. The docs, including the CI guidance row, cover it properly.
A correction on my part, which is finding 1 below. I accepted the shared-path warning and prompt without checking the predicate that triggers them. global_extension_is_shared compares resolved paths only, and since resolve_omp_dir returns $PI_CODING_AGENT_DIR verbatim, it is unconditionally true for any Pi user who set that variable — whether or not OMP is installed, or even present. That turns a documented Pi workflow into a no-op in non-interactive use. I should have caught that when I signed off on the mitigation.
Findings 1 and 2 compound: the over-broad predicate decides there's something to confirm, and the non-interactive default then answers no and exits 0. Together they make rtk init -g --agent pi --uninstall silently do nothing in CI for a user who has never touched OMP.
Five findings inline.
|
The five findings from review 5050814848 are addressed in 48ee59e.
Verification: 2762 tests passed, 8 ignored; cargo fmt, Clippy, and diff checks passed. Ready for re-review. |
KuSh
left a comment
There was a problem hiding this comment.
Re-reviewed at high effort against 48ee59e. Four of the five previous threads are genuinely fixed and resolved — the marker now matches all eight allowlisted revisions (I checked each), declined actions exit non-zero with actionable text, --auto-patch --dry-run previews the overwrite, and --show degrades to (unreadable) instead of aborting.
I've reopened the shared-path thread, including a correction of my own: I endorsed the PiCompatibleAgent::Omp => Ok(true) asymmetry last round on reasoning that doesn't hold, and it now combines with the non-zero-exit change I asked for to break non-interactive uninstall for OMP-only users who relocate. Details there.
Three further findings inline. The theme across all of them is the same: this push added graceful degradation for unreadable files on the uninstall and --show paths, but the install path and the uninstall exit code didn't get the same treatment, so the three now disagree about what an unreadable file means.
|
Addressed the latest re-review findings in 42a9147 and pushed to alvins82:omp-shared.
Verification: |
KuSh
left a comment
There was a problem hiding this comment.
Re-reviewed at high effort against 42a9147. All four previous threads verified fixed and resolved — the ownership sidecar is the right shape of solution, the symmetry error I endorsed two rounds ago is gone, and unreadable files now degrade consistently on install, uninstall and --show.
Two upstream questions settled, so they don't need to stay open:
session_startis a real Pi event — documented inearendil-works/pidocs/extensions.md(the event reference, plus an example using exactly the(_event, ctx)signature this extension uses). The status feature is live on Pi, not dead code.- The sidecar cannot be mistaken for an extension by either agent. Pi auto-discovers
*.tsand*/index.tsonly; OMP's native discovery is limited to.ts/.js.rtk.ts.rtk-agentsmatches neither, so it sits inert. Worth stating plainly since it's the obvious worry with putting a state file in a scanned directory.
Six findings inline. Four of them are on the sidecar — which is expected for brand-new state-management code, and none of them are objections to the approach. The theme is that the sidecar is currently additive-only and treated as infallible, while everything around it was just hardened to degrade gracefully.
Treat pre-existing extensions without ownership state as uncertain, cover project-scope aliases, clean canonical sidecars after symlink removal, and classify protected extension overwrites as breaking. BREAKING CHANGE: non-interactive installs of modified or unrelated Pi/OMP extensions now require --auto-patch to approve overwrites.
|
Fixed and resolved the latest review pass in
Verification: All latest review threads have replies and are resolved. Ready for re-review. |
|
Windows CI is red, and it's a one-line fix. Everything else looks good to me. The failure
Ubuntu and macOS pass, so it's platform-specific rather than a logic error. CauseThe fixture assumes an LF checkout: let crlf = PI_PLUGIN.replace('\n', "\r\n");Windows runners use Worth noting the existing FixThat also keeps the bytes RTK installs, and hashes against Optional belt-and-braces, so the fixture stays correct even if the attribute is ever lost: let crlf = PI_PLUGIN.replace("\r\n", "\n").replace('\n', "\r\n");Worth applying to any other fixture that synthesizes CRLF from an embedded file. OtherwiseLGTM. Worth calling out that this is the first CI run on the PR — earlier pushes only ever showed I do still have local follow-up work on the ownership-sidecar lifecycle (shared-file protection is inert for extensions that pre-date the sidecar, and uninstall has no |
Prevent Windows checkout conversion from corrupting embedded hook fixtures and make the CRLF regression independent of the source checkout line endings.
|
Fixed the Windows CI failure in
Local verification: The PR now has the fix pushed at |
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link, and bound cycles so an unresolvable link cannot recurse forever. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Guard process-global state with RAII: CwdGuard for the working directory and EnvVarGuard for the agent-directory overrides, each with a regression test, so a failing assertion cannot cascade into unrelated failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link, and bound cycles so an unresolvable link cannot recurse forever. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Guard process-global state with RAII: CwdGuard for the working directory and EnvVarGuard for the agent-directory overrides, each with a regression test, so a failing assertion cannot cascade into unrelated failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link, and bound cycles so an unresolvable link cannot recurse forever. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Guard process-global state with RAII: CwdGuard for the working directory and EnvVarGuard for the agent-directory overrides, each with a regression test, so a failing assertion cannot cascade into unrelated failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link, and bound cycles so an unresolvable link cannot recurse forever. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Guard process-global state with RAII: CwdGuard for the working directory and EnvVarGuard for the agent-directory overrides, each with a regression test, so a failing assertion cannot cascade into unrelated failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link, and bound cycles so an unresolvable link cannot recurse forever. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Guard process-global state with RAII: CwdGuard for the working directory and EnvVarGuard for the agent-directory overrides, each with a regression test, so a failing assertion cannot cascade into unrelated failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Put the remaining cwd-mutating tests on the RAII guard, so a failing assertion cannot strand the process inside a deleted TempDir and bury the real failure under unrelated ones. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Put the remaining cwd-mutating tests on the RAII guard, so a failing assertion cannot strand the process inside a deleted TempDir and bury the real failure under unrelated ones. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Put the remaining cwd-mutating tests on the RAII guard, so a failing assertion cannot strand the process inside a deleted TempDir and bury the real failure under unrelated ones. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link. - Route an unresolvable link through the same confirmation as any other content the user put there. Tests: - Put the remaining cwd-mutating tests on the RAII guard, so a failing assertion cannot strand the process inside a deleted TempDir and bury the real failure under unrelated ones. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link. - Route an unresolvable link through the same confirmation as any other content the user put there. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and several destructive paths had no way back. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Preserve entries written by a newer RTK across rewrites, and keep the recorded owners when one entry cannot be parsed. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - On uninstall, drop only the departing agent when the extension itself survives (removing a symlink leaves the target and its other owner). Recovery: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. - Copy non-stock content aside before replacing or removing it, never overwriting an earlier backup. - Make --dry-run describe what the real run does, including the backup. Symlinks: - Detect an alias at any path component, not just the last one. - Write through a dangling link to its target instead of replacing the link. - Route an unresolvable link through the same confirmation as any other content the user put there. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and an edited extension could not be uninstalled at all. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. Uninstall: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. The question says the edits are discarded. - Make --dry-run describe what the real run does. `rtk init --show --agent pi` reports the Pi extension instead of the generic configuration. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and an edited extension could not be uninstalled at all. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - Work out once, up front, whether the Pi and OMP paths resolve to the same file, so reading the record and warning act on one answer; an install checks again before recording, since creating the directory can make the paths meet. Uninstall: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. The question says the edits are discarded. - That question, and the advice to rerun with --auto-patch when it is declined, say whether the other agent loads the same file, since removing it removes it for both. The shared-file decision re-reads the record after the question. - Make --dry-run describe what the real run does. - Pi and OMP share one install and one uninstall path instead of near-copies. `rtk init --show --agent pi` reports the Pi extension instead of the generic configuration. The Pi README no longer says the extension blocks commands on a pipeline rule; it only rewrites. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and an edited extension could not be uninstalled at all. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - Work out once, up front, whether the Pi and OMP paths resolve to the same file, so reading the record and warning act on one answer; an install checks again before recording, since creating the directory can make the paths meet. Uninstall: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. The question says the edits are discarded. - That question, and the advice to rerun with --auto-patch when it is declined, say whether the other agent loads the same file, since removing it removes it for both. The shared-file decision re-reads the record after the question. - Make --dry-run describe what the real run does. - Pi and OMP share one install and one uninstall path instead of near-copies. `rtk init --show --agent pi` reports the Pi extension instead of the generic configuration. The Pi README no longer says the extension blocks commands on a pipeline rule; it only rewrites. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow-up to rtk-ai#3707. The ownership sidecar could not protect the case it exists for, and an edited extension could not be uninstalled at all. Ownership: - Record ownership for an extension that pre-dates the sidecar, marking the record partial instead of claiming sole ownership. Without this the sidecar is never created for an upgrading user, so shared-file protection is inert for everyone who already had the extension. - Merge into an existing record rather than resetting it: deleting the file does not unconfigure an agent that still resolves to that path. - Re-read the record immediately before writing, since a confirmation prompt sits between the caller's read and the write. - Work out once, up front, whether the Pi and OMP paths resolve to the same file, so reading the record and warning act on one answer; an install checks again before recording, since creating the directory can make the paths meet. Uninstall: - Give uninstall the same Ask/Auto/Skip policy as install, so a hand-edited or fork-built extension stays removable with --auto-patch instead of being permanently stuck. The question says the edits are discarded. - That question, and the advice to rerun with --auto-patch when it is declined, say whether the other agent loads the same file, since removing it removes it for both. The shared-file decision re-reads the record after the question. - Make --dry-run describe what the real run does. - Install's question before overwriting a non-stock extension says the same, since the overwrite reaches the other agent too. - Pi and OMP share one install and one uninstall path instead of near-copies. `rtk init --show --agent pi` reports the Pi extension instead of the generic configuration. The Pi README no longer says the extension blocks commands on a pipeline rule; it only rewrites. Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(omp)!: add Oh My Pi (OMP) support
Closes #591
Supersedes #1365
Adds
--agent omptortk init/--uninstall/--showfor the Oh My Pi coding agent.Per the 05-23 mutualization decision, OMP ships no separate extension file: the install places the exact
hooks/pi/rtk.tsthat Pi gets into OMP's extension directory, which OMP loads unchanged through its built-inlegacy-pi-compatlayer (import remap of@earendil-works/pi-coding-agentto the bundled@oh-my-pi/pi-coding-agent). Rewrite behavior is therefore byte-identical to Pi on both tested OMP versions (15.2.4 and 18.0.4).Usage
Install updates current or known historical stock content without prompting. For modified or unrelated content, the default is a confirmation prompt;
--auto-patchapproves and--no-patchleaves the file unchanged. A declined protected update, including non-interactive default No and--no-patch, exits nonzero; scripted upgrades should pass--auto-patchexplicitly.--dry-runpreviews the selected action without changing files. CRLF and LF stock files are treated identically.Uninstall is 3-way safe (the global file lives in a user-global dir): missing → no-op; exact stock match → removed; modified RTK content → preserved and refused on a normal run (previewed during
--dry-run). Unreadable content is left alone and causes a normal uninstall to exit nonzero, while--dry-runreports it and succeeds; unrelated content is left alone. When Pi and OMP paths in either scope resolve to the same file, RTK records Pi/OMP ownership in an adjacent hidden.rtk-agentsstate file. A valid sidecar is authoritative: a definitively shared file discloses the alias and prompts before removal;--auto-patchapproves a protected action, while a declined shared uninstall (including--no-patch) exits nonzero. Missing or corrupt ownership state is warned about and preserved without falsely claiming sole ownership; uncertain legacy uninstalls warn and proceed.--showreports unreadable files and continues. Last line from a dry run against a pre-existing, hand-modified global install:Why an extension (and not OMP pre-hooks)
OMP's
--hookis an alias for an extension path in current OMP, and the extension is the actively maintained surface for tool interception. With mutualization there is no new runtime surface at all — OMP's compat layer executes the Pi extension directly (tool_call→ bash-only →rtk rewrite→ mutateevent.input.command).Behavior
tool_callis delegated tortk rewrite; empty or unchanged output → command passes through untouched.console.warnis kept; the extension additionally registers a persistent session status (ctx.ui.setStatus("rtk", "RTK disabled: …")onsession_start) where the runtime exposes one. This is OMP's visible-alert channel:ctx.ui.notifytoasts are wiped by OMP's initial render (verified in 18.0.4 sources), sonotifyis deliberately not used. All additions are guarded (optional-chaining + try/catch), so the shared file is behaviorally identical on Pi.Files
12 files, +4621/−2015 (no
hooks/omp/):src/hooks/init.rs--showpaths, shared Pi/OMP ownership tracking across project/global scopes, canonical symlink detection, lossless unknown-state handling, stock-content classification, unreadable-file recovery, confirmation flow, history-based hash protection, and lifecycle testssrc/hooks/constants.rsOMP_DIR/OMP_LOCAL_DIRnext to the existing Pi constantssrc/main.rsAgentTarget::Omp+ dispatch, 3 testshooks/pi/rtk.ts.gitattributes.github/workflows/ci.ymlREADME.md,docs/guide/getting-started/supported-agents.md,hooks/README.md,src/hooks/README.mdTest plan
cargo fmt --all -- --check,cargo clippy --all-targets: clean.-textand by normalizing the embedded fixture before synthesizing CRLF input.omp): extension executes through the compat layer (-e); user-scope file auto-discovered and probed every session; project-scope.omp/extensions/rtk.tsauto-loaded and executed with no flags, no config, no prompt (marker binary fired). Full model-run e2e: a realomp -psession (qwen3.8-27b) shows the bash call asrtk git statusin the session JSONL after the extension rewrite, and the session completed.Rework of @makoMakoGo's #1365. Attribution: alvins82 +
Co-authored-by: makoMakoGo <[email protected]>(both original commits).