/brain:consolidate

Merge related weak memories into stronger combined memories. Consolidation prevents knowledge loss by combining multiple fading memories into a single, more resilient memory.

Usage

/brain:consolidate [scope]

Arguments:

  • [scope] — (Optional) Limit consolidation to a specific category or path (e.g., professional/skills). If omitted, scans the entire brain.

What It Does

When you run /brain:consolidate, the agent:

  1. Scans for candidates — Finds memories with strength below the consolidation threshold (default: 0.3)
  2. Groups related memories — Clusters candidates by path proximity, tag overlap, and temporal closeness
  3. Selects anchors — Within each group, the memory with the highest salience becomes the anchor
  4. Synthesizes content — Merges the group into a single memory, with the anchor's framing taking priority
  5. Calculates new metadata — Sets the consolidated memory's strength and decay rate using the consolidation formula
  6. Archives originals — Moves the source memories to _archived/ (recoverable and searchable)
  7. Transfers associations — All association links from source memories are redirected to the consolidated memory

Consolidation Formula

consolidated_strength = max(source_strengths) + 0.15    (capped at 1.0)
consolidated_decay    = min(source_decay_rates)          (slowest decay wins)

The consolidated memory starts stronger than any individual source (by 0.15) and decays at the slowest rate from the group. This ensures that merged knowledge is more resilient than the parts.

Salience Anchoring

The memory with the highest salience in each group serves as the anchor:

  • Its framing and perspective are prioritized in the synthesis
  • Its key details are preserved verbatim
  • Lower-salience memories contribute supplementary details and context
  • The consolidated memory inherits the anchor's salience value

This models how the brain preserves the most emotionally significant version of related experiences.

Example Interaction

User: /brain:consolidate professional/skills

Agent: Scanning professional/skills/ for consolidation candidates...

Found 2 groups of related weak memories:

Group 1: TypeScript Patterns (3 memories)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  • typescript-satisfies.md        ⚡ 0.25  salience: 0.4
  • typescript-discriminated.md    ⚡ 0.22  salience: 0.3
  • typescript-infer-keyword.md    ⚡ 0.18  salience: 0.5  ← anchor

Consolidating into: typescript-advanced-patterns.md
  New strength: 0.40 (0.25 + 0.15)
  New decay rate: 0.990 (slowest of group)

Group 2: Git Workflows (2 memories)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  • git-rebase-tips.md             ⚡ 0.28  salience: 0.4
  • git-cherry-pick-workflow.md    ⚡ 0.19  salience: 0.3

Consolidating into: git-advanced-workflows.md
  New strength: 0.43 (0.28 + 0.15)
  New decay rate: 0.990 (slowest of group)

✅ Consolidated 5 memories into 2. Originals archived.

When Consolidation Happens

Consolidation can be triggered in three ways:

  1. Manually — Running /brain:consolidate directly
  2. During sleep — The Consolidate phase (phase 6) of /brain:sleep automatically consolidates qualifying memories
  3. Auto-suggestion — When auto_consolidate is enabled (default: true), the agent suggests consolidation when it detects qualifying candidates during recall

Configuration

The consolidation threshold is configurable in ~/.brain/index.json:

{
  "config": {
    "consolidation_threshold": 0.3,
    "auto_consolidate": true
  }
}
SettingDefaultDescription
consolidation_threshold0.3Strength below which memories become consolidation candidates
auto_consolidatetrueWhether to suggest consolidation when candidates are found
Tip

Consolidation is most useful after periods of inactivity, when many memories may have decayed. Run it periodically or let /brain:sleep handle it automatically.

Info

Consolidated memories are stored in their original location in the hierarchy, not in _consolidated/. The _consolidated/ directory stores metadata about consolidation history.