Expand description
Reference tracker — lightweight side-channel that records when each
lifecycle memory record was last retrieved (referenced). Lives
outside the append-only ledger as a mutable JSON file at
<lifecycle_root>/reference-tracker.json.
Used by the staleness detection subsystem (Phase 4 Round 17) to apply a scoring penalty to memories that haven’t been retrieved in a long time.
§Concurrency
Uses fs2::FileExt::lock_exclusive (POSIX flock) to serialize
mutations. Same model as distill_queue.rs.
Structs§
Constants§
Functions§
- age_
days - Parse
last_referenced_atand return days elapsed since then. Returns None if parse fails. - read
- Load and parse the tracker file. Returns empty map if file missing or corrupt.
- staleness_
penalty - Apply the staleness decay curve:
- touch
- Load tracker, update
last_referenced_atto now (UTC ISO 8601) and incrementcountfor each record_id. Creates file if absent. Uses file locking for concurrent safety. Errors are swallowed (eprintln - tracker_
path - Resolve the tracker file path under
<root>/reference-tracker.json.