import{_ as o,o as t,c as a,ag as r}from"./chunks/framework.CvgP6Fyv.js";const g=JSON.parse('{"title":"Memory Compaction","description":"","frontmatter":{},"headers":[],"relativePath":"getting-started/compaction.md","filePath":"getting-started/compaction.md","lastUpdated":1774787421000}'),i={name:"getting-started/compaction.md"};function n(s,e,l,m,c,d){return t(),a("div",null,[...e[0]||(e[0]=[r('

Memory Compaction

As a bot accumulates memories over time, the memory pool can grow large and contain redundant or outdated entries. Memory Compaction is an automated process that consolidates and optimizes the bot's memory store, keeping the most relevant information while reducing noise.


Concept: Why Compact?

Each conversation turn can generate new memory entries. Over weeks or months of use, thousands of memories accumulate. Many of these may overlap, become stale, or lose relevance. Compaction addresses this by:


Configuration

Configure compaction from the General tab in the Bot Detail page.

FieldDescription
Compaction EnabledToggle automatic memory compaction on or off.
Compaction ModelThe LLM used to evaluate and merge memories during compaction. This can be different from the chat model.

When enabled, compaction runs periodically as part of the bot's memory maintenance cycle.


Manual Compaction

You can also trigger compaction manually from the bot's Memory tab:

  1. Navigate to the Memory tab in the Bot Detail page.
  2. Click Compact.
  3. Configure the compaction parameters:
  4. Click Start Compaction.

Compaction Logs

The Compaction tab in the Bot Detail page provides an audit trail of all compaction runs:

Managing Logs


Relationship to Memory

Compaction works with whatever Memory Provider is assigned to the bot. The compaction process:

  1. Reads all existing memories from the provider.
  2. Uses the configured Compaction Model to evaluate which memories are redundant or stale.
  3. Merges, updates, or removes entries as needed.
  4. Writes the optimized memory set back to the provider.

This process preserves the semantic content of important memories while reducing the total count. After compaction, the bot's memory retrieval becomes faster and more focused.


Next Steps

',29)])])}const p=o(i,[["render",n]]);export{g as __pageData,p as default};