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>
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>
Resolves the three-way namespace mismatch surfaced by the ADR-126 dossier:
- README.md L198-205 previously claimed 4 (-strategies/-backtests/-risk/-analysis)
- docs/adrs/0001 L63 previously claimed 4 (-backtests/-risk/-signals/-models)
- skills/trader-signal/SKILL.md L35 actually writes to `trading-signals`
- skills/trader-train/SKILL.md L28 actually writes to `trading-models`
The smoke test previously validated only the README's four, so signal data
silently landed in `trading-signals` (undeclared) and model results landed
in `trading-models` (undeclared), invisible to any downstream consumer
scoped to the documented namespace surface.
Aligns README, ADR-0001, smoke.sh, and trader-train on the canonical 5
defined by ADR-126 Phase 1:
trading-strategies — strategy definitions, parameters, regime mappings
trading-backtests — backtest results (long-lived; signed in Phase 4)
trading-risk — risk model state, VaR/CVaR, circuit-breaker triggers
trading-analysis — regime classifications + model-training results
trading-signals — short-lived signal events (TTL in Phase 2)
trader-train now stores model results to `trading-analysis` (was the
undeclared `trading-models`). smoke.sh check 8 now asserts the fifth
namespace claim. All 11 smoke checks still pass.
Refs #2068
Co-Authored-By: RuFlo <ruv@ruv.net>
The README still referenced "17 documented entry points end-to-end"
but #1988 extended the smoke to 20 (pairs/adaptive/multi-indicator
gates added). Update the text to match the actual gate count and
list what's covered.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
Updates the README prerequisites block to reflect the 2.8.x line
(flag-style CLI dispatcher with --backtest, --signal, --risk,
--portfolio, --regime, --train, --predict, --strategy-create) and
the analytical layers (walk-forward, Monte Carlo, multi-symbol,
benchmark, optimize, Kelly).
Extends runtime-smoke.sh with three new gates for the strategies
shipped in 2.8.10 and 2.8.11:
17. pairs strategy returns metrics
18. adaptive strategy picks regime
19. multi-indicator strategy runs
All 20 gates pass against neural-trader 2.8.11.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
The existing `plugins/ruflo-neural-trader/scripts/smoke.sh` is
structural-only (file presence, README pins, frontmatter checks). It
passed for months while `npx neural-trader --backtest` and every
other documented invocation crashed at runtime — those gaps got
caught and fixed across neural-trader 2.7.5 → 2.8.1.
This adds a sibling `runtime-smoke.sh` that actually:
1. Installs `neural-trader@2.8.1` in a clean tmpdir
2. Runs each of the 8 commands the plugin's skills document
3. Parses the JSON output and asserts `.command == <expected>`
4. Confirms `require('neural-trader')` exposes >= 100 exports
5. Confirms `--version` returns the pinned major.minor
Run:
bash plugins/ruflo-neural-trader/scripts/runtime-smoke.sh
Current result: 11 passed, 0 failed.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
`neural-trader@2.7.6` is on npm with three working platform binaries
(linux-x64-gnu, darwin-arm64, darwin-x64) and three additional bugs
fixed beyond the install-hook fork-bomb that was resolved in 2.7.2:
• Missing `napi-loader-shared.js` / `napi-loader.js` /
`validation-utils.js` restored — `require('neural-trader')` no
longer throws at import time on any platform (broken since
2.5.0).
• `fasthash-sys` x86-only SIMD flags replaced with stdlib
`DefaultHasher` — `cargo build` now succeeds on aarch64-darwin.
• Cross-platform binaries actually ship — `darwin-arm64` and
`darwin-x64` are in the tarball for the first time ever.
Updates the README prerequisite block to reflect the new resolution,
adds a platform-coverage table, and pins to `^2.7.6` (compatible
with whatever future patches add linux-arm64 + win32 binaries).
Refs:
• ruflo#1974 (original bug report)
• ruflo#1981 (announcement)
• https://gist.github.com/ruvnet/a1aca90a5c299d89fa92e905dab11041
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
`neural-trader@2.7.2` published 2026-05-14 — install hook no longer spawns
a recursive `npm install`. Cite the upstream PR (ruvnet/neural-trader#109)
in the README's Prerequisites section, recommend pinning to >=2.7.2, and
keep the `--ignore-scripts` flag on every documented install as defense
in depth (cheap belt-and-braces against any future install-script
regression — and what `scripts/audit-neural-trader-safety.mjs` still
enforces).
The "danger zone" advisory still appears for anyone pinned to <=2.7.1,
since lockfiles can hold older versions long after the fix lands.
Verified end-to-end:
$ rm -rf /tmp/nt-verify && mkdir /tmp/nt-verify && cd /tmp/nt-verify
$ perl -e 'alarm 30; exec("npm","install","neural-trader@latest")'
added 698 packages in 18s ← was 80 min / 120 GB RAM
exit=0
$ ps aux | grep -c "[n]eural-trader"
1 ← was 3,049
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
The upstream `neural-trader@2.7.1` (and every earlier published version
audited) ships a malicious-by-accident `install` lifecycle script that
recursively invokes `npm install` from inside the install hook. On any
non-`linux-x64` host the recursion is unbounded — one reporter saw 3,049
stuck processes consuming ~120 GB of RAM in ~80 minutes before manual
intervention.
The `plugins/ruflo-neural-trader/README.md` Prerequisites section said
plainly `npm install neural-trader` — running THAT instruction is what
fork-bombs the machine.
We can't patch upstream from this repo, but we can stop telling users
to run the dangerous command. Mitigations:
- README Prerequisites: add a prominent warning advisory + switch
the recommended install to `npm install --ignore-scripts neural-trader`.
The linux-x64 binary is hardcoded inline in the upstream tarball,
so the package still works after `--ignore-scripts` on that platform.
- agents/trading-strategist.md: same `--ignore-scripts` fix on the
"Ensure installed" line that previously fork-bombed if the package
wasn't already cached.
- 6 skill files (trader-backtest/portfolio/regime/risk/signal/train):
same one-liner fix.
- trader-cloud-backtest/SKILL.md: also patch the `npm install -g
neural-trader` line in the Managed-Agent `initScript` — cloud
containers ARE isolated, but the same in-container fork-bomb
amplification is still a problem.
CI guard: `scripts/audit-neural-trader-safety.mjs` scans
`plugins/ruflo-neural-trader/` for any `npm install neural-trader` /
`npm i neural-trader` invocation that doesn't also carry
`--ignore-scripts`. Allowlist: lines preceded by a "DO NOT run" marker
(the README's anti-example block). Wired into the existing
`hook-command-audit` job in `v3-ci.yml`.
Verified:
- audit clean on the fixed tree
- audit catches a deliberately-reverted regression (exit 1, diagnostic
names the offending file:line)
- all other audits + plugin smoke still green
Mitigates #1974 in THIS repo. Upstream fix to the `neural-trader` npm
package (drop the recursive `npm install` in the install hook + publish
the platform-binary optionalDependencies) is still required for the
underlying bug.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
ADR-117 (Accepted): dispatch heavy neural-trader jobs — multi-year
walk-forward backtests, big Monte-Carlo, parameter sweeps, LSTM/
Transformer/N-BEATS training — to an Anthropic Managed Agent cloud
container via the managed_agent_* tools (ADR-115, shipped in
3.7.0-alpha.27). No new MCP tools, no new deps — pure orchestration.
- skills/trader-cloud-backtest/SKILL.md — the recipe (provision-once,
pre-flight-cheap, run, ingest-locally, terminate-eagerly); allowed-tools
scoped to managed_agent_* + memory_* + agentdb_pattern-store + Bash/Read
(no wildcard grant).
- commands/trader.md — /trader cloud <backtest|train|sweep> subcommand.
- scripts/smoke.sh — step 2 now asserts the 7th skill exists, references
managed_agent_create, and names the local trader-backtest fallback;
step 10 ADR-status check corrected to Accepted.
- README.md — overview + skills table + Architecture-Decisions +
Related-Plugins cross-refs to ADR-117 / ADR-115 / ruflo-agent.
- ADR-115 Links — cross-refs ADR-117 as the first consumer.
Cost-optimization rules baked into the recipe (the "optimize" requirement):
install-once in initScript, reuse the environment, pre-flight cheap
(1-path/3-month smoke before a 1000-path/multi-year run), batch sweeps into
one prompt, terminate eagerly + GC orphans (#1931), cheap agent model
(Haiku/Sonnet — the compute is the Rust engine, not the LM; ADR-026),
estimate before kicking off.
Validation: ruflo-neural-trader smoke 11/0, ruflo-agent smoke 12/0,
audit-cli-mcp-tools / audit-tool-descriptions / audit-plugin-packages /
audit-hook-commands all green. No new MCP tools → cli build unaffected.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>