Ebbinghaus Forgetting Curve

Clawpy implements a biologically-inspired memory decay system based on Hermann Ebbinghaus's 1885 research on human memory retention. Unlike stateless AI assistants that either remember everything forever or forget everything immediately, Clawpy agents experience natural memory decay — with a crucial adaptive twist: memories that are accessed more frequently live longer.


The Core Formula

Every conversational memory in Clawpy carries an access_count that tracks how many times it has been recalled. The forgetting curve uses this to compute an effective age that is lower than the real age for frequently-accessed memories:

effective_age = actual_age − (access_count × RETENTION_THRESHOLD × ACCESS_LIFE_BONUS)

If effective_age > RETENTION_THRESHOLD:
    → Memory is pruned (permanently deleted)

Constants

ParameterValueMeaning
RETENTION_THRESHOLD94,608,000 seconds (3 years)Maximum memory lifespan
ACCESS_LIFE_BONUS0.20 (20%)Each recall adds 20% of threshold as extra life
MAX_DISTANCE1.4L2 distance threshold for relevance

Worked Example

A memory created 2.5 years ago that has been recalled 3 times:

actual_age      = 2.5 years = 78,840,000 seconds
bonus           = 3 × 94,608,000 × 0.20 = 56,764,800 seconds
effective_age   = 78,840,000 − 56,764,800 = 22,075,200 seconds (~0.7 years)

0.7 years < 3 years → Memory survives pruning ✓

The same memory with 0 recalls:

effective_age   = 78,840,000 − 0 = 78,840,000 seconds (~2.5 years)

2.5 years < 3 years → Still survives, but narrowly ✓

After 3.1 years with 0 recalls:

effective_age   = 97,776,000 − 0 = 97,776,000 seconds (~3.1 years)

3.1 years > 3 years → Pruned ✗

This means that a memory you've revisited 5+ times can theoretically live forever, while a memory you've never recalled will expire after the retention threshold. This mimics human memory consolidation — the act of remembering strengthens the memory trace.


Retention Tiers

While the forgetting curve governs when memories decay, retention tiers control the baseline retention policy per agent. Tiers are set in each agent's configuration:

TierDurationUse Case
Goldfish8 hoursThrowaway tasks, one-shot experiments
Standard7 daysNormal development work
Elephant90 daysLong-running projects, quarterly planning
PermanentNever expiresCore identity facts, pinned knowledge

Retention tiers apply to workspace memory (Layers B–E). The PARA layer (Layer G) is always permanent, and the session layer (Layer A) is always volatile.


What Decays vs. What Doesn't

Clawpy makes a deliberate distinction between episodic and semantic memory:

Decays (Subject to Forgetting Curve)

  • Conversations — The raw back-and-forth dialogue
  • Task summaries — Compressed records of what happened during a task
  • Assistant messages — LLM responses stored for recall

Never Decays (Pinned)

  • Learned facts — Extracted durable knowledge (e.g., "User's name is Aurelius")
  • Decisions — Recorded strategic decisions with outcomes
  • PARA facts — Canonical project knowledge
  • Soul identity — The agent's personality and constraints

This separation is enforced at the storage level. Facts and decisions use a pinned: "true" metadata flag that exempts them from the pruning sweep.


Separate Decay Domains

Clawpy runs multiple independent forgetting curves for different agent personas:

Alfred Memory (Butler)

  • Collection: alfred_conversations, alfred_facts, alfred_decisions
  • Persist directory: data/alfred_memory/
  • Retention: 3 years with 20% access bonus
  • Conversations decay. Facts and decisions are pinned.

CEO Memory (Lucius)

  • Collection: ceo_conversations, ceo_facts, ceo_decisions
  • Persist directory: data/ceo_memory/
  • Retention: 3 years with 20% access bonus
  • Includes strategic decision tracking with outcome history.

Workspace Agent Memory

  • Collection: clawpy_agent_memory (shared)
  • Persist directory: data/chroma_memory/
  • Retention: Configurable via retention tier

Each domain operates independently — pruning Alfred's old conversations never affects CEO memory or workspace agent memory.


The Nightly Extraction Cycle

The forgetting curve is applied during Clawpy's nightly extraction cycle, orchestrated by the MemoryExtractor:

                    ┌─────────────────┐
                    │  Nightly Cron    │
                    │  (24h interval)  │
                    └────────┬────────┘
                             │
                    ┌────────▼────────┐
                    │ For each agent:  │
                    │ 1. Read ledger   │
                    │ 2. Synthesise    │
                    │ 3. Write daily   │
                    │ 4. Promote PARA  │
                    └────────┬────────┘
                             │
                    ┌────────▼────────┐
                    │ Apply forgetting │
                    │ curve to Alfred  │
                    │ conversations    │
                    └─────────────────┘

The synthesis step uses a cost-capped LLM call (default budget: 20 cents, max 1,200 characters) to distil the raw ledger into durable bullet points. Only entries from the last 24 hours are processed.


Recall-Driven Life Extension

When any memory is recalled via semantic search, Clawpy automatically increments its access_count:

# From alfred_memory.py — recall triggers life extension
for rid in recalled_ids:
    meta = collection.get(ids=[rid], include=["metadatas"])
    meta["access_count"] = str(int(meta.get("access_count", "0")) + 1)
    collection.update(ids=[rid], metadatas=[meta])

This creates a positive feedback loop: useful memories get recalled, recalled memories live longer, long-lived memories remain available for future recall. Unused memories naturally fade away.

This is the same mechanism by which human long-term memory works — the spacing effect. The more you retrieve a memory, the stronger the neural trace becomes.


Cost Implications

The forgetting curve is not just a cognitive feature — it is a cost-saving mechanism:

  • Fewer stored memories → smaller ChromaDB index → faster vector searches
  • Nightly pruning prevents unbounded storage growth
  • Synthesis step uses gpt-5.1-codex-mini (the cheapest available model) to minimise extraction costs
  • Cost ceiling on extraction: 20 cents per agent per night

Over 12 months, an agent with active pruning will maintain a ChromaDB collection roughly 60–70% smaller than one without pruning, resulting in measurably faster recall latency.