Table of Contents

Class MemoryConsolidationEventArgs

Namespace
LMKit.Agents.Memory
Assembly
LM-Kit.NET.dll

Provides data for the BeforeMemoryConsolidated event, which fires before a cluster of similar memories is merged into a single entry.

public sealed class MemoryConsolidationEventArgs : EventArgs
Inheritance
MemoryConsolidationEventArgs
Inherited Members

Examples

Example: Logging consolidation and protecting specific data sources

memory.BeforeMemoryConsolidated += (sender, e) =>
{
    Console.WriteLine($"Merging {e.OriginalEntries.Count} entries into: {e.ConsolidatedText}");

    // Prevent merging entries from a critical data source
    if (e.DataSourceIdentifier == "critical_knowledge")
    {
        e.Cancel = true;
    }
};

Remarks

This event fires once per cluster. The application can inspect the original entries and the proposed consolidated text, and optionally cancel the merge by setting Cancel to true.

Properties

Cancel

Gets or sets a value indicating whether this consolidation should be cancelled.

ConsolidatedText

Gets the consolidated text proposed by the LLM.

DataSourceIdentifier

Gets the identifier of the data source containing the cluster.

OriginalEntries

Gets the list of original entry texts that will be merged.