Some models are overeager to add | head -n or | tail -n to commands #7612

Open
opened 2026-02-16 18:07:43 -05:00 by yindo · 1 comment
Owner

Originally created by @smola on GitHub (Jan 26, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Some models are overeager to add | head -n or | tail -n to commands. This makes sense with some other coding agents (e.g. gemini-cli will just fall apart on large outputs) but large outputs from Bash is handled gracefully in OpenCode, so it should not be needed.

In some cases, overeager use of head or tail leads to command repetition because the limit was too small to capture the required output. Even worse, sometimes the use of head will just make the main command file on a broken pipe.

There's a related case in overeager use of tee that could probably be addressed too, but it's practical impact in task performance is lower.

System prompt and tool call descriptions should be refined to mitigate this issue.

Plugins

None

OpenCode version

1.1.35

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Linux

Terminal

Ghostty

Originally created by @smola on GitHub (Jan 26, 2026). Originally assigned to: @thdxr on GitHub. ### Description Some models are overeager to add `| head -n` or `| tail -n` to commands. This makes sense with some other coding agents (e.g. `gemini-cli` will just fall apart on large outputs) but large outputs from Bash is handled gracefully in OpenCode, so it should not be needed. In some cases, overeager use of `head` or `tail` leads to command repetition because the limit was too small to capture the required output. Even worse, sometimes the use of `head` will just make the main command file on a broken pipe. There's a related case in overeager use of `tee` that could probably be addressed too, but it's practical impact in task performance is lower. System prompt and tool call descriptions should be refined to mitigate this issue. ### Plugins None ### OpenCode version 1.1.35 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System Linux ### Terminal Ghostty
yindo added the bug label 2026-02-16 18:07:43 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 26, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10438: gemini-3-pro-preview tends to avoid grep/glob due to system prompt issues affecting model behavior
  • #10640: Feature request to intercept known bash patterns (cat, head, tail, grep, find) and replace them with specialized tools
  • #10634: Compaction overflow check doesn't account for large tool outputs, which may incentivize models to limit output

These related issues discuss the root cause (system prompts and tool interception) and potential solutions to prevent models from being overeager about limiting command output.

Feel free to ignore if your case is specifically different from these.

@github-actions[bot] commented on GitHub (Jan 26, 2026): This issue might be a duplicate of existing issues. Please check: - #10438: gemini-3-pro-preview tends to avoid grep/glob due to system prompt issues affecting model behavior - #10640: Feature request to intercept known bash patterns (cat, head, tail, grep, find) and replace them with specialized tools - #10634: Compaction overflow check doesn't account for large tool outputs, which may incentivize models to limit output These related issues discuss the root cause (system prompts and tool interception) and potential solutions to prevent models from being overeager about limiting command output. Feel free to ignore if your case is specifically different from these.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7612