DashboardopencodeOpenCode Truncate service: limits, trun…

OpenCode Truncate service: limits, truncation logic, and hint strategy

Category: architecture
Confidence: 0.80
ID: 019f140c-591b-7518-916f-fb5f756bab04
Project ID: c0425955-02bc-4c17-9af2-b114c00077e7
Cross-project: No
Recalled in other projects: 0
Source session: 0nN06O4MLYAtzl82C
Created: 2026-06-29 15:43:01
Updated: 2026-06-29 15:43:01

Content

packages/opencode/src/tool/truncate.ts: MAX_LINES=2000, MAX_BYTES=50KB, overridable via cfg.tool_output.max_lines/max_bytes. output() returns unchanged if within limits; otherwise writes full text to file and returns head/tail preview with hint. Hint differs by agent capability: if agent has task tool → delegate to Task tool; else → use Grep/Read with offset/limit. Truncated format: ${preview}\n\n...N lines truncated...\n\n${hint}. Cleanup runs hourly (1-min delay), removes entries older than 7 days. wrap() in tool.ts auto-applies truncation unless result.metadata.truncated is already set.

Move to: