Skip to content

cli: make shell tool command/output collapse limits configurable #59897

Open

Description

@JoakimStauStald

Feature hasn't been suggested before.

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

Summary

In v2, the TUI already shortens a shell tool call: the command is cut to a fixed number of rows and the output shows its tail under (N earlier lines). Both limits are hardcoded, and there is no cli.json setting to change them. I'd like to make them configurable, including down to a single row for the command and a minimal output preview.

This follows the maintainer reply on #55420 ("If you'd like those limits to be configurable in v2, please open a new v2 request"). Related: #40096, #51229.

Environment

  • opencode version: v2.2.0
  • OS: Darwin 27.0.0 (arm64)
  • Terminal: Ghostty (TERM_PROGRAM=ghostty, COLORTERM=truecolor)
  • Shell: /bin/zsh
  • Install/channel: latest
  • Active plugins: one local TUI plugin (git-status, footer/status only; does not touch tool rendering)

Use case

I chain several commands in one tool call (cd ... && sed -n ...; cat ...; sed -n ...). In the full TUI that call takes several rows for the command, plus a tail of the output. In long sessions these blocks dominate the transcript and make it hard to follow the conversation. I would like a compact form: the command on one row and little or no output, with click-to-expand for details.

Proposal

Add settings under session in cli.json, for example:

{
  "session": {
    "tools": {
      "shell": {
        "command_rows": 1,
        "output_rows": 0,
        "output_tail": true
      }
    }
  }
}
  • command_rows: number of rendered rows of the command to show before truncating. The current hardcoded value would be the default.
  • output_rows: number of output lines to show. 0 would show only a summary like (N lines). The current hardcoded value would be the default.
  • output_tail: show the last lines (current behavior) or the first lines.
  • Clicking the block still expands it fully.

Defaults would preserve current behavior, so nothing changes unless set. A per-tool-name override (for other tools such as read/grep/generic) would be a natural extension.

What I tried

Additional Context

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the clear write-up, @JoakimStauStald! In short, you'd like cli.json settings for how many rows a shell tool block shows for the command and for the output (head or tail), with 0 meaning a summary only. Defaults would stay as they are, and clicking would still expand the block.

    You're right that these limits are hardcoded in v2 right now. The shell block uses a 10-line budget, and collapseShellOutput in packages/tui/src/util/collapse-tool-output.ts caps the command at 2 rows and shows the output's tail in what's left. Nothing in the config changes this yet. The TUI plugin API also has no hook for rendering tool blocks, so a plugin can't do it for now either.

    Maintainers will consider the request. Related issues:

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

Metadata

Metadata

Assignees

No one assigned

    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