ruvnet's response to @shaal on #2078 acknowledges that the
settings-generator opt-in (#2079 → ruflo-bot email) only fixes half
the surface. The other half is the Claude Code Bash tool's built-in
commit-message instructions, which suggest `Co-Authored-By: RuFlo
<ruv@ruv.net>` regardless of project settings. Users have to
explicitly tell Claude to ignore that suggestion.
This patch adds a rule to the generated CLAUDE.md that does exactly
that — every fresh `ruflo init` now writes:
- NEVER add a `Co-Authored-By` trailer to user commits unless this
project's `.claude/settings.json` has `attribution.commit` set
(#2078). The Claude Code Bash tool may suggest one in its default
commit-message template — ignore it. `Co-Authored-By` is semantic
authorship attribution under git/GitHub convention; the tool is
the facilitator, not a co-author.
The agent reads this on every session start, so the Bash-tool default
gets overridden at the project level without the user having to
discover the override themselves.
Settings-level (`attribution.commit`) opt-in path still works for
users who want the trailer.
Verified: `ruflo init --preset default` in a clean tmpdir produces a
CLAUDE.md containing the rule.
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Three independent bugs across three subsystems, all reproducible on
alpha.76 today. Each fix is small and localized.
#2098A — `--no-global` flag silently ignored (@pierrefuseau)
The parser handles `--no-foo` by stripping the prefix and storing
`flags.foo = false` (parser.ts:291-294), not by storing
`flags['no-foo'] = true`. The consumer at init.ts:190 read the
wrong key (`flags['no-global']`), so the flag was always undefined
and the global ~/.claude/CLAUDE.md got modified anyway.
Fix: read `flags['global'] === false` (the canonical form) AND
keep accepting the literal-key form for any caller passing flags
programmatically.
#2098B / #2093 — Daemon subprocess group not killed (@pierrefuseau, @maxstefanakis1114)
headless-worker-executor.ts spawns `claude --print` without
`detached: true`. Grandchildren (MCP stdio bridges, plugin tools)
belong to the parent's process group, so `child.kill()` on
timeout only signals the head — grandchildren get reparented to
init and leak. Combined with the queue-file path the alpha.73
`.processed/` rename already fixed, the surface was 90% closed
but the residual gap was the missing tree-kill.
Fix: spawn with `detached: true` (POSIX only — Windows process
groups don't work the same way), then signal the group with
`process.kill(-pid, sig)` instead of `child.kill(sig)`. Fallback
to plain `child.kill` if -pid kill fails for any reason.
#2085 — agent_spawn not in swarm_status.agents (@seo-yas)
agent_spawn writes only to the agent store (agent-tools.ts:275),
swarm_status reads only from the swarm store. The two stores are
never bridged. Every topology is affected, not just hierarchical
as the reporter assumed. Also the schema never accepted
`swarmId` — which is why their 5 parameter-shape variants all
failed identically.
Fix: add `swarmId` to the agent_spawn input schema (optional;
defaults to most-recently-created swarm), then after writing the
agent store, also push the agentId into `swarm.agents`. Idempotent
so retries don't duplicate. Exports `loadSwarmStore`/
`saveSwarmStore` from swarm-tools.ts so agent-tools.ts can write
to the same on-disk store the swarm tools read from.
Build: `npm run build` in v3/@claude-flow/cli — clean.
Existing smokes: init-bundle-invariants + github-safe-injection PASS.
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Adds scripts/smoke-init-bundle-invariants.mjs with three assertions:
1. Every subdir under .claude/{commands,agents}/ has a COMMANDS_MAP or
AGENTS_MAP entry (zero orphaned dirs).
2. Every skill in SKILLS_MAP has SKILL.md or README.md in the package
(catches Phase 1 regression).
3. No init-template agent shares a basename with a plugin agent (ADR-128
Phase 2 dedup invariant).
Also copies the 5 remaining SKILLS_MAP-referenced skills that were not in
the 29 Phase-1 core/agentdb/github/v3 set (browser, flow-nexus-neural,
flow-nexus-platform, flow-nexus-swarm, dual-mode) so assertion 2 passes.
Wires the smoke into v3-ci.yml as init-bundle-invariants-smoke job with
path filters on .claude/**, src/init/**, plugins/*/agents|skills|commands/**,
and the smoke itself.
Smoke matrix: init-bundle-invariants=PASS, deprecated-actions=PASS,
github-safe-injection=PASS, github-actions-pins=PASS,
attribution-opt-in=PASS, ruvllm-wasm-auto-init=PASS,
plugin-registry-signature=PASS — no regressions.
Co-Authored-By: RuFlo <ruv@ruv.net>
Deletes commands/flow-nexus/ (9 files) — the only directory the ADR
explicitly marks for deletion. Promotes all remaining orphaned substrate
dirs to first-class COMMANDS_MAP keys: agents, coordination, hiveMind,
memory, swarm, workflows (default true) and pair, training, streamChain,
truth, verify (opt-in, default false). Adds matching CommandsConfig
interface fields and DEFAULT_INIT_OPTIONS entries.
Deviation from task's estimated "87 orphan deletions": the ADR Phase 3
resolution for the other 78 orphaned files is promotion (add COMMANDS_MAP
key), not deletion. Deleting substrate commands like swarm/, memory/,
hive-mind/ would be a regression. Only flow-nexus/ (domain-specific,
plugin-owned) is deleted. Ambiguous-as-substrate files preserved.
Co-Authored-By: RuFlo <ruv@ruv.net>
Changes DEFAULT_INIT_OPTIONS.agents: github, hiveMind, v3, optimization
now default false; core, consensus, swarm, sparc, testing remain true.
agents.all flipped from true to false. Adds --all-agents CLI flag to
restore the full set when users explicitly opt in.
Default install now ships ~17 substrate agents instead of 98. Full set
(89 after Phase 2) available via: ruflo init --all-agents
Co-Authored-By: RuFlo <ruv@ruv.net>
Deletes the 9 init-template agent files that have diverged from their
canonical plugin counterparts. Plugins now own: coder.md (ruflo-core),
researcher.md (ruflo-core), reviewer.md (ruflo-core), tester.md
(ruflo-testgen), memory-specialist.md (ruflo-rag-memory),
security-auditor.md (ruflo-security-audit), sparc-orchestrator.md
(ruflo-sparc), goal-planner.md (ruflo-goals), adr-architect.md
(ruflo-adr). AGENTS_MAP not modified: map values are directory names;
the copy function picks up whatever files remain in those dirs.
Co-Authored-By: RuFlo <ruv@ruv.net>
Builds on ADR-127 (which only modernized .github/). Generalizes the
discipline to the whole init bundle, plus fixes the skill
source-of-truth gap surfaced at the close of ADR-127.
Top three findings:
1. All 9 forked agents have genuinely diverged. Largest is
memory-specialist.md at 1,049 diff lines between init template
(agents/v3/) and the ruflo-rag-memory plugin.
2. 87 of 176 init-template command files are orphans — they ship in
the npm tarball (.claude/ is in files[]) but no COMMANDS_MAP key
reaches them. Every install carries dead weight.
3. The agents.all=true default in DEFAULT_INIT_OPTIONS makes every
project install all 98 agents including domain-specific subtrees
(flow-nexus/, payments/, data/). One-character flip to false drops
default agent count from 98 → ~24.
Tracking issue: #2095.
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Post-publish validation of alpha.74 found 5 init-template agents still
shipping `actions/checkout@v3`:
v3/@claude-flow/cli/.claude/agents/github/release-manager.md
v3/@claude-flow/cli/.claude/agents/github/swarm-pr.md
v3/@claude-flow/cli/.claude/agents/github/release-swarm.md
v3/@claude-flow/cli/.claude/agents/github/repo-architect.md
v3/@claude-flow/cli/.claude/agents/github/workflow-automation.md
The Phase 3 sed in PR #2094 only scanned `.claude/agents/github/`
(dogfood) and `v3/@claude-flow/cli/.claude/commands/github/` (init
commands). It missed the *init-template agents* subtree at
`v3/@claude-flow/cli/.claude/agents/github/` and the *dogfood commands*
at `.claude/commands/github/`.
`smoke-deprecated-actions.mjs` had the same scan-tree gap, which is
why CI didn't catch this. Smoke now scans all 5 trees:
.claude/agents/github/
.claude/skills/
.claude/commands/github/ (added)
v3/@claude-flow/cli/.claude/agents/github/ (added)
v3/@claude-flow/cli/.claude/commands/github/
Verified: `npm pack @claude-flow/cli@3.7.0-alpha.74 && grep ... @v3`
showed the 5 missed files in the published tarball.
Versions bumped to 3.7.0-alpha.75 across cli + claude-flow umbrella + ruflo wrapper.
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
The >256KB rejection case fails on Linux CI because Linux's
MAX_ARG_STRLEN (128 KiB per argv element on most kernels) trips
before the helper's own size cap fires. spawnSync returns
status=null with error.code='E2BIG' instead of status=1.
Local macOS development passes because Mach's per-arg limit is
~1 MiB so the helper's cap is what fires. The smoke now accepts
either path — the assertion is "rejected before gh is invoked,"
and E2BIG satisfies that even more strongly (the body cannot
reach exec at all).
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Remove 13 hardcoded "Generated with Claude Code" attribution strings from
6 github command/agent/skill files (dogfood + init-template copies):
.claude/agents/github/{release-manager,sync-coordinator,issue-tracker}.md
.claude/skills/github-project-management/SKILL.md
v3/@claude-flow/cli/.claude/commands/github/{release-manager,sync-coordinator,issue-tracker}.md
Add <!-- last-updated: 2026-05-21 — ADR-127 --> stamps to the top-level
code-block boundary of each edited file so readers can trace the change
back to this ADR without opening git log.
Export ATTRIBUTION_FOOTER from helpers-generator.ts (ADR-127 §opt-in):
when options.attribution === true, materialise a .claude/helpers/attribution
file during init so PR templates can append it conditionally, without
hard-wiring the emoji into every user's commit history (#1670).
Add scripts/smoke-attribution-opt-in.mjs + github-attribution-opt-in-smoke
CI job: static scan that fails if the 🤖 emoji pattern reappears in the
three github-scoped template trees — prevents copy-paste regression.
Co-Authored-By: RuFlo <ruv@ruv.net>
Replace all actions/checkout@v3 and actions/setup-node@v3 refs with @v4
across .claude/agents/github/, .claude/skills/github-*/,
and v3/@claude-flow/cli/.claude/commands/github/ (19 files total).
Add scripts/smoke-deprecated-actions.mjs: static scan that fails if any
of the deprecated refs (checkout@v3, setup-node@v3,
create-release@*, upload-release-asset@*, softprops/action-gh-release@v1)
reappear in scope — preventing copy-paste regression from blog posts or
AI-generated YAML snippets.
Wire github-deprecated-actions-smoke job and path filter into v3-ci.yml
so every future PR touching the github surface re-runs this gate.
Co-Authored-By: RuFlo <ruv@ruv.net>
github-safe.js (both copies — dogfood + init-template)
Adds GITHUB_SAFE_VERSION='1.0.0' constant for smoke assertions.
Adds explicit 256KB body cap (MAX_BODY_BYTES): rejects oversized bodies
with exit 1 before any temp-file write, matching the GitHub API body
field limit documented in ADR-127. Adds strict error handling: all
execSync calls wrapped in try/catch, cleanup in finally. Adds
GITHUB_SAFE_DRY_RUN=1 env-var for smoke tests to skip gh exec.
github-setup.sh (both copies)
Prepends set -euo pipefail. Replaces bare `gh auth status &>/dev/null`
with a check that parses "Logged in" and "repo" scope from the output.
Adds security rationale comment explaining why each flag is needed.
Agent frontmatter WebFetch removal (dogfood copies only — init-template
commands don't have frontmatter; the relevant change there is the injection
fix below):
release-manager.md — removes WebFetch (keeps Write for CHANGELOG)
release-swarm.md — removes WebFetch (keeps Write for CHANGELOG)
repo-architect.md — removes WebFetch
All 13 agents already have explicit tools: lines; only the 3 above had
WebFetch. No agent in scope now has WebFetch in its tools: list.
swarm-pr.md + swarm-issue.md (BOTH dogfood .claude/agents/github/ AND
init-template v3/@claude-flow/cli/.claude/commands/github/):
Replaces unquoted ${{ github.event.comment.body }} interpolated into
--comment "..." with mktemp + printf + grep + --comment-file pattern.
Replaces unquoted ${{ github.event.label.name }} == "swarm-ready" with
mktemp + printf + grep -qx pattern. Closes prompt-injection path where
a PR comment with shell metacharacters could execute attacker-controlled
shell in a pull_request-triggered workflow.
smoke-github-safe-injection.mjs updated:
Upgrades the >256KB test case from "note" (Phase 1 red) to "ok" (Phase 2
green) now that the 256KB cap is enforced.
Acceptance checks:
node scripts/smoke-github-safe-injection.mjs → all 5 cases pass
node scripts/smoke-github-actions-pins.mjs → ok (no regressions)
grep -r 'github.event.comment.body.*--comment' .claude/agents/ v3/@claude-flow/cli/.claude/
→ exit 1 (no matches)
Co-Authored-By: RuFlo <ruv@ruv.net>
Creates two new CI smoke scripts and wires them into v3-ci.yml.
smoke-github-safe-injection.mjs
Generalizes the smoke-pre-bash-hook.mjs pattern (#2017) to the GitHub
helper surface. Drives adversarial PR/issue bodies (backticks, $(),
semicolons, empty) through github-safe.js via a fake-gh shim and
asserts the body lands verbatim in a temp file with --body-file, not
inline as --body. The >256KB cap case is documented as a red→green
transition for Phase 2 (no cap yet enforced). Runs against both
.claude/helpers/github-safe.js (dogfood) and the init-template copy.
smoke-github-actions-pins.mjs
Static scan of .claude/agents/github/*.md, .claude/skills/github-*/
SKILL.md, and v3/@claude-flow/cli/.claude/commands/github/*.md. Every
uses: ref must be SHA-pinned (40-hex) OR present in the new
.github/supply-chain/allowed-deps.json "actions" block. Exits 0 now
that allowed-deps.json covers the full set of refs in-use. Phase 3
upgrades @v3→@v4 across all files; this smoke is the regression gate
that prevents them drifting back.
.github/supply-chain/allowed-deps.json
Adds "actions" key with allowed[], minimumVersion, and an explanatory
comment per ADR-127 §Phase 1. Lists all GitHub Actions currently
referenced in scope: checkout, setup-node, pnpm/action-setup, cache,
upload-artifact, ruvnet/swarm-action, aws-actions/configure-aws-credentials.
.github/workflows/v3-ci.yml
Adds path-filter entries under both push and pull_request triggers
covering the 6 ADR-127-specified paths:
.claude/agents/github/**
.claude/skills/github-*/**
v3/@claude-flow/cli/.claude/commands/github/**
.claude/helpers/github-safe.js
v3/@claude-flow/cli/.claude/helpers/github-safe.js
scripts/smoke-github-*.mjs
.github/supply-chain/allowed-deps.json
Adds two independent smoke jobs: github-safe-injection-smoke and
github-actions-pins-smoke, following the ruvllm-wasm-auto-init-smoke
pattern.
Co-Authored-By: RuFlo <ruv@ruv.net>
The original draft missed `.claude/skills/github-workflow-automation/SKILL.md`
(23KB, last touched 2026-04-06) in the dogfood-layer count. Fix the
inventory line in §Context so Phase 1 + Phase 3 work targets the correct
set of files.
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Proposes a 4-phase modernization of the .github-related skills, commands,
agents, and init-template surface, grounded in patterns already shipped:
the static-contract smoke pattern from #2017 / #1922 / #2086, the
5-layer supply-chain audit in scripts/audit-supply-chain.mjs, and the
opt-in attribution refactor from #2079.
Top three gaps the research found:
1. swarm-pr.md and swarm-issue.md interpolate \${{ github.event.comment.body }}
into shell unquoted — the same class of silent-failure that #2017 fixed.
2. ruvnet/swarm-action@v1 (first-party) ships unpinned; the supply-chain
audit covers 5 npm layers but zero .yml \`uses:\` references.
3. 19 GitHub command files inject attribution footers unconditionally,
ignoring the opt-in toggle that #2079 added in settings-generator.
Tracking issue: #2089.
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Reported by @seo-yas. The `loadRuvllmWasm()` helper in
`v3/@claude-flow/cli/src/mcp-tools/ruvllm-tools.ts` did a bare
`import('../ruvector/ruvllm-wasm.js')` and never called
`initRuvllmWasm()`. Result: `_wasmReady` stayed false even after
`ruvllm_sona_create` / `ruvllm_microlora_create` / `ruvllm_hnsw_create`,
which left every downstream `sona_*` / `microlora_*` / `hnsw_*` call
either erroring inside the WASM module or returning empty.
`ruvllm_status` reported `wasm.available=true, wasm.initialized=false`
forever because nothing triggered `initSync({ module: wasmBytes })`.
Fix: fold `await mod.initRuvllmWasm()` into `loadRuvllmWasm()`. The
init function is idempotent (early-returns on `_wasmReady`), so the
cost after the first call is one boolean check. `ruvllm_status`
deliberately uses a separate `loadRuvllmWasmModule()` helper so the
diagnostic path stays callable when init has not been attempted (a
diagnostic that triggers the very thing it diagnoses is worse than
useless).
CI guard: `scripts/smoke-ruvllm-wasm-auto-init.mjs` statically asserts
all 12 invariants the fix relies on. Wired into v3-ci.yml as
`ruvllm-wasm-auto-init-smoke` with path filters on the two source files
and the smoke itself, so future refactors that drop the `await
mod.initRuvllmWasm()`, reroute `ruvllm_status` through the auto-init
loader, or add a new `ruvllm_*` tool that bypasses `loadRuvllmWasm()`
without an instance lookup will fail the check before merge.
Versions bumped to 3.7.0-alpha.73 (cli, claude-flow umbrella, ruflo).
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Claude Code's plugin manifest schema requires `repository` to be a
string URL. This plugin declared it as an npm package.json-style object
({type,url,directory}), causing every install to fail with:
Validation errors: repository: Invalid input: expected string, received object
ruflo-graph-intelligence is the only plugin in the marketplace affected.
Place above the ruFlo Summit badge in the three customer-facing READMEs
(repo root, ruflo wrapper package, @claude-flow/cli package). Same
hosting pattern as the summit asset.
Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
Three-part security review of the ruflo-neural-trader plugin, documented
under plugins/ruflo-neural-trader/docs/.
1. Supply-chain audit (security-audit-2026-05-20.md):
- `node scripts/audit-supply-chain.mjs` filtered for the plugin:
no plugin-specific findings
- Repo-wide layers all clean: 0 CVE direct-dep, 0 lockfile integrity,
0 allowlist, 0 typosquat hits, 5 known publisher-trust entries
2. Static checks on plugin files (security-audit-2026-05-20.md):
- `grep process.env|API_KEY|SECRET`: only documented prereqs
(ANTHROPIC_API_KEY in trader-cloud-backtest) and feature flags
(RUFLO_SUBLINEAR_NATIVE in sublinear-adapter). No hardcoded
secrets anywhere.
- `grep eval|new Function`: zero in code.
- `grep spawn|execSync|spawnSync`: zero actual invocations —
only documentation comments. Reviewed against the #2073/#2074
Windows ENOENT regression: plugin never calls spawn* directly.
3. AIDefence wiring sketch (aidefence-wiring.md):
- Per ADR-118, market data ingestion should pass through
`aidefence_has_pii` / `aidefence_scan` / `aidefence_is_safe` —
the same four-gate pattern ruflo-browser and ruflo-federation
already use.
- Wire points: `--symbol $TICKER` input + `fetchLiveBars` JSON
response in market-analyst, plus the LLM prompt body and the
AgentDB store value.
- NOT implemented in this PR. Deferred to a separate ADR-127
follow-up — wiring before the ADR-126 Phase 5 comms boundary
is stable risks landing the gates in the wrong place.
Verdict: no blocking findings. The plugin is safe to ship as-is; the
AIDefence wiring is a defense-in-depth enhancement, not a remediation.
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
Add docs/perf-notes.md ranking the three hotspots identified by the #48
bench suite, with one concrete in-scope optimization shipped here.
Optimization (sublinear-adapter.mjs / neumannSeries):
Replace per-iter `new Float64Array(n)` allocation with a two-buffer
ping-pong (cur / next, swapped by reference). At n=256 a typical
5-iter solve previously allocated 5×2 KB of garbage per call — fully
eliminated. Algorithm unchanged: Jacobi-style update from cur into
next, convergence check on inf-norm(next-cur), swap.
Measured (portfolio-cg.bench.mjs at n=256, 5-run mean):
- Before: Neumann avg ~0.635 ms
- After: Neumann avg ~0.522 ms (~18% faster)
- Parity: ||cg − neumann||_∞ = 2.12e-8 (identical to baseline)
- smoke-neural-trader-portfolio-cg.mjs: PASS
Tracked-not-fixed (documented in perf-notes.md):
- Memory recall scales ~96% of linear in the bench — production
path uses HNSW (ADR-006), the bench is the recall regression gate.
- Signal scan p99 ~9× p50 — GC pressure suspected; upstream
`npx neural-trader` change, not plugin-layer.
Explicitly NOT optimized (would break a contract):
- canonicalBytes — ADR-126 Phase 4 / CWE-347 parity with the
plugin-registry signer requires `JSON.stringify` with NO sort.
- isSymmetric — already short-circuits; full scan IS the SPD guard
the smoke depends on.
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
Add three self-contained benchmark files under
`plugins/ruflo-neural-trader/benchmarks/` to baseline JS-side compute
throughput for the plugin's hot paths. None of these touch
`portfolio-cg.bench.mjs` (ADR-126 Phase 3 / #2080 territory).
1. signal-generation.bench.mjs — anomaly-detection arithmetic core
shared with `trader-signal --signal scan`. 5 symbols × 252 daily bars
× 200 iters. Worst-symbol avg ~22 µs, full-scan sum-of-avgs <0.1 ms.
2. backtest-throughput.bench.mjs — SMA(10)/SMA(50) crossover on 1 sym
× 252 daily bars. Avg ~0.04 ms / >6M bars/sec. Also reports Sharpe,
max drawdown, trade count on the resulting equity curve so the
bench doubles as a strategy regression gate.
3. memory-recall.bench.mjs — cosine-similarity top-K linear scan
over N ∈ {100, 1000, 5000} 384-dim Gaussian embeddings (matches
all-MiniLM-L6-v2 output dim). p95 at N=5000 is ~4 ms. Recall@10
is computed against a 90% subset — the approximate-vs-exact gap
an HNSW backend would have. The bench is the regression budget
for any future linear→HNSW migration in the plugin.
Each bench writes markdown to stdout; baselines for all three are
captured under benchmarks/results/<name>-baseline-<timestamp>.md.
Synthetic data is mulberry32-seeded so the numbers are stable across
runs and CI workers — no live Yahoo, no network dependency.
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
The Phase 3 SublinearAdapter (PR #2070) shipped with a JS-only kernel.
This wires the dispatch path to mcp__ruflo-sublinear__solve when the
ruflo-sublinear plugin is registered + available at runtime, falling
back to the local JS CG when not. The dispatch is detected via
`SublinearAdapter.detectSublinearTool()` (probes globalThis for the
mounted tool first, then honours `RUFLO_SUBLINEAR_NATIVE=1` as an
operator-controlled manual override for canary / A-B rollouts).
When the native path is hit, expected speedup is 40-60× per the
sublinear-time-solver@1.7.0 measured baseline (816 ns vs 50 µs Neumann
at n=256). Local JS fallback remains at 1.5-1.9× — same as PR #2070's
measured baseline, re-confirmed in this branch's bench.
Adapter result now carries `method: 'cg-sublinear-native' | 'cg-local'`
and `solver: 'sublinear-time-solver@1.7.0' | 'local-js-cg'` so the
operator can verify which backend ran. The trader-portfolio-cg skill
pulls both fields straight from the adapter result and records them
in the trading-risk artifact metadata.
Bench gained `CG native (ms)` and `Native speedup` columns — graceful
"n/a" when the tool surface isn't reachable. The smoke gained contract
checks for `detectSublinearTool`, `RUFLO_SUBLINEAR_NATIVE`, and the
new method+solver result fields. Smoke only validates the dispatch
contract; the actual 40-60× measurement requires the daemon to mount
the MCP tool — CI exercises that path.
Files:
- plugins/ruflo-neural-trader/src/sublinear-adapter.{ts,mjs}
- plugins/ruflo-neural-trader/skills/trader-portfolio-cg/SKILL.md
- plugins/ruflo-neural-trader/benchmarks/portfolio-cg.bench.mjs
- plugins/ruflo-neural-trader/benchmarks/results/cg-native-baseline-20260520T202735Z.md
- scripts/smoke-neural-trader-portfolio-cg.mjs
Refs #55 (downstream task tracker), ruvnet/ruflo#2068 (ADR-126 Phase 3)
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
The opt-in attribution feature (#1670) used `ruv@ruv.net`, a personal
email that GitHub maps to the maintainer's contributor graph. When
users opt in (or have legacy `.claude/settings.json` from before #1670),
the trailer silently adds ruvnet as a contributor to their repos.
Switch to `ruflo-bot <ruflo-bot@users.noreply.github.com>` — GitHub's
no-reply convention excludes the address from contributor graphs and
maps it to a tool identity rather than a person.
The default (no `--attribution` flag) still writes no trailer at all
per #1670. This is purely about what's written when the user opts in.
Also updates the same trailer format in three sibling locations that
hardcoded the personal email:
- v3/@claude-flow/cli/.claude/settings.json (this repo's local settings,
eating our own dog food)
- v3/@claude-flow/codex/src/generators/agents-md.ts (codex AGENTS.md
template generator)
- v3/@claude-flow/codex/AGENTS.md (the generated AGENTS.md, regenerated
to match the template change)
Out of scope: the harness portion of #2078 (Claude Code runtime trailer)
is a separate concern handled by the Claude Code itself, not by ruflo.
Refs #2078
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
Bumps @claude-flow/cli, claude-flow, ruflo to 3.7.0-alpha.72 carrying
the fix for #2073 (memory export returned null values; new --value-only
pipe-friendly retrieve flag).
Published:
- @claude-flow/cli@3.7.0-alpha.72 (tags: alpha, latest, v3alpha)
- claude-flow@3.7.0-alpha.72 (tags: alpha, latest, v3alpha)
- ruflo@3.7.0-alpha.72 (tags: alpha, latest, v3alpha)
Verified against the published artifact: `npx @claude-flow/cli@3.7.0-alpha.72
memory export -o out.json -f json -n test` now writes the real entry
value as a parseable JSON string (was null in alpha.71).
Refs #2073
Co-Authored-By: RuFlo <ruv@ruv.net>
Two related fixes for the cost-tracker reporting pipeline:
1. `memory export -f json` now writes the real entry value instead of
null. Root cause: the export tool used `(e as { value?: unknown }).value`
but `listEntries` only returned metadata — the SELECT pulled `content`
from SQL but the result-mapping dropped it. Fix: `listEntries` /
`bridgeListEntries` now accept `includeContent: true` to opt into
returning the full content string, and `memory_export` passes that
flag + writes `e.content` to the exported `value` field.
2. `memory retrieve --value-only` emits ONLY the raw value to stdout —
no box, no banner, no decoration — designed for piping into JSON.parse
without any cleanup. Closes the third suggested fix from #2073.
3. `memory retrieve --format json` was already wired in the handler but
wasn't discoverable through `--help`. Removed dead per-command option
override (the global --format from parser.ts:78 already handles it
with choices: ['text','json','table']) and documented it in a comment.
Backward compat: when callers don't pass `includeContent`, listEntries
omits the field entirely (no behavior change for the 14 existing
call sites that just want metadata). When `includeContent: true`, the
returned id is no longer truncated to 20 chars — exporters need the
full id for round-trip via memory_import.
Verification (against the fixed dist):
$ node bin/cli.js memory store -n test -k x \
--value '{"sessionId":"abc","byTier":{"opus":1.23}}'
$ node bin/cli.js memory retrieve -n test -k x --value-only \
| node -e "console.log(JSON.parse(require('fs').readFileSync(0,'utf8')))"
{ sessionId: 'abc', byTier: { opus: 1.23 } } # ✅
$ node bin/cli.js memory export -o out.json -f json -n test
$ jq -r '.entries[0].value | fromjson' out.json
{ "sessionId": "abc", "byTier": { "opus": 1.23 } } # ✅
Refs #2073. Restores the ruflo-cost-tracker reporting pipeline
(cost summary / report / conversation / budget / export / federation /
optimize — all of which depend on a working memory read path).
Closes#2073
Co-Authored-By: RuFlo <ruv@ruv.net>
Phase 6 of ADR-126 closes the regulator-grade interpretability gap that
LSTM / Transformer trading signals leave by default. Given a `signalId`,
the new `trader-explain` skill builds a feature-contribution graph, runs
single-entry forward-push PageRank from the signal output node, and
persists the top-K ranked features to `trading-analysis` as a
`SignedAttributionArtifact`.
What's new:
- `plugins/ruflo-neural-trader/src/signed-attribution.{ts,mjs}` —
typed contract + runtime mirror for the Ed25519-signed attribution
envelope. Re-uses the Phase 4 signing scheme exactly (canonical body
excludes signature fields; verifier pins to a caller-supplied
`trustedPublicKey`, NOT the served `witnessPublicKey` — CWE-347 /
#1922). Adds `localSingleEntryPageRank` (seeded mulberry32 power-
iteration fallback, ~30 LOC), `singleEntryPageRank` (MCP dispatch with
local fallback, mirrors the SublinearAdapter pattern from Phase 3), and
`topKFeatures` (deterministic tie-breaking by node index).
- `plugins/ruflo-neural-trader/skills/trader-explain/SKILL.md` —
the call site. Retrieves the signal from `trading-signals`, extracts
per-feature contributions via `npx neural-trader --predict --explain
--json` (degrades to a z-score heuristic if the flag isn't shipped
upstream yet — artifact tagged `attribution_method:
"input-zscore-fallback"`), runs the PageRank, signs the result with
`signAttributionArtifact`, persists to `trading-analysis`, and surfaces
a markdown ranking table to the agent.
- `scripts/smoke-neural-trader-feature-attribution.mjs` — three-layer
regression smoke: (1) static contract on TS/MJS + skill, (2) Ed25519
crypto round-trip with tamper detection on feature scores AND on the
graphMetadata.seed (seed is signed-in), (3) reproducibility — same seed
→ byte-identical scores + ordering; different seed → scores differ.
- `.github/workflows/v3-ci.yml` — `neural-trader-feature-attribution-smoke`
job with path triggers on the three load-bearing artifacts.
- `plugins/ruflo-neural-trader/README.md` — new "Feature attribution"
section with schema, example output, regulator-compliance angle
(EU AI Act Article 13 / SEC Reg-AI), and reproducibility guarantee.
- `plugins/ruflo-neural-trader/scripts/smoke.sh` — step 2 now requires
9 skills (was 8), adding `trader-explain` to the contract check.
Acceptance (ADR-126 Phase 6):
- All 36 checks in `scripts/smoke-neural-trader-feature-attribution.mjs`
pass: static contract, crypto round-trip, reproducibility, mass
conservation, signed-seed coverage.
- No regression: portfolio-cg smoke, backtest-signing smoke, pipeline
smoke all still green.
- Plugin smoke: 11 passed, 0 failed.
- `npx neural-trader --help` still clean (no upstream regression).
With Phase 6 landed, all six phases of ADR-126 are now complete:
Phase 1 — Namespace alignment
Phase 2 — TTL + dedup lifecycle (#2069)
Phase 3 — Portfolio CG via sublinear (#2070)
Phase 4 — Ed25519-signed backtest artifacts (#2071)
Phase 5 — SendMessage risk-gate pipeline (#2071)
Phase 6 — Feature attribution via single-entry PageRank (this PR)
Closes#2068
Co-Authored-By: RuFlo <ruv@ruv.net>
Refactor the four neural-trader agents as a typed SendMessage pipeline
with risk-analyst as a structural BLOCKING GATE. The live broker call
(`npx neural-trader --broker <name>`) cannot fire without an explicit
RiskDecision approval event from risk-analyst for the proposal's
signalId.
Pipeline:
market-analyst → (RegimeVerdict) → trading-strategist
trading-strategist → (SignalProposal[]) → risk-analyst ◄── BLOCKING
risk-analyst → (RiskDecision) → trading-strategist
└→ execute-or-halt
backtest-engineer — orthogonal (signed promotion candidates only)
Reinforces Phase 4: signed artifacts give cryptographic provenance of
what was tested; the SendMessage risk-gate gives auditable provenance
of who approved the trade.
- src/pipeline-messages.ts: RegimeVerdict, SignalProposal, RiskDecision
TypeScript schemas + PipelineMessage discriminated union. Future
programmatic dispatchers can switch on `type` to validate routing.
- agents/market-analyst.md: pipeline entry point, sends RegimeVerdict
to trading-strategist. Comms protocol section appended.
- agents/trading-strategist.md: middle stage. Live broker step
(--broker <name>) now carries an explicit REFUSAL clause:
refuses to fire without a RiskDecision approval for the signalId.
Includes [ERROR] log shape + "NON-NEGOTIABLE" language so future
refactors see the gate is mandatory.
- agents/risk-analyst.md: blocking gate. Receives SignalProposal,
runs circuit-breaker checks, sends RiskDecision (approved or
rejected with reasons + adjustedSizePct).
- agents/backtest-engineer.md: documented as orthogonal research
lane — produces signed-artifact promotion candidates (Phase 4),
does NOT participate in the live pipeline hot path.
- scripts/smoke-neural-trader-pipeline.mjs: four-layer smoke.
Frontmatter + comms-section + structural-gate static checks, plus
a behavioral mock that drives the pipeline. Happy path executes;
missing approval, rejected decision, AND mismatched signalId are
ALL refused (proves the gate correlates by signalId).
- .github/workflows/v3-ci.yml: neural-trader-pipeline-smoke job +
path triggers for pipeline-messages.ts + all 4 agent files +
the smoke script.
Smoke output: 28/28 checks pass. Phase 3 portfolio-CG smoke unchanged.
Phase 4 backtest-signing smoke unchanged (21/21). Plugin smoke.sh:
11/11 still pass.
Refs #2068
Co-Authored-By: RuFlo <ruv@ruv.net>
Add cryptographic tamper-evidence to the paper→live promotion gate.
Mirrors the CWE-347 plugin-registry pattern (#1922): canonical body =
JSON.stringify without signature fields; verifier pins to a caller-
supplied trustedPublicKey, NOT to the served self-asserted
witnessPublicKey (which an attacker can swap freely).
- src/signed-artifact.{ts,mjs}: SignedBacktestArtifact schema + signer
+ verifier. Both files kept in sync; .mjs is the runtime the smoke
imports directly (plugin has no build step).
- skills/trader-backtest: signs the artifact before store. Resolves
the key via RUFLO_WITNESS_KEY_PATH → verification/witness-key.json
→ loud degraded-unsigned warning. Never silent.
- skills/trader-cloud-backtest: verifies the artifact against the
pinned trusted pubkey BEFORE promoting to a live strategy. Refuses
to promote on verify failure (fail-closed).
- scripts/smoke-neural-trader-backtest-signing.mjs: three-layer smoke
modeled on smoke-plugin-registry-signature.mjs. Static contract,
crypto round-trip (tampered/empty/swapped-served-key/wrong-trusted-key),
and call-site byte check on the SKILL.md files.
- .github/workflows/v3-ci.yml: neural-trader-backtest-signing-smoke job
+ path triggers for the artifact files + both skill SKILL.md files.
Smoke output: 21/21 checks pass. Phase 3 portfolio-CG smoke unchanged.
Plugin smoke (scripts/smoke.sh): 11/11 still pass.
Refs #2068
Co-Authored-By: RuFlo <ruv@ruv.net>
Wires the Conjugate-Gradient mean-variance solve `Σ · x = μ` that ADR-123
Wedge 8 promises a 40-60× speedup over the legacy Neumann series. Ships:
- `src/sublinear-adapter.ts` — `SublinearAdapter` class per the ADR-123
§262-289 contract: `solveCG(matrix, vector, opts)`, `isMcpAvailable()`,
`SolveResult` shape, SPD/symmetric sanity checks, graceful degrade with
`degraded: true` for malformed inputs.
- `src/sublinear-adapter.mjs` — runtime mirror so the smoke + bench
import the adapter directly (the plugin has no build step). Both files
ship a self-contained ~50-LOC CG kernel + Jacobi/Neumann baseline; the
same call site picks up the full native-WASM speedup automatically
once `mcp__ruflo-sublinear__solve` is registered.
- `skills/trader-portfolio-cg/SKILL.md` — declares `mcp__ruflo-sublinear__solve`
in allowed-tools, writes weights with provenance metadata
(`method: 'cg-sublinear' | 'cg-local' | 'neumann-fallback'`) to the
canonical `trading-risk` namespace (ADR-126 Phase 1 alignment),
documents the `RUFLO_NEURAL_TRADER_DISABLE_CG` disable flag, defines
the legacy `npx neural-trader --portfolio optimize` fallback.
- `benchmarks/portfolio-cg.bench.mjs` — CG vs Neumann on synthetic SPD
covariance at n ∈ {16, 64, 256}. Fixed-seed parity check
(`||cg − neumann||_∞ < 1e-4`) and per-size latency table.
- `benchmarks/results/cg-baseline-20260520T022220Z.md` — captured
baseline numbers. CG at n=256 is sub-ms (0.31 ms). The JS-vs-JS gap is
~1.5-1.9× because both kernels JIT to similar efficiency; the upstream
40-60× figure is for native-CG vs native-Neumann in
`sublinear-time-solver@1.7.0`, which the skill picks up automatically
through the MCP dispatch.
- `scripts/smoke-neural-trader-portfolio-cg.mjs` — three-layer regression
smoke: static adapter contract (class shape, method signatures, MCP
tool name), static skill contract (allowed-tools, namespace, disable
flag, fallback path), runtime correctness (textbook 2×2 SPD case
A=[[4,1],[1,3]], b=[1,2] → x=[1/11, 7/11] within 1e-6, plus degraded
paths for non-square / non-symmetric input).
- `.github/workflows/v3-ci.yml` — `neural-trader-portfolio-cg-smoke` job
on the same shape as the kg-extract guard; triggers on adapter, skill,
or smoke changes.
- `README.md` + plugin-smoke skill-count bumped from 7 → 8.
Acceptance:
- `bash plugins/ruflo-neural-trader/scripts/smoke.sh` → 11/11 pass.
- `node scripts/smoke-neural-trader-portfolio-cg.mjs` → all 17 checks pass.
- Bench parity: `||cg − neumann||_∞ < 1e-4` at every n ∈ {16, 64, 256}.
Refs: #2068, ADR-126 Phase 3, ADR-123 §162 Row 8 (Wedge 8).
Co-Authored-By: RuFlo <ruv@ruv.net>
Wires the plugin into the ADR-125 lifecycle guarantees shipped in
@claude-flow/memory@3.0.0-alpha.18 (already published). No new code,
just three lifecycle hooks:
1. trader-signal/SKILL.md
- Adds `expiresAt: Date.now() + 24h` to the signal memory_store call.
Rationale: intraday signals shouldn't pollute long-running memory;
the MemoryConsolidator.sweepExpired() pass (ADR-125 Phase 4) clears
them from all indexes — including HNSW — after they expire.
- Adds `mcp__claude-flow__memory_delete` to allowed-tools (for
symmetry with the dedup path; trader-signal itself doesn't delete
today, but the allowed-tools surface is shared across the lifecycle
story so consumers don't have to mentally re-derive permissions).
2. trader-backtest/SKILL.md
- New step 5: search for prior entries with the same (strategyId,
paramsHash) and memory_delete them before writing the fresh result.
Inline dedup keeps memory_search deterministic right after a re-run.
- Documents that the MemoryConsolidator.dedup('keep-newest') pass
achieves the same convergence asynchronously every 6h, so the
inline step is an optimization not a correctness requirement.
- Adds `mcp__claude-flow__memory_delete` to allowed-tools.
- Renumbers subsequent steps.
3. README.md — new "Memory lifecycle (ADR-125 integration)" subsection
under "Namespace coordination". Covers:
- Warm HNSW restart (Phase 3 — automatic via MemoryService)
- Hybrid retrieval RRF+MMR (Phase 5 — automatic, graceful FTS5
degrade)
- Signal TTL (24h)
- Backtest dedup (inline + 6h consolidator)
- Consolidator schedule
Smoke: 11 passed, 0 failed.
Refs #2068
Co-Authored-By: RuFlo <ruv@ruv.net>