π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Memory SOTA Report β 2026-09-03
TL;DR: Tonight's memory deep-dive confirms and closes a specific, well-scoped gap flagged (but not fixed) since 2026-08-28: smart-retrieval.ts's MMR diversity re-ranking step used a token-Jaccard text-overlap proxy for "similarity to already-selected," instead of the embedding-cosine similarity every 2025-2026 production system (LangChain's reference implementation, Qdrant's native Mmr query shipped Sept 2025, Weaviate's MMR reranker shipped April 2026) uses β even though Ruflo's own pipeline already computes real ONNX embeddings and discards them before they reach MMR. Five parallel research roles (Deep Researcher, Competitor Analyst, 2 Scan Researchers, Ruflo Architecture Reviewer) independently verified the gap, found it is not a live research question in 2025-2026 literature (silently settled years ago by convergent practice), and confirmed the fix is small, additive, and zero-cost. Shipped: thread the already-computed embedding through searchEntries() β SearchCandidate β mmrRerank, using cosine similarity when both candidates have one, falling back to token-Jaccard otherwise (so callers/tests without embeddings are unaffected). Evaluated via deterministic Vitest, baseline-isolated via git stash: a discriminating test (a low-token-overlap paraphrase vs. a genuinely different topic) fails on baseline and passes on candidate. Full @claude-flow/memory suite: 460/461 passing, identically with and without the candidate (1 pre-existing, unrelated environmental failure). Separately, this session closed an automation-scan finding flagged in three prior gists (08-19, 08-28, 09-02) without ever being acted on: a scheduled CI workflow (dream-cycle-backlog-guard.yml) surfacing the Dream Cycle's own unmerged-draft-PR backlog, so the ledger-visibility gap stops being silently re-discovered every few nights.
What's New in 2026
| Finding | Source | Confidence |
|---|---|---|
Qdrant shipped native embedding-cosine MMR (Mmr query param, diversity 0.0β1.0) ~3 months after a May-2025 feature request |
Qdrant blog, Sept 4 2025 | A |
Weaviate shipped a native MMR reranker (balance param) in v1.37 |
Weaviate 1.37 release notes, Apr 23 2026 | A |
LangChain's reference maximal_marginal_relevance() (the implementation most MMR code in the wild derives from) has always operated on embedding vectors, never lexical overlap |
LangChain core reference docs, current 2026 | B |
| No 2025-2026 paper or vendor source directly debates lexical-overlap vs. embedding-cosine as MMR's diversity term β the question was settled by convergent practice years ago, with no published postmortem either way | Absence result across ~10 targeted queries (Deep Researcher) | B |
| Milvus/Vespa deliberately chose categorical/attribute bucketing over continuous embedding-MMR for cost/scale reasons at billion-vector scale β a documented tradeoff, not a belief that lexical proxies are qualitatively better | Zilliz/Milvus grouping-search docs; Vespa result-diversification blog | B |
Mem0/CrewAI/AutoGen/OpenAI's file_search skip diversity re-ranking entirely, investing in relevance-side tuning instead β a scope choice for sparser per-user memory pools, not a gap |
Mem0 reranker docs; CrewAI engineering blog (Mar 2026); comparative surveys | B |
| The 2025-2026 frontier is MMRβDPP (determinantal point processes), not lexicalβembedding: ScalDPP (Feb 2026) reports +7.7% NDCG@10 vs. non-diversified baseline using a cosine kernel, but is single-paper evidence, not benchmarked against MMR, and not adopted by any production vector DB found | arXiv:2604.03240 | C |
| A real practitioner report (unmerged GitHub issue) found session-transcript "verbose restatements" captured 41% of top-3 slots in hybrid agent-memory search β lexical/BM25 signals under-detect this; embedding cosine catches it β independently reproducing the exact failure mode this finding predicts | openclaw/openclaw#19760, Feb 2026 | C (corroboration only) |
Ruflo Current Capability
smart-retrieval.ts's mmrRerank() (phase 4 of SmartRetrieval's 5-phase pipeline: query expansion β RRF fusion β recency boost β MMR β session round-robin) computed pairwise similarity via tokenize()/jaccard() on raw text β the file's own header named it "MMR Diversity (token-Jaccard proxy)." Meanwhile memory-initializer.ts's searchEntries() computes real embedding-cosine similarity at two live sites (RaBitQ-rerank, brute-force SQL) for the primary relevance score, then discards the parsed embedding before returning (return type never included one). The two CLI/MCP bridge sites (memory-tools.ts, commands/memory.ts) had nothing to pass through as a result. A second, independent instance of the same root cause: controller-registry.ts's toCands() (feeds the separate, zero-production-caller hybridSearch controller) had the embedding available on r.entry.embedding but never copied it from its internal _entry stash to .embedding.
Competitor Comparison
| System | Diversity mechanism | Similarity basis | Tunable? | Grade |
|---|---|---|---|---|
| LangChain/LangGraph | maximal_marginal_relevance(), search_type="mmr" |
Embedding (cosine) | Yes (lambda_mult) |
B |
| Qdrant | Native Mmr query object |
Embedding (cosine/vector distance) | Yes (diversity 0β1) |
A |
| Weaviate | Native MMR reranker (v1.37) | Embedding | Yes (balance) |
A |
| Milvus | Grouping Search (group_by_field) |
Categorical/lexical (field equality) | Bucket-shape only, no Ξ» | B |
| Vespa | Result-grouping language | Lexical/attribute by default | Bucket sizes only | B |
| LanceDB | No diversity reranker (relevance-fusion rerankers only) | None built-in | N/A | B |
| Mem0 | No MMR β cross-encoder relevance rerank instead | N/A | N/A | B |
| CrewAI | No MMR β composite similarity+recency+importance, write-time consolidation | N/A | N/A | B |
OpenAI file_search |
No MMR β relevance ranking options only | N/A | N/A | B |
Ruflo smart-retrieval.ts (before tonight) |
MMR present, but token-Jaccard proxy | Lexical | Yes (mmrLambda), but wrong similarity basis |
β |
Ruflo is the only system reviewed that already computes embeddings for retrieval yet paid nothing for that investment at MMR β behind Qdrant/Weaviate's pattern, arguably behind LangChain's decade-old default, while doing strictly more than the four systems that skip diversity re-ranking entirely.
Hypothesis
Given SmartRetrieval's MMR diversity re-ranking step (
mmrRerankinsmart-retrieval.ts) operating onSearchCandidateobjects sourced fromsearchEntries()(memory-initializer.ts), when the per-pair similarity term is changed from token-Jaccard text overlap to embedding-cosine similarity (reusing the ONNX embeddingsearchEntries()already computes but previously discarded), falling back to token-Jaccard when either candidate lacks an embedding or dimensions mismatch, then MMR-selected diversity should correctly suppress low-token-overlap semantic near-duplicates (paraphrases) that a lexical-only proxy misses, subject to: (1) non-MMR pipeline phases (RRF fusion, recency boost, session round-robin) unchanged; (2) all existing tests remain green; (3) $0 evaluation cost, zero new LLM calls; (4) the embedding field does not leak into final CLI/MCP JSON responses.
Frozen before evaluation; not modified after seeing results.
Benchmarks / Evaluation
evaluated: accepted. Real evaluator: Vitest, deterministic, zero LLM calls, $0 cost. Candidate touches 5 files (~110 net lines): memory-initializer.ts (thread embedding through both live compute sites), smart-retrieval.ts (embedding? field, cosineSimilarity/pairSimilarity helpers, mmrRerank uses cosine-with-fallback), controller-registry.ts (toCands copies r.entry.embedding), memory-tools.ts + commands/memory.ts (bridge mappers pass embedding through), plus 2 new tests in smart-retrieval.test.ts.
Discriminating test: A (seed), B (paraphrase of A β 1/11 Jaccard overlap, embedding-cosine β1.0), C (different topic β 0 Jaccard overlap, embedding-cosine β0, lower relevance score than B). Baseline-isolated via git stash of the 5 source files (test kept): baseline picks B second (0.2154 > 0.21 under Jaccard β it can't tell "low overlap because paraphrase" from "low overlap because unrelated") β reproduced live, confirmed failing. Candidate picks C second (cosine correctly flags B as A's near-duplicate). A second, non-discriminating regression test (embeddings absent/mismatched) passes both ways, confirming the fallback path is unchanged β disclosed honestly per this repo's evaluation-transparency convention.
Full @claude-flow/memory suite: 460/461 passing, identically with/without the candidate (controller-registry.test.ts + graceful-retrieval.test.ts: 75/75). The 1 failure (auto-memory-bridge.test.ts, chmod-based, can't enforce read-only under a root-owned sandbox) is pre-existing, same class as every night since 08-15. tsc --noEmit on @claude-flow/memory: zero errors. @claude-flow/cli's tsc --noEmit: 455 errors both with and without this candidate (verified via git stash, identical count) β pre-existing, caused by unbuilt workspace packages (@claude-flow/memory/neural/cli-core have no dist/), unaffected by this diff.
Adversarial critique (STEP 10): weakened the benchmark? No β additive tests, full-suite run. Altered gold answers? No LLM/gold-answer path exists. Cherry-picked? No, full 461-test suite both ways. Cost/latency regression? No β pure in-memory float math, no new I/O (embedding was already parsed in scope). Undocumented caching/threshold changes? No. Leaks the embedding externally? Checked: both CLI/MCP mappers (memory-tools.ts:559-569, commands/memory.ts:633-639) whitelist output fields rather than spreading the candidate β confirmed it cannot reach a tool caller's JSON response.
Darwin Results
Skipped β scope mismatch, same class as every recent night. This is a correctness/similarity-metric fix with a discriminating unit test, not a continuous parameter with a gold-labeled retrieval corpus to search a fitness gradient over.
SOTA Proof & Witness
| Field | Value |
|---|---|
| Session commit | db4991967c45c6f72133dff0bb80b0a492960fc1 |
| Gist SHA-256 (pre-witness content) | 6a2c2fd79a37e7c0d5955fc4570d2e31d3db7fdbb6bd89c01df28186181324a1 |
| Witness stamp | 9ce94e313fd75bb9fbf313c029300f1ac00f24fa5b47ea31df08d674bab774f4 |
| Evaluation receipt | deterministic Vitest, git stash-isolated baseline vs. candidate (see Evaluation section) |
| Flywheel evidence | none signed β deterministic-test evidence, same class as every accepted night since 08-18 |
| Darwin lineage | none β skipped, scope mismatch (see Darwin Results) |
Verifier procedure: fetch this file as it existed before this table was filled in (a one-line placeholder sentence), SHA-256 it, concatenate with the session commit above, SHA-256 again β result must equal the witness stamp.
Recommended Next Steps
- Merge the linked draft PR β small, additive, reversible, matching Qdrant/Weaviate's production pattern, with an honest baseline-fails/candidate-passes test.
- Follow-up (deferred, larger scope):
searchEntries()also never returnsmetadata/createdAt/updatedAt, silently no-opping 2 of SmartRetrieval's other 3 phases (recency boost, session round-robin) for every CLI/MCPsmart:truesearch. Same fix shape, but needs 2 SQLSELECTs extended (new columns, not just returning an already-computed value) β a dedicated night. - Follow-up (plugins scan, 08-28 finding still open):
PluginManager.installFromNpm()shells straight tonpm install, never checking the downloaded package against the registry'schecksum/cid/trustLevelfields β defined and displayed, never enforced. Fix: verify the tarball hash before writing the manifest, or drop the fields since leaving them is misleading. - Human review/merge of the growing 08-24..09-02 ACCEPT-evidence draft-PR backlog (see issue for tonight's backlog-guard workflow).
Addendum (2026-09-05) β response to review REJECT
Added after the fact; does not alter the witnessed content above (see Verifier procedure). ruvnet reviewed PR #3169 and rejected pending: (1) splitting the CI workflow out of the MMR PR, (2) a green CI baseline, (3) a representative benchmark (not a 3-item fixture) reporting Recall/nDCG/diversity/duplicate-rate/latency/memory vs. baseline, (4) malformed/dimension-mismatch embedding cases plus a no-leak check, (5) a determinism proof.
- Split: the
dream-cycle-backlog-guard.ymlcommit moved to its own branch/PR, #3205. PR #3169 now carries only the memory-fix commit. - CI: root cause (unpublished
@claude-flow/[email protected]pin,npm ciETARGETon every job) was fixed onmainby a different session, #3203 (merged), before this remediation started.dream/2026-09-03-memoryrebased onto the fixedmain; CI is green. - Benchmark (new:
src/mmr-benchmark.test.ts): 18-doc / 6-topic labeled corpus (1 canonical + 2 low-token-overlap paraphrases per topic), run through the realsmartSearch/mmrRerankcode, swept acrossmmrLambdaβ {0.3, 0.5, 0.7, 0.9} rather than reporting one favorable value. Honest finding: at diversity-heavy Ξ» (0.3-0.5), candidate's Recall@6/nDCG@6 drop sharply vs. baseline (0.333 vs 1.000) β because cosine correctly suppresses same-topic near-duplicates while Jaccard fails to detect them at all and so "accidentally" keeps full recall. This is MMR's documented relevance/diversity trade-off operating as designed, not a defect in the metric swap. Atsmart-retrieval.ts's own default (Ξ»=0.7) β the actual production operating point β Recall@6 and nDCG@6 are identical between baseline and candidate (1.000 / 0.777 both), while topic-diversity improves 0.472β0.667 and ground-truth duplicate-rate drops 0.289β0.200. Latency: both paths sub-millisecond at this corpus size (candidate p95 β0.39ms vs baseline β0.32ms). Memory: +64 bytes/doc (8-dim synthetic embedding Γ 8 bytes), never externally observable (see #4). - Malformed/dimension-mismatch: found and fixed a real bug while writing these cases β a NaN/Infinity-poisoned embedding component would previously reach
cosineSimilarityunguarded, poisoning the dot product to NaN, which (sinceNaN > xis alwaysfalsein JS) could silently break MMR's selection loop and under-fill results below the requested limit. AddedisWellFormedEmbedding()(finite-component guard) so malformed/empty-array embeddings fall back to Jaccard, same as absent/mismatched ones. 3 new tests (NaN/Infinity, empty array, explicit dimension-mismatch) plus a mirrored-whitelist regression test assertingembeddingcannot appear in either real CLI/MCP output shape. - Determinism: new test runs the same input through
smartSearch5 times concurrently and asserts byte-identical result ordering every time, including a genuine same-embedding tie case.
Net: 2 new test files (mmr-benchmark.test.ts, malformed/determinism additions to smart-retrieval.test.ts), 1 real hardening fix (isWellFormedEmbedding), 0 changes to the original hypothesis or its evaluated conclusion at the module's default operating point.