com um clique
trader-backtest
Run a historical backtest using npx neural-trader with Rust/NAPI engine (8-19x faster) and walk-forward validation; Ed25519-sign the result for paper→live tamper evidence (ADR-126 Phase 4)
Menu
Run a historical backtest using npx neural-trader with Rust/NAPI engine (8-19x faster) and walk-forward validation; Ed25519-sign the result for paper→live tamper evidence (ADR-126 Phase 4)
Baseado na classificação ocupacional SOC
One-command drift detection. Composes audit-list + oia-audit + audit-trend into a single primitive — finds the most recent audit in `metaharness-audit` namespace, runs a fresh audit against the current repo, diffs them via ADR-152 §3.1 similarity, and alerts when structural distance crosses `--threshold`. Iter 53 of ADR-150 deep integration.
ADR-152 — weighted similarity between two harness fingerprints (genome + score JSON). Returns overall score in [0,1] plus per-component breakdown (cosine over 9 numerics, categorical agreement over 4 enums, jaccard over agent_topology). Unblocks ADR-151 §3.2 Recommender, §3.3 Drift Detection, §3.5 Plugin Compat. Pure-TS, no `@metaharness/*` dep — preserves ADR-150's four architectural constraints.
Composite Phase-2 audit worker (ADR-150). Bundles harness oia-manifest + threat-model + mcp-scan into one timestamped audit record stored in the `metaharness-audit` memory namespace. Designed for cron-scheduled drift detection.
7-section repo readiness report from `metaharness genome <path>`. Returns repo_type / agent_topology / risk_score / mcp_surface / test_confidence / publish_readiness. Pure-read; degrades gracefully (ADR-150).
Static security scan of a harness's declared MCP surface via `harness mcp-scan <path>`. Reads `.mcp/servers.json` + `.harness/claims.json`. Pure-read, no dispatch. Exits 1 on findings at or above `--fail-on` severity.
Scaffold a custom AI agent harness via `metaharness new <name> --template <id> --host <id>`. Defaults to DRY-RUN (no writes) unless --confirm is passed. Refuses to write to the calling repo root or anywhere inside it. Honors ADR-150 architectural constraint + ruflo's "destructive-action confirmation" pattern.
| name | trader-backtest |
| description | Run a historical backtest using npx neural-trader with Rust/NAPI engine (8-19x faster) and walk-forward validation; Ed25519-sign the result for paper→live tamper evidence (ADR-126 Phase 4) |
| allowed-tools | Bash Read mcp__claude-flow__memory_store mcp__claude-flow__memory_retrieve mcp__claude-flow__memory_search mcp__claude-flow__memory_delete mcp__claude-flow__neural_train mcp__claude-flow__agentdb_pattern-store |
| argument-hint | <strategy-name> --symbol <TICKER> [--period 2020-2024] |
Run a historical backtest using the neural-trader Rust/NAPI engine, then Ed25519-sign the result so the paper→live promotion gate has cryptographic tamper evidence (ADR-126 Phase 4 + CWE-347 pattern).
Steps:
npm ls neural-trader 2>/dev/null || npm install --ignore-scripts neural-tradermcp__claude-flow__memory_retrieve({ key: "strategy-STRATEGY_NAME", namespace: "trading-strategies" })
If not found, list available: mcp__claude-flow__memory_search({ query: "strategy", namespace: "trading-strategies", limit: 10 })npx neural-trader --backtest --strategy <name> --symbol <TICKER> --period <range> --walk-forward
For multi-indicator strategies:
npx neural-trader --backtest --strategy multi-indicator --position-sizing kelly --symbol SPY --period 2020-2024
(strategyId, paramsHash) before storing the fresh one (ADR-125 lifecycle / ADR-126 Phase 2 — keep-newest semantics):
mcp__claude-flow__memory_search({ query: "backtest STRATEGY paramsHash:PARAMS_HASH", namespace: "trading-backtests", limit: 10 })backtest-STRATEGY-* AND whose stored paramsHash equals the current run's hash, delete it: mcp__claude-flow__memory_delete({ key: "OLD_KEY", namespace: "trading-backtests" })MemoryConsolidator.dedup('keep-newest') background pass introduced in @claude-flow/memory@3.0.0-alpha.18 runs every 6h and will eventually converge. Doing it inline keeps memory_search results deterministic immediately after a re-run.)SignedBacktestArtifact body — { strategyId, paramsHash, dataRange: {from,to}, metrics, runsHash, generatedAt } — where paramsHash = sha256(canonical params JSON), runsHash = sha256(canonical runs array JSON), and generatedAt = new Date().toISOString().RUFLO_WITNESS_KEY_PATH env var — points to a JSON file with { "privateKey": "<hex>" }.verification/witness-key.json (the ADR-103 default path, if present).signBacktestArtifact(body, privateKeyHex) from plugins/ruflo-neural-trader/src/signed-artifact.mjs. The returned value is a SignedBacktestArtifact with schema, witnessPublicKey: "ed25519:<hex>", and witnessSignature: "<hex>" populated."[WARN] ruflo-neural-trader: no witness signing key found (RUFLO_WITNESS_KEY_PATH unset, verification/witness-key.json missing) — storing backtest artifact in UNSIGNED degraded mode. paper→live promotion will be refused by trader-cloud-backtest until a signed artifact replaces this one." — and store the body unsigned. NEVER silently fall back.trading-backtests namespace:
mcp__claude-flow__memory_store({ key: "backtest-STRATEGY-TIMESTAMP", value: JSON.stringify(signedArtifact), namespace: "trading-backtests" })
The stored value contains witnessSignature + witnessPublicKey when signed; downstream consumers (trader-cloud-backtest) MUST call verifyBacktestArtifact(artifact, trustedPublicKey) before promoting any artifact to live.mcp__claude-flow__agentdb_pattern-store({ pattern: "profitable-STRATEGY_TYPE", data: "PARAMS_AND_RESULTS" })mcp__claude-flow__neural_train({ patternType: "trading-strategy", epochs: 10 }){ "privateKey": "<64-hex-chars>" } in a JSON file referenced by RUFLO_WITNESS_KEY_PATH. Keep it OUT of the repo. For local development, generate one once with node -e "import('@noble/ed25519').then(async ed=>{const sk=crypto.getRandomValues(new Uint8Array(32));console.log(Buffer.from(sk).toString('hex'))})" and write it to ~/.ruflo/witness-key.json.trustedPublicKey to verifyBacktestArtifact(...) — never trust the witnessPublicKey field on the artifact itself (CWE-347 / #1922).