Temporal Decay

Why a living memory must forget: the exponential decay and reinforcement-on-access model that keeps the knowledge graph sharp over time.

Version 1.0 · Updated

01

Why Forgetting Is a Feature

A knowledge graph that accumulates without pruning drifts toward noise. Stale relations resurface in search results, prompt context bloats with outdated facts, and recall latency grows as the graph expands indiscriminately. Forgetting is not a failure mode — it is a design requirement.

The biological precedent is precise: the human brain forgets selectively, not randomly. Working memory stays usable because the hippocampus deprioritizes traces that go unreinforced. Cortex inherits that principle directly.

The design goal is progressive, non-destructive decay. Nothing is ever deleted. Salience is reduced until explicitly revived. The Raw Layer is immutable by invariant: even an entity decayed to near-zero strength can be resurrected by replaying the raw event log. Decay operates on the Semantic and Compiled layers only.

02

The Ebbinghaus Forgetting Curve

Hermann Ebbinghaus (1885) established the first quantified law of human forgetting: retention decays exponentially with elapsed time since encoding. The curve is given by R = exp(−Δt / σ), where Δt is elapsed time and σ is the stability parameter (equivalently, R = 0.5^(Δt / half_life) — both forms express the same exponential envelope).

Cortex treats the Ebbinghaus curve as its baseline — the shape of decay before any reinforcement is applied. The practical implication is deterministic: an entity left untouched will cross the invisibility threshold at a predictable time. The system does not need heuristics to decide when to suppress it; the math does.

0.0 0.2 0.35 0.5 1.0 0d 30d 60d 90d 120d Time (days) auto-inject threshold link visibility threshold retrieval +boost retrieval +boost memory_strength(t)
Decay and reinforcement curve: a single entity's memory_strength over time. Exponential decay is interrupted by retrieval events that spike strength upward and reset the decay clock. The two horizontal bands mark the auto-inject and link-visibility thresholds.
04

The memory_strength Formula

The simplified model (hippo-memory lineage, implementation variant):

memory_strength = base_strength × (1 + reinforcement_factor) × exp(−Δt / half_life)

The extended model from the architectural specification decomposes each factor explicitly:

strength(t)      = base × decay × retrieval_boost × emotional_multiplier

decay            = 0.5 ^ (Δt / effective_half_life)
effective_half_life = half_life × reward_factor
reward_factor    = 1 + 0.5 × ((pos − neg) / (pos + neg + 1))

retrieval_boost  = 1 + 0.1 × log₂(retrieval_count + 1)

emotional_mult   = neutral:1.0 | positive:1.3 | negative:1.5 | critical:2.0

Parameter semantics: base_strength is the initial strength at creation, in [0.0, 1.0]. half_life is configurable per entity class — 45d for project entities, 10d for minor concepts, 30d for behavioral patterns, 90d for world knowledge, 60d for operator instructions. All values live in config/decay.yaml.

The reward_factor extends the effective half-life proportionally to positive feedback history. An entity that has consistently led to good outcomes gets a longer natural life — modeling dopamine-modulated synaptic consolidation. The emotional_mult applies at encoding time: negative and critical memories are retained longer, matching the well-established negativity bias in human memory (emotionally charged traces are more durable).

05

Reinforcement on Access — Spaced Repetition

Each retrieval — whether from a search hit, a prompt injection, or a new Raw mention of the entity — reinforces its memory. In the simplified model this adds +0.3 to reinforcement_factor. In the extended model it increments retrieval_count, which feeds the retrieval_boost term via a logarithmic scale (diminishing returns on repeated retrieval).

The cognitive basis is the testing effect (Roediger & Karpicke, 2006): the act of retrieving a memory strengthens it more than passive re-exposure. This maps onto hippocampal replay — recalling re-encodes the trace at a higher stability. Cortex treats every search hit as a recall event and applies the boost accordingly.

The reward_factor extends the effective half-life when an entity has accumulated positive feedback (pos > neg), operationalizing the principle that reward-predicting representations are preferentially consolidated (Schultz, 1998). Entities that have been useful stay useful longer.

Nightly, a Compiled Truth document is regenerated for each active entity. This is the system's equivalent of memory reconsolidation: each recall cycle rewrites the synthesized artifact with current strength weighting, so the output reflects the graph's present state rather than its state at last ingestion.

06

Decay Triggers and Scheduling

Four distinct trigger modes drive decay and reinforcement. They are not mutually exclusive — a single event can activate more than one:

ActionTypeFrequencyTarget
Relation updateBackgroundPer eventweight_temporal
Entity retrievalBackgroundPer searchmemory_strength
New Raw inputEvent-triggeredImmediatereinforcement + Retain Job
Nightly ConsolidationCRONEvery nightGlobal decay + consolidation

Background decay runs inline on every read/write path — no separate daemon is required. The nightly CRON job performs the bulk recalculation and triggers the sleep-cycle consolidation pass, during which Compiled Truth documents are regenerated and stale entities are suppressed below threshold.

07

Thresholds and Behavioral Consequences

Two thresholds govern behavioral state transitions. Neither triggers deletion.

weight_temporal < 0.2 on a relation: the edge becomes effectively invisible in multi-strategy search. It remains queryable via explicit temporal search, but it will not surface in standard graph traversal or prompt context assembly.

memory_strength < 0.35 on an entity: the Compiled Truth document for that entity is no longer auto-injected into prompts. The Markdown file persists on disk and retains its search index entry, but it loses priority in the ranking pass.

The Raw Layer is immutable. Resurrection is always possible via /rebuild compiled <slug> or by re-encountering the entity in new raw input. Decay is a gradient, not a cliff — no state change is irreversible from the operator's perspective.

ACTIVE strength ≥ 0.35 · prompt-injected FADING 0.2–0.35 · searchable only SUPPRESSED < 0.2 · graph-invisible REVIVED reinjected nightly decay decay continues raw input or /rebuild strength restored retrieval +boost
Memory lifecycle state machine. An entity moves from Active to Fading to Suppressed as nightly decay accumulates. Retrieval events apply a boost at any state. Resurrection via new raw input or /rebuild compiled restores an entity to Revived, then back to Active once strength crosses the threshold.