Feature hasn't been suggested before.
Describe the enhancement you want to request
Right now, plugins are completely blind to worktree operations (create, remove, reset). Because these operations only emit directly to GlobalBus instead of going through Bus.publish(), they successfully reach SSE clients and the TUI, but entirely bypass plugin subscriptions.
This creates a few major roadblocks for plugin authors:
- Leaked external resources: If a plugin spins up a dev server, Docker container, or DB branch for a worktree, it has no signal to tear it down when the worktree is removed (or provision it on create).
- Stale cache data: Plugins that maintain local state per worktree (like indexed context or build artifacts) end up holding onto dead data because they don't know when a worktree is deleted or hard-reset.
Proposed events
Three new events emitted via Bus.publish() so they reach both plugins (via Bus.subscribeAll) and existing SSE/TUI consumers (via GlobalBus):
| Event |
Payload |
When |
worktree.created |
{ info: { name, branch, directory } } |
After git worktree add and sandbox registration succeed, before async bootstrap |
worktree.removed |
{ directory } |
After worktree directory cleanup and branch deletion |
worktree.reset |
{ directory } |
After git reset --hard, git clean, and submodule update complete |
Feature hasn't been suggested before.
Describe the enhancement you want to request
Right now, plugins are completely blind to worktree operations (create, remove, reset). Because these operations only emit directly to
GlobalBusinstead of going throughBus.publish(), they successfully reach SSE clients and the TUI, but entirely bypass plugin subscriptions.This creates a few major roadblocks for plugin authors:
Proposed events
Three new events emitted via
Bus.publish()so they reach both plugins (viaBus.subscribeAll) and existing SSE/TUI consumers (viaGlobalBus):worktree.created{ info: { name, branch, directory } }git worktree addand sandbox registration succeed, before async bootstrapworktree.removed{ directory }worktree.reset{ directory }git reset --hard,git clean, and submodule update complete