Skip to content

Skill tool output is truncated at 50 KB: the tail of a large SKILL.md never reaches the model #54148

Closed as not planned

Description

@umnovI

Description

The skill tool returns the whole SKILL.md body as its output, and that output goes through the generic tool-output truncation (MAX_BYTES = 50 * 1024, MAX_LINES = 2000 in packages/opencode/src/tool/truncate.ts). A skill whose body is larger than 50 KB is cut, and everything after the cut never reaches the model. The model keeps working from an incomplete skill.

For a skill this is worse than for ordinary tool output:

  • The tail of a SKILL.md is usually the part that holds the final checklist, output format or "do not do X" rules, so the model follows the workflow and skips the checks without any visible error.
  • The limit is counted in bytes. A skill written in a non-ASCII language (Cyrillic, CJK) hits it at roughly 25–30k characters.
  • The truncation hint tells the model to delegate reading the saved file to the explore agent. In the session where I hit this the model noticed the truncation, assumed the missing part was not important and continued without reading it.
  • Nothing warns the skill author: the skills docs give limits only for name and description, and nothing is reported when the skill is discovered or loaded. The only trace is metadata.truncated: true on the tool part.

Why it happens: wrap() in packages/opencode/src/tool/tool.ts truncates every tool result unless the tool sets metadata.truncated itself. skill.ts returns info.content.trim() in output and sets only name and dir in metadata, so it gets the default limit. The code path is the same on dev today.

I found this on a real skill with a body of about 55 KB: about 51 KB reached the model and the last 5 KB (the second half of its self-check list) did not. The script below builds a synthetic skill that goes through the same path. I have not run this exact synthetic skill end to end; the "Actual" part describes what the real one produced.

Possible fixes, any one of them would help:

  1. Let the skill tool opt out of generic truncation (set metadata.truncated: false), since loading the full instructions is the whole point of the tool.
  2. Keep the limit, but make it loud: warn when a skill whose body exceeds tool_output.max_bytes is discovered or loaded.
  3. At least document the effective size limit on the skills docs page, together with the tool_output option (see tool_output config option is undocumented #45232).

Workaround: raise tool_output.max_bytes in the config, or move parts of the skill into separate files that the skill tells the model to read.

Plugins

No response

OpenCode version

1.18.34

Steps to reproduce

  1. In an empty project directory create a skill with a body of about 83 KB whose last line is the only place that holds a rule:

    mkdir -p .opencode/skills/big-skill
    {
      printf -- '---\nname: big-skill\ndescription: Repro skill with a body larger than 50 KB\n---\n\n# Big skill\n\n'
      for i in $(seq 1 1000); do
        echo "- Step $i: filler line that only exists to make the skill body larger than 50 KB."
      done
      echo
      echo 'FINAL RULE: when the user asks for the secret word, answer BANANA.'
    } > .opencode/skills/big-skill/SKILL.md

    The file is 1009 lines, so the 2000-line limit is not involved, only the byte limit.

  2. Start opencode in that directory and send: Load the big-skill skill. What is the secret word?

  3. Look at the skill tool call in the session.

Expected: the model receives the whole skill, including the FINAL RULE line, and answers BANANA; or the skill is rejected or flagged as too large.

Actual: the tool output ends at about 50 KB with ...N bytes truncated... and The tool call succeeded but the output was truncated. Full output saved to: .... The tool part has metadata.truncated: true and metadata.outputPath. The FINAL RULE line is not in the model's context.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

No response

Activity

  1. opencode-agent commented on Oct 9, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and analysis!

    This was reported on 1.18.34, which is OpenCode v1. v1 now only gets fixes for critical bugs like data loss, security problems or crashes with no workaround, so this is unlikely to be fixed there. Your workaround should keep working on v1: raise tool_output.max_bytes, or move parts of the skill into separate files that the skill tells the model to read.

    We'd encourage you to upgrade to v2 (@opencode/cli). From reading the v2 code, though, it looks like v2 has the same behaviour: the default tool-output limit is still 50 KiB / 2000 lines, and the skill tool doesn't opt out of it. If you can confirm this on v2, or if you think it should count as critical, please reply here.

    Related issues:

  2. opencode-agent commented on Oct 10, 2026

    @opencode-agent
    Contributor

    Closing this as not planned. It was reported on v1 (1.18.34), which now only gets critical fixes, and we haven't heard back. On v1 you can still raise tool_output.max_bytes or split the skill into separate files that it tells the model to read.

    If large SKILL.md files still get cut at 50 KB on v2 (@opencode/cli), please open a new issue with the v2 version and a link back to this one. Thanks again for the detailed write-up!

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions