Skip to content

feat(omp)!: add Oh My Pi (OMP) support - #3707

Merged
KuSh merged 14 commits into
rtk-ai:developfrom
alvins82:omp-shared
Sep 4, 2026
Merged

KuSh merged 14 commits into
rtk-ai:developfrom
alvins82:omp-shared

Conversation

@alvins82

@alvins82 alvins82 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

feat(omp)!: add Oh My Pi (OMP) support

Closes #591
Supersedes #1365

Adds --agent omp to rtk init / --uninstall / --show for 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.ts that Pi gets into OMP's extension directory, which OMP loads unchanged through its built-in legacy-pi-compat layer (import remap of @earendil-works/pi-coding-agent to 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

$ rtk init --agent omp --dry-run
[dry-run] would create local OMP extensions directory: .omp/extensions
[dry-run] would create OMP extension: .omp/extensions/rtk.ts
$ rtk init -g --agent omp --dry-run
[dry-run] would update OMP extension: ~/.omp/agent/extensions/rtk.ts
$ rtk init --agent omp --uninstall
RTK OMP extension was not installed (nothing to remove)

Install updates current or known historical stock content without prompting. For modified or unrelated content, the default is a confirmation prompt; --auto-patch approves and --no-patch leaves the file unchanged. A declined protected update, including non-interactive default No and --no-patch, exits nonzero; scripted upgrades should pass --auto-patch explicitly. --dry-run previews 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-run reports 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-agents state file. A valid sidecar is authoritative: a definitively shared file discloses the alias and prompts before removal; --auto-patch approves 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. --show reports unreadable files and continues. Last line from a dry run against a pre-existing, hand-modified global install:

$ rtk init -g --agent omp --uninstall
rtk: OMP extension at ~/.omp/agent/extensions/rtk.ts contains RTK content that does not match the stock extension. Remove the file manually.
$ rtk init --agent omp --show
rtk Configuration (Oh My Pi):

  Global extension: ~/.omp/agent/extensions/rtk.ts (modified - rtk init will refuse to overwrite; remove it manually)
  Project extension: .omp/extensions/rtk.ts (not installed)

Why an extension (and not OMP pre-hooks)

OMP's --hook is 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 → mutate event.input.command).

Behavior

  • Rewrite, fail-open: bash tool_call is delegated to rtk rewrite; empty or unchanged output → command passes through untouched.
  • Unavailable/too-old RTK: existing console.warn is kept; the extension additionally registers a persistent session status (ctx.ui.setStatus("rtk", "RTK disabled: …") on session_start) where the runtime exposes one. This is OMP's visible-alert channel: ctx.ui.notify toasts are wiped by OMP's initial render (verified in 18.0.4 sources), so notify is deliberately not used. All additions are guarded (optional-chaining + try/catch), so the shared file is behaviorally identical on Pi.
  • Shared file: the extension remains byte-identical between Pi and OMP; OMP-only status reporting is guarded by the host UI surface.

Files

12 files, +4621/−2015 (no hooks/omp/):

File Change
src/hooks/init.rs OMP install/uninstall/--show paths, 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 tests
src/hooks/constants.rs OMP_DIR / OMP_LOCAL_DIR next to the existing Pi constants
src/main.rs AgentTarget::Omp + dispatch, 3 tests
hooks/pi/rtk.ts the 4 guarded deltas above (shared with OMP)
.gitattributes preserves hook payload line endings across platforms
.github/workflows/ci.yml full Git history for the extension hash regression guard
README.md, docs/guide/getting-started/supported-agents.md, hooks/README.md, src/hooks/README.md additive rows/section only

Test plan

  • cargo fmt --all -- --check, cargo clippy --all-targets: clean.
  • Full suite: 2773 passed / 8 ignored / 0 failed across 10 test suites, including CRLF handling, confirmation flow, unreadable-file safety, Pi/OMP ownership lifecycle unit tests, CLI integration coverage, project/global directory- and file-level symlink alias detection, uncertain legacy/corrupt-state handling, and the full-ancestor Git-history extension hash guard.
  • Windows checkout behavior is covered by marking hook payloads -text and by normalizing the embedded fixture before synthesizing CRLF input.
  • Extension harness (Pi-shaped fake API): 5/5 — normal rewrite, no-op passthrough, rtk missing, rtk too old, non-bash passthrough.
  • Dry runs of all OMP install/uninstall paths (outputs above), including modified-content previews and shared-path confirmation previews against real pre-existing installs.
  • Live OMP 18.0.4 (homebrew omp): extension executes through the compat layer (-e); user-scope file auto-discovered and probed every session; project-scope .omp/extensions/rtk.ts auto-loaded and executed with no flags, no config, no prompt (marker binary fired). Full model-run e2e: a real omp -p session (qwen3.8-27b) shows the bash call as rtk git status in 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).

alvins82 and others added 2 commits August 25, 2026 19:04
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]>
@CLAassistant

CLAassistant commented Aug 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@KuSh KuSh left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_omp got the missing/exact-match/modified split; uninstall_pi is 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 making uninstall_pi 3-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.

Comment thread hooks/pi/rtk.ts Resolved
Comment thread hooks/pi/rtk.ts Resolved
Comment thread src/hooks/init.rs Resolved
@alvins82

Copy link
Copy Markdown
Contributor Author

Addressed the review feedback in ad51059 and pushed it to alvins82:omp-shared.

  • Removed the shared setLabel("RTK") call because Pi’s setLabel is the two-argument tree-entry API; the shared extension no longer calls it with the wrong contract.
  • Registered the unavailable-status handler before the async rtk --version probe and retained the session context, so a session_start during the probe cannot lose the status.
  • Kept the persistent setStatus path; OMP v18.0.4 source still clears initial-render notify toasts. Added failure-safe handling.
  • Added SHA-256 allowlisting for all known stock Pi extension revisions, so untouched older installs are recognized by uninstall and --show.
  • Made Pi uninstall 3-way safe like OMP: remove only known stock RTK content, refuse modified RTK content, and leave unrelated extensions alone.

Verification: cargo fmt --all -- --check, cargo clippy --all-targets, cargo test --all (2,719 passed, 8 ignored), and the extension harness including the probe/session_start race all pass.

Please re-review.

@alvins82

Copy link
Copy Markdown
Contributor Author

Resolved the branch conflict by merging the latest rtk-ai/rtk:develop into omp-shared in 12a7cf0.

GitHub now reports the PR as mergeable. Validation after the merge: cargo fmt --all -- --check, cargo clippy --all-targets, and cargo test --all (2,743 passed, 8 ignored).

Ready for re-review.

@alvins82

Copy link
Copy Markdown
Contributor Author

Following up on the review-level design note: uninstall_pi is now 3-way safe as well. It removes current or known-stock RTK content, refuses modified RTK content, and leaves unrelated extensions untouched. The shared-file additions remain lightweight.

This is included in ad51059 plus merge commit 12a7cf0; the full suite passes after the merge (2,743 passed, 8 ignored).

@cprivitere

Copy link
Copy Markdown

Replaces: #3347 #3151 #2166 #1827 #1365

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-argument setStatus(key, text).
  • session_start race — registerRtkUnavailableNotice(pi) now runs before await pi.exec(...), and the retained sessionContext + applyStatus() covers both orderings. Fail-open try/catch around pi.on is right. Accepted the setStatus-over-notify decision 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).

Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
@alvins82

Copy link
Copy Markdown
Contributor Author

Follow-up fixes are pushed in d268e8f.

  • Completed the stock-hash allowlist with the current and shipped revisions, removed the dead entry, and made the invariant test validate the array directly.
  • Documented Pi/OMP install and uninstall behavior, including modified-file handling, OMP sharing, the global path override, and the changelog entry.
  • Made OMP dry-run output consistent for missing and unrelated files.
  • Reused OMP’s PI_CODING_AGENT_DIR override and added behavioral global install/uninstall coverage.
  • Pi and OMP installs now refuse to overwrite unknown existing files, preserving modified or third-party extensions.

Validation: cargo fmt --all -- --check, cargo clippy --all-targets, and cargo test --all (2,746 passed, 8 ignored). Ready for re-review.

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
@alvins82

Copy link
Copy Markdown
Contributor Author

Follow-up fixes for the latest re-review are pushed in 0022488 (002248839e2dec6ce146d23a344cacbbe4f6ca78), and the PR description is updated.

Addressed:

  • OMP stock uninstall now has the dry-run footer and real-removal restart guidance.
  • Global uninstall warns when PI_CODING_AGENT_DIR makes the Pi and OMP paths share one file; the supported-path/profile limitations are documented.
  • --show now matches the refusal-on-modified-content behavior.
  • Install validation happens before directory creation; modified-content dry runs report the refusal and exit successfully without changing files.
  • Historical hash coverage now pins the current and all seven known historical revisions.
  • Uninstall classification uses the actual pi.exec("rtk", ["rewrite" code marker, not prose comments.
  • Added CLI integration coverage for these paths.

Validation is clean: cargo fmt --all -- --check, cargo test --all (2754 passed, 8 ignored), and cargo clippy --all-targets.

Ready for re-review.

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 of bail!. This is the --force escape hatch that's currently missing, and because read_line hits 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 an eprintln! 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.

Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
@alvins82

Copy link
Copy Markdown
Contributor Author

Addressed the latest re-review in 256d4a7 (256d4a77bb75530de3d2de40a01e515e31d4b82e).

In addition to the four inline fixes:

  • Pi/OMP stock identity now normalizes CRLF to LF.
  • Modified-content uninstall dry runs preview and exit successfully; unreadable files are preserved.
  • Global installs disclose the shared PI_CODING_AGENT_DIR alias.
  • Shared global uninstalls now use PatchMode::Ask; --auto-patch approves, --no-patch skips, and --dry-run previews the prompt. Ordinary stock upgrades remain prompt-free.
  • The PR description and safety documentation now describe the confirmation behavior.

Validation remains clean: cargo fmt --all -- --check, cargo test --all (2760 passed, 8 ignored), and cargo clippy --all-targets.

Ready for re-review.

@abcabc0330

Copy link
Copy Markdown

Verified this implementation against a real omp install — supporting merge.

Path correctness confirmed. I checked omp's actual extension discovery:

  • Project-local: <cwd>/.omp/extensions (rtk.ts) ✅ matches this PR's .omp/extensions/
  • User-global: ~/.omp/agent/extensions (rtk.ts) ✅ matches this PR's global path

I tested the shared extension end-to-end: the exact hooks/pi/rtk.ts file loaded from ~/.omp/agent/extensions/rtk.ts in a live omp session rewrites git status → rtk git status (verified in rtk gain --history). omp's legacy-pi-compat layer resolves the @earendil-works/pi-coding-agent import, so sharing one file between Pi and OMP works as this PR describes.

The shared-path protection (asking before overwriting/removing the Pi/OMP aliased file when PI_CODING_AGENT_DIR is set) is a thoughtful safety touch I don't see in the other omp PRs — that alone makes this the strongest candidate. The dedicated tests/omp_init_test.rs and CHANGELOG/supported-agents updates round it out.

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 KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
@alvins82

Copy link
Copy Markdown
Contributor Author

The five findings from review 5050814848 are addressed in 48ee59e.

  • Pi-only relocated global installs no longer warn or prompt unless OMP configuration is present; explicit OMP operations remain shared-path aware.
  • Declined protected installs and shared uninstalls now fail nonzero; dry-runs remain non-destructive previews.
  • Older stock Pi extensions using a locally imported exec are recognized.
  • Auto-patch dry-runs explicitly preview non-stock overwrites.
  • OMP --show reports unreadable files and continues.

Verification: 2762 tests passed, 8 ignored; cargo fmt, Clippy, and diff checks passed. Ready for re-review.

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
@alvins82

Copy link
Copy Markdown
Contributor Author

Addressed the latest re-review findings in 42a9147 and pushed to alvins82:omp-shared.

  • Added symmetric Pi/OMP ownership tracking for relocated shared extensions via an adjacent rtk.ts.rtk-agents sidecar, with configuration-directory fallback for older installs.
  • Made unreadable/non-UTF-8 installs follow Ask/Auto/Skip policy, including --auto-patch recovery and dry-run previews.
  • Made normal unreadable uninstalls warn on stderr and exit nonzero while leaving the file untouched; dry-run remains a successful preview.
  • Documented the nonzero behavior for protected Pi/OMP --no-patch actions.

Verification: cargo fmt --all -- --check, cargo test --all (2765 passed, 8 ignored), cargo clippy --all-targets, and git diff --check all pass. Ready for re-review.

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_start is a real Pi event — documented in earendil-works/pi docs/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 *.ts and */index.ts only; OMP's native discovery is limited to .ts/.js. rtk.ts.rtk-agents matches 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.

Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
Comment thread src/hooks/init.rs Resolved
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.
@alvins82 alvins82 changed the title feat(omp): add Oh My Pi (OMP) support feat(omp)!: add Oh My Pi (OMP) support Sep 2, 2026
@alvins82

alvins82 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Fixed and resolved the latest review pass in d302797.

  • Pre-existing extensions with absent ownership state remain uncertain; no invented sole-owner sidecar.
  • Alias protection now covers project and global scopes, including symlinked agent directories.
  • Uninstalls capture the canonical sidecar path before deleting the extension, including file-level symlinks.
  • Removed the duplicate normal-run stdout message for --no-patch.
  • Corrected the history guard to use git rev-list HEAD --full-history -- hooks/pi/rtk.ts.
  • Classified the protected overwrite behavior as breaking in the changelog, commit metadata, PR title, and migration guidance for --auto-patch.

Verification: cargo test --all — 2773 passed, 8 ignored; cargo clippy --all-targets -- -D warnings — clean; formatting and diff checks — clean.

All latest review threads have replies and are resolved. Ready for re-review.

@KuSh

KuSh commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Windows CI is red, and it's a one-line fix. Everything else looks good to me.

The failure

test (windows-latest) — 3000 passed, 1 failed:

thread 'hooks::init::tests::test_known_pi_plugin_hashes_are_sha256'
panicked at src\hooks\init.rs:9086:9:
assertion failed: is_current_pi_plugin(&crlf)

Ubuntu and macOS pass, so it's platform-specific rather than a logic error.

Cause

The fixture assumes an LF checkout:

let crlf = PI_PLUGIN.replace('\n', "\r\n");

Windows runners use core.autocrlf=true, and .gitattributes currently exempts only tests/fixtures/** from EOL conversion — not hooks/. So on Windows hooks/pi/rtk.ts is checked out with CRLF, PI_PLUGIN is already CRLF, and the replace produces \r\r\n. normalize_pi_plugin_line_endings is a single-pass replace("\r\n", "\n"), so "\r\r\n" becomes "\r\n" — still not LF — and the assertion fails.

Worth noting the existing .gitattributes comment already describes this exact failure mode ("tests that synthesize CRLF input from them produce \r\r\n"); the hook payloads just weren't covered by it.

Fix

# .gitattributes
hooks/**/*.ts -text

That also keeps the bytes RTK installs, and hashes against KNOWN_PI_PLUGIN_HASHES, identical across platforms — which matters beyond this one test.

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.

Otherwise

LGTM. Worth calling out that this is the first CI run on the PR — earlier pushes only ever showed check-target: skipping — so the matrix going green is signal that wasn't available during the review rounds. clippy, fmt, both security scans, doc review and the other two platforms all pass.

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 --auto-patch escape hatch for hand-edited content). None of it is a regression against develop — OMP support doesn't exist there today — so I'd rather it not hold this up; happy to send it as a follow-up once this lands.

Prevent Windows checkout conversion from corrupting embedded hook fixtures and make the CRLF regression independent of the source checkout line endings.
@alvins82

alvins82 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the Windows CI failure in a083e05.

  • Added hooks/**/*.ts -text to .gitattributes so installed hook payloads and embedded hashes keep stable line endings across platforms.
  • Made the CRLF regression fixture normalize existing CRLF before synthesizing CRLF, so it remains correct even if checkout attributes change.
  • Updated the PR description with the fix and current stats.

Local verification: cargo test --all — 2773 passed, 8 ignored; cargo clippy --all-targets -- -D warnings — clean; fmt and diff checks — clean.

The PR now has the fix pushed at a083e05; Windows CI should rerun against this head.

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@KuSh
KuSh merged commit e53ec1c into rtk-ai:develop Sep 4, 2026
12 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Sep 4, 2026
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 5, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 13, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 17, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 20, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 20, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 20, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 20, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 21, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Sep 28, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Oct 7, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Oct 7, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Oct 19, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Oct 19, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Oct 31, 2026
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]>
KuSh added a commit to KuSh/rtk that referenced this pull request Nov 28, 2026
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]>
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.

Add support for Oh-My-Pi

5 participants