Skip to content

dream(performance): HNSWIndex efSearch query-time default (evaluated, REJECTED) - #3034

Draft
ruvnet wants to merge 3 commits into
mainfrom
dream/2026-08-15-performance
Draft

dream(performance): HNSWIndex efSearch query-time default (evaluated, REJECTED)#3034
ruvnet wants to merge 3 commits into
mainfrom
dream/2026-08-15-performance

Conversation

@ruvnet

@ruvnet ruvnet commented Aug 15, 2026

Copy link
Copy Markdown
Owner

1. Hypothesis

Given AgentDB's HNSWIndex-backed memory search, when the query-time default candidate-pool size is decoupled from efConstruction via a dedicated efSearch default (50), then per-query search latency should decrease relative to baseline, subject to: (1) recall@10 must not drop below 0.90 at any measured corpus size, (2) build/insert-time behavior is unchanged, (3) existing tests remain green.

2. Candidate

v3/@claude-flow/memory/src/hnsw-index.ts + types.ts — 2 code lines changed, 1 interface field added:

  • HNSWConfig.efSearch: number (new field, default 50)
  • search()'s implicit-default line: Math.max(k, efConstruction)Math.max(k, efSearch)

Previously, every caller of HNSWIndex.search() that omitted ef (which is every production caller in agentdb-adapter.ts — no in-repo caller currently passes ef) implicitly used the build-time graph-quality knob (efConstruction, 200) as the query-time latency/recall knob. This decouples them, matching standard HNSW practice.

3. Evaluation Receipt

New seeded benchmark: v3/@claude-flow/memory/benchmarks/results/scripts/efsearch-default-benchmark.mjs. Clustered synthetic corpus (256-dim, N=3000/8000, 60 queries/N), live brute-force recall@10 ground truth (never stored), paired per-query timing.

N Latency Δ Recall@10 Δ Floor (0.90)
3000 -55.9% (t=-30.5, n=60) -3.17pp (0.995→0.9633) held
8000 -57.5% (t=-32.7, n=60) -7.5pp (0.9517→0.8767) BREACHED

4. Baseline Comparison

Baseline = git stash the candidate diff, rebuild, rerun the identical script; candidate = restore diff, rebuild, rerun. Same script, same seeds, two code states — see receipt-baseline.json / receipt-candidate.json / comparison-efsearch-final.json in this PR.

5. Darwin Lineage

Skipped — candidate failed its own pre-declared quality invariant (STEP 12 precondition: "candidate passed basic evaluation" not met). Running bounded generations over a rejected baseline would tune toward passing a floor that already caught a real problem.

6. Flywheel Evidence

No signed @metaharness/flywheel bundle — bespoke deterministic benchmark, not an LLM-task corpus the replay/verify tooling targets. Evidence retained as committed receipts + the issue/gist report.

7. Reward Hack Check

Manual checklist clear: gold computed live (not stored), no threshold tuned to pass (0.90 floor set before the final run and the candidate fails it), both N sizes reported including the failing one, seeds identical across baseline/candidate labels, zero API cost.

8. Security Review

Not security-sensitive: in-process vector-index query-default change only. No credential/network/filesystem/MCP-authority surface touched.

9. Regression Analysis

Existing test suite 456/456 minus 1 pre-existing environmental failure (root bypasses a read-only-file-permission test, confirmed identical with/without the candidate via stash/rebuild) → 455/456 both before and after. Zero regressions attributable to the candidate.

10. ADR

None — simple parameter-default change, and REJECTED; doesn't meet this pipeline's bar for an architectural decision record.

11. Research Gist

docs/dream-cycle/dream-gist-2026-08-15.md (this session had no gist-creation tool available, consistent with every prior dream-cycle night).

12. Issue

#3033

13. Witness

Field Value
Session commit 45e65b5dae5d2c312e70cd5ba90df0701ea05c28
Report SHA-256 (pre-witness content) 2f2de7910ca69da3752d18c67964927871cf8a8b8ce1c470d1d798170f5e81fd
Witness stamp d756e6d92234275d44976fe47668e8713fa359481abd3d9d85e983ec94a4dd2d

14. Merge Policy

Human review required. Do not self-merge. Do not autonomously promote Flywheel state. This PR is REJECTED evidence, retained for reviewability and follow-up, not intended to be merged as-is — see Recommendation §15 in issue #3033 for the proposed follow-up direction (higher/scale-adaptive efSearch default, fix HNSWIndex.deserialize()'s persistence gap, re-test at production-realistic 1536-dim).


Generated by Claude Code

claude added 3 commits August 15, 2026 06:23
…-time efConstruction (evaluated, REJECTED)

Given AgentDB's HNSWIndex-backed memory search, decoupling the implicit
query-time candidate-pool default from efConstruction (200) into a
dedicated efSearch default (50) cuts per-query latency ~56-58% (paired
t~-31, n=60) but breaches a pre-declared recall@10>=0.90 invariant at
N=8000 (0.8767) while holding at N=3000 (0.9633). REJECT per this
pipeline's own rule: a failed pre-declared criterion rejects regardless
of primary-effect strength. Evidence retained for a follow-up with a
higher or scale-adaptive efSearch default.

Evaluation receipts, seeded benchmark harness (deterministic clustered
corpus, live brute-force recall@10 ground truth, paired per-query
timing), and comparison script committed alongside the candidate diff.
Committed in place of gh gist create (no gist-creation tool available in
this environment, consistent with every prior dream-cycle night).
…08-15

2026-08-14 (swarm, REJECTED) had a fully-run pipeline (issue #3026, PR
#3027) but its live ledger row was never appended — cosmetic gap, verified
via git ls-remote / gh pr list before backfilling, not assumed.

2026-08-15 (performance, REJECTED): HNSWIndex efSearch query-time default
vs build-time efConstruction. Issue #3033, PR #3034.

ruvnet commented Aug 15, 2026

Copy link
Copy Markdown
Owner Author

The "🤝 Agent Coordination Tests (performance-benchmarker, 1)" failure on f2f5a20cd is a transient infra flake, not a code issue: Unable to download artifact(s): Failed to GetSignedArtifactURL: Unable to make request: ECONNRESET while pulling a setup artifact between CI jobs — unrelated to this PR's diff (v3/@claude-flow/memory/src/{hnsw-index,types}.ts + the new benchmark scripts under v3/@claude-flow/memory/benchmarks/results/).

That commit is already superseded by ae2b1b59b (ledger update), which triggered a fresh set of CI runs currently in progress. No action taken here; will follow up if the new run fails for a real reason.


Generated by Claude Code

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