Documentation
¶
Overview ¶
Package tooloutput provides deterministic truncation of tool output before it is fed back into the model context. This prevents large outputs (e.g. verbose build logs) from consuming disproportionate context window space.
All processing is deterministic — no LLM-based summarization. If LLM-based output summarization is needed in the future, it must be behind a flag to avoid contaminating evaluation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Process ¶
Process applies the rule to toolOutput, truncating if necessary. Returns the original output if the rule is zero-value or output is within limits. Never returns empty for non-empty input.
func RulesFromContext ¶
RulesFromContext retrieves the output processing rules from ctx. Returns nil when no rules are stored.
Types ¶
type Rule ¶
type Rule struct {
MaxLines int // 0 = unlimited
MaxTokens int // 0 = unlimited (approximate: 4 chars ≈ 1 token)
Truncation string // "head", "tail", "head_tail"; default "tail"
TruncationMessage string // template with {line_count}, {token_count}
}
Rule defines truncation parameters for a specific tool's output. A zero-value Rule is a no-op: output passes through unchanged.