Claude plugin: install the plugin version that matches the installed wt
Problem
The Claude Code plugin is installed from the marketplace at main, by design (#2402, #3434). The binary usually comes from a release, through Homebrew or cargo install. Nothing ties the installed plugin to the installed binary, so the plugin can run ahead of the wt it calls. A claude plugin update, or Claude Code's own background update, can move the plugin past what the binary supports at any time.
Since #4305 this skew has a concrete cost. Every hook goes through wt config plugins claude hook, and on wt v0.80.0 or earlier, worktree creation and removal fail. Today the only guard is the README's minimum-version note.
Proposal
Claude Code supports a command plugin source (v2.1.229+). The marketplace entry names a command that prints a plugin directory as one line. Claude Code runs it on install and update, then once per session in the background, and reinstalls when the directory's contents change. That fits a CLI that ships its own plugin.
A subcommand such as wt config plugins claude path could print a directory holding the plugin for this binary's version. The files could be embedded in the binary, the way the Pi extension already ships with include_str!, or fetched at the matching tag. wt config plugins claude install could then register a marketplace whose entry is:
{ "name": "worktrunk", "source": { "source": "command", "command": "wt config plugins claude path" } }
After a brew upgrade worktrunk, the next session would pick up the matching plugin, and the plugin could never run ahead of the binary.
A smaller alternative: an install --ref <tag> option that adds the marketplace as max-sixty/worktrunk#<tag>. That pins the plugin but still needs a re-run after each upgrade.
The Codex plugin is installed from main the same way, so it has the same skew wherever Codex offers a comparable mechanism.
What I'm doing meanwhile
I use a local directory marketplace named worktrunk, so the plugin id stays worktrunk@worktrunk and wt config plugins claude install still sees it as installed. Its one entry is a command source that runs a short script:
- Map
wt --versionto its tag, refusing anything that isn't a plainvX.Y.Z. - Shallow-fetch
plugins/worktrunkat that tag into a cache, once per version. - Print the path.
It works on Claude Code 2.1.318. After an upgrade, the next session's background run fetches the new tag. A failed fetch leaves the installed plugin in place. Happy to share the script if it helps.
This was written by Claude Code on behalf of zengzheqing
This changes how the plugin is installed and adds a subcommand, so whether to do it is a maintainer decision. I haven't opened a PR. Here is how it would fit the code as it stands.
Why the coupling is already there. Since #4305, every hook in plugins/worktrunk/hooks/hooks.json calls back into wt config plugins claude hook, so the plugin can only run against a wt new enough to have it. That is what the v0.81.0 note in plugins/worktrunk/README.md is about. Today install adds max-sixty/worktrunk as a GitHub marketplace (MARKETPLACE_SOURCE in src/commands/config/plugins.rs), and nothing ties that marketplace to the installed binary.
Embed the files rather than fetch them. Claude Code runs a command source once per session. If path fetched the plugin at the matching tag, wt would make a background network call the user never asked for, and Worktrunk only touches the network when the user asks. The fetch approach also has no tag to use for cargo install --git or other dev builds; your script refuses those. Embedding the files avoids both problems. wt already embeds the Pi, OMP and OpenCode plugins with include_str!, though those are single files. plugins/worktrunk is about 32 files (~530K). path would write them to a cache keyed by version and print that directory.
Costs a maintainer would weigh:
- A plugin-only fix, such as a skill doc or hook change, would reach users only with the next
wtrelease. Today a merge tomainships it. This is the reverse of the tradeoff #2402 made. - The command source needs Claude Code v2.1.229+, and administrators can turn it off with
disableCommandPluginSources.installwould still need the GitHub marketplace as a fallback, and the installed and uninstall checks (is_marketplace_configured) would need to recognise both kinds of marketplace. - The Codex plugin would keep the same skew until Codex has a comparable mechanism.
The install --ref <tag> alternative is less work, but it adds a flag and the plugin drifts again after every upgrade until install is re-run. It narrows the skew without removing it.
Your local command-source marketplace is a reasonable stopgap until then. It keeps the worktrunk@worktrunk id, which is the plugin install and uninstall look for.
Why the coupling is already there. Since #4305, every hook in
plugins/worktrunk/hooks/hooks.jsoncalls back intowt config plugins claude hook, so the plugin can only run against awtnew enough to have it. That is what thev0.81.0note inplugins/worktrunk/README.mdis about. Todayinstalladdsmax-sixty/worktrunkas a GitHub marketplace (MARKETPLACE_SOURCEinsrc/commands/config/plugins.rs), and nothing ties that marketplace to the installed binary.
I think this covers as much as is simple to implement though; unless anyone has a clear vision of how we could this in a simple way?
I don't see a simple way to fully pin the plugin. Every route goes through the command source or a pinned ref, with the costs above.
There is one cheap step that would make future skew mostly harmless, though. All hooks already go through the single wt config plugins claude hook entry point. The remaining risk is a newer plugin registering an event that an older wt doesn't know. Today ClaudeHook fails to parse an unknown hook_event_name. A #[serde(other)] Unknown variant that exits 0 would let an older binary skip events it doesn't handle, instead of erroring. After that, keeping the hook interface additive would cover most of what pinning would. It only protects binaries released after the change, so the v0.81.0 note still stands for older ones.