Commit Graph
7782 Commits
Author SHA1 Message Date
ruv 126c23a0fc feat(graph-intelligence): #2044 ADR-123 Phase 1 — ruflo-graph-intelligence plugin foundation
Scaffolds plugins/ruflo-graph-intelligence/ — the RuFlo Graph Intelligence
Engine. Built on sublinear-time-solver@^1.7.0. Three-layer architecture:
Neural / Graph Intelligence / Complexity.

Phase 1 deliverables:
- package.json @ 0.1.0-alpha.1
- domain/types.ts — SparseMatrix, ComplexityClass (12 tiers + fitsBudget +
  isEdgeSafe), CoherenceReport, PageRankQuery/Result, SolveQuery/Result,
  SolveOnChangeQuery, structured GraphIntelError taxonomy
- domain/adapter.ts — SublinearAdapter interface, AdapterRegistry (singleton)
- infrastructure/solver-bridge.ts — coherenceScore, singleEntryPageRank
  (forward-push), conjugateGradient, neumann, solveOnChange, hashResult,
  observedComplexity, runPageRank/runSolve/runSolveOnChange entry points
- mcp-tools/index.ts — 6 MCP tools under sublinear/*:
  page-rank-entry / solve / solve-on-change / analyze / feasibility / jl-embed
  All threaded with maxComplexityClass + coherenceThreshold budget gates.
- tests: 37/37 passing — solver-bridge (coherence, PR, CG, Neumann,
  solve-on-change, hash determinism), adapter-registry (CRUD + singleton),
  mcp-tools (happy path, graph-not-found, coherence-rejected,
  complexity-budget-exceeded)

CI guard (#2044 follow-up):
- .github/workflows/v3-ci.yml — adds plugins/ruflo-graph-intelligence/**
  to both push and pull_request path filters
- New job: ruflo-graph-intelligence build + test smoke. Installs (npm ci
  with --legacy-peer-deps because the plugin is outside the v3 pnpm
  workspace), typechecks, builds, runs vitest. Cross-platform via Node 22.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 21:44:51 -04:00
ruv 05010fce33 adr: ADR-123 — reframe as Graph Intelligence Engine with complexity-aware execution
Strategic positioning sharpened per stakeholder feedback. The technical
content stays; the headline shifts from "sublinear PR integration" to
"intelligence that understands its own computational cost".

Title now: "RuFlo Graph Intelligence Engine: real-time relationship
intelligence with complexity-aware execution".

New top-of-doc "Strategic positioning" section commits to the
three-layer architecture:
  - Neural Layer        (adaptive learning — existing)
  - Graph Intelligence  (relationship reasoning — this ADR)
  - Complexity Layer    (runtime governance   — this ADR)
The three layers compose. No competing system has all three.

Plain-language framing for the README is included so the product story
is "RuFlo continuously reasons across agents / memory / infrastructure /
workflows while automatically adapting computation to available runtime
budgets" — rather than "asymmetric DD sublinear single-entry PR".

`maxComplexityClass` is repositioned as **computational QoS for
intelligence systems** — agents request bounded compute, edge devices
reject unsafe workloads, browsers stay responsive, federation peers
negotiate budgets.

Signed PR artifact now explicitly carries `complexity_class` +
`coherence_score` so federation verification means: provenance + budget
compliance + input stability. That is the operative meaning of
"verifiable reasoning" in this ADR.

Added a "Core capabilities" mapping that translates each wedge into
the product vocabulary (PR → relationship intelligence, sparse
propagation → continuous awareness, etc.). Also added the "Built for"
list (autonomous agents, browser automation, AIoT, edge AI, etc.).

Category move recorded: from "graph-accelerated agent" to
"self-regulating cognition infrastructure".

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 21:36:23 -04:00
ruv c3cab70e2f adr: ADR-123 — track upstream sublinear-time-solver@1.7.0
Three upstream additions in v1.7.0 (released 2026-05-19) materially
shape ADR-123:

1. **ComplexityClass enum + Complexity trait** — 12-tier compile-time
   complexity taxonomy with is_edge_safe(). Wires into ADR-026's 3-tier
   model router as a per-MCP-call `maxComplexityClass` budget arg.
   Phase 1 surface now ships six tools instead of five (all six accept
   the budget) and edge-runtime detection uses upstream is_edge_safe()
   rather than a hand-rolled check.

2. **Coherence gate** — coherence_score(matrix) + SolverError::Incoherent.
   Closes original Open Question #5 (failure modes when source matrix
   is not DD). MCP calls take an optional `coherenceThreshold`; the
   structured error has is_recoverable() = true so adapters fall back
   gracefully. RuFlo no longer hand-rolls a DD check.

3. **solve_on_change(matrix, prev, delta)** — new IncrementalSolver
   trait blanket-impl'd on every SolverAlgorithm. Adds Wedge 12
   (streaming subset of W1/3/6/7/10) covering federation trust deltas,
   MCTS branch additions, append-only causal breaks, cost-spend events,
   span streams, AIDefence flag updates. New MCP tool
   sublinear/solve-on-change. New Phase 6.5 in the rollout.

Witness-signed PR artifact (Phase 7) now also embeds complexity_class +
coherence_score so federation peers can verify budget compliance + DD
margin at signing time. solver_version pinned to 1.7.0.

Open Question 8 added for the new "when does solve-on-change win over
full re-solve" tuning. Open Question 5 marked closed-by-upstream.

References updated for 1.7.0 + upstream `sublinear` ADR-001 "Complexity
as Architecture" + upstream CHANGELOG.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 21:33:04 -04:00
ruv 06cbb77dcf adr: ADR-123 — sublinear-time-solver integration into RuFlo
8-phase rollout integrating `sublinear-time-solver@1.6.0` into the RuFlo
substrate. Eleven plugin graphs map to diagonally-dominant linear systems
where single-entry PageRank reduces per-query cost from O(n) to O(log n).

Beyond-SOTA wedge (Phase 7 + 8): signed, replayable, federation-distributable
PageRank artifacts. RuFlo's Ed25519 witness chain (ADR-103) + RVF cognitive
container + ADR-104 federation transport + sublinear's deterministic
single-entry forward-push compose into a primitive no competing memory
framework (LangGraph, AutoGen, Letta, MemGPT, Mem0, HippoRAG) can ship
without rebuilding their core.

SOTA exploration covers 5 axes with citations: sublinear-DD foundations
(AKP19) + 2025 asymmetric-DD extension (arXiv 2509.13891), GOAP/LaMMA-P/
GoalAct hierarchical planning, PageRank substrate primitive uses
(HippoRAG, Pinterest), cryptographic provenance for AI (zk-SNARK threat
model contrast), and competitive AI-agent memory landscape comparison.

GOAP critical path (3.75 engineer-days to ADR-122 MCTS PR-aware selection):
A1 add-dep → A2 scaffold-plugin → A3 adapter-contract → A4 solver-bridge →
A5a wedge1-causal-browser → A6 wedge2-mcts-browser.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 21:23:17 -04:00
rUv 0ddf1dfa46 Merge pull request #2043 from ruvnet/feat/adr-122-browser-beyond-sota
feat(browser): ADR-122 — RuFlo Browser Substrate (Phases 0-7, published alpha.4)
2026-05-18 21:05:18 -04:00
ruv cc007d952f ci: #2041 ADR-122 — make browser rvf smoke tolerant of missing dist
Two coupled fixes for the `browser rvf create flag smoke (#2015)` job:

1. Workflow (.github/workflows/v3-ci.yml):
   - Use pnpm + `pnpm install --frozen-lockfile` + `pnpm -r build` at the
     v3 workspace root (mirrors the Build V3 job) so workspace:* deps
     resolve in topological order.
   - `continue-on-error: true` on the build step — pre-existing TS errors
     in unrelated v3 packages should not block this static scan.

2. Smoke script (scripts/smoke-browser-rvf-create-flags.mjs):
   - When a `/dist/` path is absent at scan time, log it as a skipped
     entry rather than a hard failure. Dist is derivable from source;
     the matching `src/` form is still scanned and is what the contract
     actually polices.
   - Source files (TS, shell, markdown) remain hard requirements.

Same #2015 contract holds: every `rvf create` callsite must carry
`--dimension` and must not carry `--kind`. The dist scan is now a
defense-in-depth check that only runs when the build actually succeeded.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 20:55:31 -04:00
ruv 62aa08f499 ci: #2041 ADR-122 — browser rvf smoke uses pnpm (workspace:* protocol)
The "Build CLI" step in the `browser rvf create flag smoke` job runs
`npm install` in `v3/@claude-flow/cli`, but the CLI's package.json
declares `workspace:*` deps that npm doesn't understand
(EUNSUPPORTEDPROTOCOL). Same root cause as PR #2013's matching failure
which merged with it red. Switch to pnpm + setup-pnpm action.

Pre-existing infra issue surfaced by the ADR-122 PR; fix is workflow-only.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 20:49:29 -04:00
ruv 87f2a26cd6 chore(deps): #2041 ADR-122 — refresh v3/pnpm-lock.yaml for agent-browser 0.27
Companion to the root npm lockfile refresh (489ff2fe6). The v3 workspace uses
pnpm with --frozen-lockfile in CI, so Test V3 Packages + Type Check V3 jobs
failed with ERR_PNPM_OUTDATED_LOCKFILE on the agent-browser ^0.6.0 → ^0.27.0
spec mismatch. `pnpm install --lockfile-only --filter @claude-flow/browser`
brings it back in sync.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 20:46:39 -04:00
ruv 338f7320a3 chore(deps): #2041 ADR-122 — refresh root package-lock for agent-browser 0.27 bump
Phase 0 bumped v3/@claude-flow/browser to agent-browser@^0.27.0 but the root
lockfile wasn't regenerated. CI's `npm ci` then failed with EUSAGE on missing
@opentelemetry/* transitives. This commit runs `npm install --legacy-peer-deps`
at the root to bring the lockfile back in sync.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv 116613e935 docs(ruflo-browser): #2041 link plugin to ADR-122 substrate
Adds a substrate-alignment banner pointing at the published
@claude-flow/browser@3.0.0-alpha.4 npm package + the announcement gist.
The plugin is the user-facing skill layer; npm package is the substrate.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv 72d31a00a8 docs(browser): #2041 ADR-122 security audit + substrate benchmarks + announcement draft
- scripts/benchmark-substrate.mjs — measures Phase 1/2/3/5/7 throughput;
  results: Ed25519 sign 37µs, verify 88µs, annotate 2µs, vault verify 83µs,
  classify 0.16µs, production UCT 0.32µs, compile 23µs. All under 100µs.
- docs/SECURITY_AUDIT.md — full audit: 0 new vulnerabilities, all transitive
  findings (Xenova, OTel, sqlite3) tracked under ADR-118/121. Code-level
  review per phase: timing-safe verify, no shell injection, anchored regexes,
  fail-safe JSON parsing, defense-in-depth on attestations. Approves
  3.0.0-alpha.4 for npm publish.
- docs/ANNOUNCEMENT.md — substrate framing + 8-phase table + benchmarks
  + quick-start. To be uploaded as a public gist at publish time.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv 350bcf0606 feat(browser): #2041 ADR-122 Phase 7 — Workflow Compiler + production-aware UCT
Phase 7 (substrate-layer compiler):
- domain/workflow.ts — CompiledWorkflow schema with WorkflowStep (primary
  SelectorSpec + ordered fallback chain), WorkflowRequirements (sessionCapsule,
  origins[], taskClass), WorkflowGuards (irreversibleAction,
  requiresUserConfirmation), WorkflowReplay (maxRetries, timeoutMs).
  ProductionUctSignals/Weights for the production-aware UCT formula.
- application/workflow-compiler.ts — WorkflowCompiler.compile() walks a signed
  trajectory envelope's steps, extracts the primary locator from each step
  input, derives an ordered selector fallback chain from observed snapshot
  metadata (role+name → text → ref), classifies highest-risk action via
  Phase 6 RiskClassifier, gates requirements + guards. toYaml() emits
  deterministic, parseable YAML for VCS check-in.
- application/production-uct.ts — productionUct(input, weights) implements
  the full substrate scoring formula:
    score = Q + C·√(ln(N)/n) + λ_R·replayability
            − λ_risk·risk − μ_cost·cost − α_auth·auth_fragility
  Unvisited branches still return +Infinity for parity with Phase 4 UCB1.
  blendQ() linearly mixes scorer value + replay-success-rate.
- 12 new tests: compile login flow + fallback chain, financial-action
  guard escalation, origin extraction, deterministic YAML output, UCT
  invariants (infinity for unvisited, prefers safe over risky, penalises
  cost, rewards replayability, custom weights honoured), blendQ linearity.

Renames in src/index.ts re-export: WorkflowStep → CompiledWorkflowStep
(avoids collision with workflow-templates.ts's pre-existing WorkflowStep).

230/230 tests passing (+12 for Phase 7). Build + typecheck clean.

Beyond SOTA: no other web agent compiles MCTS traces into signed, replayable
YAML workflows with selector fallback graphs. The compiler is the "output of
the substrate" — what makes browser experience truly reusable.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv 45f951143e feat(browser): #2041 ADR-122 Phase 6 + substrate reframing — Session Capsule + adapters + risk classes
ADR-122 reframed as **RuFlo Browser Substrate**: ruflo becomes the memory,
policy, replay, distributed-planning layer underneath browser agents. Stagehand,
Browser Use, Playwright, Browserbase, Surfer-H become execution targets — not
competitors. Added Architecture section: layered system, 6 runtime services,
risk-class taxonomy, Session Capsule schema, production-aware UCT, SOTA rubric.

Phase 6 implementation (substrate primitives):
- domain/session-capsule.ts — full SessionCapsulePayload with origins[],
  reusePolicy (allowedOrigins, allowedTaskClasses, maxReplays, requireFreshMfa,
  allowCrossDevice/Installation), consentProof (signed statement),
  browserProfile, witnessChainHead, expiry, replays counter. RiskClass enum
  (read-only / authenticated-read / draft-write / external-submission /
  financial / account-mutation / destructive) + AUTONOMOUS_CLASSES set.
- application/session-capsule-service.ts — create() with PII-scan gate,
  verify() with schema+signature+trust-list+expiry+maxReplays checks, mount()
  that increments replays + rolls witness chain head, revoke(), per-class
  RiskClassifier with verb+target regex taxonomy.
- domain/browser-adapter.ts — BrowserExecutionAdapter interface (single
  surface above the tool wars: open/snapshot/click/fill/type/screenshot/wait/
  getUrl/getTitle/getText/close/observe).
- infrastructure/agent-browser-execution-adapter.ts — first concrete adapter
  wraps existing AgentBrowserAdapter; future Phase 6.5+ adds Stagehand,
  Browserbase, local Chrome.
- 20 new tests: clean+PII create, tamper rejection, expired capsule, trust
  list, mount replays + chain head, maxReplays cap, origin/taskClass policy
  enforcement, revoke, RiskClassifier for all 7 classes (Class 1-3 autonomous,
  Class 4-7 human approval), inline-state PII detection regression fix
  (string-spread bug that prevented SSN regex matching).

218/218 tests passing (+20 for Phase 6). Build + typecheck clean.

Beyond SOTA: no public browser-agent system ships a signed-state capsule with
origin scope, consent proof, replay counter, witness chain, AND risk-class
gating. Stagehand v3 portability + Browserbase persistence + Surfer-H vision
are all *execution-layer* — ruflo is the substrate that sits above them.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv a0d3d01c33 feat(browser): #2041 ADR-122 Phase 5 — cost-aware routing + GOAP preflight
- domain/action-routing.ts — ActionTier, RoutingDecision, TrajectoryCostReport
- application/action-router.ts — verb-based 3-tier classifier (Tier 1 booster
  $0, Tier 2 haiku $0.0002, Tier 3 sonnet/opus $0.005+); causal-risk-aware
  escalation; per-trajectory cost rollup with tier-1 share
- application/goap-preflight.ts — pre-session dry-run: missing-cookie /
  high-causal-risk / unsafe-URL findings + estimated total cost
- 11 new tests: classification (DOM verbs Tier 1, find Tier 2, eval Tier 3),
  risk escalation, cost rollup with tier-1 share ≥30% on representative
  workload, GOAP preconditions (cookie present/missing), high-causal-risk
  warning, URL safety, routing-plan + total-cost emission

198/198 tests passing (+11). Build + typecheck clean. All 6 phases done.

Beyond SOTA: combines existing ruflo primitives (Agent Booster, hooks_route,
ruflo-goals GOAP, AIDefence) into a per-action cost optimizer that no
single-process LLM browser agent ships.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv dfb7747b32 feat(browser): #2041 ADR-122 Phase 3 + Phase 4 — attested cookie vault + federated MCTS
Phase 3 — AIDefence-attested cookie vault:
- domain/cookie-vault.ts — CookieValue, ScanAttestation, VaultEntryEnvelope
- application/cookie-vault-service.ts — store() with AIDefence-gate, sealed
  envelope sign, verifyAttestation(), refusal audit log, optional persistence
- 14 new tests: clean store + verify, PII refusal (cookie + audit + no persist),
  tamper detection (value swap, hash+value swap, schema-invalid), clean=false
  attestation refusal (defense in depth), trust-list filter, audit record

Phase 4 — Federated MCTS branch exploration:
- domain/mcts-branch.ts — McTsBranch, MctsRunResult, PeerAdapter, ValueScorer
- application/mcts-explorer.ts — UCB1 selection, backprop, expansion via policy,
  least-spend peer load balance, per-peer budget caps, signature blacklist,
  pending-branch finalization (rejected-budget vs terminated)
- 8 new tests: UCB1 invariants, basic exploration, tree expansion, signature
  rejection + peer blacklist, budget enforcement, multi-peer distribution,
  winner-by-average-score

Beyond SOTA — both phases:
- No web agent ships per-cookie attestation; cross-installation cookie sharing
  is a known open problem. The witness signature is the trust boundary.
- No web agent distributes MCTS exploration across multiple installations.
  PeerAdapter abstracts local vs federation execution; the explorer itself
  is the wedge (signature verification + cost gating + winner selection).

187/187 tests passing (+22). Build + typecheck clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv 8d10e1aa8c feat(browser): #2041 ADR-122 Phase 1 MCP + Phase 2 causal recovery
Phase 1 MCP tool surface (5 new tools):
- browser/sign-trajectory — seal a BrowserTrajectory into Ed25519 envelope
- browser/verify-trajectory — verify with optional trust-list filtering
- browser/plan-replay — dry-run replay with mutations (no browser exec)
- browser/build-replay-delta — detect action/outcome drift between runs
- browser/generate-witness-key — bootstrap a fresh Ed25519 keypair

Phase 2 (beyond-SOTA wedge: causal-graph self-healing selectors):
- domain/causal-recovery.ts — SelectorBreakEvent + CausalRiskAnnotation types
- infrastructure/causal-recovery-store.ts — in-memory + JSON-on-disk store
  + classifyBreak() taxonomy: not-found/not-visible/not-enabled/detached/
    ref-stale/timeout/navigation-during-action/unknown
  + parseUrl() for origin/path isolation in the graph
- application/causal-recovery-service.ts — reportBreak / annotateSnapshot
  / decorateTree / explain (prior breaks + alternative locator suggestions)
- 18 new tests: classification, URL parsing, risk scoring (0→N breaks),
  snapshot annotation, cross-origin isolation, explain with role+name
  fuzzy-match, listBreaks

165/165 tests passing (was 147; +18 for Phase 2). Build + typecheck clean.

Beyond SOTA: no other web agent (Surfer-H, Browser Use, Stagehand, Operator,
Skyvern) surfaces WHY a selector broke — they retry silently. AgentDB-backed
swap is a single-file change (IBreakStore interface).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv 5fedd1d022 feat(browser): #2041 ADR-122 Phase 0 + Phase 1 — agent-browser 0.27 + signed trajectories
Phase 0 (convergence):
- Bump agent-browser dep ^0.6.0 → ^0.27.0 (21-minor drift closed)
- Package version → 3.0.0-alpha.4
- Adapter already had full 0.27 surface (find/mouse/set/network/tabs/etc.)

Phase 1 (beyond-SOTA wedge: signed trajectory containers):
- domain/signed-trajectory.ts — envelope schema + replay types
- infrastructure/witness-signer.ts — Ed25519 sign/verify via node:crypto
- application/signed-trajectory-service.ts — seal/verify/replay-plan/replay-delta
- BrowserService.endTrajectory now optionally seals via signTrajectories:true
- 19 new tests: round-trip, tamper detection, trust list, replay planning,
  delta detection, determinism. 147/147 tests passing.

Acceptance (Phase 1):
- record → sign → distribute → verify round-trips
- forging a step/goal/screenshot-hash breaks verify (signature invalid)
- trust-list filtering accepts/rejects by signer public key
- replay planning applies replaceStepInput + skipSteps mutations
- buildReplayDelta detects action drift + outcome drift

Beyond SOTA: no other web agent (Surfer-H, Browser Use, Stagehand, Operator,
Skyvern) ships cryptographic provenance for AI browsing sessions.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00
ruv f8ab5a3255 fix(witness): #2021 — refresh stale markers, regen signed manifest, add fast drift CI guard
#2021 (HIGH) fired after the alpha.43 release chain: bumping
`@claude-flow/cli`'s `@claude-flow/memory` pin from alpha.14 → 16
removed the literal string `"@claude-flow/memory": "^3.0.0-alpha.14"`
from `v3/@claude-flow/cli/package.json`, which was the marker for
fix `#1825`. The scheduled cron started reporting `regressed=1` on
all 3 OS manifests.

Three additional ADR markers were ALSO regressed (pre-existing,
not part of #2021's scope) — `ADR-104-transport`, `ADR-107-tls-pinning`,
`ADR-104-stream-mux` — all pointing at
`v3/@claude-flow/plugin-agent-federation/dist/plugin.js`. Those
symbols (`loadQuicTransport`, `agentic-flow/transport/loader`)
moved to `dist/transport/midstream-aware-loader.js` in an earlier
refactor; the markers never followed. Cleaning them up while in here
since they're the same drift class and the new CI guard would block
publish on them anyway.

## Marker fixes (verification/{macos,linux,windows}/manifest.md.json)

  #1825              v3/@claude-flow/cli/package.json
                       marker: "@claude-flow/memory": "^3.0.0-alpha.14"
                            →  "@claude-flow/memory": "^3.0.0-alpha.
                       (version-agnostic prefix — survives future bumps)

  ADR-104-transport  was: dist/plugin.js  marker: agentic-flow/transport/loader
                     now: dist/transport/midstream-aware-loader.js  marker: loadQuicTransport

  ADR-107-tls-pinning  was: dist/plugin.js  marker: loadQuicTransport
                       now: dist/transport/midstream-aware-loader.js  marker: loadQuicTransport

  ADR-104-stream-mux  was: dist/plugin.js  marker: loadQuicTransport
                      now: dist/transport/midstream-aware-loader.js  marker: loadQuicTransport

Re-signed all 3 OS manifests via plugins/ruflo-core/scripts/witness/regen.mjs.
History.jsonl appended for each OS.

## Final manifest state (local verify, built tree)

  macos:   pass=113 drift=0 regressed=0 missing=0  exit=0
  linux:   pass=113 drift=0 regressed=0 missing=0  exit=0
  windows: pass=113 drift=0 regressed=0 missing=0  exit=0

## New CI guard: witness-marker-drift-smoke (#2021)

The slow `witness-verify` job catches drift but runs cross-platform
matrix + dist builds — direct pushes to main (e.g. release chains)
can land before it surfaces a regression. The scheduled 12h cron
then files HIGH-severity issues post-merge.

scripts/smoke-witness-marker-drift.mjs is a fast static-only smoke:
  - No build step
  - No cryptographic signature check (drift is a markers-vs-source
    gap, not an integrity gap — separate concern)
  - No native deps
  - For every fix in verification/<os>/manifest.md.json:
      - If cited file exists AND marker string is missing → exit 1
      - If cited file doesn't exist → skip (that's #1880's territory,
        handled by witness-verify-precondition-smoke)

Wired into witness-verify's `needs:` so drift blocks publish.
Validated with negative test: broke #1825 marker locally, smoke
exited 1 and named the regressed id correctly; restored, smoke
returned to exit 0.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-16 19:20:26 -04:00
ruv 5b71c7ac13 release(alpha.43+44): pin neural→sona@0.1.5, republish modules w/ standalone READMEs, add npm download badges everywhere (#2022)
This commit closes the chain started in ca0a6fa5c (standalone use recipes
landed in repo but never reached npm because no version bumps shipped).

## Changes

### Module version bumps (alpha.43)
- @claude-flow/memory     → 3.0.0-alpha.17  (republish standalone use README)
- @claude-flow/embeddings → 3.0.0-alpha.18  (republish standalone use README)
- @claude-flow/security   → 3.0.0-alpha.8   (republish standalone use README)
- @claude-flow/neural     → 3.0.0-alpha.9   (pin @ruvector/sona to 0.1.5,
                                             republish standalone use README)
- @claude-flow/cli        → 3.7.0-alpha.43  (repin to new modules above)
- claude-flow             → 3.7.0-alpha.43  (umbrella)
- ruflo                   → 3.7.0-alpha.43  (umbrella)

### Umbrella bump (alpha.44) — npm download badges
- @claude-flow/cli        → 3.7.0-alpha.44
- claude-flow             → 3.7.0-alpha.44
- ruflo                   → 3.7.0-alpha.44

### Neural sona pin (root fix for #2022)
@claude-flow/neural alpha.8 had `"@ruvector/sona": "latest"`, and
@ruvector/sona@0.1.6 (current latest on npm) shipped as an empty publish
— README + package.json only, no index.js or native bins. So every
fresh `npm install @claude-flow/neural@alpha.8` broke at import time
with `Cannot find package '.../node_modules/@ruvector/sona/index.js'`.

Alpha.9 pins to the exact known-good 0.1.5 (which has index.js + 7
platform-specific .node bins). Will revert to a range once
@ruvector/sona@0.1.7+ ships with content (tracked in #2022).

### npm download badges across every published package README
Added `shields.io/npm/dm/<pkg>` (monthly downloads) badges to:
  - claims, cli-core, plugins (had no npm badges at all)
  - plugin-agent-federation, plugin-iot-cognitum (no npm badges)
  - browser, codex, mcp (had version badge, missing downloads)
  - umbrella root README (now badges both `ruflo` + `claude-flow`)
The ruflo/README.md and v3/@claude-flow/cli/README.md auto-copy from
root via prepublishOnly, so they inherit the new badges on publish.

Packages that already carried downloads badges (aidefence, deployment,
embeddings, guidance, hooks, integration, memory, neural, performance,
providers, security, shared, swarm, testing) are unchanged.

## Live functional check on the published artifacts

  - Fresh `npm install @claude-flow/neural@3.0.0-alpha.9`:
    sona resolves to 0.1.5; `import('@claude-flow/neural')` returns
    A2CAlgorithm, BalancedMode, BaseModeImplementation, BatchMode,
    CuriosityModule, ... (was broken before alpha.9).
  - Standalone use sections from ca0a6fa5c now visible on npmjs.com for
    memory@alpha.17, embeddings@alpha.18, security@alpha.8, neural@alpha.9.
  - npm dm/ badges resolve and render the current weekly download count.

Co-Authored-By: RuFlo <ruv@ruv.net>
v3.7.0-alpha.44
2026-05-16 16:46:34 -04:00
ruv ca0a6fa5cb docs(modules): publish standalone-use recipes for memory, embeddings, security + flag @ruvector/sona empty-publish blocking neural
Adds a 'Standalone use (without the Ruflo CLI)' section to each
module's README right after Installation, with copy-pasteable
recipes verified against the published artifacts (fresh `npm install`
clean room, no patched dist, exit 0 for every example).

Recipes:

@claude-flow/memory (@3.0.0-alpha.16)
  1. HNSWIndex — add 3 vectors, search top-2, no other deps
  2. ControllerRegistry + injected AgentDB — proves the v3
     governance layer works on a caller-owned AgentDB instance
     (the agentdb injection field added in #2019)

@claude-flow/embeddings
  1. MockEmbeddingService + cosineSimilarity — embed + compare
     without network calls
  2. Provider swap snippet showing OpenAI / Transformers / etc.
     keep the same API surface

@claude-flow/security (@3.0.0-alpha.7)
  1. InputValidator.validate(EmailSchema) +
     new PasswordHasher({ rounds: 12 }) +
     createCredentialGenerator().generateApiKey() — three of the
     OWASP top 10 in ~15 lines
  2. createDevelopmentExecutor — git through the allowlist gate;
     createProjectPathValidator — refuses `../` traversal with
     errors[] surfaced

Bugs uncovered by running the recipes against live npm:

  - `embed()` returns { embedding, tokens, ... }, not a raw Float32Array
    (recipe destructures `.embedding`).
  - createPasswordHasher(rounds: number) accepts a NUMBER, not a
    config object (passing `{ rounds: 12 }` made config.rounds nest
    into `{ rounds: 12 }` and bcryptjs threw 'Illegal arguments:
    string, object'). Switched recipe to `new PasswordHasher(...)`.
  - generateCredentials() does NOT generate API keys — that lives
    on `CredentialGenerator.generateApiKey(prefix)`. Recipe now
    uses createCredentialGenerator().generateApiKey().
  - PathValidator result is { isValid, errors[], ... }, not
    { valid, error }. Recipe matches the real shape.

Not included — @claude-flow/neural standalone recipe:

  @claude-flow/neural@3.0.0-alpha.8 currently fails on fresh
  install because @ruvector/sona@0.1.6 is an empty publish (only
  README + package.json — no index.js, no native bins).
  @ruvector/sona@0.1.5 had full content (index.js + 7 platform
  bins), so this is a regression in the latest sona release that
  blocks the entire neural package from loading.

  Rather than ship a broken recipe, the neural README gains a
  'Known issue' callout pointing at @ruvector/sona@0.1.6. Fix
  path: republish @ruvector/sona with content or pin
  @claude-flow/neural to @ruvector/sona@^0.1.5 in its next bump.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-16 10:00:27 -04:00
ruv 9056720219 fix(browser): #2015 round 2 — strip bogus --kind flag, ship alpha.42
Round 1 (alpha.41) added the required --dimension flag to
`ruvector rvf create` but left the equally bogus `--kind browser-session`
in place. ruvector@0.2.25's `rvf create` accepts only:

  -d, --dimension <n>    (required)
  -m, --metric <metric>  (optional, default cosine)

Commander's required-option check fires before its unknown-option
check, so the original bug report (#2015) only surfaced the dimension
error. The fresh live regression check after publishing alpha.41
exposed the second-layer bug: `error: unknown option '--kind'`.

This round:
- Strip `--kind browser-session` from all 5 call sites (TS source,
  compiled dist via rebuild, replay-spike.sh, browser-agent.md,
  browser-record/SKILL.md). Also fixed the ADR prose example.
- Tighten the smoke (scripts/smoke-browser-rvf-create-flags.mjs):
  - Switch from rg-based content scan to an explicit PATHS_IN_SCOPE
    list (the original `--kind browser-session` anchor is gone, so
    we can no longer identify call sites by content).
  - Police BOTH invariants per line:
      * --dimension / -d is present
      * --kind is ABSENT (since ruvector@0.2.25 rejects it)
  - Skip quoted-string false positives ('rvf create failed' log lines).

Versions:
  @claude-flow/cli    3.7.0-alpha.42
  claude-flow         3.7.0-alpha.42
  ruflo               3.7.0-alpha.42
  @claude-flow/memory 3.0.0-alpha.16  (unchanged, #2019 fix already live)

Post-publish live functional check (everything green):
- ruvector rvf create --dimension 384 (no --kind): exit 0, .rvf file
  written. Reproduces what the MCP tool now invokes.
- Published CLI dist:113 carries '--dimension','384', no --kind.
- #2019 vectorBackend / graphAdapter functional test from
  alpha.41 still passes against published memory@3.0.0-alpha.16.
- verify.mjs precondition contract still holds.

Co-Authored-By: RuFlo <ruv@ruv.net>
v3.7.0-alpha.42
2026-05-16 09:02:08 -04:00
ruv e4bd9bbcbe fix(verify+memory+browser): #1880, #2019, #2015 — three precondition/contract fixes + CI guards
Three small but recurring bugs ship together because they share the
same anti-pattern: a try/catch (or a missing flag) silently turned a
clear precondition failure into a vague "verification failed" /
"controller disabled" / "rvf create failed" outcome that downstream
consumers couldn't act on.

#1880 — witness verify exits 1 on source-only checkouts
  - The 12h scheduled verification has been filing a duplicate
    "HIGH — verification broken" issue every cron run since 2026-05-10
    because the runner does a source-only checkout (no @noble/ed25519
    install, no `npm run build`) and verify.mjs lumped that into the
    same exit-1 bucket as a real signature regression.
  - verify.mjs now reserves exit 2 strictly for precondition misses:
      * @noble/ed25519 not installed                → exit 2
      * every manifest entry missing AND manifest   → exit 2
        references /dist/ paths (= "dist not built")
    Real failures (signature invalid, specific marker regressed)
    keep exit 1. The scheduled runner can now distinguish
    "needs install/build" from "we broke something".
  - New CI guard: scripts/smoke-witness-verify-precondition.mjs
    drives all three shapes (missing dep, all-files-missing,
    built tree) and asserts the exit code contract.
  - Wired into v3-ci.yml as witness-verify-precondition-smoke and
    into witness-verify's `needs:` so a contract break blocks publish.

#2019 — vectorBackend controller permanently disabled
  - @claude-flow/memory's controller-registry.ts calls
    agentdb.getController('vectorBackend'). agentdb@3.0.0-alpha.14's
    getController switch only handles memory/reflexion/skills/causal
    and throws `Unknown controller: vectorBackend` for everything else
    — silently swallowed, leaving the controller `enabled: false`
    even though `agentdb.vectorBackend` is a real field on the
    instance (assigned in AgentDB.initialize()).
  - Registry now probes `agentdb[name]` directly first, falls back to
    getController only when the field is absent. Applied to all three
    accessor paths (initializeController, get, isEnabled).
  - RuntimeConfig gains an optional `agentdb` injection field so
    tests and consumers with a pre-built AgentDB can govern it via
    the registry.
  - Two new tests in controller-registry.test.ts cover both branches
    (direct property wins; falls back to getController when absent).
  - Full controller-registry suite stays green (67 tests).

#2015 — ruflo-browser session_record fails every call
  - ruvector@0.2.25 makes `-d, --dimension <n>` required on
    `rvf create`. The browser_session_record MCP tool wrapper invoked
    `rvf create … --kind browser-session` WITHOUT the flag, so every
    call returned `{ success: false, error: "rvf create failed" }`.
  - All five call sites updated to pass `--dimension 384` (matches
    MiniLM-L6 / AgentDB index default):
      v3/@claude-flow/cli/src/mcp-tools/browser-session-tools.ts
      plugins/ruflo-browser/scripts/replay-spike.sh
      plugins/ruflo-browser/agents/browser-agent.md
      plugins/ruflo-browser/skills/browser-record/SKILL.md
      plugins/ruflo-browser/docs/adrs/0001-browser-skills-architecture.md
  - New CI guard: scripts/smoke-browser-rvf-create-flags.mjs
    statically scans every `rvf create … --kind browser-session`
    invocation across the repo (TS, dist, shell, markdown) and
    fails if any is missing --dimension / -d.
  - Wired into v3-ci.yml as browser-rvf-create-flags-smoke and into
    witness-verify's `needs:` so a regression blocks publish.

Cases covered by guards: source-only checkout (no deps), source-only
checkout with build, built tree, missing dimension flag on TS/dist/
shell/markdown call sites. The smokes are independent jobs so the CI
summary names the specific contract that broke.

Co-Authored-By: RuFlo <ruv@ruv.net>
v3.7.0-alpha.41
2026-05-16 08:44:51 -04:00
Reuven d5dbfa4b92 fix(hooks): #2017 — defensive pre-bash + new CI gate against silent-swallow shape
The pre-bash PreToolUse hook in .claude/helpers/hook-handler.cjs is a
security gate that refuses dangerous commands. In 3.6.30 it read the
wrong stdin field (`toolInput` object instead of `toolInput.command`
string), `.toLowerCase()` threw TypeError, the global safety-timer
try/catch swallowed it, and the handler printed misleading
"[OK] Command validated" while exiting 0 — letting `rm -rf /` through.

The bind-the-string fix already landed in alpha.39 via #1944. This
commit adds:

1. Belt-and-suspenders defensive coding — wrap with String(... || '')
   so any future regression that re-binds command to null/undefined/an
   object can no longer throw and silently exit 0.

2. New dedicated CI job `pre-bash-hook-smoke` (#2017) that drives real
   Claude-Code-shaped PreToolUse JSON into BOTH handler copies and
   fails on any of:
     - dangerous command + exit 0 (the security bypass)
     - "[OK] Command validated" on a dangerous input (misleading log)
     - "[WARN] Hook X encountered an error" anywhere (silent-swallow)
   Wired into witness-verify's needs:, so the gate now blocks publish.

3. Path filters extended: '**/.claude/helpers/hook-handler.cjs' triggers
   the smoke whenever either handler copy changes.

Cases covered: dangerous rm -rf /, fork-bomb, format c:, null command
field (defensive), empty payload, snake_case tool_input.command shape
(the exact #2017 reproduction), innocuous ls -la.

Ships as 3.7.0-alpha.40 to all three packages.
2026-05-15 22:29:21 -04:00
Reuven 1430b4c76e fix(embeddings): #2018 — drop @huggingface/transformers from optionalDependencies (npx Invalid Version)
Same failure shape as #1147: `npx @claude-flow/cli@latest` crashes with
`npm error Invalid Version: ` on npm 11.x / Node 24+.

Root cause: @claude-flow/embeddings declared @huggingface/transformers in
both `optionalDependencies` AND `peerDependencies` (with
peerDependenciesMeta.optional = true). When npm 11.x arborist runs
PlaceDep.pruneDedupable → Node.canDedupe → semver.eq, the overlap plus a
"-dev." prerelease transitive (onnxruntime-web@1.26.0-dev.…) trips the
empty-version crash inside @npmcli/arborist.

Fix:
- @claude-flow/embeddings: keep only the optional peerDependency, drop
  the duplicate optionalDependencies entry. Bumped to 3.0.0-alpha.17.
- @claude-flow/cli: pin embeddings to ^3.0.0-alpha.17 so existing
  lockfiles re-resolve to the fixed version. Bumped to 3.7.0-alpha.39.

Regression guards (so this can't recur):
- scripts/audit-package-dep-overlap.mjs — static check that no package
  declares the same name in BOTH optionalDependencies and
  peerDependencies. Wired into v3-ci.yml as part of the
  plugin-package-audit job.
- scripts/smoke-cli-npx-install.mjs — behavioural smoke: pack the CLI
  tarball, install it into a scratch project with optionals enabled,
  fail if `npm install` prints "Invalid Version:" or exits non-zero.
  New v3-ci.yml job `cli-npx-install-smoke` runs on Node 22 + 24
  (Node 24 ships npm 11.x, where the bug surfaces) and gates witness-verify.

Verified end-to-end:
  $ npx -y @claude-flow/cli@3.7.0-alpha.39 doctor
  ✓ MCP Servers, AIDefence, Disk Space, TypeScript … 10 passed
2026-05-15 21:44:39 -04:00
rUvandReuven 455f0b17be fix(plugin-agent-federation): #1949 — agentic-flow → optional peer dep (drops cookies@0.9.1 blocker) (#2013)
Hardened npm registries reject `@claude-flow/plugin-agent-federation@alpha`
with `403 Forbidden` on `cookies@0.9.1` because of a deep transitive
chain (agentic-flow → fastmcp → mcp-proxy → pipenet → koa → cookies).
The plugin only uses agentic-flow for one function (`loadQuicTransport`
as fallback), so it doesn't need to be a hard runtime dep.

**package.json**
- Moved `agentic-flow` from `dependencies` → `peerDependencies` with
  `peerDependenciesMeta.agentic-flow.optional = true`
- Added `midstreamer` as a second optional peer (so an operator can
  pick either or both backends — per ADR-120's Step 2 loader)
- Kept `agentic-flow` in `devDependencies` so vitest + tsc still
  resolve it in this workspace
- Bumped version 1.0.0-alpha.15 → 1.0.0-alpha.16

**midstream-aware-loader.ts**
- Replaced the static value import of `loadQuicTransport` with a
  lazy `loadAgenticFlowQuicTransport()` that uses direct dynamic
  `import()` (vitest-mockable) and falls back to `null` when the
  package isn't installed
- Type imports remain static — they're erased at compile time, so
  TypeScript users still get full IntelliSense without forcing the
  install
- `loadFederationTransport()` now throws a clear, actionable error
  when neither midstreamer nor agentic-flow is present, instead of
  silently crashing on a missing module

**Impact**
- Install size: 529 packages → 2 packages (verified via `npm pack` +
  fresh install in an empty workspace)
- No more `cookies@0.9.1`, no more `koa-router@14.0.0` deprecation
  warning, no more 403 in hardened registries
- 555/555 vitest tests pass (up from 549 — 6 loader tests now
  exercise the new lazy-import path)

**audit-fix-invariants.mjs**
- Added 4 new invariants checking the peer-dep wiring stays in
  place (package.json `peerDependencies` + `peerDependenciesMeta`,
  and the loader's type-only import + lazy loader symbol)
- 38/38 invariants pass

Closes #1949.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-15 07:47:29 -04:00
rUvandReuven e0a922eef9 feat(federation-peer): wire real midstreamer-quic@0.3.0 + aimds-core@0.2.0 (ADR-120 Step 3) (#2011)
Replaces the typed `not implemented` placeholders in
`native_transport` and `native_gate` with real implementations that
delegate to the embedding traits published in ruvnet/midstream PR #82.

**Cargo.toml**
- Bumped `midstreamer-quic` 0.2.1 → 0.3.0 (now exposes `QuicTransport`)
- Bumped `aimds-core` 0.1.1 → 0.2.0 (now exposes `SafetyGate` + `SafetyVerdict`)
- Dropped optional `aimds-detection` / `-analysis` / `-response` —
  the peer composes any `aimds_core::SafetyGate` so the concrete
  3-gate pipeline is supplied by the caller (e.g. AIMDS's
  `ComposedGate` or a custom composition)
- Added optional `uuid` + `chrono` (used by the gate adapter to
  build `PromptInput` values)

**lib.rs — `native_transport::MidstreamerTransport<T: QuicTransport>`**
- Generic over any embedder-supplied transport (defaults to `QuicConnection`)
- `connect(addr)`: opens a client connection via `QuicConnection::connect`
- `send(addr, msg)`: opens a bidirectional stream, writes one NDJSON
  line per `FederationMessage`, finishes the stream
- `recv()`: accepts an inbound bidirectional stream, reads to EOF
  (16 MiB cap), parses one JSON value
- `close()`: closes the connection with reason "peer shutdown"

**lib.rs — `native_gate::AimdsGate`**
- Adapter that holds `Arc<dyn aimds_core::SafetyGate>` so it composes
  any 3-gate pipeline (AIMDS's canonical `ComposedGate`, a custom
  composition, or a test stub)
- Converts `FederationMessage` ↔ `PromptInput` (payload-as-string +
  metadata-as-context)
- Converts `aimds_core::SafetyVerdict` ↔ peer-local `SafetyVerdict`,
  preserving routing metadata on `Redact`

**bin.rs**
- Under `--features native`, boots a real tokio runtime that wires
  `MidstreamerTransport::connect()` + `AimdsGate` (with a
  pass-through default gate so the smoke boot path works without
  AIMDS rules) + an NDJSON-stdout dispatcher
- Reads `RUFLO_FEDERATION_REMOTE_ADDR` for the connect target

**Tests**
- New `aimds_gate_adapter_forwards_pass_and_block_verdicts` test
  exercises the real `aimds_core::SafetyGate` trait surface
- 4/4 tests pass under `--features native`; 3/3 pass without

**audit-fix-invariants.mjs**
- Bumped Cargo.toml pin invariants to 0.3.0 / 0.2.0
- Added two new invariants checking the lib.rs imports actually
  reference upstream `QuicTransport` and `aimds_core::SafetyGate` —
  guards against silent reversion to a typed placeholder
- 34/34 invariants pass

Closes ADR-120 Step 3.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 23:35:32 -04:00
rUvandReuven 29ea78f21e chore(release): 3.7.0-alpha.38 — ADR-120 Step 3 (Rust peer crate) + Step 2 path update (#2010)
Cuts alpha.38 covering #2009 (Rust peer crate + midstreamer@0.3.1 path
update). Tests: cargo (3/3), vitest (555/555), audit (31/31).

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 23:01:35 -04:00
rUvandReuven b50d4dd7a2 feat(federation): ADR-120 Step 3 — Rust peer crate + Step 2 path update (#2009)
Lands the remaining ADR-120 work in ruflo now that upstream
ruvnet/midstream#81 shipped midstreamer@0.3.1 with real QUIC.

## Step 3 — `v3/crates/ruflo-federation-peer/`

New Rust crate that composes the QUIC transport (midstreamer-quic
or any TransportProvider impl) with the AIMDS 3-gate safety
pipeline (any SafetyGate impl) into a single Peer<T, G, D> dispatch
loop. Replaces today's Node-bridge → Node-MCP → Rust-crate path
with one process per federation peer.

Surface:
  * `TransportProvider`, `SafetyGate`, `Dispatcher` traits — async,
    Send + Sync, so the Peer can run in any tokio executor.
  * `Peer::run()` — inbound dispatch loop. `Pass` → dispatch;
    `Block` → quarantine (never reaches dispatch); `Redact` →
    dispatch the cleaned variant.
  * `Peer::send()` — outbound through the gate first; Block error
    bubbles back to the caller.
  * `--features native` — pulls in midstreamer-quic@0.2.1 +
    aimds-{core,detection,analysis,response}@0.1.1 from crates.io.
    Without it, the binary builds and the trait surface compiles
    so CI / `cargo check` work in any tree.

Verified:
  * `cargo build` and `cargo test` — 3/3 unit tests pass
    (dispatch loop with PassThroughGate, BlockEverythingGate, and
    outbound-send-blocks-when-gate-blocks).
  * `cargo check --features native` — resolves the upstream deps
    cleanly.

## Step 2 update — `midstream-aware-loader.ts`

Probes `midstreamer/quic` (the new sub-path added in
midstreamer@0.3.1) first, falls back to the root `midstreamer`
import for older versions. Accepts both ESM and CommonJS shapes
(via `.default`) since the upstream sub-path is CJS.

## CI guards

  * New workflow `.github/workflows/federation-peer-rust.yml`:
    two jobs — `stable-noop` (cargo build + cargo test without
    features) and `stable-native` (cargo check --features native).
    Triggers on changes to the crate or this workflow.
  * `scripts/audit-fix-invariants.mjs` gains 4 invariants pinning
    the crate name + the midstreamer-quic version + the two
    pluggable trait names. 31 invariants now present across 18
    files (was 27/16).

## Verification matrix

  * `node scripts/audit-fix-invariants.mjs` → 31/31 ✓
  * `npx vitest run` in plugin-agent-federation → 22 files, 555/555 ✓
  * `cargo test` in v3/crates/ruflo-federation-peer → 3/3 ✓

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 23:01:05 -04:00
rUvandReuven 6e0ced7935 chore(release): 3.7.0-alpha.37 — ADR-119 + ADR-120 + Step 2 loader (#2008)
Cuts the alpha.37 release covering the three midstream-related PRs
merged today:

  #2005 — ADR-119 — midstreamer adoption assessment (decision: wait)
  #2006 — ADR-120 — cross-port plan (Steps 1-3)
  #2007 — ADR-120 Step 2 — midstream-aware federation transport loader

Source changes are TS-only + audit guards; no native build surface
change. The midstream-aware loader is opt-in via MIDSTREAMER_QUIC_NATIVE
and falls through transparently to the agentic-flow loader otherwise,
so behavior on the published package is unchanged today.

  • audit-fix-invariants.mjs: 27 invariants across 16 files (was 25/14)
  • Federation plugin tests: 555/555 passing
  • Type-check: clean

Bumps all 3 packages (@claude-flow/cli, claude-flow umbrella,
ruflo umbrella) to 3.7.0-alpha.37.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 22:29:40 -04:00
rUvandReuven 8f5934dea5 feat(federation): ADR-120 Step 2 — midstream-aware transport loader (#2007)
Lands the ruflo-side of ADR-120 (cross-port agentic-flow QUIC into
midstream + Rust inflight agentics) Step 2: extend the federation
plugin's transport loading to prefer midstream's real QUIC build
when MIDSTREAMER_QUIC_NATIVE=1, with a transparent fallthrough to
the existing agentic-flow loader (which itself handles ADR-108
native QUIC and ADR-104 WebSocket fallback).

Surface:

  • New `src/transport/midstream-aware-loader.ts` —
    `loadFederationTransport(config)` probes midstreamer first,
    refuses the WASM stub via `isStub()` if reported (ADR-119),
    returns a `LoadedFederationTransport` envelope with `source`
    + optional `fallbackReason` for log/metric visibility.

  • `src/plugin.ts` now imports from the wrapper instead of
    `agentic-flow/transport/loader` directly. Logs the resolved
    source on successful load.

  • 5 unit tests covering both branches (env unset / "0" / "1"
    without package), config passthrough, envelope shape.

Behavior unchanged today: midstream's WASM build is a counter-
tracking stub per ADR-119, so `MIDSTREAMER_QUIC_NATIVE=1` falls
through to agentic-flow's loader on every install. The wrapper
activates the moment `midstreamer@0.3.0` ships real QUIC (ADR-120
Step 1, upstream work in ruvnet/midstream).

Test results in the worktree:
  • Full plugin suite: 22 files, 555/555 tests passing
  • audit-fix-invariants.mjs: 27 invariants across 16 files,
    all present (was 25/14)

Two new invariants added to the audit guard so a refactor can't
silently revert to the bare `loadQuicTransport` import and bypass
the midstream preference.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 22:28:20 -04:00
rUvandReuven cecd31085f docs(adr): ADR-120 — cross-port agentic-flow QUIC bridge into midstream + Rust in-flight agentics (#2006)
Answers the user's question: "can we update ruvnet/midstream using
agentic-flow's QUIC implementation and republish, then integrate
into ruflo with Rust-based inflight agentics?"

Short answer: yes, and the path is short because both repos already
share quinn 0.11. The three-step plan:

1. Upstream (ruvnet/midstream): cross-port agentic-flow-quic's
   working TS bridge (UDP dgram ↔ WASM sendMessage/recvMessage)
   + handshake state machine into midstream's npm-wasm/ build.
   Keep midstreamer-quic's better Rust crate (OS trust store via
   rustls-platform-verifier, proptest coverage). Republish
   midstreamer@0.3.0 with real QUIC instead of the current
   counter stub.

2. Ruflo (loader): extend ADR-108's loader pattern with one new
   env flag (MIDSTREAMER_QUIC_NATIVE=1) and one new module path.
   Behind a flag, so no default-behavior change.

3. Ruflo (in-flight agentics): new crate
   v3/crates/ruflo-federation-peer/ that composes midstreamer-quic
   + aimds-{core,detection,analysis,response} into one Rust binary
   per federation peer. Collapses today's Node-bridge → Node-MCP →
   Rust-crate path into a single process. Federation hop + 3-gate
   AIDefence run in-process. Dispatches to local agents via the
   existing stdio MCP path.

Resolves both ADR-108 (waiting on native QUIC binding) and
ADR-119's "revisit when an N-API binding lands." Backward-
compatible: WebSocket fallback (ADR-104) stays first-class,
WireGuard mesh (ADR-111) unchanged, 3-gate MCP surface
(ADR-118) unchanged.

Built on the agentic-flow QUIC-STATUS.md (Oct 17 2025) showing
100% complete with validated 53.7% latency improvement vs HTTP/2
and 91.2% 0-RTT reconnection improvement.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 22:11:47 -04:00
rUvandReuven dc8bd3d95b docs(adr): ADR-119 — midstreamer adoption assessment (decision: wait) (#2005)
Investigation by ruflo-goals:deep-researcher (88k tokens, 34 tool
uses) answered the user's question — could `midstreamer` (sibling
to `aidefence` in `ruvnet/midstream`) give ruflo QUIC, Tailscale-
style mesh, or in-flight agentics?

Short answer: no, no, and partially-via-aidefence-which-we-already-
took. The QuicMultistream class is a counter-tracking stub with no
real UDP. The npm package is a 64 KB WASM blob with four classes
(TemporalCompare DTW/LCS, NanoScheduler browser-only, StrangeLoop
in-process meta-learning, and the stub QUIC). The real QUIC lives
in the native `midstreamer-quic` Rust crate which has no N-API
binding — so adopting the npm package buys nothing for federation
transport.

ADR records:

  • Per-feature decisions (don't adopt / wait / already-taken-via-
    aidefence).
  • Concrete revisit triggers (N-API binding lands; trajectory-
    comparison requirement surfaces in agentdb/intelligence;
    Node-compatible scheduler; reconciliation protocol designed
    for a second meta-learning system).
  • Explicit non-overlap with ADR-104 / ADR-108 / ADR-111 so the
    federation transport + WireGuard mesh decisions stand.
  • Identifier-ambiguity note (`midstreamer` install name vs
    `@midstream/wasm` README vs `midstream-wasm` inner pkg.json)
    so future integrators know what they're getting.

Sibling adoption already shipped via ADR-118 (aidefence@2.3.0).
This ADR draws the boundary so the two are not re-conflated.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 22:04:56 -04:00
rUvandReuven c328b76541 docs(plugins): aidefence 2.3.0 surface in ruflo-aidefence/-browser/-federation READMEs (#2003)
Followup to ADR-118. Three plugin READMEs amended to describe what
the upstream aidefence@2.3.0 / aimds-*@0.1.1 release improves in
their existing 3-gate flows:

  • ruflo-aidefence: new "What the gates catch" table — prompt
    injection (0..4 modifier window), role hijack, jailbreak
    markers; aidefence_stats counters now accurate.

  • ruflo-browser: AIDefence Gate 3 (Prompt-injection check) note
    that scraped-content scans now flag role-hijack + jailbreak
    in addition to the canonical `ignore all previous
    instructions` family.

  • ruflo-federation: 3-gate alignment block extended with a
    paragraph that the inbound aidefence_is_safe gate's wider
    detection runs through the adaptive confidence calibration
    automatically — no plugin code change needed.

No semantic change to the plugins themselves. Pure documentation
of behavior the 2.3.0 bump already provides through the unchanged
MCP-tool surface.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:48:42 -04:00
rUvandReuven 194922df0f docs(adr): ADR-118 — aidefence 2.3.0 / aimds-* 0.1.1 upgrade plan (#2002)
Records the decision and migration plan for adopting the upstream
aidefence@2.3.0 npm release (paired with aimds-* 0.1.1 on
crates.io, both shipped 2026-05-14). Same MCP-tool surface, strictly
better detection + accurate audit counters + cleared CVE.

Covers:

  • What changed upstream (sanitizer regex now matches "ignore all
    previous instructions" + role-hijack + jailbreak markers;
    AuditLogger counters fixed; meta_learning effectiveness +
    optimize_strategy bugs fixed; RUSTSEC-2024-0421 cleared).

  • Decision: bump @claude-flow/aidefence to consume the new
    upstream; no MCP signature changes; add invariant to
    audit-fix-invariants.mjs to prevent silent downgrade.

  • Per-plugin doc updates needed (ruflo-aidefence,
    ruflo-federation, ruflo-browser, ruflo-security-audit).

  • Migration: bump → 3-gate smoke → new detection-positive smoke
    gates → dashboard re-baseline → invariant entry.

  • Compatibility note: aidefence_is_safe now returns unsafe on
    phrasings it previously passed (the canonical injection prefix
    + role-hijack + jailbreaks). Intended improvement; flagged for
    plugins that may have pre-baselined the old behavior.

Slots into the alpha.36 audit-guard pattern just established
(PR #2001 / 25 invariants).

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:46:16 -04:00
rUvandReuven 91657b9fce chore(release): 3.7.0-alpha.36 — 10 fixes + audit guard update (#2001)
Cuts the alpha.36 release covering today's 10 PRs (#1992-#2000):

  #1989 statusline RFE1 cascade        (#1992)
  #1987 memory stats HNSW persistent    (#1993)
  #1973 Windows install README          (#1994)
  #1948 platform-aware statusLine cmd   (#1995)
  #1937 memory_import_claude excl.      (#1996)
  #1921 @opentelemetry/core override    (#1997)
  #1910 MCP stdio stdout protection     (#1998)
  #1880 verify.mjs actionable error     (#1999)
  #1872 SwarmCoordinator (2 of 5)       (#2000)
  #1990 runtime-smoke gate count

Plus 9 new invariants added to `scripts/audit-fix-invariants.mjs`
covering the source-side fixes (statusline magic-bytes, page-count
clamp, memory-stats persistent count, platform-aware statusLine,
exclusion-patterns flag, otel pin, MCP stdio mode + uncaught
handler, scaleAgents target semantics, executeTask try/catch).

Result: `node scripts/audit-fix-invariants.mjs`
  → 25 invariants across 14 file(s), all present.

Bumps all 3 packages (@claude-flow/cli, claude-flow umbrella,
ruflo umbrella) to 3.7.0-alpha.36.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:38:14 -04:00
rUvandReuven c3ab5ef240 fix(swarm): scaleAgents targets total, executeTask catches throws (#1872) (#2000)
Two of the five integration tests skipped under #1872 fix real
production bugs in SwarmCoordinator.

1. scaleAgents({type, count}) treated `count` as a delta added to
   the existing count. Calling scaleAgents({count:3}) then
   scaleAgents({count:2}) ended up at 1+3+2=6 instead of the
   intuitive target of 2. Fixed: count now means TARGET TOTAL of
   the given type; spawn or terminate to reach it. Scale-down
   terminates the oldest first so the operation is deterministic.

2. executeTask(agentId, task) did `await agent.executeTask(task)`
   without a try/catch. A thrown error propagated up to the
   caller, defeating the documented `TaskResult{status:'failed',
   error}` contract callers rely on for graceful degradation.
   Fixed: wrap the call, convert a throw into a structured failed
   result with the error message preserved.

Both tests now run (was `it.skip`, now `it`), with the skip-banner
comments replaced by "fixed" notes that point back to this issue.
Pure source-side fixes — no API surface change, callers that were
already using the documented contract keep working.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:33:44 -04:00
rUvandReuven dafc567d82 fix(verify): actionable error when @noble/ed25519 isn't installed (#1880) (#1999)
The 12-hour scheduled verification has bounced off the same failure
6+ times — `verify.mjs` can't load `@noble/ed25519` because the
scheduled runner is a source-only checkout with no `npm install`
step. The root package.json already declares the dep; this is purely
a pipeline problem.

Until the scheduled runner is fixed (add `npm ci && npm run build`),
make the error message itself spell out the exact remediation:

  Fix: from the repo root, run `npm install` (the dep is declared
  in the root package.json under @noble/ed25519). If your runner
  is a source-only checkout, your verification pipeline must run
  `npm ci && npm run build` before invoking this script.

Also returns a `reason: 'noble-ed25519-not-installed'` field so the
scheduled runner can distinguish "missing dep" from a real
signature failure programmatically without grepping the error.

Pure error-message + structured-output change. No behavior change
when the dep IS installed.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:24:40 -04:00
rUvandReuven 0873f81463 fix(mcp): protect stdout from stray console.log in stdio MCP mode (#1910) (#1998)
A broad MCP tool smoke test bricked the transport mid-batch: after
hooks_pre_task ran, every subsequent hooks_* / mcp_* call returned
`Transport closed`, including mcp_status. Root cause is stdout
protocol corruption — Codex closes the MCP transport the moment it
sees a non-JSON line on fd 1, and one or more of the modules that
hooks_route lazy-loads (@ruvector/router, @claude-flow/neural,
transformers.js/ONNX, semantic-router init) emits a diagnostic via
console.log into the JSON-RPC stream.

Defense in three layers, all in `startStdioServer()`:

1. **Hijack console.log/info/debug → stderr.** As the first thing
   the server does, replace those three methods with stderr writers
   prefixed `[stdout→stderr]`. Any subsequent module that calls
   `console.log(...)` (lazy-loaded or otherwise) goes to stderr
   instead of corrupting the protocol. `console.error` is
   unchanged.

2. **`writeFrame()` helper for JSON-RPC.** All three
   server-originated frames (`server.initialized`, the
   `Request too large` error, and tool responses) go through a
   dedicated helper that calls `process.stdout.write(...)`
   directly. The hijack above can't redirect protocol frames
   because they bypass `console.log` entirely.

3. **uncaughtException + unhandledRejection handlers.** Previously
   only SIGINT/SIGTERM were caught — an unhandled rejection in a
   lazy-loaded module's init (very common during the hooks
   semantic-router race the issue describes) crashed the server
   silently. Now those go to stderr with the full stack and the
   process stays up.

Plus: sets `process.env.MCP_STDIO_MODE = '1'` so downstream code
that wants to behave differently in stdio mode can probe a single
flag.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:04:17 -04:00
rUvandReuven 1a1c117165 fix(deps): pin @opentelemetry/{core,resources,sdk-trace-base} to 1.25.1 (#1921) (#1997)
npm 10.8.x's arborist has a bug in `pruneDedupable` where it
constructs an in-memory placeholder node for `@opentelemetry/core`
(pulled in transitively via `agentic-flow` → `@opentelemetry/
exporter-trace-otlp-grpc@0.52.1`) whose `version` is the empty
string. `canDedupe` then calls `semver.gte(other.version,
this.version)`, `new SemVer("")` throws `TypeError: Invalid Version:`,
and the whole install fails. Every `npx claude-flow@alpha …`
invocation (including all five hook commands in the repo's
hooks.json) hits this on first cache-miss.

The reporter (#1921) walked the arborist stack to ground-truth:
the empty version is constructed in-memory by placement order, not
read from disk. `@opentelemetry/core@1.25.1` is what
`exporter-trace-otlp-grpc@0.52.1` declares; pinning it via
`overrides` eliminates the conditions under which arborist creates
the unresolved nested placeholder.

Pin three otel-1.25 packages that move together:
  • @opentelemetry/core            1.25.1
  • @opentelemetry/resources       1.25.1
  • @opentelemetry/sdk-trace-base  1.25.1

(Defensive — `core` alone resolves the immediate failure but the
sibling packages share the same version family.)

Defense-in-depth: the resilient hook shim added in earlier work
(plugins/ruflo-core/scripts/ruflo-hook.sh) already swallows install
errors so users on this npm version don't see the failure surface
in Claude Code. This change additionally prevents the install
itself from failing.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 20:42:14 -04:00
rUvandReuven ced2abc200 feat(memory): excludeFilePatterns/excludeFiles for memory_import_claude (#1937) (#1996)
`memory_import_claude` only had `allProjects: true/false` granularity.
Voice-fidelity-aware operators (named-persona content, PII-aware
hygiene) couldn't bulk-import without contaminating the unified
`claude-memories` namespace with the subset of files they had to
exclude. The current workaround was to halt imports entirely.

Two new params:

  excludeFilePatterns: string[]
    Glob patterns matched against the absolute file path. Files
    matching ANY pattern are skipped. Supports:
      `**`  any chars including path separators
      `*`   any chars except path separators
      `?`   exactly one char except a path separator
    Example: ["**/voice-*.md", "**/persona-*.md"]

  excludeFiles: string[]
    Absolute file paths to skip verbatim. Faster than a pattern when
    the operator already has a list captured.

Both apply to either branch (`allProjects: true` or single-project).
The response gains an `excludedByPattern` counter so callers can
verify the exclusion ran.

A minimal `globToRegex` helper is added (anchored, escapes regex
metas, handles `**` / `*` / `?`). Verified four representative
cases pass; the unrelated regex escapes the issue's voice-fidelity
patterns need.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 20:36:37 -04:00
rUvandReuven 1f8971d16b fix(init): platform-aware statusLine command (#1948) (#1995)
The statusLine command was hardcoded as
`sh -c 'D="${CLAUDE_PROJECT_DIR:-.}"; … exec node "$D/<script>"'`
on every platform. On native Windows (cmd / PowerShell, no
Git-Bash) `sh` either isn't on PATH or its quoting gets mangled.
Symptom in #1948: spurious files like `0)` or
`toastr.error('ESD...` appearing in the repo root because misparsed
shell tokens leak back into the file system as filenames.

Fix: detect `process.platform === 'win32'` at init time and emit a
shell-free command instead — a `node -e "…"` one-liner that
resolves the script path internally using `process.env`. No shell
quoting hazards because the resolution happens inside Node, not in
the shell.

  Windows: node -e "const fs=require('fs'),p=require('path');
    const d=process.env.CLAUDE_PROJECT_DIR||'.';
    const f=p.join(d,'.claude/helpers/statusline.cjs');
    const h=p.join(process.env.USERPROFILE||process.env.HOME||'.', '.claude/helpers/statusline.cjs');
    require(fs.existsSync(f)?f:h);"

  POSIX:   unchanged (sh -c with project-dir / HOME fallback)

Verified both branches emit valid JSON when generated through the
real settings-generator path on each platform.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 20:14:14 -04:00
rUvandReuven 92ae6cd29b docs(readme): flag Windows install path explicitly (#1973) (#1994)
The CLI Install section listed `curl … | bash` first without
flagging that it's POSIX-only. Native Windows users (cmd /
PowerShell, no Git-Bash) get `'bash' is not recognized` and bounce
off the docs.

Split the section into two blocks so each platform has a path it
can actually copy-paste:

  • macOS / Linux / WSL / Git-Bash: curl | bash (unchanged)
  • All platforms (incl. native Windows): npx ruflo@latest init
    wizard (same end result, no bash needed)

Adds a one-line callout explaining the choice and pointing folks
who copy the curl line on Windows toward the npx alternative.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 20:02:16 -04:00
rUvandReuven 6b9250ea8c fix(memory): memory stats HNSW count reads persistent DB (#1987) (#1993)
`memory stats` always reported `HNSW Index: active (0 entries)` even
when `memory store` had just stored a vector and `memory search`
successfully retrieved it. Root cause: the rendered count was
`hnsw.entryCount`, which is the live in-process JS state
(`hnswIndex?.entries.size`). A fresh `memory stats` invocation has
never initialized HNSW in this Node process, so the in-process
counter is always 0 — even when the persistent .swarm/memory.db has
many entries with embeddings.

Fix: prefer the persistent count from the `memory_stats` MCP tool,
which already computes `entriesWithEmbeddings` by listing the DB's
real rows. Fall back to the live counter when persistent count
isn't available. When both are non-zero, take the max (covers the
edge case where the live process has indexed more entries than the
persisted store has flushed).

Behavior matrix:

  hnsw.available  persisted  live    →  rendered
  false           any        any     →  "not active"   (unchanged)
  true            0          0       →  "available but not initialized"
  true            N>0        any     →  "active (max(N,live) entries)"
  true            0          M>0     →  "active (M entries)"    (unchanged)

Adds `entriesWithEmbeddings?: number` to the stats result type so
TypeScript is happy. The MCP tool already returns this field; this
just teaches the consumer to read it.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 19:44:08 -04:00
rUvandReuven 4680a2c044 fix(statusline): guard SQLite header read on encrypted memory.db (#1989) (#1992)
Resolves #1989. When encryption at rest is enabled, `.swarm/memory.db`
becomes an RFE1-magicked ciphertext blob rather than a SQLite
database. The statusline-generator's "page count at offset 28"
fallback read ciphertext bytes as a uint32 and rendered
3,367,093,602 patterns, which then cascaded into fake DDD 5/5 /
100% / intelligence 100% downstream.

Three defense layers, all in `statusline-generator.ts` (the template
that `ruflo init` writes to `.claude/helpers/statusline.cjs`):

  1. **Magic-bytes check** -- compare the first 16 bytes against the
     literal "SQLite format 3\\0" before interpreting any subsequent
     bytes. Encrypted, empty, or non-SQLite files are skipped.

  2. **Page-count sanity clamp** -- reject pageCount > 1,000,000
     (~4GB DB). Catches future regressions or genuinely corrupt
     headers even on plaintext SQLite.

  3. **Defensive consumer clamps** in `getV3Progress` and
     `getSystemMetrics` -- `Number.isFinite` + range check on
     `learning.patterns` before deriving domainsCompleted /
     intelligencePct. If any future regression in the reader returns
     a wild value, the downstream displays stay honest.

Verified with a fake RFE1-headered `memory.db` matching the
forensic bytes from the issue:

  Before: DDD Domains 5/5 / 100% / patterns=3367093.6k / 🧠 100%
  After:  DDD Domains 0/5 /   0% / patterns=0          / 🧠   0%

The `\\0` in the SQLite-magic string is intentional: the
statusline-generator emits via a JS template literal, so the
source-level `\\\\0` resolves to `\\0` in the generated .cjs which
JS then parses as the null byte.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 19:40:10 -04:00
rUvandReuven 639b45a66b docs(plugin): correct runtime smoke gate count 17 → 20 (#1990)
The README still referenced "17 documented entry points end-to-end"
but #1988 extended the smoke to 20 (pairs/adaptive/multi-indicator
gates added). Update the text to match the actual gate count and
list what's covered.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 15:32:24 -04:00
rUvandReuven 17986904a5 chore(plugin): bump pin to ^2.8.11 + add pairs/adaptive/multi-indicator smoke (#1988)
Updates the README prerequisites block to reflect the 2.8.x line
(flag-style CLI dispatcher with --backtest, --signal, --risk,
--portfolio, --regime, --train, --predict, --strategy-create) and
the analytical layers (walk-forward, Monte Carlo, multi-symbol,
benchmark, optimize, Kelly).

Extends runtime-smoke.sh with three new gates for the strategies
shipped in 2.8.10 and 2.8.11:

  17. pairs strategy returns metrics
  18. adaptive strategy picks regime
  19. multi-indicator strategy runs

All 20 gates pass against neural-trader 2.8.11.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 14:42:03 -04:00
rUvandReuven 5e39e61252 ci(plugin): add neural-trader runtime-smoke workflow (#1986)
The runtime smoke (added in #1984, extended in #1985) verifies that
the documented `npx neural-trader` commands actually work against
the currently-pinned package. Run it on:

  • Plugin changes (PR + push to main)
  • Workflow changes
  • Manual dispatch
  • Weekly cron (Monday 06:17 UTC) so upstream regressions don't go
    unnoticed if the plugin itself isn't touching the contract

The runtime smoke takes ~30s — installs the npm package fresh in a
tmpdir, runs the 17 gates, exits non-zero on any failure. Catches
exactly the class of bug that hit us across 2.7.x: missing loader,
unwired flags, `MODULE_NOT_FOUND` on documented invocations.

Distinct from the existing structural `smoke.sh` (file-presence and
README pins) which runs as part of validate-marketplace.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 14:11:19 -04:00
rUvandReuven b92716b322 test(plugin): extend runtime smoke to assert advanced backtest features (#1985)
Adds 6 new gates (11-16) that exercise the features wired in
neural-trader 2.8.x:

  11. .metrics.kellyFraction       (real Kelly from win/loss stats)
  12. .walkForward.windowsRun       (rolling 6m/1m validation)
  13. .monteCarlo.distribution      (Gaussian-resampled p5/p50/p95)
  14. .optimization.best.sharpeRatio (parameter sweep result)
  15. .signalsCount                  (live indicator scan)
  16. .aggregate.bestSymbol          (multi-symbol aggregate)

Also bumps NT_PIN default to 2.8.9. Current result: 17 / 17.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 14:05:38 -04:00
rUvandReuven cad471be2f test(plugin): add runtime smoke that exercises every documented command (#1984)
The existing `plugins/ruflo-neural-trader/scripts/smoke.sh` is
structural-only (file presence, README pins, frontmatter checks). It
passed for months while `npx neural-trader --backtest` and every
other documented invocation crashed at runtime — those gaps got
caught and fixed across neural-trader 2.7.5 → 2.8.1.

This adds a sibling `runtime-smoke.sh` that actually:
  1. Installs `neural-trader@2.8.1` in a clean tmpdir
  2. Runs each of the 8 commands the plugin's skills document
  3. Parses the JSON output and asserts `.command == <expected>`
  4. Confirms `require('neural-trader')` exposes >= 100 exports
  5. Confirms `--version` returns the pinned major.minor

Run:
  bash plugins/ruflo-neural-trader/scripts/runtime-smoke.sh

Current result: 11 passed, 0 failed.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 12:42:47 -04:00
rUvandReuven c37b7764b9 chore(plugin): bump neural-trader pin 2.7.2 → ^2.7.6 (#1982)
`neural-trader@2.7.6` is on npm with three working platform binaries
(linux-x64-gnu, darwin-arm64, darwin-x64) and three additional bugs
fixed beyond the install-hook fork-bomb that was resolved in 2.7.2:

  • Missing `napi-loader-shared.js` / `napi-loader.js` /
    `validation-utils.js` restored — `require('neural-trader')` no
    longer throws at import time on any platform (broken since
    2.5.0).
  • `fasthash-sys` x86-only SIMD flags replaced with stdlib
    `DefaultHasher` — `cargo build` now succeeds on aarch64-darwin.
  • Cross-platform binaries actually ship — `darwin-arm64` and
    `darwin-x64` are in the tarball for the first time ever.

Updates the README prerequisite block to reflect the new resolution,
adds a platform-coverage table, and pins to `^2.7.6` (compatible
with whatever future patches add linux-arm64 + win32 binaries).

Refs:
  • ruflo#1974 (original bug report)
  • ruflo#1981 (announcement)
  • https://gist.github.com/ruvnet/a1aca90a5c299d89fa92e905dab11041

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 11:02:41 -04:00