HybridStrategy
Defined in: agent/compaction/strategies/hybrid.ts:37
Hybrid strategy - summarizes old turns + keeps recent turns.
This is the recommended default strategy as it:
- Preserves important historical context via summarization
- Keeps recent conversation turns verbatim for continuity
- Falls back gracefully to sliding window when appropriate
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HybridStrategy():
HybridStrategy
Returns
Section titled “Returns”HybridStrategy
Properties
Section titled “Properties”
readonlyname:"hybrid"="hybrid"
Defined in: agent/compaction/strategies/hybrid.ts:38
Human-readable name of the strategy
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”compact()
Section titled “compact()”compact(
messages,config,context):Promise<CompactionResult>
Defined in: agent/compaction/strategies/hybrid.ts:43
Compact the given messages to fit within target token count.
Parameters
Section titled “Parameters”messages
Section titled “messages”Conversation history messages (excludes system/gadget base)
config
Section titled “config”Resolved compaction configuration
context
Section titled “context”Context including token counts and LLM client
Returns
Section titled “Returns”Promise<CompactionResult>
Compacted messages with metadata