Repository navigation
Description
Problem
OpenCode plugins can currently transform completed text, but they cannot reliably prevent noisy model output from briefly appearing in the TUI/CLI while it is streaming.
This matters for models that emit reasoning or scratchpad-style text in the normal assistant channel, for example <think>...</think> blocks or long implementation narration. A plugin can clean the persisted session afterward, but the user still sees the raw stream flash live before cleanup.
Current workaround
I am using an external plugin/session-cleaner approach:
experimental.text.complete/ post-processing strips reasoning blocks and compacts final reports.- A background cleaner rewrites persisted session text shortly after it is stored.
- A separate audit script catches visible reasoning blocks or missing final-report evidence after the fact.
This works for stored session readability, but it is inherently post-hoc. It cannot provide a clean live UI experience.
Requested capability
Please add a plugin hook that runs before streamed assistant text is rendered to the TUI/CLI, for example:
"experimental.text.delta"?: (input, delta) => string | { text: string; hidden?: boolean }or a similar pre-render event such as:
"message.part.delta.beforeRender"?: ({ sessionID, messageID, partID, textDelta }) => { textDelta?: string; hidden?: boolean }Useful semantics:
- Runs before a text delta is displayed.
- Can replace, suppress, or mark a delta as hidden.
- Can preserve the original text internally if OpenCode needs it for debugging/session data.
- Applies consistently to TUI, CLI, desktop, and IDE views if those surfaces share the stream renderer.
- Should be best-effort and bounded; plugins should not be able to hang streaming indefinitely.
Use cases
- Hide model reasoning emitted in the assistant channel, such as
<think>blocks. - Compact verbose progress narration while preserving tool calls and final answers.
- Redact accidental secrets before they are displayed.
- Route raw reasoning to a hidden/debug channel while showing only user-facing progress.
- Enforce organization-specific output policies without forking OpenCode.
Why existing hooks are not enough
Completed-text hooks are useful, but they happen too late for live UX. They can clean the final stored result, but they cannot stop the user from seeing raw model output during generation.
A pre-render stream hook would let plugins solve this externally and keep OpenCode easy to update, instead of requiring local forks or patches to the renderer.
Thanks for considering this. I am happy to test an experimental hook against noisy reasoning models and report back on plugin behavior.
Activity
github-actions commentedon Jun 26, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:(e.g.,[FEATURE]: pre-render stream/output filter hook for plugins).Please edit this issue to address the above within 2 hours, or it will be automatically closed.
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Jun 26, 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.