Skip to content

Move to OpenCode 2 and install Pi with mise - #29

Merged
kelchm merged 1 commit into
masterfrom
t3code/upgrade-opencode2-add-pi
Oct 3, 2026
Merged

kelchm merged 1 commit into
masterfrom
t3code/upgrade-opencode2-add-pi

Conversation

@kelchm

@kelchm kelchm commented Oct 3, 2026

Copy link
Copy Markdown
Owner

What changes

  • OpenCode 1 → 2. OpenCode 2 is published only as the npm package @opencode/cli; mise's registry opencode still resolves to 1.18.x. The tool entry becomes "npm:@opencode/cli" with allow_builds for that one package, because its postinstall script selects the native binary and mise blocks lifecycle scripts by default.
  • Pi added like the other harnesses: pi = "latest" (mise registry default backend), included in harness:update, PI_SKIP_VERSION_CHECK=1 so updates stay with mise, and rtk init -g --agent pi in both RTK init scripts.
  • RTK's OpenCode integration is dropped for now. RTK's plugin targets the V1 plugin API. OpenCode 2 logs failed to load plugin … must export a default definition on every server start. The init scripts no longer install it and .chezmoiremove deletes the stale ~/.config/opencode/plugins/rtk.ts. Restore both when feat: add opencode v2 plugin support (opencode2) rtk-ai/rtk#3463 ships.

Unchanged: the opencode.jsonc merge rule. OpenCode 2 reads the same config file and still honors enabled_providers / disabled_providers. OPENCODE_DISABLE_AUTOUPDATE is still recognized by the 2.x binary.

Verified on macOS (arm64)

  • mise install with this config installs npm:@opencode/[email protected] and [email protected]; opencode --version and opencode2 --version both report v2.0.22. Without allow_builds the install succeeds but the binary exits with "postinstall script was not run".
  • mise upgrade --dry-run and mise outdated accept the new tool list.
  • In a throwaway HOME: OpenCode 2 rejects RTK's current rtk.ts, and rtk init -g --agent pi --auto-patch installs only ~/.pi/agent/extensions/rtk.ts.
  • chezmoi status against this branch shows D .config/opencode/plugins/rtk.ts and the init script renders with the Pi line.

Not verified

  • Windows. The npm package ships Windows binaries and the postinstall handles win32, but nothing here was run on Windows.
  • A real chezmoi apply; nothing was applied to the live home directory.

After merging, per machine

  1. chezmoi apply
  2. Check opencode --version reports 2.x, then mise uninstall --all opencode to drop the old 1.x copy.

🤖 Generated with Claude Code

OpenCode 2 is published only as the npm package @opencode/cli; mise's
registry `opencode` still resolves to 1.x. Its postinstall selects the
native binary, so allow that one build script.

RTK's OpenCode plugin targets the V1 plugin API and fails to load under
OpenCode 2, so stop installing it and remove the stale copy until
rtk-ai/rtk#3463 ships. Pi gets the same treatment as the other
harnesses: mise install, update task, version-check opt-out, RTK init.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 25dbd2a6-5f76-40b9-9c7a-5b69539c9638
📥 Commits

Reviewing files that changed from the base of the PR and between 3300dad and 3300dad.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 763fccf6-5dc4-430b-8a85-d2f35a0f1089
📥 Commits

Reviewing files that changed from the base of the PR and between a377274 and 3300dad.

📒 Files selected for processing (5)
  • .chezmoiremove
  • README.md
  • dot_config/mise/config.toml
  • run_onchange_05-init-rtk.ps1.tmpl
  • run_onchange_05-init-rtk.sh.tmpl

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features
    • Added support for installing and updating the Pi CLI alongside OpenCode 2.
    • RTK initialization now configures the Pi integration on Windows and macOS.
  • Compatibility
    • OpenCode 2 is installed through its npm package. RTK’s OpenCode integration is skipped because its V1 plugin is incompatible with OpenCode 2.
    • Documentation now covers OpenCode 2 setup, migration limits, and removing duplicate installations.

Walkthrough

The mise configuration and README now track OpenCode 2 through @opencode/cli and add Pi. RTK setup initializes Pi instead of OpenCode, and the RTK OpenCode plugin is excluded while OpenCode V1 support is unavailable.

Changes

CLI and RTK setup

Layer / File(s) Summary
Harness CLI tracking
.chezmoidata/..., dot_config/mise/config.toml, README.md
The mise configuration adds Pi and installs and updates OpenCode 2 through npm:@opencode/cli. The README lists the six tools in its mise check and upgrade commands and documents OpenCode 2 installation and compatibility details.
RTK Pi setup
.chezmoiremove, README.md, run_onchange_05-init-rtk.*.tmpl
The RTK initialization scripts target Pi. The README describes the OpenCode V1 plugin incompatibility and replaces the OpenCode setup example with Pi. .chezmoiremove excludes the RTK OpenCode plugin.

Priority: ⚪ Not assessed

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 3300d

This change moves OpenCode to version 2 through its npm package, adds Pi, and points RTK setup at Pi. The OpenCode npm package supports Windows, and no concrete merge-blocking problem remains. Windows setup and a real chezmoi apply are still untested.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 3300d

The change adds trusted upstream installation code and a new per-user agent integration, without introducing explicit privilege elevation. The incompatible OpenCode plugin is deliberately removed. No security vulnerability was established, but upstream installation behavior and interrupted or concurrent setup remain incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Installation and initialization authority follows the invoking account, not a repository-specific sandbox. If newly trusted upstream code were malicious, its potential reach would include that account's accessible files and inherited environment, and downstream resources authorized by available credentials. Actual credential access or compromise was not observed.

Trust Boundaries and Controls

  • observed — The new installation trust boundary explicitly permits @opencode/cli lifecycle execution rather than enabling builds globally. Existing updater suppression and release-age configuration remain. These controls narrow installation policy but do not sandbox the permitted package or prove its dependency behavior.

Resilience and Maintainability Implications

  • inferred — The strongest supported partial-failure outcome is an incomplete optional RTK integration, not a demonstrated fail-open security control. Nevertheless, safe recovery of generated files after interruption or concurrent application cannot be established without RTK atomicity, ownership, and idempotency guarantees.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: moving to OpenCode 2 and adding Pi through mise.
Description check ✅ Passed The description explains the OpenCode 2 migration, Pi setup, RTK integration change, verification performed, and known limitations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kelchm kelchm mentioned this pull request Oct 3, 2026
@kelchm
kelchm added this pull request to stack #31 October 3, 2026 18:33
@kelchm
kelchm merged commit 6336081 into master Oct 3, 2026
1 check passed
kelchm added a commit that referenced this pull request Oct 3, 2026
Stacked on #29.

## Why

Three independent benchmarks (JetBrains, Glia, Quesma) put RTK at
roughly cost-neutral on real agent work, with slightly more turns and
flat-to-slightly-worse pass rates. Against that it costs two init
scripts, a stitch in every instruction file, a `CODEX_HOME` workaround,
and, after #29, a workaround for OpenCode 2 rejecting its plugin.

## What changes

- `rtk` leaves the mise config and the `harness:update` task.
- The `@RTK.md` stitches and the "prefix supported commands with `rtk`"
instruction leave the Claude and Codex instruction templates.
- The RTK init scripts are replaced by a one-time cleanup script (macOS
and Windows) that runs `rtk init --uninstall` for Claude, Codex, and Pi,
then `mise uninstall --all rtk`. It exits quietly on a machine that
never had RTK. Delete it once every machine has applied.
- `.chezmoiremove` still deletes the stale OpenCode plugin.

## Verified on macOS

Ran the rendered cleanup script against a throwaway `HOME` (with `mise`
stubbed so the real install was untouched) after installing all three
integrations there:

- It removed both `RTK.md` files, the `rtk hook` entries in
`settings.json` and `hooks.json`, and the Pi extension, and left an
unrelated Bash hook in place.
- A second run, and a run with no RTK installed, both exit 0.
- Rendered `CLAUDE.md`, `AGENTS.md`, and the mise config contain no RTK
references.

## Not verified

- The PowerShell script; it mirrors the shell one but was not run.
- A real `chezmoi apply`.

## Left behind on purpose

- RTK's own data directory (history and settings), e.g.
`~/Library/Application Support/rtk`.
- The `settings.json.bak` / `hooks.json.bak` files RTK writes when it
edits those files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[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.

1 participant