
Trader Explain
- 439 installs
- 67k repo stars
- Updated August 4, 2026
- ruvnet/ruflo
trader-explain is a Claude Code skill that explains trading signals from LSTM or Transformer models by ranking top-K feature contributions with single-entry PageRank and persisting SignedAttributionArtifact records per A
About
trader-explain is a signal-explanation skill from ruvnet/ruflo that attributes predictions from LSTM or Transformer models using a feature-contribution graph and single-entry forward-push PageRank (ADR-123). Invoke it with a signalId and optional --top-k (default 10) and --seed flags; allowed tools include Bash, Read, and MCP integrations for claude-flow memory and ruflo-sublinear PageRank entry. The skill returns a markdown table of top-K ranked features driving the prediction and persists results to trading-analysis as a SignedAttributionArtifact under ADR-126 Phase 6. Developers reach for it when regulatory or internal review requires regulator-grade feature attribution for any model signal, not just heuristic summaries.
- trader-explain
Trader Explain by the numbers
- 439 all-time installs (skills.sh)
- +6 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #959 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ruvnet/ruflo --skill trader-explainAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 439 |
|---|---|
| repo stars | ★ 67k |
| Last updated | August 4, 2026 |
| Repository | ruvnet/ruflo ↗ |
How do you explain which features drove a trading signal?
Use trader-explain for development tasks
Who is it for?
Quant developers running ruflo who need regulator-grade feature attribution for LSTM or Transformer trading signals.
Skip if: Casual market commentary or teams without ruflo MCP tooling and persisted trading-analysis storage.
When should I use this skill?
The user provides a signalId and asks to explain, attribute, or rank features behind an LSTM or Transformer prediction.
What you get
A top-K feature attribution markdown table and a persisted SignedAttributionArtifact in trading-analysis.
- Top-K feature attribution table
- SignedAttributionArtifact record
By the numbers
- Default --top-k ranks 10 features per signal explanation
- Implements ADR-126 Phase 6 SignedAttributionArtifact persistence
- Uses single-entry forward-push PageRank per ADR-123
Files
Explain a trading signal by building a feature-contribution graph and running single-entry forward-push PageRank from the signal output node. Top-K ranked features are returned as a markdown table AND persisted to trading-analysis as a SignedAttributionArtifact (ADR-126 Phase 6).
Why this skill matters:
- EU AI Act + SEC Reg-AI guidance require interpretable model output for any algorithmic trading system that touches retail capital. This is the regulator-grade attribution path the rest of the substrate has been waiting for.
- The same call site picks up the full native-WASM PageRank from
mcp__ruflo-sublinear__page-rank-entryonce that tool is registered in the runtime — until then, the local power-iteration kernel ships insigned-attribution.mjsand produces the same ordering (seeded mulberry32).
Steps:
1. Retrieve the signal from the canonical trading-signals namespace (ADR-126 Phase 1 + Phase 2 lifecycle):
mcp__claude-flow__memory_retrieve({
key: "SIGNAL_ID",
namespace: "trading-signals"
})The signal entry includes modelId, prediction, and the feature vector at the time of inference.
2. Extract per-feature contribution scores from the model:
npx neural-trader --predict --signal "$SIGNAL_ID" --explain --jsonThe expected output shape:
{
features: Array<{ name: string; contribution: number }>;
// for Transformers, also includes per-head attention co-occurrence:
attention?: Array<{ head: string; cooccur: Array<[number, number, number]> }>;
}Fallback path — if --explain is not shipped on the installed neural-trader build (older versions; the flag was scoped for a follow-up upstream PR), the skill degrades to a deterministic feature-importance heuristic over the signal's input vector: contribution_i = |input_i - μ_i| / σ_i (z-score magnitude). This is a known proxy — not as faithful as attention/SHAP — and the resulting artifact is tagged attribution_method: "input-zscore-fallback" so downstream consumers can filter it out for regulator filings. Document the fallback path in the resulting markdown summary so the agent surfaces it to the user.
3. Build the feature-contribution graph:
- Nodes: one node per feature + one source node
__signal_output__for the prediction. - Edges: outgoing edges from
__signal_output__to each feature node, weighted bycontribution_i. When attention co-occurrence data is available, also add edges between feature nodes weighted bycooccur— this is what makes the PageRank single-entry rather than degenerating to plain top-K. - Source:
__signal_output__(index 0 by convention so the smoke can assert reproducibility).
4. Run single-entry PageRank — preferred path when mcp__ruflo-sublinear__page-rank-entry is registered:
mcp__ruflo-sublinear__page-rank-entry({
nodes: GRAPH_NODES,
edges: GRAPH_EDGES,
sourceIndex: 0,
damping: 0.85,
maxIterations: 100,
tolerance: 1e-8,
seed: 42
})The local fallback (localSingleEntryPageRank in plugins/ruflo-neural-trader/src/signed-attribution.mjs) runs ~30 LOC of seeded power-iteration when the MCP tool is not available — same math, same result up to floating-point tolerance, same ordering for the same seed (the Phase 6 smoke asserts this).
5. Build the top-K `AttributionFeature[]` via topKFeatures(graph, scores, k=10, excludeIndex=0) — excludes the source node from the ranked output. Ties broken by node index (lower index wins) so the ranking is deterministic.
6. Sign the artifact (reuses the Phase 4 signing primitives — same Ed25519 + canonicalization):
- Build the
SignedAttributionArtifactbody:
{
signalId: SIGNAL_ID,
modelId: SIGNAL.modelId,
features: TOP_K_FEATURES, // from step 5
graphMetadata: {
nodeCount: GRAPH.nodes.length,
edgeCount: COUNT_EDGES,
pageRankIterations: PR_RESULT.iterations,
seed: SEED // load-bearing for reproducibility
},
generatedAt: NEW_DATE_ISO
}- Resolve the witness signing key — same lookup order as Phase 4:
1. RUFLO_WITNESS_KEY_PATH env var — JSON file with { "privateKey": "<hex>" }. 2. verification/witness-key.json (the ADR-103 default path).
- If a key resolves:
signAttributionArtifact(body, privateKeyHex)fromplugins/ruflo-neural-trader/src/signed-attribution.mjs. - If NEITHER path resolves: log
"[WARN] ruflo-neural-trader: no witness signing key found — storing attribution artifact in UNSIGNED degraded mode. Regulator filings will reject UNSIGNED artifacts."and store the body unsigned. NEVER silently fall back.
7. Store the (possibly signed) artifact to the canonical trading-analysis namespace (ADR-126 Phase 1):
mcp__claude-flow__memory_store({
key: "attribution-SIGNAL_ID-TIMESTAMP",
namespace: "trading-analysis",
value: JSON.stringify(signedArtifact)
})The trading-analysis namespace is the canonical home for model-analysis output (regime classifications, technical-indicator summaries, model-training results — and now attribution rankings). Long-lived — no TTL — because the audit trail is the deliverable.
8. Return the markdown summary to the agent. Suggested format:
## Feature attribution for signal `SIGNAL_ID` (model: MODEL_ID)
| Rank | Feature | Score |
|------|---------|-------|
| 1 | NAME | 0.42 |
| 2 | NAME | 0.18 |
| … | … | … |
- PageRank iterations: N
- Graph: nodeCount nodes, edgeCount edges
- Seed: 42 (reproducible — same seed → same ordering)
- Path: mcp | local
- Signature: ed25519:abcd… (or UNSIGNED — degraded warning above)Verification
Downstream consumers verify the artifact before any regulator-facing report or paper→live promotion:
import { verifyAttributionArtifact } from 'plugins/ruflo-neural-trader/src/signed-attribution.mjs';
const ok = await verifyAttributionArtifact(artifact, trustedPublicKey);
if (!ok) {
// [ERROR] attribution verification failed — refuse to publish.
// Pin to trustedPublicKey from project config; do NOT trust the
// artifact.witnessPublicKey field (CWE-347 / #1922 — attacker-controllable).
return;
}Acceptance criteria (ADR-126 Phase 6):
trader-explain <signalId>returns a ranked feature list whose top-3 features overlap the model's attention argmax (when--explainavailable; documented tolerance).- Reproducibility: two runs with the same
signalId+ same--seedproduce byte-identical rank ordering (asserted byscripts/smoke-neural-trader-feature-attribution.mjs). - Signed artifact verifies under the trusted pubkey; tampering any feature score or
graphMetadata.seedinvalidates the signature. - Fallback paths engage cleanly: when MCP unavailable, local kernel runs; when
--explainflag missing, z-score heuristic runs and the artifact is tagged.
Refs:
- ADR-126 Phase 6 (this skill's authoring ADR)
- ADR-126 Phase 4 (the signing scheme this reuses)
- ADR-123 (single-entry PageRank substrate; the same family that Phase 3 leverages for portfolio CG)
plugins/ruflo-neural-trader/src/signed-attribution.ts(the typed contract)plugins/ruflo-neural-trader/src/signed-attribution.mjs(the runtime mirror)scripts/smoke-neural-trader-feature-attribution.mjs(the regression smoke)
Related skills
FAQ
What models does trader-explain support?
trader-explain supports LSTM and Transformer trading signals. trader-explain builds a feature-contribution graph and runs single-entry forward-push PageRank to rank the top-K features that drove a given signalId prediction.
What artifact does trader-explain persist?
trader-explain persists a SignedAttributionArtifact to the trading-analysis store per ADR-126 Phase 6. trader-explain also returns a markdown table of ranked feature contributions for immediate review.
What CLI options does trader-explain accept?
trader-explain accepts a required signalId plus optional --top-k (default 10) and --seed (default 42) flags. trader-explain uses Bash, Read, and ruflo MCP tools for PageRank entry and memory persistence.