Alexander Whitestone
|
aa6eabb816
|
feat(memory): enable temporal decay with access-recency boost
Forge CI / smoke-and-build (pull_request) Failing after 23s
The holographic retriever had temporal decay implemented but disabled
(half_life=0). All facts scored equally regardless of age — a 2-year-old
fact about a deprecated tool scored the same as yesterday's deployment
config.
This commit:
1. Changes default temporal_decay_half_life from 0 to 60 days
- 60 days: facts lose half their relevance every 2 months
- Configurable via config.yaml: plugins.hermes-memory-store.temporal_decay_half_life
- Added to config schema so `hermes memory setup` exposes it
2. Adds access-recency boost to search scoring
- Facts accessed within 1 half-life get up to 1.5x boost on their decay factor
- Boost tapers linearly from 1.5 (just accessed) to 1.0 (1 half-life ago)
- Capped at 1.0 effective score (boost can't exceed fresh-fact score)
- Prevents actively-used facts from decaying prematurely
3. Scoring pipeline: score = relevance * trust * decay * min(1.0, access_boost)
- Fresh facts: decay=1.0, boost≈1.5 → score unchanged
- 60-day-old, recently accessed: decay=0.5, boost≈1.25 → score=0.625
- 60-day-old, not accessed: decay=0.5, boost=1.0 → score=0.5
- 120-day-old, not accessed: decay=0.25, boost=1.0 → score=0.25
23 tests covering:
- Temporal decay formula (fresh, 1HL, 2HL, 3HL, disabled, None, invalid, future)
- Access recency boost (just accessed, halfway, at HL, beyond HL, disabled, range)
- Integration (recently-accessed old fact > equally-old unaccessed fact)
- Default config verification (half_life=60, not 0)
Fixes #241
|
2026-04-13 15:38:12 -04:00 |
|