DefaultMemoryMaintenanceOrchestrator

data class DefaultMemoryMaintenanceOrchestrator(repository: PropositionRepository, consolidator: MemoryConsolidator, abstractor: PropositionAbstractor? = null, abstractionThreshold: Int = 5, abstractionTargetCount: Int = 3, retireBelow: Double? = null, retireDecayK: Double = 2.0, decayManager: DecayManager? = null, collector: CollectorRunner? = null) : MemoryMaintenanceOrchestrator

Default MemoryMaintenanceOrchestrator: runs consolidation, abstraction, retirement, and optionally the mark-and-sweep collector as a four-stage pipeline.

The consolidation and abstraction logic delegates to SessionConsolidationPass and AbstractionPass respectively — they own the details of what changes. This orchestrator just drives the sequence and persists results in the legacy per-step call shape so maintain's observable contract stays intact.

A few intentional divergences from the dream-loop path worth knowing:

  • Every qualifying entity group is re-abstracted on every maintain call with no level ceiling. The dream-loop's skip-covered idempotency guard has nothing to match here because maintain only ever sees the level-0 ACTIVE snapshot.

  • The decay/retirement step hard-deletes propositions below retireBelow, unlike the dream-loop which soft-transitions them to STALE by default. This preserves the original behavior for backward compatibility.

Persistence is per-step, not transactional: the abstraction step saves each entity group as it goes, so if a later group throws, earlier groups are already written. That's safe here because maintain re-runs abstraction from the level-0 snapshot on every call, so the next call simply re-processes whatever didn't finish — partial state heals itself rather than corrupting.

Parameters

repository

Storage backend for propositions.

consolidator

Decides how session propositions are folded into long-term memory.

abstractor

Optional; synthesizes higher-level insights from entity groups.

abstractionThreshold

Minimum propositions per entity group before abstraction runs.

abstractionTargetCount

How many abstractions to generate per group.

retireBelow

Hard-delete propositions whose effective confidence falls below this; null disables retirement.

retireDecayK

Decay-rate multiplier used when computing effective confidence for retirement.

decayManager

Optional; refreshes the store's materialised effective-confidence column right before retirement so the pushed-down below-threshold filter reads fresh values (see retire). Null for backends that compute effective confidence live (the in-memory store), where there is no column to refresh.

collector

Optional mark-and-sweep collector run as the final stage; null disables it.

Constructors

Link copied to clipboard
constructor(repository: PropositionRepository, consolidator: MemoryConsolidator, abstractor: PropositionAbstractor? = null, abstractionThreshold: Int = 5, abstractionTargetCount: Int = 3, retireBelow: Double? = null, retireDecayK: Double = 2.0, decayManager: DecayManager? = null, collector: CollectorRunner? = null)

Functions

Link copied to clipboard
open override fun maintain(contextId: <Error class: unknown class>, sessionPropositions: List<Proposition>): MaintenanceResult

Run all maintenance stages for the given context.

Link copied to clipboard

Attach the decay manager whose sweep refreshes the materialised column before retirement runs.