hook-tool-output-truncator

Truncate oversized tool outputs with configurable middle-cut limits.

Updated Apr 12, 2026
One-click install
npx skills add https://github.com/xuezhaojun/oh-your-opencode --skill hook-tool-output-truncator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-tool-output-truncator
Source: https://github.com/xuezhaojun/oh-your-opencode/tree/main/.opencode/skills/hook-tool-output-truncator
Command: npx skills add https://github.com/xuezhaojun/oh-your-opencode --skill hook-tool-output-truncator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Truncates oversized tool outputs from grep, glob, webfetch, bash, and other tools to prevent context window blowout, preserving the beginning and end so the LLM retains useful context.

Core Features & Use Cases

  • Middle-cut truncation preserves the start and end of long outputs to keep essential context.
  • Configurable limits allow a global default and per-tool overrides for precise control.
  • Low overhead activates only when outputs exceed thresholds, reducing token usage.
  • Use case: large repo searches or logs where results overwhelm the context window.

Quick Start

Start by enabling the hook in your project and integrating the tool-output-truncator with your existing hook pipeline to apply per-tool limits.

Frequently Asked Questions about hook-tool-output-truncator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I truncate large tool outputs to prevent context window blowout?

This middle-cut truncation strategy reduces token usage by preserving the beginning and end of long tool outputs. It activates only when results exceed configurable limits, ensuring the LLM retains essential context without overwhelming the context window.

Can I set different token limits for grep and webfetch outputs?

Yes, you can set different token limits for grep and webfetch outputs using configurable limits. The system supports a global default threshold alongside per-tool overrides, allowing precise control over token management for each specific tool in your project.

What is the middle-cut strategy for managing tool output tokens?

The middle-cut strategy for managing tool output tokens truncates the center section of oversized results while preserving the start and end. This approach ensures the LLM retains essential context from large codebase searches or logs without exceeding token limits.

Does the truncator add overhead to normal tool execution?

No, the truncator adds zero overhead to normal tool execution. It features low overhead activation that only triggers when tool outputs exceed configured thresholds, ensuring token management does not impact performance for smaller grep or bash results.

How do I integrate tool output truncation into my existing hook pipeline?

To integrate tool output truncation into your existing hook pipeline, enable the hook in your project and configure per-tool limits. This applies the middle-cut truncation strategy across tools like grep, glob, webfetch, and bash within your large codebase.