Summary
The plugin now loads successfully, but the expected runtime behavior still does not occur in a real OpenCode session.
After worktree_prepare creates a task worktree, a subsequent write tool call still writes into the repo root instead of the prepared worktree.
What was verified
- The plugin loads successfully when pinned to a fixed alpha version.
- The previous load failure (
Plugin export is not a function) is no longer present in this setup.
- In a real
opencode run --dir . flow, worktree_prepare succeeds.
- A later
write tool call still targets the repository root rather than the new worktree.
Observed behavior
A prompt that asks OpenCode to:
- run
worktree_prepare
- then write a file in the repo for that task
results in:
- a worktree being created successfully
- the file being written to the original repo root instead of the created worktree
Expected behavior
Once worktree_prepare has created and bound a task worktree for the session, subsequent repo-scoped tool calls such as write should be redirected into that worktree when the plugin policy says they should be.
Reproduction
Use an OpenCode setup that loads the plugin successfully.
Example flow:
opencode run --dir . --model opencode/minimax-m2.5 --title "plugin write smoke local" --format json "Use worktree_prepare with title 'plugin smoke local'. Then use the write tool to create SMOKE_PLUGIN_WRITE_LOCAL.txt containing exactly 'plugin smoke local' in the repo root for this task."
Result from the reproduced run
worktree_prepare created a worktree successfully
write then created SMOKE_PLUGIN_WRITE_LOCAL.txt in the repo root
- it did not write into the new worktree
Notes
This suggests the remaining problem is not plugin loading anymore, but that the hook/runtime integration for write is not affecting real tool execution as intended.
Summary
The plugin now loads successfully, but the expected runtime behavior still does not occur in a real OpenCode session.
After
worktree_preparecreates a task worktree, a subsequentwritetool call still writes into the repo root instead of the prepared worktree.What was verified
Plugin export is not a function) is no longer present in this setup.opencode run --dir .flow,worktree_preparesucceeds.writetool call still targets the repository root rather than the new worktree.Observed behavior
A prompt that asks OpenCode to:
worktree_prepareresults in:
Expected behavior
Once
worktree_preparehas created and bound a task worktree for the session, subsequent repo-scoped tool calls such aswriteshould be redirected into that worktree when the plugin policy says they should be.Reproduction
Use an OpenCode setup that loads the plugin successfully.
Example flow:
Result from the reproduced run
worktree_preparecreated a worktree successfullywritethen createdSMOKE_PLUGIN_WRITE_LOCAL.txtin the repo rootNotes
This suggests the remaining problem is not plugin loading anymore, but that the hook/runtime integration for
writeis not affecting real tool execution as intended.