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>
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>
* 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.
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.
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.
* 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
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>
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>
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>
* 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>
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>