mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
2 lines
5.2 KiB
JavaScript
2 lines
5.2 KiB
JavaScript
import{_ as o,o as t,c as a,ag as r}from"./chunks/framework.DXGyWiRo.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('<h1 id="memory-compaction" tabindex="-1">Memory Compaction <a class="header-anchor" href="#memory-compaction" aria-label="Permalink to "Memory Compaction""></a></h1><p>As a bot accumulates memories over time, the memory pool can grow large and contain redundant or outdated entries. <strong>Memory Compaction</strong> is an automated process that consolidates and optimizes the bot's memory store, keeping the most relevant information while reducing noise.</p><hr><h2 id="concept-why-compact" tabindex="-1">Concept: Why Compact? <a class="header-anchor" href="#concept-why-compact" aria-label="Permalink to "Concept: Why Compact?""></a></h2><p>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:</p><ul><li><strong>Merging redundant memories</strong> — Combining entries that express the same information.</li><li><strong>Removing outdated entries</strong> — Discarding memories that are no longer accurate.</li><li><strong>Reducing retrieval noise</strong> — Fewer, higher-quality memories lead to better search results during chat.</li></ul><hr><h2 id="configuration" tabindex="-1">Configuration <a class="header-anchor" href="#configuration" aria-label="Permalink to "Configuration""></a></h2><p>Configure compaction from the <strong>General</strong> tab in the Bot Detail page.</p><table tabindex="0"><thead><tr><th>Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Compaction Enabled</strong></td><td>Toggle automatic memory compaction on or off.</td></tr><tr><td><strong>Compaction Model</strong></td><td>The LLM used to evaluate and merge memories during compaction. This can be different from the chat model.</td></tr></tbody></table><p>When enabled, compaction runs periodically as part of the bot's memory maintenance cycle.</p><hr><h2 id="manual-compaction" tabindex="-1">Manual Compaction <a class="header-anchor" href="#manual-compaction" aria-label="Permalink to "Manual Compaction""></a></h2><p>You can also trigger compaction manually from the bot's <strong>Memory</strong> tab:</p><ol><li>Navigate to the <strong>Memory</strong> tab in the Bot Detail page.</li><li>Click <strong>Compact</strong>.</li><li>Configure the compaction parameters: <ul><li><strong>Ratio</strong> — The compression ratio (e.g., <code>0.8</code>, <code>0.5</code>, <code>0.3</code>). Lower values mean more aggressive compaction.</li><li><strong>Decay Days</strong> — Optionally restrict compaction to memories older than a specified number of days.</li></ul></li><li>Click <strong>Start Compaction</strong>.</li></ol><hr><h2 id="compaction-logs" tabindex="-1">Compaction Logs <a class="header-anchor" href="#compaction-logs" aria-label="Permalink to "Compaction Logs""></a></h2><p>The <strong>Compaction</strong> tab in the Bot Detail page provides an audit trail of all compaction runs:</p><ul><li><strong>Status</strong> — Whether the compaction completed successfully, encountered an issue, or failed.</li><li><strong>Time</strong> — When the compaction was triggered.</li><li><strong>Duration</strong> — How long the compaction took.</li><li><strong>Result</strong> — A summary of what was compacted (memories merged, removed, etc.).</li></ul><h3 id="managing-logs" tabindex="-1">Managing Logs <a class="header-anchor" href="#managing-logs" aria-label="Permalink to "Managing Logs""></a></h3><ul><li><strong>Refresh</strong> — Reload the log list.</li><li><strong>Clear Logs</strong> — Remove old compaction records.</li></ul><hr><h2 id="relationship-to-memory" tabindex="-1">Relationship to Memory <a class="header-anchor" href="#relationship-to-memory" aria-label="Permalink to "Relationship to Memory""></a></h2><p>Compaction works with whatever <strong>Memory Provider</strong> is assigned to the bot. The compaction process:</p><ol><li>Reads all existing memories from the provider.</li><li>Uses the configured <strong>Compaction Model</strong> to evaluate which memories are redundant or stale.</li><li>Merges, updates, or removes entries as needed.</li><li>Writes the optimized memory set back to the provider.</li></ol><p>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.</p><hr><h2 id="next-steps" tabindex="-1">Next Steps <a class="header-anchor" href="#next-steps" aria-label="Permalink to "Next Steps""></a></h2><ul><li>To manage individual memories, see <a href="/getting-started/memory.html">Memory Management</a>.</li><li>To configure the memory backend, see <a href="/memory-providers/index.html">Memory Providers</a>.</li></ul>',29)])])}const p=o(i,[["render",n]]);export{g as __pageData,p as default};
|