You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Plugin hook to update active model and have subagents inherit it #18666
I have verified this feature I'm about to request hasn't been suggested before.
Right now when a plugin changes the model via the chat.message hook, it only affects that one turn. The model picker still shows the old model, and the next turn goes back to it.
I want plugins to be able to actually change the active model so that:
The model picker updates to show the new model
Future turns use the new model
Subagents inherit it properly
This would fix #17870 (subagents ignoring parent's model) and enable things like dynamic model routing based on task type.
What works today:chat.message can mutate output.message.model and it flows through to the assistant and subagents for that turn.
What's missing: The active model state and UI don't update. Future turns revert.
Proposed: When a plugin changes the model in chat.message, also update OpenCode's active model state so the UI reflects it and future turns use it.
I have tests covering the model inheritance chain at packages/opencode/test/session/chat-message-model-routing.test.ts and JSDoc in the plugin index documenting this capability.
If your feature request is specifically about the plugin hook mechanism (not just the inheritance bug), it may be worth clarifying how it differs from #18615 to avoid duplicate effort.
Activity
github-actions commentedon Mar 22, 2026
This issue might be a duplicate of or closely related to existing issues. Please check:
If your feature request is specifically about the plugin hook mechanism (not just the inheritance bug), it may be worth clarifying how it differs from #18615 to avoid duplicate effort.
v1truv1us commentedon Mar 22, 2026
Closing this one and reopening with better context.
feat: add chat.model hook with reference token-optimizer plugin