research(nightly): coherence-drift checkpoint scheduling — hypothesis rejected - #835
Draft
ruvnet wants to merge 3 commits into
Draft
research(nightly): coherence-drift checkpoint scheduling — hypothesis rejected#835ruvnet wants to merge 3 commits into
ruvnet wants to merge 3 commits into
Conversation
Implements ruvector-coherence-checkpoint: witness-chained snapshot scheduling for agent memory, comparing fixed-interval checkpointing against drift-triggered variants that reuse ruvector-temporal-coherence's centroid-drift concept as a snapshot trigger instead of a retrieval gate. Real path dependencies on ruvector-agent-memory (MemoryStore) and ruvector-proof-gate (HashChainGate witness chain) — no mocks. Every recovery is verified by exact vector-for-vector replay reconstruction, not digest comparison alone. 19 tests including adversarial tamper detection for both the witness chain and stored snapshot digests. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Bb4WyGvPZs3o8yqDnVahHH
Records the falsified hypothesis, measured evidence across 5 thresholds and 4 seeds, the diminishing-sensitivity root cause, and the rejection criteria — so future nightly runs don't re-propose whole-history cumulative-centroid drift as a checkpoint trigger without reading this. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Bb4WyGvPZs3o8yqDnVahHH
Full methodology, raw benchmark output (8 threshold/seed combinations, all REJECT), memory/performance math, ecosystem integration analysis (RVF/RVM/ruFlo/MCP/WASM), and a standalone gist article summarizing why cumulative-mean drift fails as a checkpoint-scheduling signal. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Bb4WyGvPZs3o8yqDnVahHH
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
Nightly research run testing whether coherence-drift-triggered checkpoint scheduling for agent memory beats naive fixed-interval checkpointing. Result: hypothesis rejected, with reproducible evidence across 5 drift thresholds × 4 seeds (8 total runs, all
REJECT).crates/ruvector-coherence-checkpoint: three witness-chained snapshot policies (FixedIntervalbaseline,DriftTriggered,DriftTriggeredCapped) over a sharedCheckpointPolicytrait, driving a realruvector-agent-memory::MemoryStoreand witness-chaining every snapshot through a realruvector-proof-gate::HashChainGate— no mocks.ADR-305records the rejected decision, evidence, and root-cause diagnosis.docs/research/nightly/2026-08-18-coherence-drift-checkpointing/has the full methodology, raw benchmark output, and a standalone gist.Why it matters
RuVector has pieces of an agent-memory durability story (
ruvector-agent-memoryfor what to keep,ruvector-temporal-coherencefor how to weight retrieval,ruvector-proof-gatefor write tamper-evidence) but nothing for when to checkpoint full state into a durable, signed snapshot (the RVF portable-artifact use case). This connects the existing coherence-drift concept to that fourth question — and finds, with evidence, that the naive version doesn't work.Key finding
DriftTriggered's worst-case replay gap (events since nearest snapshot) was 57%–139% larger than a fixed-interval baseline matched to the same snapshot budget, at every threshold (0.02–0.25) and every seed (7, 2026, 4242, 99) tested — the opposite of the hypothesized ≥20% improvement.Root cause (confirmed via
examples/diag_snapshot_indices.rs): the drift signal uses a whole-history running-mean centroid. A burst phase's contribution to that mean shrinks as total event count grows, so the signal becomes progressively less sensitive to recent bursts later in the stream — inter-snapshot gaps grow from ~300-470 early in the stream to 753-840 late in it. This is a genuine, non-obvious negative result, not an implementation bug: checkpoint/witness/replay correctness held at 100% in every run (exact_replay=40/40,chain_rederivation_ok=true,receipt_structural_ok=true).Benchmark command
Canonical run (threshold=0.08, seed=2026), x86-64/4 cores/Linux 6.18.5/rustc 1.94.1:
Full 8-run sweep table (all thresholds and seeds, no cherry-picking) is in the nightly README and ADR-305.
Acceptance result
ACCEPT | REJECT | INCONCLUSIVE → REJECT, per the acceptance threshold fixed in the benchmark code before the first measurement ran (≥20% max-gap reduction at matched snapshot budget, 100% exact-replay correctness, 100% witness integrity).
Darwin / Flywheel
FixedInterval, i.e. no scheduling change toruvector-agent-memory) is retained.Security review
No new cryptographic primitives (reuses
ruvector-proof-gate::HashChainGateunmodified). Two independent tamper checks are unit-tested: chain structural re-derivation and payload rehash-and-compare. Nounsafecode, no network calls. Details in ADR-305 §Security.Main limitations
Production recommendation
Do not adopt
DriftTriggered/DriftTriggeredCappedas specified.FixedIntervalremains the recommended default checkpoint policy. The witness-chained checkpoint/exact-replay mechanism (independent of the rejected trigger) is real, tested, and reusable for a follow-up experiment.Next experiment
Swap the whole-history
RunningCentroidfor a fixed-size windowed mean or an exponentially-weighted moving centroid — the concrete, falsifiable follow-up hypothesis identified by this run's root-cause diagnosis, reusing this same benchmark harness.Documents
docs/adr/ADR-305-coherence-drift-checkpointing.mddocs/research/nightly/2026-08-18-coherence-drift-checkpointing/README.mddocs/research/nightly/2026-08-18-coherence-drift-checkpointing/gist.mdTest plan
cargo build --release -p ruvector-coherence-checkpointcargo test --release -p ruvector-coherence-checkpoint— 19/19 passingcargo clippy --release --all-targets -p ruvector-coherence-checkpoint— cleancargo fmt -p ruvector-coherence-checkpoint -- --check— cleanGenerated by Claude Code