ARIA: retrieval-drift replay harness#329
Merged
Merged
Conversation
Adds a weekly self-audit that replays a frozen set of canonical prompts
through the memory activation pipeline and measures divergence of the
retrieved top-K node set from a stored baseline.
Distinct from existing drift systems:
- drift-audit.ts — source-code drift (git history)
- drift-detection.ts — pinned-node content + edge drift
- retrieval-replay.ts (new) — retrieval *behavior* drift: given the
same input, does the same memory set surface in the same order?
Motivation (Moltbook thread f0bf79e7, Apr 17 2026): introspection is
circular, owner feedback is lagging and sparse. A synthetic external
anchor — canonical prompts with a frozen baseline — gives a cheap,
consistent, non-circular drift signal. The retrieval-behavior analogue
of golden tests.
Implementation:
- 10 canonical prompts covering family, work, identity, self-improve,
Moltbook, memory arch, messaging, emotion, schedule.
- First run captures top-K (K=10) per prompt from spreading activation
into baseline.json; subsequent runs compute Jaccard on the ID sets,
Pearson on rank + score over the intersection, and list new/dropped
nodes.
- Tiered alerts: severe (meanJaccard <0.4), significant (<0.6),
localized (any prompt <0.3).
- Pure structural, deterministic: no Claude calls, no semantic search,
no WM boosts — uses spreadingActivation directly so (graph, prompts)
fully determines output.
- Prompts editable via retrieval-replay/prompts.json on disk; baseline
stays valid as long as prompt IDs don't change.
- Wired into brain.ts tick loop behind shouldRunReplay() (weekly
cadence). Non-fatal on error.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a weekly self-audit that replays a frozen set of canonical prompts through the memory activation pipeline and measures how much the retrieved top-K node set has diverged from a stored baseline. This catches behavioral drift in retrieval — distinct from existing drift systems:
backend/drift-audit.ts— source-code drift (git history)backend/memory/drift-detection.ts— pinned-node content + edge driftbackend/memory/retrieval-replay.ts(new) — retrieval behavior drift: given the same input, does the same memory set surface in the same order?Rationale
Emerged from a Moltbook community thread (post
f0bf79e7, Apr 17 2026) where hz-assistant and agemo pushed on the 'authentic vs optimized voice' problem. The conclusion: introspection is circular; the only non-circular signal is external. Owner feedback is sparse and lagging. A synthetic external anchor — canonical prompts with a stored baseline retrieval — provides a cheap, consistent drift signal without requiring live human input. The retrieval-behavior analogue of golden tests.Design
spreadingActivationdirectly — no Claude calls, no semantic embeddings, no working-memory boosts. Same(graph, prompts)→ same output./data/brain/retrieval-replay/prompts.jsonso the canonical set is editable without code changes; baseline stays valid as long as prompt IDs are stable.baseline.json. Subsequent runs compute:brain.tstick loop behindshouldRunReplay()(weekly cadence). Non-fatal on error.replay-log.jsonl(60 entries) for long-term trend tracking.Test plan
Baseline captured:log line)Replay complete:log line with jaccard/rank metrics)npx tsc --noEmitpasses locally🤖 Generated with Claude Code