mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
87f2a26cd6fa4b7faf8638272cbde02dda925bcb
6475
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
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 inv3.7.0-alpha.44 |
||
|
|
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>
|
||
|
|
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 |
||
|
|
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 |
||
|
|
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. |
||
|
|
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 |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
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>
|
||
|
|
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>
|
||
|
|
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>
|
||
|
|
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>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
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>
|
||
|
|
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>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
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>
|
||
|
|
4051aeecad |
docs(neural-trader): record 2.7.2 fix, keep --ignore-scripts as defense (#1974) (#1979)
`neural-trader@2.7.2` published 2026-05-14 — install hook no longer spawns a recursive `npm install`. Cite the upstream PR (ruvnet/neural-trader#109) in the README's Prerequisites section, recommend pinning to >=2.7.2, and keep the `--ignore-scripts` flag on every documented install as defense in depth (cheap belt-and-braces against any future install-script regression — and what `scripts/audit-neural-trader-safety.mjs` still enforces). The "danger zone" advisory still appears for anyone pinned to <=2.7.1, since lockfiles can hold older versions long after the fix lands. Verified end-to-end: $ rm -rf /tmp/nt-verify && mkdir /tmp/nt-verify && cd /tmp/nt-verify $ perl -e 'alarm 30; exec("npm","install","neural-trader@latest")' added 698 packages in 18s ← was 80 min / 120 GB RAM exit=0 $ ps aux | grep -c "[n]eural-trader" 1 ← was 3,049 Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
4a19793e52 |
chore(release): 3.7.0-alpha.35 — ships #1974 mitigation
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.35. Fixes: - #1974 — neural-trader@2.7.1 has a malicious-by-accident `install` lifecycle script that recursively invokes `npm install` from inside the install hook → unbounded process recursion → ~120 GB RAM + 3,049 stuck processes on macOS Apple Silicon. The plugin's docs told users to run the dangerous command verbatim. Now every documented install uses `npm install --ignore-scripts neural-trader` (the linux-x64 binary is hardcoded inline in the upstream tarball, so the package still works on that platform after `--ignore-scripts`). 9 files patched + new `scripts/audit-neural-trader-safety.mjs` CI guard in the `hook-command-audit` job. Merged via #1976. Also closed #1975 (recruiter outreach, not a bug) and asked #1973 for specific repro details (vague "Windows install + bash + wiki" report without a failing command or error). Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.35 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.35 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.35 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
4bd194554d |
fix(neural-trader): mitigate upstream fork-bomb on install + CI guard (#1974) (#1976)
The upstream `neural-trader@2.7.1` (and every earlier published version
audited) ships a malicious-by-accident `install` lifecycle script that
recursively invokes `npm install` from inside the install hook. On any
non-`linux-x64` host the recursion is unbounded — one reporter saw 3,049
stuck processes consuming ~120 GB of RAM in ~80 minutes before manual
intervention.
The `plugins/ruflo-neural-trader/README.md` Prerequisites section said
plainly `npm install neural-trader` — running THAT instruction is what
fork-bombs the machine.
We can't patch upstream from this repo, but we can stop telling users
to run the dangerous command. Mitigations:
- README Prerequisites: add a prominent warning advisory + switch
the recommended install to `npm install --ignore-scripts neural-trader`.
The linux-x64 binary is hardcoded inline in the upstream tarball,
so the package still works after `--ignore-scripts` on that platform.
- agents/trading-strategist.md: same `--ignore-scripts` fix on the
"Ensure installed" line that previously fork-bombed if the package
wasn't already cached.
- 6 skill files (trader-backtest/portfolio/regime/risk/signal/train):
same one-liner fix.
- trader-cloud-backtest/SKILL.md: also patch the `npm install -g
neural-trader` line in the Managed-Agent `initScript` — cloud
containers ARE isolated, but the same in-container fork-bomb
amplification is still a problem.
CI guard: `scripts/audit-neural-trader-safety.mjs` scans
`plugins/ruflo-neural-trader/` for any `npm install neural-trader` /
`npm i neural-trader` invocation that doesn't also carry
`--ignore-scripts`. Allowlist: lines preceded by a "DO NOT run" marker
(the README's anti-example block). Wired into the existing
`hook-command-audit` job in `v3-ci.yml`.
Verified:
- audit clean on the fixed tree
- audit catches a deliberately-reverted regression (exit 1, diagnostic
names the offending file:line)
- all other audits + plugin smoke still green
Mitigates #1974 in THIS repo. Upstream fix to the `neural-trader` npm
package (drop the recursive `npm install` in the install hook + publish
the platform-binary optionalDependencies) is still required for the
underlying bug.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
131ac346a0 |
ci(guards): add fix-invariants audit covering 8 recent fixes (#1972)
Companion to scripts/audit-vector-dim.mjs (#1947) and scripts/audit-hook-handler-prompt.mjs (#1944) — those each guard one fix's specific regression pattern. This one is a single "presence-check" audit covering the load-bearing line(s) from 8 more fixes that shipped without a dedicated test: #1939 Win32 cwd → Claude Code slug normalization (memory-tools.ts — Win32 candidate regex + replace pattern) #1941 Per-namespace vector_indexes provisioning (memory-bridge.ts + memory-initializer.ts — INSERT OR IGNORE) #1943 Helper path project-local OR $HOME probe (settings-generator.ts — sh `[ -f "$D/` + cmd /c IF EXIST) #1945 Bridge respects CLAUDE_FLOW_MEMORY_PATH (memory-bridge.ts — getDbPath uses getMemoryRoot) #1946 Doctor respects CLAUDE_FLOW_MEMORY_PATH (doctor.ts — checkMemoryDatabase uses getMemoryRoot) #1951 Statusline reads installed version from plugin package.json (3 files — RUFLO_VERSION probe + marketplaces/ruflo candidate) #1953 hooks_pretrain code-file budget + code-dir-first traversal (hooks-tools.ts — codeFilesScanned counter) #1968 daemon forwards --workers / --headless / --sandbox (daemon.ts — forkArgs.push for each flag) 15 invariants total. Each entry pins one substring or regex that MUST appear in a specific file, with a `why` field explaining what runtime behavior breaks if the line is removed. The failure output includes that `why` so the next developer who hits the audit knows whether to update the invariant (fix moved/refactored) or restore the line. Verified locally: - `node scripts/audit-fix-invariants.mjs` → clean (`exit 0`) - Inject a regression (strip the sh probe + the getMemoryRoot call) → exits 1 with a per-issue diagnostic. Wired into the existing `hook-command-audit` CI job alongside the hook-handler-prompt audit. Combined with the other two scripts, the recent triage cycle's 14 fixes now have: audit-vector-dim → #1947 (+ siblings #1942 / #1952) audit-hook-handler-prompt → #1944 audit-fix-invariants → #1939 / #1941 / #1943 / #1945 / #1946 / #1951 / #1953 / #1968 The two remaining (#1947 RC2 embeddings-index optional `-c`, #1930 cost-tracker compact resolution) are runtime-behavior surface changes without a single load-bearing line to guard; both are exercised by their own smokes / manual repros. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
c8258cc07c |
fix(cost-tracker/compact): resolve from anywhere + free HEALTH_PORT (#1930) (#1971)
`compact.mjs` only worked when the caller ran from a cwd where `@claude-flow/integration` resolved — which on a pnpm-workspace marketplace install means `cwd=v3/@claude-flow/integration/` specifically (pnpm doesn't hoist into `v3/node_modules/`). The skill's documented `cd v3 && node ...` path failed with `Cannot find module @claude-flow/integration/token-optimizer`. The script also imported agentic-flow indirectly, which binds `process.env.HEALTH_PORT || 8080` at module-load time and EADDRINUSE'd on any host with something else already on 8080. Fix: 1. Resolution chain (#1930 step 5) — try in order: - createRequire(cwd) — works for npm-style hoisted installs - createRequire(script-dir) — works when run from inside the plugin - absolute path walk from `import.meta.url` up to 6 levels looking for `v3/@claude-flow/integration/dist/token-optimizer.js` — works on the marketplace layout regardless of cwd 2. HEALTH_PORT (#1930 step 4) — set to `0` by default (OS picks a free port) before the dynamic import runs. Users can still override. 3. dist/-missing (#1930 step 1) — when the resolver finds a path that doesn't exist on disk, surface a clear error pointing at the build command (`cd v3/@claude-flow/integration && pnpm run build`) instead of the generic MODULE_NOT_FOUND. Steps 2 (agentic-flow not in workspace deps) and 3 (sharp prebuild missing) are install-environment issues outside the script's reach. The graceful-fallback path already reports `agenticFlowAvailable: false` when the bridge can't load, which covers those cases truthfully. Resolves #1930 (script-level — the deeper packaging fix to ship a built `@claude-flow/integration/dist` in marketplace bundles is separate). Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
c29ed99637 |
chore(release): 3.7.0-alpha.34 — ships #1968 fix + #1946/#1943/#1940 closeouts
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.34. Code fix: - #1968 — daemon start --workers map silently dropped the flag when the launcher forked the foreground child, so the daemon came up with the full default worker set regardless of the user's selection. Threaded --workers / --headless / --sandbox through the same validation + forwarding path the resource thresholds already use. Merged via #1970. Issue-tracker closeouts (no new code — these were fixed in earlier alphas but the issues weren't auto-closed by the PRs that resolved them): - #1946 — doctor "Not initialized" — fixed in alpha.29 (#1959) - #1943 — global-install hook MODULE_NOT_FOUND — fixed in alpha.28 (#1957) - #1940 — bridge_status totalEntries:0 — fixed in alpha.31 (#1963) Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.34 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.34 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.34 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
8a4803020f |
fix(daemon): forward --workers / --headless / --sandbox to forked child (#1968) (#1970)
`daemon start --workers map` (and `--headless` / `--sandbox`) were accepted by the launcher but silently dropped when it forked the foreground child — so the daemon came up with the full default worker set (`map,audit,optimize,consolidate,testgaps`) regardless of what the user asked for. Root cause: `startBackgroundDaemon()` only accepted resource thresholds (`--max-cpu-load` / `--min-free-memory`) and forwarded just those plus `--workspace` to the forked child. `--workers` / `--headless` / `--sandbox` were read by `ctx.flags.*` but never passed through. Fix: thread the three additional flags through the launcher and add them to the forked child's argv, gated by the same kind of strict input validation the existing thresholds use: - `--workers <list>` — `/^[a-z][a-z0-9_-]*(,[a-z][a-z0-9_-]*)*$/` - `--headless` — boolean - `--sandbox <mode>` — one of `strict|permissive|disabled` Anything that fails validation is dropped silently — same posture as the existing thresholds. Forced through the same `forkArgs.push()` path so the child sees them in argv (which both the daemon's own arg parser AND `killStaleDaemons` rely on for workspace identification). Behaviour now (matching the user's repro from #1968): $ ruflo daemon start --workers map --max-cpu-load 1000 --min-free-memory 0 $ ruflo daemon status Workers Enabled: 1 map enabled Build verified clean (tsc). Resolves #1968. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |