Skip to content

research(nightly): agent memory compaction via coherence-gated graph clustering#548

Draft
ruvnet wants to merge 2 commits into
mainfrom
research/nightly/2026-06-09-ruvector-memory-compact
Draft

research(nightly): agent memory compaction via coherence-gated graph clustering#548
ruvnet wants to merge 2 commits into
mainfrom
research/nightly/2026-06-09-ruvector-memory-compact

Conversation

@ruvnet

@ruvnet ruvnet commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Nightly RuVector research for 2026-06-09: agent memory compaction via coherence-gated graph clustering.

Introduces crates/ruvector-memory-compact — the first Rust crate to treat vector database compaction as a semantic problem rather than a structural storage concern. Three compaction strategies over a MemoryStore of agent episodic memories:

  • naive-kmeans: Lloyd's K-means centroid replacement (baseline, fastest)
  • graph-merge: k-NN cosine graph + threshold-based connected components (discovers natural topic granularity)
  • coherence-gated: k-NN graph + per-node coherence score gate (controlled, integrity-preserving)

All variants emit WitnessRecord chains (auditable attestation of which original IDs were merged into which centroid), enabling rollback and AI safety provenance.

Measured results (x86-64, release, N=1000, D=128, 20 topics × 50 vecs)

Variant Compact% Recall@10 Mean latency Throughput
naive-kmeans 60% 0.915 71 ms 14,164 vecs/s
graph-merge 98% 1.000 121 ms 8,292 vecs/s
coherence-gated 60% 0.990 118 ms 8,489 vecs/s

Acceptance: recall@10 ≥ 0.55 — ALL PASS ✓

What's included

  1. ✅ Working Rust PoC (crates/ruvector-memory-compact) — 6 source files, all <500 lines
  2. ✅ 10 unit tests passing
  3. ✅ Benchmark binary with real measured numbers
  4. ✅ ADR-199 (docs/adr/ADR-199-agent-memory-compaction.md)
  5. ✅ Research document (docs/research/nightly/2026-06-09-ruvector-memory-compact/README.md)
  6. ✅ Public gist article (docs/research/nightly/2026-06-09-ruvector-memory-compact/gist.md)

Topic selection (3-pass research loop)

Scored 10 candidate topics using formula:
final = 0.30×RuVector_fit + 0.25×feasibility + 0.20×novelty + 0.15×SEO + 0.10×ecosystem

Candidate Score
memory-compact (selected) 4.45
graph-rag 4.30
semantic-drift 4.25
proof-retrieval 4.20

Selected because: uniquely uses coherence + mincut primitives already in ruvector; no competitor ships this; auditable witness chain is original; connects ruFlo / MCP / ruvnet ecosystem.

Research doc

docs/research/nightly/2026-06-09-ruvector-memory-compact/README.md

ADR

docs/adr/ADR-199-agent-memory-compaction.md

Gist

docs/research/nightly/2026-06-09-ruvector-memory-compact/gist.md (pending public publish)


Generated by Claude Code

claude added 2 commits June 9, 2026 07:24
Nightly research pass 2026-06-09. Topic: agent memory compaction via
coherence-gated graph clustering (ADR-199, score 4.45/5).

Selected over: graph-rag (4.30), semantic-drift (4.25), proof-retrieval (4.20).
Implements three memory compaction strategies over a MemoryStore of
agent episodic memories:

- NaiveCompactor: Lloyd's K-means centroid replacement (baseline)
- GraphMergeCompactor: k-NN cosine graph + threshold-based connected components
- CoherenceGatedCompactor: k-NN graph + per-node coherence score gate

All variants implement the Compactor trait and emit WitnessRecord chains.
No internal workspace dependencies; independently buildable.

Measured results (N=1000, D=128, 20 topics × 50 vecs):
  naive-kmeans:    60% compact, recall@10=0.915, 71ms
  graph-merge:     98% compact, recall@10=1.000, 121ms
  coherence-gated: 60% compact, recall@10=0.990, 118ms

Acceptance: recall@10 ≥ 0.55 — ALL PASS
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