Skip to content

research(nightly): coherence-drift checkpoint scheduling — hypothesis rejected - #835

Draft
ruvnet wants to merge 3 commits into
mainfrom
claude/focused-darwin-mv3cba
Draft

research(nightly): coherence-drift checkpoint scheduling — hypothesis rejected#835
ruvnet wants to merge 3 commits into
mainfrom
claude/focused-darwin-mv3cba

Conversation

@ruvnet

@ruvnet ruvnet commented Aug 18, 2026

Copy link
Copy Markdown
Owner

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).

  • New crate crates/ruvector-coherence-checkpoint: three witness-chained snapshot policies (FixedInterval baseline, DriftTriggered, DriftTriggeredCapped) over a shared CheckpointPolicy trait, driving a real ruvector-agent-memory::MemoryStore and witness-chaining every snapshot through a real ruvector-proof-gate::HashChainGate — no mocks.
  • Every recovery is verified by exact vector-for-vector replay reconstruction (not digest comparison alone), sampled at 40 points per run.
  • ADR-305 records 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-memory for what to keep, ruvector-temporal-coherence for how to weight retrieval, ruvector-proof-gate for 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

cargo run --release -p ruvector-coherence-checkpoint --example benchmark -- 6000 48 <seed> <threshold>

Canonical run (threshold=0.08, seed=2026), x86-64/4 cores/Linux 6.18.5/rustc 1.94.1:

variant                               snapshots   max_gap  mean_gap   p95_gap    storage_KB    time_ms
baseline (FixedInterval)                     12       499     249.5       475        6189.8     40.009
candidate_A (DriftTriggered)                 12       839     282.0       691        5106.9     33.470
candidate_B (DriftTriggeredCapped)           14       499     220.1       449        6799.1     43.928

ACCEPTANCE_RESULT: REJECT

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

  • Darwin: not run — no promising candidate to bound-search once the acceptance gate fails at every tested parameter. Parent (FixedInterval, i.e. no scheduling change to ruvector-agent-memory) is retained.
  • Flywheel: this PR (README + ADR-305) is the flywheel record — an explicit, evidenced rejection so future work doesn't re-propose whole-history cumulative-centroid drift as a checkpoint trigger.

Security review

No new cryptographic primitives (reuses ruvector-proof-gate::HashChainGate unmodified). Two independent tamper checks are unit-tested: chain structural re-derivation and payload rehash-and-compare. No unsafe code, no network calls. Details in ADR-305 §Security.

Main limitations

  • Single synthetic workload family (alternating calm/burst phases); real agent-memory drift patterns may differ — rejection is scoped to what was measured, not claimed universal.
  • Single dims/event-count scale (48 dims, 6,000 events); no scale sweep.
  • Sequential inserts only — no concurrent-write or delete/update scenario.

Production recommendation

Do not adopt DriftTriggered/DriftTriggeredCapped as specified. FixedInterval remains 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 RunningCentroid for 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

Test plan

  • cargo build --release -p ruvector-coherence-checkpoint
  • cargo test --release -p ruvector-coherence-checkpoint — 19/19 passing
  • cargo clippy --release --all-targets -p ruvector-coherence-checkpoint — clean
  • cargo fmt -p ruvector-coherence-checkpoint -- --check — clean
  • Benchmark reproduced across 4 independent seeds and 5 thresholds, all results consistent

Generated by Claude Code

claude and others added 3 commits August 18, 2026 07:30
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants