Member Junction
    Preparing search index...

    Interface AgentPostRunCompactionConfig

    Configuration for background post-run conversation compaction, memory extraction, and scratchpad pruning after an agent run completes (finalizeAgentRun), so the next user turn starts with a pre-compacted message window and zero compaction latency.

    When enabled via ExecuteAgentParams.compactAfterRun, BaseAgent.finalizeAgentRun runs post-run maintenance after flushing step saves and persisting the run record:

    1. Message Window Pre-Compaction: Compacts older conversation messages when the conversation length reaches messageCountThreshold (default: 20), preserving the initial goal message (index 0) and the most recent messages.
    2. Scratchpad Pruning: When maxScratchpadNotes is specified, prunes excess low-priority scratchpad note lines and completed tasks down to the configured limit.
    3. Memory Extraction Trigger: When extractMemories is enabled (default: true) and the run succeeded, triggers asynchronous memory extraction via MemoryManagerAgent.

    All post-run maintenance runs inside defensive error boundaries so failures are logged diagnostically without ever failing a completed agent run.

    interface AgentPostRunCompactionConfig {
        enabled: boolean;
        extractMemories?: boolean;
        maxScratchpadNotes?: number;
        messageCountThreshold?: number;
    }
    Index

    Properties

    enabled: boolean

    Whether post-run compaction is enabled

    extractMemories?: boolean

    Whether to trigger async note/example extraction via MemoryManager (default: true)

    maxScratchpadNotes?: number

    Maximum number of scratchpad notes to retain after pruning expired/excess notes (optional)

    messageCountThreshold?: number

    Minimum conversation message count before post-run compaction triggers (default: 20)