Skip to content

research(nightly): page-coherent-memory — paged agent context loading via greedy coherence clustering - #780

Draft
ruvnet wants to merge 1 commit into
mainfrom
research/nightly/2026-08-03-page-coherent-memory
Draft

research(nightly): page-coherent-memory — paged agent context loading via greedy coherence clustering#780
ruvnet wants to merge 1 commit into
mainfrom
research/nightly/2026-08-03-page-coherent-memory

Conversation

@ruvnet

@ruvnet ruvnet commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Nightly RuVector research: Page-Coherent Agent Memory — organizing vector memory stores into semantically coherent pages for faster retrieval and higher-quality agent context loading.

  • Topic: Paged agent memory with greedy coherence clustering
  • Crate: ruvector-coherence-pages (zero external dependencies, WASM-safe)
  • ADR: docs/adr/ADR-280-page-coherent-memory.md
  • Research doc: docs/research/nightly/2026-08-03-page-coherent-memory/README.md

What this adds

Three PageStore implementations benchmarked on 8,000 vectors × 128 dimensions:

Variant Speedup vs flat Recall@10 Coherence Build
FlatStore (baseline) 1.000 0.7533 0 ms
CentroidPageStore (k-means) 7.0× 0.346 0.7693 832 ms
GreedyCoherenceStore 9.6× 0.233 0.7782 65 ms

Key finding: greedy coherence achieves highest intra-page cosine similarity (+0.025 vs flat) but lower recall than centroid paging. K-means centroids are better retrieval anchors; greedy seeds produce tighter topic clusters for context loading. Both achieve 7–10× speedup at 10% probe rate. All 8 acceptance criteria pass.

Files changed

  • crates/ruvector-coherence-pages/ — new crate (zero deps)
    • src/lib.rsPageStore trait, VecPage, utilities, 6 unit tests
    • src/flat.rs — exhaustive baseline
    • src/centroid.rs — k-means centroid paging
    • src/greedy.rs — greedy coherence paging
    • src/bin/benchmark.rs — benchmark binary with real measured numbers
  • docs/adr/ADR-280-page-coherent-memory.md
  • docs/research/nightly/2026-08-03-page-coherent-memory/README.md
  • docs/research/nightly/2026-08-03-page-coherent-memory/gist.md
  • Cargo.toml — added ruvector-coherence-pages to workspace members

Test status

cargo test -p ruvector-coherence-pages
running 6 tests
test tests::dot_and_normalize_correct ... ok
test tests::flat_store_recall_perfect ... ok
test tests::page_coherence_greedy_beats_flat ... ok
test tests::centroid_store_builds_correct_pages ... ok
test tests::greedy_store_recall_above_threshold ... ok
test tests::centroid_store_recall_above_threshold ... ok
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured

Benchmark: cargo run --release -p ruvector-coherence-pages --bin benchmarkRESULT: ALL CHECKS PASSED ✓

Ecosystem connections

Page-coherent memory bridges: vector search + agent memory + coherence scoring + DiskANN-style paging + WASM edge deployment + MCP tool surface + ruFlo recompaction workflows.


Generated by Claude Code

Topic: Page-Coherent Agent Memory via Greedy Coherence Clustering
ADR: ADR-280
Crate: ruvector-coherence-pages

Adds working Rust proof-of-concept for organizing vector-based agent
memory into semantically coherent pages. Three variants benchmarked:
- FlatStore baseline (recall=1.0, 711 q/s)
- CentroidPageStore k-means (7.0× speedup, recall=0.35, coherence=0.7693)
- GreedyCoherenceStore (9.6× speedup, recall=0.23, coherence=0.7782)

Key finding: greedy coherence maximizes local intra-page similarity
(best for agent context loading) while k-means centroids maximize
retrieval recall (best for ANN accuracy). Tradeoff is real and measured.

All 6 unit tests pass. All 8 benchmark acceptance checks pass.
Zero external dependencies. Compiles to WASM-safe Rust.

Co-Authored-By: claude-flow <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01P5KFoo44c7opwbMJGC2sn5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants