Commit Graph
104 Commits
Author SHA1 Message Date
ruv 643f415db3 chore(release): point consumers at the stable internal leaves
All 18 internal @claude-flow/* leaves are now published at stable versions
(3.0.0; cli-core 3.7.0; plugin-agent-federation and plugin-iot-cognitum 1.0.0).
This moves every consumer onto them:

- cli: exact pins to the stable leaves (deps + optionalDeps)
- root package.json and codex: same
- audit-leaf-package-publish: drop the shared waiver, now resolved
- v3/.npmrc: prefer-workspace-packages=true. Without it pnpm replaced
  link:../cli with registry cli@3.47.1 (released from a branch not on main)
  and pulled its alpha cli-core/neural/memory deps into the lockfile.
- both lockfiles regenerated; only @claude-flow entries change
- CLAUDE.md: leaves follow the stable policy (embeddings excepted), the
  bundled four are dual-distributed, files allowlist / no publishConfig.tag
  rule, and the lockfile no longer proves a leaf was published

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-28 17:13:43 -04:00
ruvnetandClaude Opus 5 cf9aebf21e chore(release): 3.42.5 + @claude-flow/memory 3.0.0-alpha.25
Ships #3390 (#3327 Finding A). The fix spans two packages and only one of
them rides the release train, so memory is bumped and published alongside:

  - cli/src/memory/memory-bridge.ts      -> @claude-flow/cli 3.42.5 (train)
  - memory/src/controller-registry.ts    -> @claude-flow/memory 3.0.0-alpha.25

Without the memory publish the embedder half of the fix never reaches users
and reasoningBank stays inert, since @claude-flow/memory is NOT in
INTERNAL_RUNTIME_PACKAGES and resolves from the registry via ^3.0.0-alpha.23.

CLAUDE.md: correct the Publishing Rules claim that internal @claude-flow/*
components are all bundled. Only four are (security, codex, mcp,
plugin-agent-federation); cli-core, neural, shared and memory resolve from
the registry and need a standalone publish when their source changes. Adds a
semver-aware pre-tag drift check that fails loudly if it inspects zero leaves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 14:52:57 -04:00
rUv b52f54beb7 docs: NPM_TOKEN publish path restored (granular access token) (#2868)
* docs: NPM_TOKEN publish path restored (granular access token)

The prior NPM_TOKEN secret (versions 1/2, classic automation tokens)
lost publish rights when npm started restricting 2FA-bypass tokens
account-wide. Rotated in a granular access token (version 3,
package:write + bypass_2fa:true, scoped to the three release
packages) and confirmed it end-to-end: a real npm publish for
@claude-flow/cli and dist-tag writes to both a scoped and unscoped
package all went through with zero OTP/WebAuthn prompt.

Documents the token-first procedure with the WebAuthn dance
demoted to a fallback for if/when this token expires or gets
narrowed.

* docs: mirror NPM_TOKEN into cognitum-20260110 GCP project too

Added as version 7 there, alongside ruv-dev version 3+, since the
token's scope covers cognitum/cognitum-one orgs as well. Either
project's copy is current — use whichever gcloud session is already
authenticated.
2026-07-30 10:43:38 -04:00
rUv 503b647325 docs: confirm npm publish WebAuthn procedure from v3.32.39 release (#2861)
Replaces the speculative OTP/automation-token note with the actual
confirmed procedure: the account uses a WebAuthn security key, not
TOTP (no --otp code exists to pass). The NPM_TOKEN automation-token
secret does not have publish rights to @claude-flow/cli (confirmed
twice: 200 on reads, 404 on the publish PUT). What works is disabling
"require 2FA for write actions" + a fresh npm login, after which
npm publish runs unattended — but npm dist-tag add still needs a
fresh browser approval per call regardless (6 individual approvals
for a 3-package release, not 1).

Also documents that a fresh worktree needs both `npm install` at
root and `pnpm install` in v3/ (two separate workspace trees) before
prepare-root-publish.mjs's pnpm --filter build steps will succeed.
2026-07-29 22:28:34 -04:00
rUv 6143e1e6ea docs: document npm publish OTP/automation-token gotcha (#2860)
Hit this live during the 3.32.39 release: the interactive npm login
session has 2FA set to auth-and-writes (needs a fresh OTP per
publish, which an agent can't supply unattended), and the NPM_TOKEN
automation-token fallback in GCP ruv-dev is not guaranteed valid —
one attempt got a 404 on the publish PUT (npm's way of saying
permission/scope problem on a scoped package, not "doesn't exist").

Document both paths, the correct test order, and that npm whoami is
not a reliable pre-check for the automation token — only a real
publish attempt tells you if it works.
2026-07-29 22:05:55 -04:00
rUv 67ff9898c0 fix: resolve current runtime and verification defects for v3.32.36 (#2850)
* fix(cli): make runtime status and learning signals truthful

* fix(metaharness): accept padded scan severities

* fix(codex): make core hooks and status skill native

* fix(security): make witness verification hermetic

* fix(metrics): expose grounded learning outcomes

* fix(hooks): deduplicate project and plugin events

* fix(verification): preserve security audit payloads

* fix(runtime): stabilize dual memory skills and MCP schemas

* fix(cli): harden helper signing and reflexion health

* test(release): align helper and container invariants

* chore(release): prepare v3.32.36

* test(funnel): align gates with cold-start seed pool

* fix(ci): document MCP environment precedence
2026-07-29 15:08:51 -04:00
rUv ddd27576cb fix(release): ship Capability Brain as a self-contained 3.32.30 train (#2829)
* fix(release): bundle policy and Codex runtimes

* fix(release): verify self-contained three-package archives
2026-07-29 01:30:53 -04:00
rUv 495a451cf6 feat: add ADR-324 agentic policy engine (#2822)
* feat(memory): typed provenance in AgentDB (ADR-323)

Corrects and implements the 2026-07-28 dream-cycle research proposal
(PR #2804, closed as superseded) for typed memory provenance in
AgentDB, addressing MemIR/MemSyco-Bench's "provenance-role collapse"
and memory-induced sycophancy findings.

The dream-cycle PR's proposed schema change targeted the wrong table
(`vector_indexes`, which is per-namespace HNSW index metadata, not
per-entry) and its filename collided with the already-merged
`ADR-322-metaharness-flywheel-integration.md` (#2817) — both corrected
here as ADR-323 against `memory_entries`, the real per-record table.

- memory-initializer.ts: `provenance_type` column (user_claim |
  agent_output | system_observation | tool_result | unknown, default
  unknown) on `memory_entries`, migrated for existing DBs via
  `ensureSchemaColumns()`. `storeEntry()`/`searchEntries()` accept and
  validate `provenanceType`/`provenanceFilter`.
- memory-bridge.ts: same wiring for the native better-sqlite3 AgentDB
  v3 path (`bridgeStoreEntry`/`bridgeSearchEntries`).
- commands/memory.ts: `memory store --provenance <type>`, `memory
  search --provenance-filter <types>` (comma-separated, OR semantics).
- mcp-tools/memory-tools.ts + cli-core/mcp-tools/memory-defs.ts:
  `memory_store`'s `provenance_type` param, `memory_search`'s
  `provenance_filter` param (kept in sync across both tool-def sets).

Found and fixed during implementation: an initial design skipped the
RaBitQ/HNSW acceleration paths entirely whenever a provenance filter
was requested (neither carries provenance_type on their candidates).
This reproducibly crashed the CLI process on exit (a libuv assertion
on Windows) after printing correct results. Fixed by never skipping
those paths — RaBitQ now fetches provenance_type in its existing
per-candidate query, HNSW does one batched (namespace, key) lookup
afterward — eliminating the crash across repeated runs. See ADR-323's
"Implementation note" for detail.

7 new end-to-end tests (adr-323-memory-provenance.test.ts), including
a repeated-run regression guard for the crash. Full existing memory
suite re-verified with no regressions (one pre-existing, environment-
specific #2558 test failure confirmed identical against unmodified
main — better-sqlite3's native bridge is unavailable in this dev
environment, unrelated to this change).

Closes the follow-up from dream-cycle PR #2804 (closed as superseded).

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(memory): enforce provenance across retrieval paths

* feat: add agentic policy engine

* fix: align Codex MCP integration

* fix: keep MetaHarness dependencies optional

* fix: declare MetaHarness as optional peers

* fix: sync workspace lockfile

* fix: document policy tool selection guidance

* test: cover governed in-process flywheel

* ci: make MetaHarness absence drill deterministic
2026-07-28 22:12:19 -04:00
ruv b9010cb226 docs: drop unverified Flash Attention speedup claim from CLAUDE.md (#2739 dream-cycle)
Every dream-cycle for 7+ nights has flagged the "Flash Attention
2.49x-7.47x speedup" number as unverified. It was inherited from
upstream marketing and never reproduced in-tree — same class as the
HNSW "150x-12,500x" claim I dropped in the 2026-07-26 sweep.

Two options were: (a) benchmark it, or (b) drop the number. I'm
taking (b) because a benchmark harness that measures Flash Attention
against a real transformer forward pass is a real project on its own
and would delay closing the credibility flag by weeks.

Change in all 5 sites (root, v3/, v3/@claude-flow/cli/ CLAUDE.md):
- Perf-target rows now read "integration available; measured speedup
  pending benchmark" and explain WHY the number was dropped.
- Sibling bullets under intelligence-system notes cross-reference the
  same explanation so the removal is documented, not silent.

Refs: dream-cycle #2739 (2026-07-20) + repeat mentions in
#2727 #2739 #2752 #2760 #2763 #2768 #2778 #2783.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-07-26 20:21:07 -04:00
ruvnet c316ce2f0d docs(claude.md): capture v3.29.0 publish-flow learnings — signing-key leak avoidance + Windows prepublishOnly hazard
Two operational learnings from the v3.29.0 release flow, both worth institutionalizing
so the next publisher doesn't hit them:

1. **Signing key handling on Windows.** `sign-helpers.mjs` uses
   `execFileSync('gcloud', ...)` which fails on Windows (Node CreateProcess doesn't
   auto-append `.cmd`). The intuitive workaround — invoking `gcloud secrets versions access`
   in the shell — prints the PEM to stdout, which becomes tool-visible output in Claude
   Code and lands in the session transcript. That's how key v1 leaked today (rotated in
   #2673). Docs now spell out the "redirect to file, never stdout" rule and prefer the
   `RUFLO_HELPERS_SIGNING_KEY=<path>` env over the broken `RUFLO_HELPERS_SIGNING_SECRET`
   env on Windows.

2. **`prepublishOnly` on Windows.** The CLI's prep chain (`cp`, `rm -rf`, `mkdir -p`,
   `cp -r`) is POSIX-only and fails under `cmd.exe`. Docs now show the manual-prep +
   `npm publish --ignore-scripts` workaround that unblocked v3.29.0, and mark cross-
   platform rewrite as a follow-up.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-07-14 13:08:52 -04:00
ruv 5ca9ce1bd2 docs: document helpers-signing key location + concurrent-session corruption risk
Publishing @claude-flow/cli needs RUFLO_HELPERS_SIGNING_SECRET from the
ruv-dev GCP project (not cognitum-20260110 or claude-flow — both checked,
secret isn't there). Also documents a real, observed-live race: a stale
cached `npx @claude-flow/cli@latest` MCP server from a concurrent Claude
Code session running against this repo's cwd can silently downgrade the
hand-maintained hook-handler.cjs/intelligence.cjs + signed manifest
mid-publish.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-07-13 23:27:08 -04:00
rUv 1d5b06e4a2 fix(federation): unblock main — TS shim types + dispatcher import + witness re-sign (#2604)
* fix(federation): sync shim types + guard optional close() to unblock Build V3

Fixes 7 TS errors on main that block Build V3 across all 3 platforms:
- src/transport/midstream-aware-loader.ts:39-52 — local AgentMessage/
  AgentTransport shim was over-minimized by #2578. Restored required
  {id, type, payload, metadata?} on AgentMessage and made send/onMessage
  2-arg (address, message) to match how plugin.ts actually calls them.
- src/transport/midstream-aware-loader.ts:84 — cast dynamic import()
  through `unknown` since upstream's exported AgentTransport carries a
  richer InboundMessageHandler surface we intentionally hide behind the
  minimal shim.
- src/plugin.ts:481 — this.transport.close is optional (`?`) on the
  shim; guard with optional chaining `close?.()`.

Local tsc build clean after fix.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(federation): dispatcher import + re-sign witness manifests (3.25.3 drift)

Two more preexisting main-red root causes, in the same fix:

(1) inbound-dispatcher.ts:22 still imported `AgentMessage` from
    `agentic-flow/transport/loader` — the exact phantom subpath #2578
    eliminated in midstream-aware-loader.ts. Repointed to the local
    shim. This is the residual site #2578 missed; the graph schema smoke
    (ADR-130 P1) failure was a cascade of this same TS type collision.

(2) Re-signed verification/{linux,macos,windows}/manifest.md.json via
    plugins/ruflo-core/scripts/witness/regen.mjs. The 3.25.3 release
    (PR #2602) edited the ADR-104-transport `desc` string in all 3 per-OS
    manifests but did not re-run regen.mjs, so the stored
    integrity.manifestHash no longer matched sha256(JSON.stringify(
    manifest)) and Witness verify exited 1 across all 3 platforms.
    Manifests now verify cleanly (117 pass, 0 drift, 0 regressed).
    Note: witness/regen.mjs takes --manifest + --history and re-signs
    deterministically from manifest.gitCommit; already wired but the
    3.25.3 release process skipped it.

Local verify: pass=117 drift=0 regressed=0 missing=0 on all 3 OSes.
Local tsc build: clean.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(hooks): PreToolUse hook emits valid JSON verdict (#2613)

Cursor imports third-party Claude Code hooks under its stricter
`preToolUse` contract, which requires stdout to be a valid JSON
permission verdict (`{"permission":"allow"|"deny"|"ask"}`) and
fail-closes on any other text. The prior PreToolUse commands ran the
ruflo hook shim which prints telemetry to stdout — Cursor then blocked
every Bash/Write/Edit tool call across every workspace.

Fix:
1. ruflo-hook.sh (all three copies) — redirect stdout to /dev/null in
   addition to stderr. Claude Code doesn't consume this stdout either,
   so silencing it is a pure cleanup with no functional cost.
2. hooks.json PreToolUse commands — after invoking the shim, always
   `printf` a well-formed `{"permission":"allow"}` verdict. Valid for
   both Claude Code's JSON-hook contract and Cursor's stricter
   preToolUse contract, so telemetry keeps working while nothing is
   blocked. Also guard `${CLAUDE_PLUGIN_ROOT:-}` so an unset env var
   collapses to the safe empty branch instead of a bash parse error.

Simulated Cursor invocation (CLAUDE_PLUGIN_ROOT unset) now emits:
  {"permission":"allow"}

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ci): indirect optional-dep imports in cli — @ruvector/*, @metaharness/router (#2608)

Same install-safety anti-pattern as #2586's prime-radiant fix, now
surfaced in @claude-flow/cli once plugin-agent-federation's TS2307
stopped masking it (630034ca4 on this branch). Build V3 fails with
"Cannot find module '@ruvector/learning-wasm'" and
"Cannot find module '@metaharness/router'" whenever the optional deps
aren't installed — which is the case in the install-safety /
Build V3 configurations.

Every call site is already runtime-guarded (try/catch, availability
probes). But a literal `await import('@ruvector/learning-wasm')` or a
`typeof import('@metaharness/router')` type expression forces tsc to
statically resolve the specifier at build time, so TS2307 fires when
the package is absent.

Fix: route the specifier through a string-typed variable
(`const pkg: string = '...'; await import(pkg)`) — same idiom as the
optional better-sqlite3 loader and #2586. Runtime behaviour unchanged:
the package still loads when present, still falls back cleanly when
absent.

Also replaced services/ruvector-training.ts's static `import type
{ WasmMicroLoRA, ... } from '@ruvector/learning-wasm'` with local
`type X = any` aliases (mirrors the existing FlashAttention et al.
pattern a few lines below).

Verified: with @ruvector/learning-wasm, @ruvector/attention, and
@metaharness/router hidden locally (matching the CI condition), the
cli package now compiles clean (tsc, 0 TS2307). plugin-agent-federation
remains clean as well.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(smoke): add metaharness optionalDep to ruflo wrapper (ADR-150 constraint #2)

The all-plugins-smoke, metaharness-ci `score`, and no-metaharness-smoke
CI jobs all fail on the same single step (ruflo-metaharness smoke #16):

  → 16. ruflo wrapper has metaharness in optionalDependencies
        (architectural constraint #2) ... FAIL:
        ruflo wrapper missing metaharness optionalDep

ADR-150 §"Architectural constraint" rule #2 requires `metaharness` and
`@metaharness/*` packages to live in `optionalDependencies` (never
`dependencies`) so ruflo remains operational when they're removed. The
CLI already satisfies this; the wrapper package.json had an empty
`optionalDependencies` block.

Pin to `~0.3.1` — the current npm-published `metaharness@latest`, and
the same range family used by CLAUDE.md's `@metaharness/router@~0.3.2`
pin. Wrapper install remains graceful-fail when the optional dep is
absent (that's the whole point of ADR-150's removable rule #1).

Unblocks PR #2604 merge. Only 3 CI failures on the branch — all
the same rule — so this single change flips them green.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(smoke): reconcile ADR-150 rule #2 with #2561 npx-startup budget

Two CI gates were mutually incompatible on this PR:

- ruflo-metaharness smoke #16 (older): asserted \`metaharness\` MUST be
  in \`ruflo/package.json\` optionalDependencies.
- guard #2561 (newer): enforces \`RUFLO_MAX=0\` optionalDependencies
  AND FORBIDs \`metaharness\` specifically, because installing it as a
  ruflo postinstall dep timed out the \`npx -y ruflo@alpha --version\`
  fast-path (measured incident).

Adding \`metaharness\` to ruflo optDeps satisfies #16 but breaks #2561;
removing it satisfies #2561 but leaves #16 red (pre-existing main state).

Fix: correct the smoke #16 rule. ADR-150 §"Architectural constraint"
rule #2 says "when \`@metaharness/*\` or \`metaharness\` appears in a
package's dep graph, it MUST be in \`optionalDependencies\`, never
\`dependencies\`". It does NOT require ruflo to depend on metaharness.
The old check was over-restrictive — it demanded PRESENCE, not just
correct SHAPE-when-present. The new check enforces the actual invariant:
no \`metaharness\` / \`@metaharness/*\` in ruflo's hard \`dependencies\`.
Absence is fine (ruflo delegates to @claude-flow/cli, which keeps
metaharness as a runtime dynamic import via ADR-150 rule #1).

#2561 is stronger evidence (proven cold-npx timeout) than the old #16
assertion, so the correction goes to #16.

Verified locally:
  smoke #16 PASS (new logic)
  guard #2561 PASS

Also reverts the ruflo/package.json optionalDeps change that briefly
tried to satisfy the old #16 rule — the wrapper stays clean.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(init): heal duplicate MCP registrations without breaking plugin refs (#2612)

Users who followed pre-rename setup docs ended up with two independent
MCP server registrations pointing at the same binary — one keyed
`claude-flow`, one keyed `ruflo` — doubling Claude Code's tool-schema
load (~350 duplicated tools) with zero added capability. Bug #2612.

The naive fix (rename the canonical key from `claude-flow` → `ruflo`)
silently re-opens #2206 (closed), because ~166 plugin files across
plugins/**/{agents,commands,skills}/*.md reference tools with the
`mcp__claude-flow__*` prefix. Claude Code derives the tool prefix from
the MCP server key; flipping the key to `ruflo` renames every plugin
tool to `mcp__ruflo__*` and every one of those 166 refs errors with
"Unknown tool".

Correct reconciliation:

  - Canonical MCP key STAYS `claude-flow` (preserves #2206 for the 166
    plugin refs). The binary invoked is `ruflo@latest` — only the
    registration name is legacy.
  - Duplicate is HEALED via `ruflo doctor`, not by renaming: detect
    coexisting `ruflo`-keyed + `claude-flow`-keyed registrations for
    the same binary, warn, and instruct the operator to remove the
    `ruflo`-keyed one.

Changes:

  - src/init/mcp-generator.ts — server key restored to `claude-flow`;
    manual `claude mcp add …` commands restored to name `claude-flow`.
    Comment now explains the #2206/#2612 duality.
  - src/init/executor.ts — writeMCPConfig skip-comment updated to
    reflect that `claude-flow` is canonical and `ruflo`-keyed is the
    legacy duplicate form; existing detection accepts both keys (was
    already correct).
  - src/init/claudemd-generator.ts — generated CLAUDE.md `Setup`
    section restored to `claude mcp add claude-flow -- …`.
  - src/commands/doctor.ts — inherit the concurrent session's
    duplicate-detection logic (rufloLocations / duplicateLocations /
    legacyLocations / currentLocations), but flip which key is
    treated as canonical: `claude-flow`/`claude-flow_alpha` are
    current, `ruflo`/`ruflo_alpha` are legacy. Fix-message now
    references removing the `ruflo`-keyed entry and cites #2206.
  - src/commands/swarm.ts — help output uses `claude mcp add
    claude-flow` again.
  - __tests__/issue-2612-mcp-rename.test.ts — regression guard for the
    duplicate-detection warning; header comment documents the
    canonical/legacy roles matching the flipped semantics.
  - CLAUDE.md / v3/@claude-flow/cli/CLAUDE.md / v3/@claude-flow/mcp/CLAUDE.md /
    v3/implementation/init/API.md — kept the binary-update from
    `@claude-flow/cli@latest` → `ruflo@latest` (correct, this IS the
    post-rename wrapper), but restored the MCP server KEY to
    `claude-flow` in every example line.

Verified:
  - tsc clean (CLI package)
  - all 70 test files / 726 tests pass locally, including:
    - __tests__/init-wizard-bugs.test.ts (#2206 canonical key + #2207 dual-key detection)
    - __tests__/stale-mcp-key-2369.test.ts (10 tests, unchanged)
    - __tests__/issue-2612-mcp-rename.test.ts (new — asserts doctor
      surfaces "Duplicate Ruflo MCP registrations found" with legacy
      `ruflo` + current `claude-flow`)
  - Manual doctor run against a synthetic .mcp.json/.claude.json pair
    surfaces the exact warning + remediation string.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-07-09 10:16:55 -04:00
rUvanddjimit ae9bba523e feat(metaharness): learn + gepa integration — metaharness@0.3.0 / darwin@0.8.0 (15 MCP tools) (#2540)
* fix(mcp-bridge): streamable-HTTP session cleanup — DELETE + Mcp-Session-Id + 202 (#2425)

Closes #2425. Cherry-picked from djimit's commit b905c09f4 with
extensions: applied symmetrically to BOTH bridges (per ADR-166's
"both bridges move together" rule), and added regression coverage
in the ADR-166 security lock so this can't silently regress.

Streamable-HTTP clients (Codex/RMCP) send `DELETE /mcp` with an
`Mcp-Session-Id` header at shutdown. Previously the bridge returned
`Cannot DELETE /mcp` which surfaced as noisy client-side cleanup
failures after otherwise-successful MCP calls.

Changes (both bridges — ruflo/src/mcp-bridge/index.js AND
ruflo/src/ruvocal/mcp-bridge/index.js):

- Stable per-process `MCP_SESSION_ID = randomUUID()` echoed as the
  `Mcp-Session-Id` header on every `/mcp*` response
- `DELETE /mcp` and `DELETE /mcp/:group` → 204 No Content (idempotent)
- `DELETE` added to `Access-Control-Allow-Methods`; `Mcp-Session-Id`
  added to `Access-Control-Allow-Headers` (both compatible with the
  ADR-166 CORS allowlist wiring — allowlist controls Origin, not
  Method/Header)
- `notifications/initialized` responses now `202 Accepted` with empty
  body per the MCP streamable-HTTP spec (was returning a jsonrpc
  envelope which some clients rejected as unexpected)

Regression locks (extends ADR-166 §6 acceptance):
- test-security-lock.js — 2 new static checks (#7 delete handler,
  #8 Mcp-Session-Id header) × 2 bridges = 16/16
- test-runtime-security.mjs — 2 new runtime checks per bridge (R6
  DELETE→204 + header echoed; R7 notifications/initialized→202 empty)
  = 20/20 total green

Interaction with ADR-166 auth: DELETE flows through `app.use(requireAuth)`
same as the rest of `/mcp*`. When `MCP_AUTH_TOKEN` is set, DELETE without
Bearer returns 401 (verified in R2 by contrast; DELETE with Bearer
returns 204 verified in R6). Local-only deployments with no token remain
zero-friction (the middleware is a no-op).

Credit: @djimit for the original patch (branch
fix/mcp-session-cleanup-forkbase on djimit/claude-code-flow, commit
b905c09f42).

Co-Authored-By: djimit <djimit@users.noreply.github.com>
Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(metaharness): learn + gepa integration — metaharness@0.3.0 / darwin@0.8.0

Version pins (optionalDependencies, both @claude-flow/cli + ruflo wrapper):
- @metaharness/darwin  ~0.3.1 → ~0.8.0  (GEPA engine + cand-6 genome)
- metaharness          ~0.2.6 → ~0.2.8
- @metaharness/redblue ~0.1.1 → ~0.1.4  (+ versioned cache dir — pin bumps
  now invalidate stale installs instead of serving 0.1.1 forever)
- @metaharness/kernel  ~0.1.0 → ~0.1.2

New surfaces (13 → 15 MCP tools, 11 → 13 CLI subcommands):
- metaharness_learn / `ruflo metaharness learn` — upstream ADR-235 GEPA
  learning run; $0 dry-run default, --run to spend, structured
  checkout-required payload when the metaharness clone is absent
- metaharness_gepa / `ruflo metaharness gepa` — darwin GEPA library
  surface (genome|validate|render|analyze); gepaOptimize stays
  library-only (in-process evaluator can't cross subprocess boundary)
- skills: harness-learn, harness-gepa

Fixes found during validation:
- gepa.mjs treats ERR_PACKAGE_PATH_NOT_EXPORTED (stale pre-0.8.0 darwin
  in ancestor node_modules) as recoverable → falls back to versioned cache
- smoke.sh contract counts advanced (scripts 13→15, tools 13→15,
  subcommands 11→13, CLAUDE.md doc counts)

Validated: tsc clean; test-mcp-tools 171/171 across all 15 tools; darwin
0.8.0 evolve/bench/security-bench verbs proven through wrappers; redblue
0.1.4 attack preview proven via new cache path.

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: djimit <djimit@users.noreply.github.com>
2026-07-03 14:17:09 -04:00
rUv 6f89c76404 docs(claude): metallm ask-vs-delegate rule + $0.26 delegate floor warning (#2538)
Adds the load-bearing split: metallm_ask for single-shot facts/summaries/classification/
small code questions; metallm_delegate ONLY for autonomous multi-step execution or isolated
agent context. Documents the measured cost floor (delegate spawns claude -p → ~43k-token
context → ~$0.26/call floor vs ~$0.0001 for ask, ~2500x) so delegate isn't used casually.
Notes the tracked auto-tier over-tiering caveat (meta-llm #38). No key/URL committed.


Claude-Session: https://claude.ai/code/session_01V84YJJK7RBF9TuUo4eVSW7
2026-07-03 09:21:46 -04:00
rUv 0810d3b8cb docs(claude): enforce gateway-delegated development via meta-llm dev-bridge (#2535)
For complex reasoning / architecture / hard bug-fixes, delegate through the
metered meta-llm gateway (metallm_delegate / metallm_ask) — cheap-tier-first,
Fable-escalating, cost-governed, context-preserving. Setup (bridge + cog key)
stays local/gitignored; no secrets or gateway URL in this public repo.


Claude-Session: https://claude.ai/code/session_01V84YJJK7RBF9TuUo4eVSW7
2026-07-03 07:44:10 -04:00
ruv a63cdf0526 feat(metaharness): integrate @metaharness/redblue@~0.1.1 — adversarial red/blue LLM testing
ADR-150 sibling-package integration. `@metaharness/redblue` runs an
adversarial red-team → judge → blue-team patch → retest → report loop
against an LLM target you own. Covers OWASP LLM Top-10 / NIST AI RMF
families (prompt injection, tool misuse, data leakage, jailbreaks,
denial-of-wallet). Joins score/genome/mcp-scan/threat-model/oia-audit
as the run-time red/blue layer of the security plugin surface.

Why integrate here vs ruflo-aidefence or ruflo-security-audit:
- aidefence is detection (PII / prompt-injection scan); redblue is
  *generation* — they complement, redblue doesn't replace it
- security-audit is dep CVEs / static scan; redblue is run-time LLM eval
- ruflo-metaharness already carries the @metaharness/* wrapper pattern
  (`_darwin.mjs`, `_harness.mjs`), the locator, the MCP-tool registration
  surface, and the smoke/CI gates — redblue slots in as one more sibling

Surface added:
- `npx ruflo metaharness redblue {init|run|patch|attack|report}` CLI
- `metaharness_redblue` MCP tool (subcommand + family + tests + patch +
  mockJudge + alertOnFail + timeoutMs)
- Skill discoverability via CLAUDE.md (both CLI catalog + MCP tool catalog)
- 11 metaharness subcommands (was 10), 13 MCP tools (was 12)

Safety posture (inherited verbatim from upstream; wrapper does NOT relax):
- upstream `src/config/safety.ts` hard-enforces no real credentials, no
  live external targets (loopback / *.test / *.internal only), no shell,
  no arbitrary network, no eval at config-load time — a config that
  enables any of these errors at load
- `--mock-judge` is the $0 marker-fixture path for CI / offline; the real
  model judge requires `OPENROUTER_API_KEY` and is capped by
  `max_cost_usd` / `max_runtime_minutes` / `max_tests`
- wrapper shells out with `shell: false` argv arrays; never string interp
- ADR-150 graceful-degradation rule #3 — on install/network failure the
  wrapper returns `{degraded: true, reason: ...}` and exits 0 so ruflo
  stays operational

Upstream bug workaround (track for revert):
`@metaharness/redblue@0.1.1`'s CLI bootstrap uses
`isMain = import.meta.url === \`file://\${process.argv[1]}\``. When npx
links `redblue` → `dist/cli/index.js`, argv[1] is the symlink path but
import.meta.url is the resolved real path, so isMain is false and the
binary silently exits 0 with no output, no file, no error. Darwin's CLI
calls `main()` unconditionally and is unaffected. Workaround: install the
package once into `~/.ruflo/redblue-cache` via `npm install --prefix` and
invoke `node <abs_path>/dist/cli/index.js` directly — argv[1] then equals
the real path and isMain becomes true. First install hits npm's cache so
the cold path is ~200ms; warm invocations are ~20ms.

Locator hardening (prevents recurrence of artifact-mirror staleness):
The publish artifact at `v3/@claude-flow/cli/plugins/ruflo-metaharness/`
is regenerated only at `prepublishOnly`. On a dev tree with a fresh
script in source but a stale mirror, the locator would pick the mirror
because `_harness.mjs` exists in both. Locators in `commands/metaharness.ts`
and `mcp-tools/metaharness-tools.ts` now accept an optional `requiredScript`
that narrows the match to dirs containing the dispatched script. The
artifact mirror is also synced with the two new redblue scripts so the
publish artifact stays usable until the next `prepublishOnly`.

Gates updated to lock new state:
- smoke.sh: 9 subcommands in dispatcher (was 8), 11 in description list
  (was 10), 13 MCP tools (was 12), 13 mcp-script-count (was 12), 14
  MCP_SUCCESS_SEMANTIC footnotes (was 13), 13 `success: r.success`
  occurrences (was 12), tilde-pin check covers @metaharness/redblue
- test-mcp-tools.mjs: `tools.length === 13`, `metaharness_redblue`
  enumerated, attack-preview Phase-3 input, 180s timeout (cold-cache npx
  fetch class)
- CLAUDE.md: surfaced under both CLI catalog and MCP-tool catalog (gated
  by smoke 17z56 + 17z57)

Verification:
- `bash plugins/ruflo-metaharness/scripts/smoke.sh` → 120 passed, 0 failed
- `node plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs` → 153 passed, 0 failed
- `node v3/@claude-flow/cli/bin/cli.js metaharness redblue init --out <path>`
  → writes the safety-asserting sample config, exits 0
- attack preview, mock-judge run (3-test → real findings report), and
  CLI dispatcher all exercised end-to-end before commit

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-27 14:01:20 -04:00
ruv 575a7bdeed fix(ci): ruflo-metaharness smoke — fix brittle 17z61 lookback + iter-93 stale count
Two plugin-contract failures in the no-metaharness-smoke job for
ruflo-metaharness:

- **17z61** (drift-from-history dispatcher round-trip) used
  \`grep -B100\` to walk back from the step to its enclosing job header.
  metaharness-ci.yml grew past 100 lines between that step (now line 604)
  and its \`metaharness-real-data:\` job header (line 493). Replaced the
  fixed-window grep with an awk one-pass that finds the most-recent
  top-level job header above the step.

- **17z56** (every MCP tool documented in CLAUDE.md, iter 93) asserted
  exactly 9 MCP tools. ADR-153 added 3 more (\`metaharness_bench\`,
  \`metaharness_evolve\`, \`metaharness_security_bench\`) without updating
  the lock count or the CLAUDE.md catalog. Documented the 3 tools in
  CLAUDE.md and bumped the count to 12.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-25 18:36:12 -04:00
ruv 0c5782a920 feat(metaharness): drift-from-history --alert-on-new-severity gate (iter 78)
Pre-iter-78, drift-from-history's alert triggered ONLY on structural-
distance threshold. A weekly cron running with --threshold 0.95 would
MISS a sudden CRITICAL mcp-scan finding if the broader structure
stayed similar.

Example failure: someone commits a new MCP server with default-allow
permissions. score/genome don't change meaningfully (still 'node_mcp_ci',
still 'typescript-sdk-harness') → overall similarity stays 0.99. But
mcp-scan would now report a CRITICAL finding. Pre-iter-78 the weekly
cron's drift detection would report 'near-identical' — and the human
reading the Actions summary would see "no drift" + miss the new finding.

Iter 78 adds an orthogonal alert gate.

WHAT SHIPPED

1. plugins/ruflo-metaharness/scripts/drift-from-history.mjs
   - New `--alert-on-new-severity <level>` flag (default off → no behavior change)
   - When set: any introduced finding with rankSeverity(severity) ≥
     rankSeverity(level) flips alertTriggered=true and appends a
     reason like "N new finding(s) at or above critical severity"
   - alert.elevatedFindings[] surfaced in payload so consumers see WHICH
     findings tripped the gate (not just a count)
   - alert.reasons[] array supplements .reason string for structured access
   - Imports rankSeverity from _harness.mjs (iter 63 shared util)

2. v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts
   - alertOnNewSeverity input added to metaharness_drift_from_history
   - enum constrained: info|low|medium|warn|high|error|critical
     (matches iter-63 SEVERITY_RANK vocabulary)
   - args.push('--alert-on-new-severity', input.alertOnNewSeverity)
   - Description calls out orthogonality: "A CRITICAL finding triggers
     even if structural similarity > threshold."

3. CLAUDE.md surfaces the new flag

4. Smoke step 17z41 anchors:
   - CLI flag + args key + elevatedFindings + rankSeverity import
   - MCP input + dispatch
   - CLAUDE.md mention
   - RUNTIME: synthetic clean baseline + ruflo's real INFO finding →
     alert-on-new-severity info exits 1 (gate triggers correctly)

VERIFIED END-TO-END

   $ # clean baseline (no findings)
   $ node oia-audit.mjs --dry-run --format json > /tmp/baseline.json
   $ jq '.components.mcpScan.json = {findings:[]}' /tmp/baseline.json > /tmp/clean.json

   $ # default (no flag) — does not fire on similarity > threshold
   $ drift-from-history --baseline-file /tmp/clean.json --threshold 0.5
   alert.triggered: false

   $ # with --alert-on-new-severity info — fires
   $ drift-from-history --baseline-file /tmp/clean.json --threshold 0.5 \
       --alert-on-new-severity info
   alert.triggered: true
   alert.reasons: ['1 new finding(s) at or above info severity']
   alert.elevatedFindings: [{ severity: 'info', message: 'No MCP security issues found...' }]
   exit: 1

DESIGN: ORTHOGONAL, NOT COMPOUND

The two alert gates work independently:
   triggered = (similarity < threshold) OR (any new finding ≥ severity)

Either gate can fire. This matches the operational reality: structural
drift and security-posture drift are different failure modes that
should each have their own threshold + own visibility.

WHY OPT-IN (NOT DEFAULT)

Default behavior unchanged (no flag = no new alert). Existing cron
scripts that depend on the iter-53 behavior keep working. Ops users
who want the new gate explicitly opt in by passing the flag.

GATES THIS ITER
   smoke:    80 → 81 (step 17z41 green)
   runtime:  smoke RUNS the actual workflow + asserts exit=1 on alert
   tsc:      CLI rebuilds clean
   roundtrip: 60/60 (no behavior change on default path)

CLI-MCP PARITY (post-iter-78)

   --path                  ✓ both
   --baseline-since        ✓ both
   --baseline-key          ✓ both (iter 66/71)
   --baseline-file         ✓ both (iter 67/71)
   --threshold             ✓ both
   --alert-on-new-severity ✓ both (iter 78)
   --dry-run               ✓ both

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-16 22:33:08 -04:00
ruv d1cdd2d54b perf(metaharness): drift-from-history --baseline-file fastest path (iter 67)
Extends iter 66's audit-list-skip pattern with a memory-skip path.
When the baseline is already on disk (e.g., from a prior CI artifact
download), iter 67's --baseline-file skips BOTH audit-list AND the
audit-trend memory roundtrip.

MEASURED IMPROVEMENT (drift detection on ruflo against itself)

  Slow path (no key, audit-list races oia-audit):   ~26,000ms
  iter 66 --baseline-key (skips audit-list):         ~1,900ms  (14x)
  iter 67 --baseline-file (skips memory entirely):   ~1,400ms  (19x)

The 500ms additional savings from iter 67 comes from skipping the
ONNX warmup in audit-trend's --baseline-key memory retrieve. With
--baseline-file, audit-trend reads JSON directly from disk.

WHAT SHIPPED

plugins/ruflo-metaharness/scripts/drift-from-history.mjs:

  - --baseline-file <path> flag (lower-cased ARGS.baselineFile)
  - When set: synthesize listResult with `file:${path}` key prefix
    to distinguish from real memory keys; skip audit-list entirely
  - audit-trend dispatch: when usedBaselineFile, pass --baseline (file
    input) instead of --baseline-key. Reuses iter-46's audit-trend
    file-input path.
  - timing.usedBaselineFile: bool — surfaced in payload so callers
    detect which fastest-path was taken

VERIFIED END-TO-END
   $ node drift-from-history.mjs --baseline-file /tmp/baseline.json \
       --dry-run --format json
   {
     "timing": {
       "skippedAuditList": true,
       "usedBaselineFile": true,
       "parallelWallMs": 1335
     },
     "drift": {
       "structuralDistance": { "verdict": "near-identical", "overall": 1 }
     }
   }
   wall: 1.4s total (vs 26s slow path)

CLAUDE.md updated with both speedup annotations:
   --baseline-key  → ~14x faster
   --baseline-file → ~19x faster

SMOKE STEP 17z30 anchors:
   - --baseline-file flag, baselineFile default, usedBaselineFile field
   - ARGS.baselineFile branch
   - `file:` prefix in synthetic listResult (distinguishable from real keys)
   - audit-trend `--baseline` (file form) used when usedBaselineFile
   - CLAUDE.md mentions

Plus iter 58's smoke step 17z21 max-call-count relaxed: 3 (was 2)
since iter 67 adds a third mutually-exclusive oia-audit branch.

GATES THIS ITER
   smoke:    69 → 70 (step 17z30 green; 17z21 grep relaxed)
   regression: roundtrip 31/31; slow path unchanged
   tsc:      no TS source changes

WORKFLOW IMPACT
For CI workflows running drift detection on artifacts:
   1. Last week's job uploaded `oia-audit.json` artifact
   2. This week downloads it: `gh run download <prev> --name audit`
   3. Runs `drift-from-history --baseline-file ./oia-audit.json` → 1.4s
   4. No memory store dependency at all — pure file pipeline

Pre-iter-67 CI workflow would have to either commit the baseline to git
(awkward) or load metaharness-audit memory namespace (slow + stateful).
Iter 67 unlocks pure-artifact CI patterns.

ITER 53-67 DRIFT-DETECTION OPTIMIZATION ARC
   53 — drift-from-history one-command primitive
   58 — Promise.all parallelization
   65 — observability (timing field)
   66 — --baseline-key skips audit-list
   67 — --baseline-file skips memory entirely

Three input paths now supported:
  no baseline arg → discover from memory (slow, default, no-config)
  --baseline-key  → skip discovery (fast, requires key knowledge)
  --baseline-file → skip memory (fastest, requires file)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-16 21:39:05 -04:00
ruv 7790df478a perf(metaharness): --baseline-key fast-path skips audit-list (iter 66)
Iter 65's measurement revealed audit-list's ~25s ONNX warmup dominates
drift-from-history's wall-clock. Cron jobs that already know the
baseline key (e.g., from a prior audit-list invocation, or stored in
configuration) shouldn't pay that cost every tick.

Iter 66 adds --baseline-key to skip audit-list entirely.

MEASURED IMPROVEMENT

  Slow path (no --baseline-key, audit-list races oia-audit):
    wall ≈ 26000ms (audit-list ONNX dominates)

  Fast path (--baseline-key audit-2026-06-17T01-24-12-587Z):
    wall ≈ 1880ms total, parallelWallMs = 608ms
    Speedup: ~14x end-to-end (~43x for the audit-list-skipping leg)

  Verdict computation: identical ('near-identical' on self-roundtrip)

WHAT SHIPPED

plugins/ruflo-metaharness/scripts/drift-from-history.mjs:

  - --baseline-key <key> flag (lower-cased ARGS.baselineKey)
  - When set: synthesize a single-record listResult `{records: [{key,
    startedAt: null}]}` so downstream code paths don't need to change,
    then run only oia-audit (the still-required fresh-audit step)
  - When unset: original Promise.all batch (audit-list + oia-audit
    race) stays — iter-58 behavior unchanged

  timing.skippedAuditList: bool — surfaced in payload so callers can
  detect which path executed without inspecting wall-clock.

CLAUDE.md updated with the new flag, annotated with the ~43x note so
ops users discover the fast path during review.

SMOKE STEP 17z29 anchors:
  - --baseline-key flag present
  - baselineKey field initialized to null
  - skippedAuditList field present
  - if (ARGS.baselineKey) branch present
  - Synthetic record literal `records: [{ key: ARGS.baselineKey`
  - CLAUDE.md surfacing

PLUS iter 58's smoke step 17z21 relaxed: now allows ≤2 oia-audit calls
(the iter-66 fast-path and slow-path are mutually exclusive at runtime
but count as 2 textual occurrences).

GATES THIS ITER
   smoke:    68 → 69 (step 17z29 green; 17z21 grep relaxed)
   regression: roundtrip 31/31 (uses slow path, unchanged); fast-path
                with real ruflo key produces identical verdict
   tsc:      no TS source changes

WORKFLOW IMPACT
For ops running drift detection on a cron schedule:
   - Week 1: `drift-from-history` (no key) — 26s, lists then picks key
   - Week 2+: cron stores the key, uses `drift-from-history --baseline-key K` — 2s

The 24-second-per-tick savings compounds: hourly cron = 8.5h/year of
ONNX warmup avoided.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-16 21:31:36 -04:00
ruv 6ba915ac53 feat(metaharness): metaharness_drift_from_history MCP tool (iter 54)
Iter 53 shipped drift-from-history as a CLI subcommand. Iter 54 exposes
it as the 9th metaharness MCP tool so agents can call it directly
without shelling out.

WHAT SHIPPED

1. v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts
   - New tool metaharness_drift_from_history
   - Input schema: path / baselineSince / threshold / dryRun
   - Description includes MCP_SUCCESS_SEMANTIC footnote (iter 46 pattern)
   - Tool count: 8 → 9

2. plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs
   - tools.length === 9 (was 8)
   - expectedNames includes metaharness_drift_from_history
   - Phase 4 positive-case: data is an object, baseline.key string,
     alert.threshold numeric — OR no-audit-history graceful error
   - Phase 3 timeout extended to 90s for this tool (chains 3 subprocesses)
   - Summary line: "All 8 MCP tools" → "All 9 MCP tools"

3. CLAUDE.md
   - CLI subcommand listing: `ruflo metaharness drift-from-history`
   - MCP tool listing: `mcp__claude-flow__metaharness_drift_from_history`

4. plugins/ruflo-metaharness/scripts/smoke.sh
   - Step 17z17 anchors the new MCP tool (name + script-dispatch + inputs)
   - Step 17o updated: 8 → 9 expected tools + count assertion `=== 9`
   - CLAUDE.md grep guards for both subcommand + MCP tool

VERIFIED END-TO-END
   $ node test-mcp-tools.mjs
   ✓ 9 tools registered (got 9)
   ✓ metaharness_drift_from_history registered
   ✓ drift_from_history positive: data is an object
   ✓ drift_from_history: baseline.key is a string
   ✓ drift_from_history: alert.threshold echoed numerically
   115 passed, 0 failed
   ✓ All 9 MCP tools satisfy the runtime contract.

GATES THIS ITER
  runtime:  103 → 115 MCP test assertions
  tsc:      clean rebuild
  smoke:    17z17 step gating new tool surface

ITER 53-54 ARC
  53 — drift-from-history as CLI subcommand + skill (composes 3 primitives)
  54 — same surface exposed as MCP tool                              ◀ this iter

The dep is now end-to-end surfaced: production module, CLI skill, CLI
subcommand, dispatcher entry, MCP tool, doctor health check, smoke gates,
CI gates, real-data roundtrip test, CLAUDE.md documentation, unit tests,
performance benchmark, upstream-issue contributions. 13 surfaces deep.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-16 19:47:06 -04:00
ruv ab745decf9 ci(metaharness): similarity-tests job + CLAUDE.md surface docs (iter 40)
Iter 39 added the unit-test contract to smoke. This iter promotes it
into a dedicated CI job so the contract survives even if smoke is
restructured. Plus closes the discoverability gap: until now CLAUDE.md
listed 7 MCP tools and 7 subcommands; the iter-36 similarity surface
was invisible to agents reading the file as their tool catalog.

WHAT SHIPPED

1. .github/workflows/metaharness-ci.yml — new `similarity-tests` job
   (5 steps, runs on ubuntu-latest with no @metaharness/* installed):

   a. node test-similarity.mjs                 — 53 unit assertions
   b. node _spike-similarity.mjs               — iter-35 regression anchor
   c. CLI skill file-input round-trip          — produces valid JSON
   d. audit-trend structural-distance          — produces verdict in
                                                  {near-identical, minor-drift}
                                                  AND distance ∈ (0, 0.2)
   e. Graceful fallback                        — old fingerprint-less
                                                  records → verdict=unavailable,
                                                  no crash
   f. --alert-on-distance-below gate           — exits 1 below threshold

   The job runs WITHOUT installing any @metaharness/* package — proving
   architectural constraint #4 at the CI level (not just smoke level).

2. CLAUDE.md MetaHarness section now lists:
   - `npx ruflo metaharness similarity --a a.json --b b.json [...]`
   - `--alert-on-distance-below` on audit-trend
   - `mcp__claude-flow__metaharness_similarity`

   Agents reading the file as their tool catalog now see the surface
   ADR-152 §3.1 ships.

3. plugins/ruflo-metaharness/scripts/smoke.sh — step 17z3:
   - Workflow file presence + 6 step-name guards (anti-deletion)
   - CLAUDE.md mentions: mcp tool, subcommand, distance flag

GATES THIS ITER
   smoke:     43 → 44 (step 17z3 green)
   fleet:     33/33
   yaml:      python yaml.safe_load passes
   dry-run:   all 5 CI steps green locally:
                step:unit-tests OK
                step:spike OK
                step:cli-skill OK
                step:structural-distance OK near-identical
                step:alert-gate OK (exit 1 as expected)

ARCHITECTURAL CONSTRAINT REINFORCEMENT
The new CI job carries no `npm install` step — it runs `node` against
checked-in source directly. Demonstrates that ADR-152 §3.1 has zero
runtime dependencies (architectural constraint #1: removable) and is
unit-runnable without any package install (architectural constraint
#4: CI-gate). The same module imports from oia-audit + audit-trend
in production.

ITERS 36-40 ARC (ADR-152 §3.1 complete deep-integration sequence)
   35 — spike with 2 invariants on synthetic fixtures
   36 — production module + CLI skill + MCP tool + dispatcher
   37 — MCP-registry runtime contract enrolment (74 assertions)
   38 — oia-audit fingerprint capture + audit-trend structural distance
   39 — 53 unit-test assertions, 8 phases, spike regression anchor
   40 — dedicated CI job + CLAUDE.md discoverability  ◀ this iter

The dep is now: shippable (module), runnable (CLI), agent-callable (MCP),
piped through (audit-trend), library-tested (unit), CI-gated (workflow),
and documented (CLAUDE.md). Five surfaces × five proofs = textbook.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-16 16:46:16 -04:00
ruv 025f3d358e docs(claude-md): MetaHarness Integration section — make ADR-150 discoverable (iter 22)
Adds a comprehensive MetaHarness Integration section to the project
CLAUDE.md so every future Claude Code session on this repo discovers
the integration surface immediately. The deepest possible
"discoverability integration".

SECTION COVERS
- Architectural constraint with all 4 load-bearing rules quoted verbatim
- CLI command surface (8 npx ruflo metaharness subcommands + npx ruflo
  eject + npx ruflo doctor --component metaharness)
- 7 MCP tools agents can call (mcp__claude-flow__metaharness_*)
- Routing integration (CLAUDE_FLOW_ROUTER_NEURAL triple-gate)
- SelfEvolvingRouter parallel-logging (CLAUDE_FLOW_ROUTER_PARALLEL_LOG)
  with the 3-criteria AND-gate from review-round-1
- All 3 CI workflows + their roles
- Cross-references: ADR-150, issue #2399, gist, upstream repo

PLACEMENT
Section lands immediately before "## Optional Plugins (20 Available)"
— natural sequence: integrations → optional plugins. Both are
"things ruflo can do" with optional dependencies.

SMOKE STEP 17n (anti-regression)
- Section header literal present
- "Ruflo remains operational if every MetaHarness package is removed"
  quote present (load-bearing invariant)
- no-metaharness-smoke.yml referenced (constraint enforcement linked)
- npx ruflo metaharness CLI example present
- mcp__claude-flow__metaharness_ tool prefix present
- CLAUDE_FLOW_ROUTER_NEURAL / CLAUDE_FLOW_ROUTER_PARALLEL_LOG flags listed
- "quality > 2% AND cost < 1% AND latency < 5%" 3-criteria gate quoted

Easy to lose during merges; the smoke step locks the section's key
load-bearing strings so accidental removal fails CI.

Smoke: 29 → 30. Fleet: 33/33.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-16 15:04:49 -04:00
ruv 0988d92ce8 feat(intelligence): deterministic Tier-1 codemods replacing Agent Booster (ADR-143)
The ADR-026 Tier-1 "Agent Booster, $0, no LLM" path was dead code AND wired
wrong (it fed natural-language instructions to a snippet-merge engine that
expects target code), and the module didn't even resolve. Replace it with real
deterministic codemods so the $0/no-LLM claim is literally true.

- engine.ts: TS-compiler codemods (var-to-const, remove-console, add-logging)
  with formatting-preserving text-range edits + a parse-diagnostic safety net.
- scope-analysis.ts: function-scope reassignment resolution (var→const promotes
  more vars to const without ever producing an incorrect const).
- enhanced-model-router: Tier-1 gated on deterministic intents; route-time
  dry-run only emits [CODEMOD_AVAILABLE] when the edit actually changes a file;
  add-types/add-error-handling/async-await honestly route to a model.
- hooks_codemod MCP tool: real executable Tier-1 surface — single file, files[],
  or glob batch; $0; path-contained.
- Honest [CODEMOD_AVAILABLE] emitters replace [AGENT_BOOSTER_AVAILABLE] and the
  phantom agent_booster_edit_file reference; CLAUDE.md Tier-1 tables corrected.
- Benchmark + golden corpus (12 cases, 100% correct, ~0.55ms/edit, $0) with a
  CI guardrail test; run JSON in cost-trend schema.

Tests: codemod-engine (23), codemod-routing (4), codemod-corpus (13); full CLI
suite 2086 pass / 46 skipped. Closes #2238.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-29 15:40:11 -04:00
rUv 08b3623759 fix+perf+docs(intelligence): self-learning audit, hardening fixes, honest perf numbers (3.10.7) (#2228)
* docs(review): empirical capability audit of the intelligence/self-learning system

6 parallel auditors ran real measurements against built dist (not docs).
- Self-learning loop is REAL, measured end-to-end (pattern confidence +
  Q-routing change persist cross-process; MoE gating converges; SONA WASM
  adapt 0.0042ms; Int8 3.92x; RaBitQ 32x memory — all CONFIRMED).
- Performance multipliers largely UNSUBSTANTIATED: HNSW 150x-12,500x measured
  1.48x peak; Flash Attention 2.49-7.47x fabricated via Math.random() at
  runtime; embeddings 75x / RaBitQ 2.70x retrieval never benchmarked.
- 1 critical bug: CLI inverts negative reward (route feedback -r -1.0 -> +1.00).
- Real-but-inert: WASM MicroLoRA apply(), MCP consolidation gradient (synthetic),
  hooks_intelligence_learn (cosmetic), CLI trajectory-* (no-op stubs), silent
  mock-embedding mislabel.

No source modified — audit branch only. Prioritized fix list in the report.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix+perf(intelligence): harden self-learning system + replace fabricated/unsubstantiated perf numbers with measured ones

Implements the prioritized fix list from docs/reviews/intelligence-system-audit-2026-05-29.md.

FIXES
- CRITICAL (audit #1, #2222 follow-up): CLI inverted negative reward — route feedback
  -r -1.0 / --reward -1.0 parsed as +1.00, so negative feedback REINFORCED the bad
  agent. Fixed in src/parser.ts (isFlagValue accepts negative numeric literals). All
  three syntaxes now yield -1.0; +6 regression assertions; 52/52 parser tests pass.
- audit #2: removed fabricated Flash Attention speedup (randomized/midpoint telemetry)
  in attention-coordinator (swarm + integration) -> unmeasured sentinel + unverified.
- audit #3: generateEmbedding returns backend:onnx|mock, surfaced in bridge_status /
  import_claude so mock embeddings are never mislabeled as real ONNX.
- audit #4/#5: trajectory-end no longer feeds EWC a synthetic sine gradient;
  hooks_intelligence_learn runs a real distill/consolidate cycle. New test added.

OPTIMIZE (HNSW, measured): root cause — HNSW never ran (no storagePath -> native DB
lock held by daemon -> silent catch{} -> brute force). Fixed vector-db.ts (unique
storagePath, hnswConfig m:32/efC:200, visible fallback warning). Same-harness
before->after: N=5000 0.92x->3.2-4.7x, N=20000 0.95x->1.89x; N=1000 below crossover
(reported honestly); reverted m16/efC64 (recall loss).

BENCHMARK: new scripts/benchmark-intelligence.mjs (HNSW N=1k-50k, Int8 3.84x/cos
0.99999, RaBitQ 32x/0.60ms, SONA 0.0043ms, MoE 0.13->0.88, embedding backend).

DOCS: README + 3x CLAUDE.md + READMEs perf tables now show MEASURED values or
unverified/target; HNSW 150x-12,500x & Flash 2.49-7.47x marked NOT reproduced.

Verification: cli build clean (tsc); 161/161 targeted tests pass.

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(release): bump 3.10.6 → 3.10.7 (intelligence hardening + honest perf docs)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-29 12:13:53 -04:00
ruvandRuFlo 619b263aa6 docs(claude.md): switch publishing policy from alpha to stable semver
User decision 2026-05-23 — alpha series ended at 3.7.0-alpha.81. From
3.7.0 onward, publish stable semver releases (3.7.0, 3.7.1, 3.8.0)
rather than alpha pre-releases.

Bump rules now codified:
  - PATCH (3.7.0 → 3.7.1) — bug fixes only
  - MINOR (3.7.0 → 3.8.0) — backward-compat additions
  - MAJOR (3.x → 4.0.0) — breaking change

Default `npm publish` tag is `latest`. The legacy `alpha` and `v3alpha`
dist-tags MUST keep existing and point at the latest stable so existing
install commands (`npx ruflo@alpha`, `npx claude-flow@v3alpha`) keep
working.

Also added a #2112 callback in the publishing checklist — when adding a
new pinned transitive to root `package.json` overrides, remember to
mirror it to `ruflo/package.json` overrides (the published wrapper does
NOT inherit from root).

Also added a "GitHub Release after publish" section pointing at
`gh release create v<version>` since we now have stable version tags
worth pinning releases to.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-23 15:23:45 -04:00
Reuvenandclaude-flow c44f527a1e feat: lean CLAUDE.md generator with SendMessage-first coordination
Rewrites claudemd-generator.ts from ~577 to ~280 lines (~50% token reduction).
Adds agent comms (SendMessage pipeline) as core section in every template.
Updates root CLAUDE.md to v3.6.10 with comms-first agent teams section.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-29 19:29:02 -04:00
Reuvenandclaude-flow 5b3169171a docs: update CLAUDE.md with memory bridge MCP tools and accurate stats
- Add Claude Code ↔ AgentDB Memory Bridge section with 3 MCP tools:
  memory_import_claude, memory_bridge_status, memory_search_unified
- Update header: 314 MCP tools, 16 agent roles, 19 AgentDB controllers
- Update package versions to 3.5.65
- Document auto-import on session start, unified search, intelligence pipeline

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-06 21:50:38 -04:00
rUv 6ff8a77e1a docs: update MCP tool counts to 259, add beginner guidance (#1366)
- Update MCP tool count from 175/170/213 to 259 across README and CLAUDE.md
- Update commit count from 5,800 to 5,900+
- Add beginner-friendly callout after install section (addresses #1196)
- Fix claude-flow umbrella v3alpha dist-tag to 3.5.22
2026-03-17 13:09:14 -04:00
rUv 4603300368 feat: Ruflo v3.5.0 — first major stable release with full agentic-flow integration
Rebranding from Claude Flow to Ruflo. Includes:
- agentic-flow v3.0.0-alpha.1 deep integration (10 subpath exports)
- AgentDB v3.0.0-alpha.9 with 8 controllers + 6 MCP tools
- Unified agentic-flow bridge with tiered embedding resolution
- Security hardening (command injection fix, TOCTOU race fix)
- Doctor health check for agentic-flow
- 22 agent/skill files updated to v3.0.0-alpha.1
- ADR-054, ADR-055, ADR-056
- Comprehensive CHANGELOG from 5,800+ commits
- All 3 packages bumped to 3.5.0

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-02-27 22:37:14 +00:00
rUv 502cd0e478 Fix ruflo CLI wrapper and hook paths for subdirectory execution
- Fix ruflo bin to walk node_modules tree instead of using require.resolve
  (blocked by @claude-flow/cli strict exports map)
- Use git rev-parse --show-toplevel for all hook paths in settings.json
  so hooks work from any subdirectory
- Update CLAUDE.md publishing rules to include ruflo as third package
- Bump ruflo to 3.1.0-alpha.16

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-02-16 18:22:49 +00:00
rUvandClaude Opus 4.5 81285a9349 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-02-07T22:48:42Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 22:48:42 +00:00
rUvandClaude Opus 4.5 ec23b8ea6e Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-02-07T22:48:32Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 22:48:32 +00:00
rUvandClaude Opus 4.5 e39f7539c5 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-02-07T22:32:53Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 22:32:53 +00:00
rUvandClaude Opus 4.5 e62af14143 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-02-07T22:31:32Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-07 22:31:32 +00:00
rUvandClaude Opus 4.5 6e5c37bc0a Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T06:03:42Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 06:03:42 +00:00
rUvandClaude Opus 4.5 952fbe80e1 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T06:03:21Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 06:03:21 +00:00
rUvandClaude Opus 4.5 bb760b87bf Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T06:03:01Z
- Changes: 6 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 06:03:01 +00:00
rUvandClaude Opus 4.5 7143c0fbbf Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T06:00:28Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 06:00:29 +00:00
rUvandClaude Opus 4.5 d9af275698 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T06:00:18Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 06:00:18 +00:00
rUvandClaude Opus 4.5 3297a8ebcd Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:39Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:39 +00:00
rUvandClaude Opus 4.5 217b07aa0e Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:33Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:33 +00:00
rUvandClaude Opus 4.5 1c9bf6dd59 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:28Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:28 +00:00
rUvandClaude Opus 4.5 8515ee8d71 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:23Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:23 +00:00
rUvandClaude Opus 4.5 c3155436c6 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:16Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:16 +00:00
rUvandClaude Opus 4.5 63c5448300 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:10Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:10 +00:00
rUvandClaude Opus 4.5 6dcbc72f04 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:04Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:04 +00:00
rUvandClaude Opus 4.5 cfc2ca36c8 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:48:00Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:48:00 +00:00
rUvandClaude Opus 4.5 3cc1f69380 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:47:55Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:47:55 +00:00
rUvandClaude Opus 4.5 f67a8c5304 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: optimize/claude-md-governance
- Timestamp: 2026-02-02T05:47:50Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 05:47:50 +00:00