Skip to content

[FEATURE]: Collapsible tool output (code/diff/blocks) in TUI #40096

Open

Description

@aravasio
  • I have verified this feature I'm about to request hasn't been suggested before.

Tool output blocks (Write, Edit, Shell, GenericTool) render fully expanded, adding noise in long sessions and making chain-of-thought hard to follow.

Request: Add a global toggle (/collapse slash command + optional keybind) that collapses all tool blocks to a summary line (file name / diff stats / line count). Per-block click-to-expand via local override on top of the global mode.

Working prototype on my fork: https://github.com/aravasio/opencode/tree/collapse-tool-output

Happy to open a PR if this direction is accepted.

Screenshots for reference

Image Image

Activity

  1. changed the title [-]Collapsible tool output (code/diff/blocks) in TUI[/-] [+][FEATURE]: Collapsible tool output (code/diff/blocks) in TUI[/+] on Aug 1, 2026
  2. github-actions commented on Aug 1, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now follows the contributing guidelines and the needs:compliance label has been removed. We appreciate you including a working prototype — that's very helpful context.

  3. aravasio commented on Aug 1, 2026

    @aravasio
    Author

    Related existing issues:

    The approach in this issue (global /collapse toggle + per-block click) is broader than #14511 — it adds a persistent toggle mode (not just last-output), a slash command, and a KV-backed global state. But the core UX overlap is real.

    Happy to consolidate if maintainers prefer one approach over the other.

  4. zhiganov commented on Sep 3, 2026

    @zhiganov

    A V2-specific case that strengthens this request: the invocation text itself can dominate the screen, even before there is any output.

    Environment:

    • OpenCode V2 v0.0.0-beta-18992
    • Windows
    • TERM=xterm-256color

    Examples from separate routine operations include:

    • A two-file git diff
    • A commit/push/status sequence
    • A generated inline node -e script that compares two OpenAPI specifications

    The generated script is the clearest case. A command shaped like this can wrap across half the viewport by itself:

    node -e "const fs=require('fs'),yaml=require('yaml'); ... [long generated OpenAPI comparison] ..."
    

    This means collapsing or truncating only the tool result is insufficient. The TUI needs to collapse both the invocation and its output.

    A useful compact presentation would be:

    Shell · inspected changes in two files
    Shell · committed and pushed
    Shell · compared two OpenAPI specifications
    

    The full invocation and result could be expanded independently. Errors and permission requests could remain expanded automatically.

  5. Nowaker commented on Oct 9, 2026

    @Nowaker

    #54039 adds this to the v1 TUI as a tui.json setting rather than a toggle. tool_output.collapse sets how many lines each tool block shows before Click to expand, per group (bash, generic for plugin and MCP tools, write, edit, apply_patch) or per tool name. 0 collapses a block to just its title or command, so every tool call takes one line until clicked, and "never" keeps it fully expanded. Write, edit and patch blocks gain the expand toggle too. There's no slash command or keybind for a global switch.

    { "tool_output": { "collapse": { "bash": 0, "generic": 0, "write": 0, "edit": 0, "apply_patch": 0 } } }

    This comment is AI generated, but under direct supervision and on request of @Nowaker.

  6. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the detailed request and the prototype, @aravasio!

    To restate it: you'd like a global collapse mode for tool blocks (Write, Edit, Shell, generic tools) in the TUI, toggled with a /collapse command or an optional keybind. Each block would shrink to a one-line summary (file name, diff stats or line count), and you could click a block to expand it on top of the global mode.

    For reference, v2 already has some related controls, though none of them collapse every tool block:

    • session.verbosity (low / medium / high), which the Verbosity command cycles through. low summarizes each run of tools and thoughts.
    • session.grouping, which controls grouping of exploration items.
    • Shell output is already cut down to a short preview that you can click to expand.

    Maintainers will look at this request and decide on the direction. Since you offered a PR, it's probably best to wait for their input on the design, for example whether this should go into the existing verbosity setting or be a separate toggle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions