Living Dynamics
How memories decay, accumulate noise, respond to emotion, and evolve over time.
Overview
Cerememory's defining feature is that memories are alive. They change over time through six mechanisms: decay, noise accumulation, emotional modulation, reactivation, reconsolidation, and consolidation. This page documents the mathematical models behind each.
Fidelity Decay (Power-Law Model)
Memory fidelity decreases over time following a modified power-law formula:
F(t) = F_0 * (1 + t/S)^(-d) * E_mod| Parameter | Symbol | Default | Description |
|---|---|---|---|
| Initial fidelity | F_0 | 1.0 | Starting fidelity score (0.0 to 1.0) |
| Elapsed time | t | -- | Seconds since last access or last decay tick |
| Stability | S | 1.0 | Stability constant; increases with each retrieval |
| Decay exponent | d | 0.3 | Controls decay speed (per-record, stored in decay_rate) |
| Emotional modulation | E_mod | 1.0 | Scales fidelity; > 1.0 for emotional memories |
The power-law curve means memories decay rapidly at first and then slowly approach zero -- never quite disappearing, but becoming increasingly unreliable. This matches empirical findings in cognitive science.
Noise Accumulation
As fidelity drops, memories accumulate noise -- random distortions that represent interference from other memories:
N(t) = N_0 + interference_rate * sqrt(t) * (1 - F(t))| Parameter | Default | Description |
|---|---|---|
| N_0 | 0.0 | Initial noise level |
| interference_rate | 0.1 | Rate of noise accumulation |
Key properties:
- Noise grows with the square root of time (sub-linear, bounded)
- Noise is inversely proportional to fidelity -- more decayed memories are noisier
- Both fidelity and noise are clamped to the [0.0, 1.0] interval
- In human recall mode, noise is applied to retrieved content; in perfect mode, it is bypassed
Emotional Modulation
Emotional intensity modulates the decay rate through the E_mod factor:
E_mod = 1.0 + emotion_intensity * 0.5The EmotionVector uses Plutchik's 8-dimensional model with an overall intensity field (0.0 to 1.0) and a valence field (-1.0 to +1.0).
At maximum emotional intensity (1.0), E_mod = 1.5, meaning the effective fidelity is 50% higher than a neutral memory at the same age. This causes emotional memories to persist significantly longer.
pub struct EmotionVector {
pub joy: f64, // 0.0 to 1.0
pub trust: f64,
pub fear: f64,
pub surprise: f64,
pub sadness: f64,
pub disgust: f64,
pub anger: f64,
pub anticipation: f64,
pub intensity: f64, // overall emotional intensity
pub valence: f64, // -1.0 (negative) to 1.0 (positive)
}Reactivation (Retrieval Boost)
When a memory is recalled, its stability constant increases, making future decay slower:
S_new = S_old * (1 + retrieval_boost * S_old^(-0.2))| Parameter | Default | Description |
|---|---|---|
| retrieval_boost | 1.5 | Multiplicative boost factor |
This implements a spaced repetition effect: the more a memory is accessed, the more stable it becomes. The boost diminishes with higher stability (the S^(-0.2) term), modeling the psychological observation that well-established memories benefit less from additional rehearsal.
Reconsolidation
When a memory is recalled (and reconsolidate: true is set in the query), the engine:
- Increments the record's
access_count - Updates
last_accessed_atto the current timestamp - Boosts the stability constant via the retrieval boost formula
- Persists these changes back to the store
This means every recall operation strengthens the retrieved memory, just as biological reconsolidation does. Memories that are never recalled will naturally decay and eventually be pruned.
Consolidation
Consolidation migrates mature episodic memories into the semantic store as distilled knowledge. It runs on-demand via the lifecycle.consolidate CMP operation.
Select candidates -- Episodic memories that exceed configurable thresholds for age (min_age_hours) and access count (min_access_count) are selected.
Summarize -- If an LLM provider is configured, candidate memories are summarized into concise semantic knowledge. Without an LLM, content is truncated.
Create semantic records -- Summarized content is stored as new semantic memory records with appropriate associations to the source episodic memories.
Prune originals -- Depending on the consolidation strategy (full, incremental, or selective), the original episodic records may be pruned or left in place.
Per-Store Decay Defaults
The evolution engine initializes each store with distinct decay parameters tuned to its role:
| Store | Decay Exponent (d) | Retrieval Boost | Interference Rate | Prune Threshold |
|---|---|---|---|---|
| Episodic | 0.3 | 1.5 | 0.1 | 0.01 |
| Semantic | 0.15 | 2.0 | 0.05 | 0.005 |
| Procedural | 0.1 | 2.5 | 0.02 | 0.001 |
| Emotional | 0.2 | 1.8 | 0.08 | 0.01 |
| Working | 0.8 | 1.0 | 0.3 | 0.1 |
These parameters are adaptively tuned by the evolution engine over time (see Evolution Engine below).
Spreading Activation
The association engine uses weighted breadth-first search (BFS) to propagate activation through the cross-store association graph. When a memory is recalled, related memories are also activated with diminishing strength.
| Parameter | Default | Description |
|---|---|---|
decay_factor | 0.5 | Activation strength multiplier per hop |
threshold | 0.05 | Minimum activation to continue spreading |
default_depth | 2 | Maximum traversal depth |
Activation at each hop is computed as parent_activation * edge_weight * decay_factor. Nodes below the threshold are not expanded.
Evolution Engine
The evolution engine autonomously tunes decay parameters based on usage patterns. It applies three rules:
- Low fidelity rule -- If median fidelity drops below 0.3, reduce
decay_exponentby 10% (memories are decaying too fast) - Low recall hit rate -- If recall hit rate drops below 0.2 (minimum 5 observations), increase
retrieval_boostby 10% - Excessive pruning -- If more than 50% of records are in the lowest fidelity bucket, reduce
prune_thresholdby 10%
All parameter adjustments are capped at ±50% of the original value to prevent runaway tuning.
Pruning
Records whose fidelity falls below the prune threshold (default: 0.01) are flagged for deletion during decay ticks. This automatic cleanup prevents unbounded storage growth while ensuring that only truly forgotten memories are removed.
Background Decay
In server mode, the engine runs a background decay task on a configurable interval (default: 3600 seconds). Each tick:
- Collects all records from all persistent stores
- Runs the decay engine in parallel across all records
- Writes updated fidelity states back to each store
- Prunes records that fall below the threshold
The background task is started with engine.start_background_decay() and stopped gracefully during shutdown.
Next Steps
Explore MemoryRecord, FidelityState, and other core types
Learn the CMP operations that control these dynamics