Skip to main content

Module prune

Module prune 

Source
Expand description

Tool output pruning.

When conversation history grows long, older tool call outputs are marked as “pruned” — their content is replaced with a placeholder string to free context tokens without permanently deleting data.

Pruning is distinct from compaction: pruning operates on individual tool output messages (cheap, no LLM call), while compaction summarises entire conversation segments (expensive, LLM call).

Ported from OpenCode V1: packages/opencode/src/session/compaction.ts prune().

Structs§

PruneResult
Result of a pruning pass.

Constants§

PRUNED_PLACEHOLDER
Placeholder text replacing pruned tool outputs.

Functions§

prune_tool_outputs
Marks old tool output messages for pruning.