with one click
trader-cloud-backtest
// Run a heavy neural-trader job (long walk-forward, big Monte-Carlo, parameter sweep, model training) on the Anthropic Managed Agent cloud runtime instead of locally
// Run a heavy neural-trader job (long walk-forward, big Monte-Carlo, parameter sweep, model training) on the Anthropic Managed Agent cloud runtime instead of locally
Comprehensive GitHub project management with swarm-coordinated issue tracking, project board automation, and sprint planning
Comprehensive GitHub code review with AI-powered swarm coordination
Multi-repository coordination, synchronization, and architecture management with AI swarm orchestration
Comprehensive GitHub release orchestration with AI swarm coordination for automated versioning, testing, deployment, and rollback management
Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management
Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.
| name | trader-cloud-backtest |
| description | Run a heavy neural-trader job (long walk-forward, big Monte-Carlo, parameter sweep, model training) on the Anthropic Managed Agent cloud runtime instead of locally |
| allowed-tools | mcp__claude-flow__managed_agent_create mcp__claude-flow__managed_agent_prompt mcp__claude-flow__managed_agent_events mcp__claude-flow__managed_agent_status mcp__claude-flow__managed_agent_terminate mcp__claude-flow__memory_store mcp__claude-flow__memory_retrieve mcp__claude-flow__memory_search mcp__claude-flow__agentdb_pattern-store Bash Read |
| argument-hint | <backtest|train|sweep> <strategy-or-model> --symbol <TICKER> [--period 2020-2024] [--mc-paths 1000] |
Dispatch a heavy neural-trader job to an Anthropic Claude Managed Agent (cloud container) instead of running it locally. See project ADR-117 (recipe + cost rules) and ADR-115 (the managed_agent_* runtime).
trader-backtest (local)| Job | Runtime |
|---|---|
| Quick sanity check; one short backtest (< ~1 min) | local โ use the trader-backtest skill |
| Multi-year walk-forward, big Monte-Carlo count, parameter sweep over a grid, or model training (LSTM/Transformer/N-BEATS) | cloud โ this skill |
Prereq: ANTHROPIC_API_KEY (or CLAUDE_API_KEY) + Managed Agents beta access. If managed_agent_* returns "needs ANTHROPIC_API_KEY", fall back to the local trader-backtest skill.
Estimate first. From the job size, print an estimated cost (โ container-minutes ร rate + tokens) โ a long sweep is a deliberate choice, not a default.
Provision (or reuse) the container โ install neural-trader at container start so the agent doesn't reinstall mid-run:
managed_agent_create({
name: "nt-cloud",
model: "claude-haiku-4-5-20251001", // orchestration only โ the compute is the Rust engine, not the LM (ADR-026)
system: "You operate the `neural-trader` CLI in this container. Run exactly the commands asked, report the metrics, write requested artifacts, then stop.",
networking: "unrestricted", // or "restricted" pinned to your data host
packages: { npm: ["neural-trader"] }, // add apt:["build-essential"] ONLY if there's no prebuilt NAPI binary for the arch (neural-trader ships prebuilds โ usually omit)
initScript: "npm install -g --ignore-scripts neural-trader >/dev/null 2>&1 || npx -y neural-trader --version >/dev/null 2>&1 || true"
})
โ { sessionId, agentId, environmentId }
For a sweep: create the environment once, run all configs in one managed_agent_prompt (one container), not N sessions.
Pre-flight cheap. Before a 1000-path / multi-year run, do a tiny smoke first (1 MC path, ~3 months) โ catches a bad strategy name / symbol in seconds:
managed_agent_prompt({ sessionId, message: "Run `npx neural-trader --backtest --strategy <name> --symbol <TICKER> --period <last 3 months> --mc-paths 1`. Just confirm it ran and report the Sharpe. Then stop.", maxWaitMs: 60000 })
If that fails, fix the args before the real run (and managed_agent_terminate).
Run the real job:
managed_agent_prompt({
sessionId,
message: "Run `npx neural-trader --backtest --strategy <name> --symbol <TICKER> --period <range> --walk-forward --mc-paths <N>` (for training: `npx neural-trader --train --model <lstm|transformer|nbeats> --symbol <TICKER> --period <range>`; for a sweep: loop the configs and run each). Report: total return, annualized return, Sharpe, Sortino, max drawdown, win rate, profit factor, # trades, 95% CVaR. Write the equity curve to /tmp/equity.csv and the trade log to /tmp/trades.csv. Then stop.",
maxWaitMs: <generous โ minutes>
})
โ { finished, status, stopReason, assistantText (the metrics), toolUses }
If finished:false, follow up with managed_agent_events({ sessionId }) until idle.
Pull artifacts (if needed): managed_agent_prompt({ sessionId, message: "cat /tmp/equity.csv" }) or managed_agent_events and read the tool_result.
Ingest locally + Ed25519 verify (ADR-126 Phase 4 fail-closed gate):
SignedBacktestArtifact body from the cloud-returned metrics + params hash + runs hash. Sign it locally with signBacktestArtifact(body, privateKeyHex) from plugins/ruflo-neural-trader/src/signed-artifact.mjs (key resolution same as trader-backtest: RUFLO_WITNESS_KEY_PATH โ verification/witness-key.json โ degraded-unsigned warning).await verifyBacktestArtifact(artifact, trustedPublicKey) where trustedPublicKey is the pinned project-config Ed25519 public key (NOT the artifact.witnessPublicKey field โ that's attacker-controllable; see CWE-347 / #1922). If verification returns false: REFUSE to promote โ emit a loud error "[ERROR] ruflo-neural-trader: SignedBacktestArtifact signature INVALID against trusted key โ refusing to promote to live strategy" and return early. This is the fail-closed gate per ADR-126.memory_store({ key: "backtest-<strategy>-<ts>", value: JSON.stringify(signedArtifact), namespace: "trading-backtests" }). The stored value carries witnessSignature + witnessPublicKey.agentdb_pattern-store({ pattern: "profitable-<strategy-type>", data: "<params + results>" }).cost-tracking namespace (per ADR-117 โ cloud sessions bill until terminated).Terminate immediately โ results in hand:
managed_agent_terminate({ sessionId, environmentId }) โ { sessionDeleted: true, environmentDeleted: true }
Never leave an idle billing container. (ruflo doctor / GC catches orphans โ #1931.)
initScript), reuse the environment, batch sweeps into one prompt, pre-flight cheap, terminate eagerly, use Haiku/Sonnet for the agent loop, estimate before kicking off. (ADR-117 ยง"Cost optimization".)managed_agent_create { "name":"nt-cloud", "model":"claude-haiku-4-5-20251001", "packages":{"npm":["neural-trader"]}, "initScript":"npm install -g --ignore-scripts neural-trader >/dev/null 2>&1 || true" }
โ { sessionId:"sesn_โฆ", environmentId:"env_โฆ" }
managed_agent_prompt { "sessionId":"sesn_โฆ", "message":"Run `npx neural-trader --backtest --strategy multi-indicator --symbol SPY --period 2020-2024 --walk-forward --mc-paths 1000`. Report Sharpe/Sortino/max-DD/win-rate/CVaR; write /tmp/equity.csv. Then stop.", "maxWaitMs":600000 }
โ { finished:true, status:"idle", assistantText:"<metrics>", toolUses:[{bash:"npx neural-trader --backtest โฆ"}] }
# โฆ memory_store the metrics, agentdb_pattern-store if Sharpe>1.5, record cost โฆ
managed_agent_terminate { "sessionId":"sesn_โฆ", "environmentId":"env_โฆ" }