π 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
dream(performance): #3183 wire real cold-start measurement, remove fabricated V2-vs-V3 benchmark (evaluated, ACCEPT-scoped) (#3184)
rUv33a2c3ed07f0
diff --git a/docs/dream-cycle/LEDGER.md b/docs/dream-cycle/LEDGER.mdindex eef6583718..e76ac218c5 100644--- a/docs/dream-cycle/LEDGER.md+++ b/docs/dream-cycle/LEDGER.md@@ -131,3 +131,43 @@ alerting.| 2026-08-17 | intelligence | discounted Thompson-sampling prior decay for model-router bandit (opt-in), recovers faster after workload shift | #3048 | #3049 | yes | ACCEPT-scoped | low-bucket recovery -17.6% (t=7.00, held); med-bucket null (no generalization) | e0fb0242... | recovered-live || 2026-08-18 | memory | hybridSearch controller reachable via explicit opt-in (was silently null-returning despite config flag) | #3056 | #3057 | yes | ACCEPT-scoped | overall recall@10 +0.267; category B (pure-paraphrase) regresses -0.133 | b28714fb... | recovered-live || 2026-08-19 | swarm | MessageBus retry-attempts silently reset to 0 on every re-queue, unbounded redelivery, message.failed unreachable | #3061 | #3062 | yes | ACCEPT | invocations 96-98/0-failed (baseline) β 3/2/1 stable (candidate); 220/220 tests | 62c4fdf7... | 08-14..08-18 all OPEN, none merged yet |++**Recovery note (2026-09-05):** rows for 2026-08-24 through 2026-09-03 were+again never appended live β same failure class as the 2026-08-19 recovery+above, now confirmed for a 3rd distinct occurrence. Verified via direct+evidence before concluding this (per STEP 1's anti-inference rule): `git+ls-remote --heads origin "dream/*"` shows real branches for every date+2026-08-24..2026-09-03, and `search_issues label:dream-cycle` /+`search_pull_requests` confirm a real issue+draft-PR pair for each β+the pipeline ran to completion every one of those nights; only the+ledger-append step silently no-op'd. **2026-08-20 through 2026-08-23 is a+separate, genuine gap**: no branches, no issues, no PRs for those 4 dates β+confirmed independently by three separate dream-cycle nights (08-24, 08-25,+08-27) before tonight, and reconfirmed here β the pipeline did not run at+all those nights (root cause still undiagnosed, still out of scope for a+single-surface nightly slot). Also separately confirmed via `issue_read` on+#3109: PRs #3043/#3044 (08-16), #3048/#3049 (08-17), #3056/#3057 (08-18),+#3061/#3062 (08-19) were **MERGED 2026-08-21** β a human merged the backlog+that had built up, contradicting nothing above but updating the "OPEN"+status this ledger last recorded for them. Backfilled below from issues/PRs+directly (titles + verdict only β full effect-size detail is in each+linked issue; not re-extracted tonight to protect budget for tonight's own+research per STEP 0.6). **This is now the 3rd occurrence of the same+ledger-append failure mode** (2026-08-19 recovery, implied prior instances,+now this one) β no longer a one-off. Elevating this from a "candidate+finding" to an explicit recommendation: a future `automation`/`meta` DEEP+night should treat "harden STEP 25's ledger-append against silent failure"+as a first-class, high-priority candidate, not a background note.++| 2026-08-24 | swarm | TopologyManager weightedConsensus() trust weights now reach the vote tally (were computed, discarded) | #3085 | #3086 | yes | ACCEPT | see issue #3085 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-08-25 | performance | productQuantizeDistance() implemented but never dispatched in HNSW search path β wired in | #3093 | #3094 | yes | ACCEPT | see issue #3093 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-08-26 | security | authorizeMcpTool() trusted unsigned caller identity (ASI07) β ADR-377 verifyInvocationToken bound into live chokepoint | #3102 | #3103 | yes | ACCEPT-with-caveats | see issue #3102 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-08-27 | intelligence | distillLearning() EWC gate read 1 of 384 Fisher dims via length-collapsed getPenalty() call; rewired to computeConfidencePenalty()/updateFisherFromConfidences() | #3109 | #3110 | yes | ACCEPT-scoped | 152/152 tests (+4 new), baseline-fails/candidate-passes via stash isolation | 89946458... | unmerged draft as of 09-05 |+| 2026-08-28 | memory | HybridBackend's dead `weights` field now drives real weighted-RRF fusion (was computed, never read by merge helpers) | #3118 | #3119 | yes | ACCEPT | see issue #3118 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-08-29 | swarm | TopologyManager.rebalanceHybrid() one-directional adjacency bug fixed | #3122 | #3123 | yes | ACCEPT | see issue #3122 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-08-30 | performance | unwired diskann-backend.ts removed + stale 150x-12,500x HNSW claim in generated CLAUDE.md corrected | #3129 | #3130 | yes | ACCEPT | see issue #3129 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-08-31 | security | MCP governance policy (.harness/mcp-policy.json) was never enforced at runtime β opt-in enforcement wired in | #3138 | #3139 | yes | ACCEPT | see issue #3138 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-09-01 | security | maxToolCallsPerTurn was a session-lifetime cumulative cap that never reset β sliding-window reset implemented | #3151 | #3152 | yes | ACCEPT | see issue #3151 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-09-02 | intelligence | LearningBridge.consolidate() was reward-blind β fixed to weight consolidation by trajectory reward | #3159 | #3160 | yes | ACCEPT | see issue #3159 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-09-03 | memory | SmartRetrieval's MMR diversity step used token-Jaccard similarity instead of the available embedding-cosine | #3168 | #3169 | yes | ACCEPT | see issue #3168 | n/a (backfill) | unmerged draft as of 09-05 |+| 2026-09-05 | performance | cli-cold-start.bench.ts's real measureColdStart() was dead code; every number (incl. a by-construction "5.00x V2 vs V3") came from setTimeout(); real spawn-based measurement wired in, fabricated comparison removed, 2 stale ADR-STATUS-SUMMARY.md rows corrected | #3183 | #3184 | yes | ACCEPT-scoped | real: 54.65ms mean (min 51.94/max 57.92, n=5) vs 500ms target; 99/99 tests (+4 new), baseline-fails/candidate-passes via stash isolation | 04f903ba... | 08-24..08-31 all unmerged drafts (ACCEPT/ACCEPT-scoped, correctly awaiting human review, none stale <14d) |diff --git a/docs/dream-cycle/dream-gist-2026-09-05.md b/docs/dream-cycle/dream-gist-2026-09-05.mdnew file mode 100644index 0000000000..d47112b6ed--- /dev/null+++ b/docs/dream-cycle/dream-gist-2026-09-05.md@@ -0,0 +1,96 @@+# Performance SOTA Report β 2026-09-05++TL;DR: Tonight's performance deep-dive found that Ruflo's own CLI cold-start "benchmark" suite (`v3/@claude-flow/performance/benchmarks/startup/*.bench.ts`) never measured the real CLI at all β every reported number, including a "V2 vs V3 Speedup: 5.00x" line, came from `setTimeout()` delays with no code in between, guaranteed to produce that ratio on every run regardless of any real behavior. A real, spawn-based measurement function (`measureColdStart()`) already existed in the file but was never called β dead code sitting next to its own fabricated replacement. Fixed: wired the real function into the suite, removed the fabricated V2-vs-V3 comparison outright (there is no V2 binary left to compare against), and added a deterministic Vitest regression test. Real measured number: CLI cold start via `node bin/cli.js --version` (the one subcommand that runs without a full `dist/` build in this worktree) averages **~54.7ms** over 5 runs β well under the 500ms target β but this covers only that subcommand, not full command initialization, so the broader "Achieved" claim in `ADR-STATUS-SUMMARY.md` is corrected to reflect what's actually verified. Also corrected the same table's already-known-false "150x-12,500x HNSW" claim to point at the real measured 1.9x-4.7x numbers. Security and hive-mind scans each surfaced one new, code-verified, low-cost-to-fix finding, documented below as candidates for future nights (not implemented tonight, to keep this patch to one conceptual change per repo convention).++## What's New in 2026++| Finding | Source | Confidence |+|---|---|---|+| Most published multi-agent "coordination gain" numbers don't survive paired, noise-floor-controlled testing (7 of 10 recent architectures tested) | arXiv:2606.20695, "How Much Coordination Gain Is Real?" (2026) | A (methodology paper; directly implicates Ruflo's own unmeasured raft/hive-mind overhead) |+| Industry-wide "AI Agent Benchmark Trust Crisis": 8 standard agent benchmarks gameable to near-100% without solving the underlying task | Pebblous, 2026 | B (industry report, not peer-reviewed, but names the exact failure class this finding reproduces in-repo) |+| Qdrant shipped native embedding-cosine "TurboQuant" (~8x compression, minimal recall loss) and Milvus added DiskANN for beyond-RAM indexes | Qdrant benchmarks (2025), Milvus 2.6 notes (2026) | B (vendor, cross-checked against ann-benchmarks.com / third-party comparison) |+| A 2026 cross-framework run found LangGraph fastest of LangGraph/AutoGen/CrewAI on 5 latency tasks; CrewAI's role-injection pattern reported ~18% token overhead vs. LangGraph | dev.to AutoAgents benchmark; the-agent-report.com (Jul 2026); markaicode.com | B/C (two independent sources agree on LangGraph's relative speed; CrewAI overhead number is single-source) |+| OpenAI's automatic prompt-prefix caching cuts cost up to 90% and improves time-to-first-token 13-31% across 500+ sessions | arXiv:2601.06007 "Don't Break the Cache" (2026) + OpenAI docs | A (peer-reviewed-style academic eval, cross-checked with vendor docs) |+| No credible reproducible cross-framework benchmark of raw agent-spawn/coordination overhead exists β not an oversight, a consequence of architectural incomparability documented in the coordination-gain paper above | Synthesis of the above | B |++## Ruflo Current Capability++`v3/@claude-flow/performance/benchmarks/startup/cli-cold-start.bench.ts` defined `measureColdStart()` (lines 21-59, pre-existing): a real, `child_process.spawn()`-based cold-start timer with a 10s timeout. It was never called anywhere in the file (confirmed by grep β zero call sites before tonight). Every benchmark in `runColdStartBenchmarks()` instead used `simulateModuleLoading()`/`simulateCLIInit()` β pure `setTimeout()` chains with invented constants. The worst instance: a "V2 vs V3 Comparison Simulation" benchmark ran `setTimeout(resolve, 100)` for "V2" and `setTimeout(resolve, 20)` for "V3" with **zero code in between**, producing "V2 vs V3 Speedup: 5.00x" deterministically, every single run, independent of any actual code change. This fabricated number is not directly quoted anywhere with a citation, but it is the same 5x figure repeated as the CLI-startup target framing across `v3/@claude-flow/performance/src/framework/benchmark.ts` (header comment, "CLI Startup: <500ms (5x faster)") and `ADR-STATUS-SUMMARY.md:167` ("CLI Startup | <500ms | β Achieved"). Sibling files `agent-spawn.bench.ts`, `mcp-server-init.bench.ts`, and `cli-warm-start.bench.ts` share the identical anti-pattern (simulated `Agent`/`MCPServer` objects, `setTimeout()` "transport init," never touching the real Task-tool spawn path or a real MCP SDK server) β not fixed tonight, documented as follow-ups below to keep this patch to one conceptual change.++Separately, `ADR-STATUS-SUMMARY.md`'s Performance Targets table carried a second, unrelated stale claim in the same block: "HNSW Search | 150x-12,500x faster | β Achieved," already contradicted by this repo's own `v3/CLAUDE.md` and `scripts/benchmark-intelligence.mjs`, which measure ~1.9x at N=20k and ~3.2x-4.7x at N=5k. Corrected alongside the CLI Startup row since both are the same defect class (an "β Achieved" claim in this one table not backed by what the repo's own measurement scripts actually show) and live 1 line apart.++## Competitor Comparison++| System | Mechanism | Performance characteristic | Evidence grade |+|---|---|---|---|+| Qdrant | Rust HNSW + TurboQuant (int8/binary modes) | ~8x compression, minimal recall loss; 10M vectors on 16GB at 6-10ms p50 | B |+| Milvus | Multi-index (HNSW/IVF/DiskANN/GPU), disaggregated storage | DiskANN lets index exceed RAM β a capability neither Qdrant nor Weaviate match | B |+| LangGraph | Graph state-delta passing (not full history replay) | Fastest of 4 frameworks on all 5 latency tasks in an independent 2026 run; >2x faster than CrewAI on a 100-run 5-agent workflow | B |+| AutoGen/AG2 | Async event loop, sequential-by-default GroupChat | Matched LangGraph on latency in the same comparison; sequential default caps concurrency gains | C |+| CrewAI | Role-based crew, role text re-injected per turn | ~18% token overhead from role injection, up to ~56% more tokens/request vs. LangGraph | C |+| OpenAI (Agents SDK, prompt caching) | Automatic exact-prefix caching | 50-90% cost cut by default; 13-31% TTFT improvement (arXiv-verified) | A |+| Ruflo (this repo, before tonight) | Custom benchmark harness with a real spawn-based measurement function already written | Function never called β 0% real coverage of its own claimed numbers | β |++**Why the "credible cross-framework agent-spawn benchmark" cell is empty everywhere, not just for Ruflo:** arXiv:2606.20695 shows 7 of 10 recent multi-agent coordination-gain claims fall inside natural run-to-run noise once tested on a paired, same-model, noise-floor-controlled harness. Architectural incomparability (graph vs. sequential vs. role-based vs. consensus-gated topologies) makes apples-to-apples spawn-overhead measurement close to meaningless without a shared task harness, and a bad self-reported number invites exactly the takedown this finding represents β so frameworks mostly don't publish one. This directly implicates Ruflo's own raft/byzantine/hierarchical coordination overhead, which remains unmeasured in-repo (see hive-mind scan below for a related, more specific gap in the same subsystem).++Synthesis: Ruflo is ahead in one specific way β it already has *some* measured, methodology-disclosed numbers (HNSW 1.9x-4.7x, SONA 0.0043ms) instead of round marketing figures, which is rarer than it should be given the Pebblous/arXiv findings above. It was behind on this one surface specifically (CLI startup) until tonight, where the claim wasn't just unverified but mathematically guaranteed-fake by construction. It remains behind on breadth: no Grade-A external validation exists for any of its own numbers, unlike OpenAI's arXiv-verified caching claim.++## Hypothesis++> Given the CLI cold-start benchmark suite (`cli-cold-start.bench.ts`), which currently reports a "V2 vs V3" speedup and other headline numbers purely from hardcoded `setTimeout()` delays without exercising any real code path, when the suite is rewired to call its own pre-existing (but dead) `measureColdStart()` function β spawning a real `node bin/cli.js` child process β and the fabricated V2-vs-V3 comparison is removed rather than "fixed" (no V2 binary remains to compare against), then the suite should report a genuine measured wall-clock number reflecting actual current CLI behavior for at least one real subcommand, subject to: (1) existing tests remain green; (2) the fix touches only the benchmark/test harness and one documentation table, not production CLI code; (3) $0 evaluation cost, zero LLM calls; (4) the honest scope limitation (measures `--version` only, not full command initialization, because this worktree's `dist/` isn't built) is disclosed rather than hidden.++Frozen before evaluation; not modified after seeing results.++## Benchmarks / Evaluation++**evaluated: accepted, with disclosed caveats (ACCEPT-scoped).** Real evaluator: Vitest 4.1.8, deterministic, zero LLM calls, $0 cost (dependencies installed fresh tonight via `pnpm install` inside `v3/`, per this repo's own documented two-workspace gotcha).++Candidate diff: `v3/@claude-flow/performance/benchmarks/startup/cli-cold-start.bench.ts` (exported `measureColdStart`/added `runRealColdStartMeasurement`/`CLI_BIN_PATH`, removed the fabricated V2-vs-V3 block, ~55 net lines), new test file `v3/@claude-flow/performance/__tests__/cli-cold-start.test.ts` (4 tests, 62 lines), and a 2-row correction in `v3/implementation/adrs/ADR-STATUS-SUMMARY.md`.++**Baseline vs. candidate, isolated via `git stash` of just the `.bench.ts` file (test file kept):** all 4 new tests **fail against baseline** β `measureColdStart`/`runRealColdStartMeasurement`/`CLI_BIN_PATH` are not exported at all pre-fix (import resolves to `undefined`), and the "no fabricated pattern" guard test also fails because the pattern is still present. All 4 **pass against candidate**. Full `@claude-flow/performance` suite: **99/99 passing** (95 pre-existing + 4 new), identical pass count confirmed both ways for the pre-existing 95. `tsc --noEmit`: zero errors.++**Real measured number** (captured via a throwaway forced-failure test to surface stdout, then discarded β not part of the committed diff): `node bin/cli.js --version`, 5 runs β mean **54.65ms**, min 51.94ms, max 57.92ms. Well under the 500ms target. Caveat disclosed in-code and here: `--version` is the one subcommand that succeeds without a built `dist/` in this worktree; other subcommands (`--help`, `status`, `doctor`) currently fail with `ERR_MODULE_NOT_FOUND` in ~207-255ms in this same unbuilt state (confirmed independently by tonight's architecture-reviewer role and re-confirmed directly) β `measureColdStart()` resolves on process **close**, not on success, so it would honestly report a *failure* path's timing as a "cold start," not silently mask it. This is why the real command chosen is `--version`, and why the fix is scoped as "real evidence exists for one subcommand" rather than "full CLI startup is now measured."++Adversarial critique (STEP 10): weakened the benchmark? No β strictly additive real measurement, removed a benchmark that measured nothing (not a real one). Altered gold data? N/A, no gold-answer path in this code. Cherry-picked? No, full 99-test suite reported both ways. Cost/latency regression? No new production-path change β this is dev/benchmark tooling only. Undocumented caching? No. Leaked expected answers? N/A. Fair baseline? Yes, real pre-existing dead code, stash-isolated. Statistically meaningful? N/A for this class of finding β it's a direct correctness fact (function called vs. not called), not a comparative statistical claim; the real 54.65ms number is disclosed with min/max/n rather than a single misleading point estimate. Survives a different workload? The `--version` timing will vary by machine/load β that variability is why the suite reports min/max/samples rather than one number, and why the ADR-STATUS-SUMMARY.md correction says "measured ~54.7ms" rather than re-asserting a universal "Achieved."++## Darwin Results++Skipped β scope mismatch, same class as most recent nights. This is a dead-code-wiring/instrumentation fix with a binary "is the real function called or not" evaluation, not a continuous or categorical parameter with a fitness gradient to search over via `npx ruvector harness darwin <config> --execute` (confirmed real interface via `--help` tonight).++## Flywheel Evidence++No signed `@metaharness/flywheel` bundle β deterministic Vitest evidence (not an LLM-task corpus the replay/verify tooling targets), consistent with every accepted night since 2026-08-18. Evidence retained as: 4 new deterministic tests + this gist + this issue + the stash-isolated baseline-fails/candidate-passes result + the real 54.65ms measurement. Classified: OBSERVATION (dead `measureColdStart()` call, confirmed via grep + direct read) / MEASUREMENT (baseline-fails/candidate-passes, 99/99 full suite green, tsc clean, real 54.65msΒ±3ms spawn-based number) / INFERENCE (the fabricated V2-vs-V3 number never reflected real behavior; this fix does not itself prove current CLI startup is fast or slow beyond the one subcommand measured) / DECISION (ship as a small, additive, benchmark-harness-only fix) / REJECTION (none this round).++## Reward Hack Check++No standalone generic reward-hack CLI reachable this session (same as recent nights β `npx ruvector harness --help` lists `status`/`route`/`flywheel`/`darwin`, no generic diff/benchmark-scanning subcommand). Manual checklist: no test weakened (new test file is purely additive); no gold-label leakage (no LLM/gold-answer path exists in this code); no cherry-picking (full 99-test suite reported both ways, baseline and candidate); no seed manipulation (fully deterministic, real subprocess timing reported honestly with variance shown via min/max); zero cost (no model calls, local `node -e "process.exit(0)"` and `node bin/cli.js --version` spawns only); no undocumented caching. The one intentionally-disclosed limitation (real measurement covers `--version` only, not full command init) is stated in-code and in this gist rather than hidden β the opposite of reward hacking the evaluation.++## Security Review++Not the primary focus tonight. Reviewed: `runRealColdStartMeasurement()` spawns a fixed, hardcoded command (`node`, `[CLI_BIN_PATH, '--version']`) with `shell: false` (unchanged from the pre-existing `measureColdStart()` helper, which already documented this as a deliberate injection-avoidance choice) β no user-controlled input reaches the spawned argument list. No new network, filesystem, or credential-boundary surface introduced; this is dev/benchmark tooling, not a production code path.++## Scan Findings: security++Plugin supply-chain controls are documented but not enforced at install time (Medium severity, new, code-verified β not previously flagged). `v3/@claude-flow/cli/src/plugins/store/discovery.ts:96-102` defines real `PluginStoreConfig` fields (`requireVerification`, `minTrustLevel: 'community'`, `blockedPlugins`, `allowedPermissions`, `requirePermissionPrompt: true`) and `SECURITY.md` documents checksum verification, trust-level gating, and permission allowlisting as the threat model β but `commands/plugins.ts:217,228`'s `--verify` flag (default true) is read into a local variable and never referenced again (2 total grep hits: declaration + option definition); the registry entry's `checksum`/`trustLevel`/`permissions` are fetched only for cosmetic display (lines 271-309) while the actual install (`manager.installFromNpm`) runs a plain `npm install <name>` fully decoupled from that metadata; and a repo-wide grep for `config.blockedPlugins|minTrustLevel|allowedPermissions|requirePermissionPrompt` returns zero matches β these config gates are never read anywhere. `manager.ts`'s `enable()` just logs a sandboxing warning and flips the plugin on regardless of trust level or requested permissions. Net effect: an `unverified`-trust, `privileged`-permission-requesting registry entry installs and enables identically to an `official` one β no checksum check, no prompt, no block β despite the CLI's own display implying verification occurred. Distinct from `discovery.ts:186`'s registry-JSON-level signature check, which is real and fail-closed. Testable at low cost with a stubbed-npm unit test (proves `--verify=false` vs. default produce identical `installFromNpm` behavior, and an `unverified`/`privileged` mock entry installs unprompted). Not implemented tonight β candidate for a future `security` DEEP night or an immediate small follow-up PR.++## Scan Findings: hive-mind++Raft leader-election safety gap in `v3/@claude-flow/swarm/src/consensus/raft.ts` (new, code-verified, distinct from the previously-fixed `weightedConsensus()` and `TopologyManager.rebalanceHybrid()` bugs). `startElection()` (lines 303-333) iterates peers, calling `requestVote()` (335-368) and counting `votesReceived`. If a peer's response reveals a higher term, the node correctly steps down to follower internally (347-352) β but the outer loop keeps counting votes from *earlier* peers who granted under the node's original (now-stale) term. If a later peer in the same loop grants a vote after the internal term-bump, `votesReceived` can cross `votesNeeded` and `becomeLeader()` fires (line 370) unconditionally β no guard that all counted votes share the current term, and no check that the node is still in `candidate` state. Net effect: a node can be declared leader for a term via a "majority" that mixes votes cast for a stale term with votes for the current one, violating Raft's core safety property and potentially producing two simultaneous leaders for the same term. Existing test coverage (`raft-transport.test.ts`) only exercises the receiver side (`handleInboundRaftMessage` per-message); nothing drives `startElection()`/`becomeLeader()` through a multi-peer loop with a mid-loop term bump β grep confirms `startElection`/`becomeLeader` are invoked only from within `raft.ts` itself. Testable cheaply: a mock `ConsensusTransport` returning different terms per peer, asserting `getState() !== 'leader'` after the loop. Not implemented tonight (surfaced by the SCAN role, not the DEEP surface; a genuine consensus-safety bug deserves its own focused night rather than a rushed same-night fix) β recommend prioritizing this for the next `swarm` or `hive-mind`-adjacent DEEP night, since it is a correctness bug, not a research question.++## SOTA Proof & Witness++| Field | Value |+|---|---|+| Session commit | `db4991967c45c6f72133dff0bb80b0a492960fc1` |+| Gist SHA-256 (pre-witness content) | `0aae2712a54567521f308721205cbcbded0dadada2ab052810476b8e94d60fce` |+| Witness stamp | `04f903bab9006e79cf201c498058d028d66a0de7d6ef17e97325638336d1e98c` |++Verifier procedure: fetch `docs/dream-cycle/dream-gist-2026-09-05.md` from this branch, strip the witness table's filled values back to `PENDING`, SHA-256 it, concatenate with the session commit above, SHA-256 again β result must equal the witness stamp.++## Recommended Next Steps++1. **Merge the linked draft PR** (human review required) β a small (~120 net lines across 3 files), fully reversible, additive fix with disclosed scope limitations and a discriminating regression test.+2. **Prioritize the hive-mind Raft election-safety finding** (see above) as a near-term `swarm`/`hive-mind` DEEP-night candidate β it is a correctness bug in a consensus-safety property, not a performance or research question, and deserves focused evaluation rather than being folded into tonight's performance patch.+3. **Fix the plugin supply-chain enforcement gap** (see security scan above) β either as a small standalone PR (wire the existing `PluginStoreConfig` fields into `commands/plugins.ts`/`manager.ts`) or as a future `security` DEEP night if it needs more design work than a wiring fix.+4. Apply the same "wire the real measurement, delete the fabricated one" fix to the three sibling files with the identical anti-pattern: `agent-spawn.bench.ts`, `mcp-server-init.bench.ts`, `cli-warm-start.bench.ts` β not done tonight to keep this patch to one conceptual change (repo convention, and STEP 6's <300-line/one-file-class guidance).+5. **Ledger-append reliability**: this is the 3rd occurrence of the dream-cycle's own ledger-append step silently failing (10 more nights backfilled tonight, 2026-08-24 through 09-03). This is no longer a background note β a future `automation`/`meta` DEEP night should treat "harden STEP 25 against silent failure" as a first-class candidate, not a footnote.diff --git a/v3/@claude-flow/performance/__tests__/cli-cold-start.test.ts b/v3/@claude-flow/performance/__tests__/cli-cold-start.test.tsnew file mode 100644index 0000000000..2de064386c--- /dev/null+++ b/v3/@claude-flow/performance/__tests__/cli-cold-start.test.ts@@ -0,0 +1,57 @@+/**+ * Regression guard for the 2026-09-05 dream-cycle finding: the CLI+ * cold-start "benchmark" suite never called its own real, spawn-based+ * measurement function β every reported number (including a hardcoded+ * "V2 vs V3 Speedup") came from setTimeout() delays with no real code+ * behind them.+ *+ * Before the fix, `measureColdStart`/`runRealColdStartMeasurement` were+ * not exported at all, so this file fails to type-check / import against+ * the pre-fix source β that is the discriminating "baseline fails"+ * evidence for tonight's evaluation, alongside the assertions below.+ */+import { describe, it, expect } from 'vitest';+import { existsSync, readFileSync } from 'fs';+import {+ measureColdStart,+ runRealColdStartMeasurement,+ CLI_BIN_PATH,+} from '../benchmarks/startup/cli-cold-start.bench.js';++describe('CLI cold start: real measurement (not synthetic)', () => {+ it('CLI_BIN_PATH resolves to a real file on disk', () => {+ expect(existsSync(CLI_BIN_PATH)).toBe(true);+ expect(CLI_BIN_PATH).toMatch(/cli[\\/]bin[\\/]cli\.js$/);+ });++ it('measureColdStart spawns a real child process and returns a plausible duration', async () => {+ const durationMs = await measureColdStart('node', ['-e', 'process.exit(0)']);+ expect(durationMs).toBeGreaterThan(0);+ expect(durationMs).toBeLessThan(10_000); // same ceiling as the function's own timeout+ }, 15_000);++ it('runRealColdStartMeasurement produces one real sample per iteration', async () => {+ const result = await runRealColdStartMeasurement(3);+ expect(result.samples).toHaveLength(3);+ for (const sample of result.samples) {+ expect(sample).toBeGreaterThan(0);+ }+ expect(result.mean).toBeGreaterThan(0);+ expect(result.min).toBeLessThanOrEqual(result.mean);+ expect(result.max).toBeGreaterThanOrEqual(result.mean);+ }, 30_000);++ it('does not reintroduce a hardcoded/deterministic-by-construction speedup benchmark', () => {+ const source = readFileSync(+ new URL('../benchmarks/startup/cli-cold-start.bench.ts', import.meta.url),+ 'utf-8'+ );+ // The removed benchmark paired these two exact delays with no real code+ // between them, guaranteeing ~5.00x on every run. Guard against silently+ // re-adding that specific fabricated-by-construction pattern (matched by+ // its `runner.run()` identifiers, not by prose that merely discusses it).+ expect(source).not.toMatch(/setTimeout\(resolve,\s*100\)/);+ expect(source).not.toContain("'v2-cold-start-simulation'");+ expect(source).not.toContain("'v3-cold-start-simulation'");+ });+});diff --git a/v3/@claude-flow/performance/benchmarks/startup/cli-cold-start.bench.ts b/v3/@claude-flow/performance/benchmarks/startup/cli-cold-start.bench.tsindex df0e67301f..5fe729f47c 100644--- a/v3/@claude-flow/performance/benchmarks/startup/cli-cold-start.bench.ts+++ b/v3/@claude-flow/performance/benchmarks/startup/cli-cold-start.bench.ts@@ -1,15 +1,34 @@/*** CLI Cold Start Benchmark*- * Target: <500ms (5x faster than current ~2.5s)+ * Target: <500ms (see V3_PERFORMANCE_TARGETS['cli-cold-start'])** Measures the time to start the CLI from a completely cold state,* including module loading, initialization, and ready state.+ *+ * 2026-09-05 dream-cycle finding: every benchmark below except+ * `runRealColdStartMeasurement()` is a synthetic `setTimeout()` delay chain+ * that never touches the real CLI β they are illustrative of *where* time+ * could go, not measurements of where it *does* go. The previously-present+ * "V2 vs V3 Speedup" benchmark computed a hardcoded ~5.00x on every run by+ * construction (`setTimeout(100)` vs `setTimeout(20)`, no code in between)+ * and has been removed rather than fixed β there is no "V2 binary" left to+ * compare against, so no synthetic replacement was substituted for it. The+ * real number now comes from `runRealColdStartMeasurement()`, which spawns+ * an actual `node bin/cli.js` child process via the `measureColdStart()`+ * helper that was already written but never called.*/import { benchmark, BenchmarkRunner, formatTime, meetsTarget } from '../../src/framework/benchmark.js';import { spawn, ChildProcess } from 'child_process';import * as path from 'path';+import { fileURLToPath } from 'url';++const __filename = fileURLToPath(import.meta.url);+const __dirname = path.dirname(__filename);++/** Path to the real CLI entry point this benchmark spawns for real measurements. */+export const CLI_BIN_PATH = path.resolve(__dirname, '../../../cli/bin/cli.js');// ============================================================================// Test Helpers@@ -18,7 +37,7 @@ import * as path from 'path';/*** Measure CLI cold start time by spawning a new process*/-async function measureColdStart(command: string, args: string[]): Promise<number> {+export async function measureColdStart(command: string, args: string[]): Promise<number> {return new Promise((resolve, reject) => {const startTime = performance.now();@@ -95,6 +114,27 @@ async function simulateCLIInit(): Promise<void> {await new Promise((resolve) => setTimeout(resolve, 3));}+/**+ * Real cold-start measurement: spawns the actual CLI binary N times and+ * reports genuine wall-clock timings. Uses `--version` because it is the+ * one subcommand that succeeds without a built `dist/` in this repo's+ * current worktree state (other subcommands import compiled output and+ * fail fast with ERR_MODULE_NOT_FOUND if `npm run build` hasn't run β+ * `measureColdStart()` still resolves on `child.on('close')` in that case,+ * so a failing invocation is honestly reported as a fast *failure*, not+ * silently treated as a successful start).+ */+export async function runRealColdStartMeasurement(+ iterations = 5+): Promise<{ mean: number; min: number; max: number; samples: number[] }> {+ const samples: number[] = [];+ for (let i = 0; i < iterations; i++) {+ samples.push(await measureColdStart('node', [CLI_BIN_PATH, '--version']));+ }+ const mean = samples.reduce((a, b) => a + b, 0) / samples.length;+ return { mean, min: Math.min(...samples), max: Math.max(...samples), samples };+}+// ============================================================================// Benchmark Suite// ============================================================================@@ -104,6 +144,16 @@ export async function runColdStartBenchmarks(): Promise<void> {console.log('\n--- CLI Cold Start Benchmarks ---\n');+ // Benchmark 0: REAL cold start (spawns the actual CLI binary β everything+ // else in this suite below is a synthetic setTimeout() illustration, not+ // a measurement of real code).+ const real = await runRealColdStartMeasurement(5);+ console.log(`[REAL] CLI Cold Start (node bin/cli.js --version): ${formatTime(real.mean)}`);+ console.log(` min=${formatTime(real.min)} max=${formatTime(real.max)} n=${real.samples.length}`);+ const realTarget = meetsTarget('cli-cold-start', real.mean);+ console.log(` Target (<500ms): ${realTarget.met ? 'PASS' : 'FAIL'}`);+ console.log('\n--- Synthetic illustrations below (not real measurements) ---\n');+// Benchmark 1: Module Loading Simulationconst moduleResult = await runner.run('module-loading',@@ -200,29 +250,12 @@ export async function runColdStartBenchmarks(): Promise<void> {const fullTarget = meetsTarget('cli-cold-start', fullColdStartResult.mean);console.log(` Target (<500ms): ${fullTarget.met ? 'PASS' : 'FAIL'}`);- // Benchmark 7: V2 vs V3 Comparison Simulation- const v2SimulationResult = await runner.run(- 'v2-cold-start-simulation',- async () => {- // Simulate V2's heavier startup- await new Promise((resolve) => setTimeout(resolve, 100));- },- { iterations: 20 }- );-- const v3SimulationResult = await runner.run(- 'v3-cold-start-simulation',- async () => {- // Simulate V3's optimized startup- await new Promise((resolve) => setTimeout(resolve, 20));- },- { iterations: 50 }- );-- const speedup = v2SimulationResult.mean / v3SimulationResult.mean;- console.log(`\nV2 vs V3 Speedup: ${speedup.toFixed(2)}x`);- console.log(` V2 Simulation: ${formatTime(v2SimulationResult.mean)}`);- console.log(` V3 Simulation: ${formatTime(v3SimulationResult.mean)}`);+ // NOTE: a "V2 vs V3 Comparison Simulation" benchmark previously lived here.+ // It computed setTimeout(100) vs setTimeout(20) with no code in between β+ // a "5.00x speedup" guaranteed by construction on every run, regardless of+ // any real V2 or V3 behavior. Removed 2026-09-05 rather than "fixed": there+ // is no V2 binary left in this repo to honestly compare against. The [REAL]+ // measurement above is this suite's only real speedup evidence now.// Print summaryrunner.printResults();diff --git a/v3/implementation/adrs/ADR-STATUS-SUMMARY.md b/v3/implementation/adrs/ADR-STATUS-SUMMARY.mdindex 6f428bc66c..d1e77e0b96 100644--- a/v3/implementation/adrs/ADR-STATUS-SUMMARY.md+++ b/v3/implementation/adrs/ADR-STATUS-SUMMARY.md@@ -163,8 +163,8 @@| Target | Specification | Status | Evidence ||--------|---------------|--------|----------|-| HNSW Search | 150x-12,500x faster | β Achieved | HNSW index in memory module |-| CLI Startup | <500ms | β Achieved | Lazy loading, -200ms improvement |+| HNSW Search | 150x-12,500x faster | β οΈ Not reproduced | Measured instead: ~1.9x @ N=20k, ~3.2x-4.7x @ N=5k vs brute force (see `v3/CLAUDE.md`, `scripts/benchmark-intelligence.mjs`) |+| CLI Startup | <500ms | β οΈ Partially verified | 2026-09-05: the prior "Achieved"/"5x faster" claim traced to a benchmark suite (`v3/@claude-flow/performance/benchmarks/startup/*.bench.ts`) that measured `setTimeout()` delays, not the real CLI. `cli-cold-start.bench.ts` now spawns the real binary (`--version`, the one subcommand that runs without a build in this worktree): measured ~54.7ms mean over 5 runs, under target β but this covers only that subcommand, not full command initialization, so "Achieved" for the whole surface remains unverified || MCP Response | <100ms | β Achieved | Connection pooling, 3-5x throughput || Memory Reduction | 50-75% | β Achieved | Quantization, tree-shaking || Pattern Search | Real vector search | β Achieved | alpha.100: 0.87 similarity, 318ms |