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: Include user message text in experimental.chat.system.transform input #17637
The experimental.chat.system.transform hook currently receives { sessionID, model } in its input, but does not include the user's message text. This makes it impossible for plugins to do targeted context injection based on the user's current prompt.
Use Case
I've built a memory recall plugin that automatically injects relevant context from a persistent knowledge base into the system prompt. The ideal flow:
User types a message about topic X
system.transform hook reads the message
Plugin queries the knowledge base for topic X
Plugin pushes relevant context into output.system
The LLM sees the context on the same turn the user asked about it
Currently, the user's message text is only available in chat.message which fires aftersystem.transform, so the targeted context can only be injected on the next turn.
Current Workaround
Two-phase approach:
Phase 1 (session.created): Broad recall using project name
Phase 2 (chat.message): Captures user text, does targeted recall, rewrites an instructions file that OpenCode re-reads on the next turn
This means turn 1 gets generic context and turn 2+ gets targeted context. Works but adds a one-turn delay.
Proposed Change
Include the user's message content in system.transform input:
awaitPlugin.trigger("experimental.chat.system.transform",{sessionID: input.sessionID,model: input.model,userMessage: currentUserMessage,// add this},{ system });
Or include the full messages array:
awaitPlugin.trigger("experimental.chat.system.transform",{sessionID: input.sessionID,model: input.model,messages: msgs,// the messages being sent to the LLM},{ system });
Verification
Confirmed via strings analysis of the OpenCode 1.2.26 binary that:
experimental.chat.system.transform exists and fires during prompt construction
chat.message exists and fires after system prompt is built
The user message is available in memory at system.transform time but isn't passed to the hook
Feature requests must use the feature request template, which requires: a title starting with [FEATURE]:, and a verification checkbox confirming the feature hasn't been suggested before.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
Activity
github-actions commentedon Mar 15, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:, and a verification checkbox confirming the feature hasn't been suggested before.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
experimental.chat.system.transformhook (same hook, different field addition)If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Mar 15, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.