Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:23blocks OS Ai maestro Memory Consolidation

From Leeroopedia
Knowledge Sources
Domains Memory, Consolidation
Last Updated 2026-10-26 10:00 GMT

Overview

A memory consolidation pattern that classifies conversation content into categories (fact, preference, pattern, insight), reinforces matching memories rather than duplicating them, and links entities via relation statements.

Description

Memory consolidation takes prepared conversations from the delta index, classifies content into memory categories using an LLM, and writes them to the long-term memory schema in CozoDB. Memories that match existing ones are reinforced (reinforcement count incremented) rather than duplicated. Entities are extracted and linked via relation statements.

The consolidation runs are guarded: `triggerConsolidation` prevents concurrent consolidation per agent, respects a consolidation-pause setting, and supports `dryRun` for preview. The result carries counters: memories created, reinforced, linked, and rejected.

Short-term memories with sufficient reinforcement are promoted to long-term tier. Short-term memories past the retention window are pruned.

Usage

Use this principle when designing a memory system where:

  • New content is classified (not stored verbatim)
  • Matching memories are reinforced (not duplicated)
  • Memories have tiers (short-term → long-term) with promotion and pruning

Theoretical Basis

The consolidation is a classify-reinforce-link pipeline:

consolidateMemories(agentDb, agentId, conversations):
  for each conversation:
    chunks = split(conversation)
    for each chunk:
      category = llm.classify(chunk)  // fact, preference, pattern, insight
      existing = findSimilar(agentDb, chunk)
      if existing:
        reinforce(existing)  // increment reinforcement_count
      else:
        create(agentDb, { category, content, tier: 'short_term' })
      entities = extractEntities(chunk)
      linkEntities(agentDb, entities, memory_id)

The reinforcement principle avoids duplicate memories: if a similar memory already exists, increment its reinforcement count instead of creating a new one. This mirrors how human memory works — repeated exposure strengthens existing memories rather than creating exact copies.

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment