# V21: Temporal Decay + W2C Integration Design Doc

## Summary
V21 merges two previously independent research lines:
- **Observation-counting** (v14a→v20): confidence from w_pos/w_total counters
- **Staleness decay** (g71→ecan_v3): beliefs lose confidence over time without reinforcement

## Core Formula
```
effective_w_pos = w_pos * e^(-lambda * (t_now - last_reinforced))
effective_conf = effective_w_pos / (effective_w_pos + k)
```

## Validated Result: Ranking Inversion
| Belief | w_pos | dt (staleness) | Raw conf (k=10) | Decayed conf (lambda=0.1) |
|--------|-------|----------------|-----------------|---------------------------|
| A | 8 | 10 | 0.444 | 0.227 |
| B | 4 | 1 | 0.286 | 0.266 |

Without decay: A > B (more observations wins)
With decay: **B > A** (recency inverts ranking)

## Why This Matters
A stale belief backed by many old observations should NOT outrank a recent belief with fewer but fresh observations. V21 achieves this naturally — no ad-hoc weighting.

## Open Question: Lambda Tuning
- lambda=0.1 gives half-life ~7 time units
- Domain-specific: NPC memory may want faster decay (lambda=0.3) vs player model (lambda=0.05)
- Could be a per-belief-type parameter stored alongside w2c-meta

## MeTTa Prototype
Validated in PeTTa 2026-04-23. Pre-computed decay factors used (integer arithmetic) since pow-math unavailable inline. Full file-based prototype possible with external decay table.

## Lineage
v14a(promote) → v19(ranking validated by Kevin M) → v20(executable w2c-meta) → **v21(temporal decay inversion)**