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
Plugins that perform PII/secret redaction (like vibeguard) currently use experimental.chat.messages.transform to redact content before it reaches the LLM API. However, this hook fires after the message is already persisted to the SQLite database.
This means sensitive data (passwords, API keys, PII) is stored in plaintext on disk in ~/.local/share/opencode/opencode.db — even though it never reaches the LLM.
There is no SDK method to update stored message parts after the fact, and the message.part.updated event is read-only.
Proposed Solution
Add a new hook:
"experimental.message.store.before": async(input,output)=>{// output.parts is the array of message parts about to be persisted// Plugin can modify part.text, state.output, etc. in-place// Modified content is what gets written to the DB}
This would fire before the message/part is written to the database, allowing privacy plugins to redact content before it ever touches disk.
Use Case
The opencode-vibeguard plugin detects and redacts PII/secrets using regex + AI (local NER model). It needs to ensure passwords and tokens never persist to disk — not just that they are hidden from the LLM.
Current Workaround
The only option today is direct SQLite manipulation after the message.part.updated event fires, which is fragile and couples to internal schema details.
Additional Context
The existing experimental.chat.messages.transform hook signature would work identically — just firing at a different lifecycle point
This would make OpenCode viable for enterprises with data-at-rest compliance requirements (SOC 2, GDPR right-to-erasure, etc.)
Activity
github-actions commentedon May 18, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:(e.g.[FEATURE]: pre-storage message transform hook)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:
message.parts.beforeplugin hook — same concept of intercepting message parts before processingIf you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon May 18, 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.