crypto-claude-desk
CLAUDE.md32 starsChanged 5 months agoMITView on GitHub
A cryptocurrency analysis system built with Claude Code's native features: agents, MCP servers, and skills. All agents are spawned via the Task tool with subagent_type: general-purpose and an explicit model parameter. This ensures every subagent inherits all MCP tools from the parent conversation. The agent .md files in agents/ contain the analysis framework — include "Read agents/{name}.md for your full analysis framework" in the prompt. Why general-purpose? Plugin-defined agent types (e.g., crypto-trading-desk:market-monitor) don't receive MCP tools due to a known…
In this repository2 other files it gives its agents.
- dashboard/AGENTS.mdAGENTS.md
- dashboard/CLAUDE.mdCLAUDE.md
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
Ask naturally and the coordinator routes by complexity:
- Distinctive: line 56
Always include "Do NOT use the Edit tool" in every agent prompt.
- Distinctive: line 59
Use for simple data points.
- Very specific: line 75
Use for "analyze X" without explicit "full analysis" or "recommendation" request.
- Very specific: line 81
Use for "full analysis", "should I buy", "recommendation", or /analyze.
- Distinctive: line 99
IMPORTANT: Do NOT spawn all 5 agents at once.
- Distinctive: line 113
NEVER over-delegate: If someone asks "price of BTC?", use one haiku agent.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Crypto Trading Desk - Multi-Agent Intelligence System
A cryptocurrency analysis system built with Claude Code's native features: agents, MCP servers, and skills.
Architecture
User Query
|
v
[Claude Code - Coordinator]
| Reads this CLAUDE.md
| Routes by complexity:
|
+-- QUICK (1 subagent) ----------> market-monitor (haiku)
|
+-- STANDARD (2-3 parallel) -----> market-monitor + technical-analyst + news-sentiment
|
+-- FULL ANALYSIS (5 subagents) -> 3 phases with file-based coordination
Phase 1 (parallel): market-monitor || technical-analyst || news-sentiment
Phase 2 (sequential): risk-specialist (reads Phase 1 files)
Phase 3 (sequential): portfolio-manager (reads all, decides)How to Use
First-Time Setup
/setup- Run once after installing. Detects environment, installs uv + Python deps, verifies MCP servers work. Cross-platform (macOS, Linux, Windows).
Slash Commands
/quick BTC- Fast market snapshot (1 agent, ~15 sec)/analyze BTC- Full 5-agent analysis with trading decision (~3-5 min)/portfolio- View portfolio status and open trades/close-trade trade_001- Close trade with post-mortem/validate-predictions- Review pending predictions against market data/monitor- Autonomous loop: check SL/TP, close trades, evaluate predictions/create- Extend the system with new components
Natural Language
Ask naturally and the coordinator routes by complexity:
- "How's BTC?" → Quick (market-monitor only)
- "RSI of ETH?" → Standard (technical-analyst only)
- "Analyze SOL" → Standard (2-3 agents)
- "Full analysis of BTC with recommendation" → Full (5 agents in phases)
- "Check my portfolio" → portfolio-manager
- "Post-mortem on trade_003" → learning-agent
Routing Rules
How Delegation Works
All agents are spawned via the Task tool with subagent_type: general-purpose and an explicit model parameter. This ensures every subagent inherits all MCP tools from the parent conversation. The agent .md files in agents/ contain the analysis framework — include "Read agents/{name}.md for your full analysis framework" in the prompt.
Why
general-purpose? Plugin-defined agent types (e.g.,crypto-trading-desk:market-monitor) don't receive MCP tools due to a known Claude Code limitation (#4476). Usinggeneral-purposewith explicitmodelworks in both plugin and local-clone modes.
Always include "Do NOT use the Edit tool" in every agent prompt.
Quick Query (single subagent via Task tool)
Use for simple data points. One agent, fast response.
| Query Type | Role | Model | Key MCP tools to mention in prompt |
| Price, volume, market overview | market-monitor | haiku | crypto-exchange, crypto-data, crypto-futures |
| RSI, MACD, indicators, patterns | technical-analyst | sonnet | crypto-technical, crypto-advanced-indicators |
| News, sentiment, FUD/FOMO | news-sentiment | sonnet | WebSearch, WebFetch (no MCP needed) |
| Portfolio status, trade history | portfolio-manager | opus | crypto-learning-db, crypto-exchange |
| Pattern lookup, pre-trade check | learning-agent | opus | crypto-learning-db, crypto-data |
Example delegation:
Task(subagent_type="general-purpose", model="haiku", prompt="You are the market-monitor agent. Read agents/market-monitor.md for your framework. Get BTC price using get_exchange_prices(symbol='BTC/USDT')... Do NOT use the Edit tool.")Standard Analysis (2-3 subagents in parallel)
Use for "analyze X" without explicit "full analysis" or "recommendation" request.
Launch 3 Tasks in parallel (all subagent_type: general-purpose):
- market-monitor (model: haiku) + technical-analyst (model: sonnet) + news-sentiment (model: sonnet)
- Coordinator synthesizes results
Full Analysis with Decision (5 subagents in phases)
Use for "full analysis", "should I buy", "recommendation", or /analyze.
Spawn 5 subagents via the Task tool in 3 sequential phases (see /analyze skill for detailed prompts):
Phase 1 - Data Gathering (3 Tasks in parallel):
- market-monitor (haiku) →
data/reports/YYYY-MM-DD-{symbol}/market-data.md - technical-analyst (sonnet) →
data/reports/YYYY-MM-DD-{symbol}/technical-analysis.md - news-sentiment (sonnet) →
data/reports/YYYY-MM-DD-{symbol}/news-sentiment.md
Wait for all 3 Task calls to return. Verify files exist on disk.
Phase 2 - Risk Assessment (1 Task AFTER Phase 1):
- risk-specialist (sonnet) reads Phase 1 files →
data/reports/YYYY-MM-DD-{symbol}/risk-assessment.md
Wait for Task to return. Verify file exists.
Phase 3 - Decision (1 Task AFTER Phase 2):
- portfolio-manager (opus) reads all files →
data/reports/YYYY-MM-DD-{symbol}/decision.md
IMPORTANT: Do NOT spawn all 5 agents at once. Phase 2/3 agents MUST read files written by previous phases. Spawn them only after confirming previous phase files exist on disk.
Special Queries (single subagent)
- "Close trade X" → portfolio-manager (close) + learning-agent (post-mortem + prediction validation)
- "What patterns have we seen?" → learning-agent
- "Check my predictions" → learning-agent via /validate-predictions
- "Risk on my position?" → risk-specialist
- "Monitor my trades" / "Check SL/TP" → /monitor (multi-agent coordination)
- "Create a new MCP/agent/skill" → system-builder via /create
Delegation Rules
ALWAYS delegate via Task with subagent_type: general-purpose and explicit model. Include the agent's role and relevant MCP tools in the prompt. Don't call MCP tools directly from the main conversation.
NEVER over-delegate. If someone asks "price of BTC?", use one haiku agent. Don't spin up 5 agents for a simple question.
After every trade close, ALWAYS delegate to learning-agent for prediction validation. This is how the system learns.
Two Books — Spot vs Futures (Always Explicit)
The portfolio is split into TWO BOOKS with different mandates. Whenever you discuss a position, allocation, or new trade, always state which book. Never let the portfolio-manager pick a book by accident — it must justify the choice.
| SPOT book | FUTURES book | |
| Job | Long-term conviction, ETF/narrative/on-chain plays | Tactical alpha, hedges, mean reversion, funding plays |
| Holding | Days to months | Hours to days |
| Direction | Long-biased (rare inverse setups) | Long + short equally |
| Leverage | 1x always | 2-5x typical, max 10x |
| SL distance | 8-15% (let thesis breathe) | 2-4% (leverage compensates) |
| R/R min | 3:1 | 2:1 |
| Max open | 5 | 3 |
| Max allocated | 80% of spot balance | 30% of futures balance (margin) |
| Funding cost | None | Tracked per trade |
| Liquidation risk | None | Computed at entry |
Book selection question for any new trade (the portfolio-manager must answer this explicitly):
- Multi-week thesis (narrative, ETF, upgrade, on-chain) → SPOT
- Multi-day technical setup at a specific level → FUTURES
- Hedge for existing spot exposure → FUTURES (short)
- Funding-rate harvest (delta-neutral) → FUTURES
- "Averaging down" a spot loss → STOP. Re-think or wait.
See agents/portfolio-manager.md § "Two Books, Two Mindsets" for the full rules.
Agents (7)
| Agent | Role | Model | MCPs | Native Tools |
| market-monitor | Fast market data, whale alerts, arbitrage scan | haiku | data, futures, exchange | WebSearch, Read |
| technical-analyst | Indicators, patterns, signals | sonnet | technical, advanced-indicators, exchange, data, learning-db | WebSearch, Read |
| news-sentiment | News + social sentiment + crowd psychology + market-priced consensus | sonnet | learning-db, polymarket | WebSearch, WebFetch, Read |
| risk-specialist | Risk, volatility, microstructure, institutional flows, on-chain capital flows | sonnet | technical, microstructure, data, exchange, learning-db, defillama | WebSearch, Read |
| portfolio-manager | Final decisions + trade execution + Polymarket/on-chain sanity check | opus | data, learning-db, polymarket, defillama | Read, Grep, Write |
| learning-agent | Predictions, patterns, post-mortem | opus | data, learning-db | Read, Grep, Write |
| system-builder | Generate new MCP servers, agents, skills + tests | opus | (none) | Read, Write, Grep, Glob, WebSearch, WebFetch |
MCP Servers (9)
| Server | Tools | Data Source |
| crypto-data | 11 | CoinGecko API (market metadata: fear/greed, dominance, rankings — NOT for live prices) |
| crypto-exchange | 15 | CCXT multi-exchange (orderbooks, OHLCV, volume, arbitrage) |
| crypto-technical | 14 | CCXT + calculated (RSI, MACD, Bollinger, patterns, signals) |
| crypto-futures | 10 | CCXT futures (funding rates, OI, long/short, liquidations) |
| crypto-advanced-indicators | 8 | CCXT (OBV, MFI, ADX, Ichimoku, VWAP, Pivot Points) |
| crypto-market-microstructure | 6 | CCXT (orderbook depth, imbalance, spoofing, market impact) |
| crypto-learning-db | 18 | SQLite (trades, predictions, patterns, summaries, track records, trade modifications) |
| crypto-polymarket | 6 | Polymarket Gamma API (prediction market probabilities — wisdom of crowds priced in real capital) |
| crypto-defillama | 7 | DefiLlama API (TVL by chain/protocol, stablecoin supply, DEX volume, on-chain capital flows) |
Note: News and sentiment analysis uses WebSearch + WebFetch directly (Claude's native web intelligence) instead of MCP. This provides real-time breaking news, social sentiment from Twitter/Reddit, and semantic understanding superior to RSS-based keyword matching.
Skills (8)
| Skill | Usage | Description |
/setup | /setup | First-time environment setup (cross-platform) |
/analyze | /analyze BTC | Full 5-agent phased analysis with decision |
/quick | /quick ETH | Fast single-agent market check |
/portfolio | /portfolio | Portfolio status and open trades |
/close-trade | /close-trade trade_001 | Close trade with post-mortem + learning |
/validate-predictions | /validate-predictions | Review pending predictions against market data |
/monitor | /monitor | Autonomous loop: check SL/TP, close trades, evaluate predictions, generate summaries |
/create | /create a DeFi tracker | Extend the system with new components (+ tests for MCP servers) |
Design Decisions
- Hybrid routing — Quick queries use single subagents (cheap, fast). Full analysis uses 5 phased subagents (parallel where possible, sequential where needed).
- Model optimization — haiku for data scouts, sonnet for analysis, opus for final decisions. ~40-60% token savings vs all-sonnet. Model is passed explicitly via Task
modelparameter. - General-purpose subagents — All agents use
subagent_type: general-purposeto inherit MCP tools. Plugin agent types don't pass MCP tools to subagents (Claude Code #4476). Agent.mdfiles define the analysis framework; the coordinator includes their instructions in the Task prompt. - Persistent memory — portfolio-manager and learning-agent use
memory: projectto build institutional knowledge across sessions. - File-based coordination — Agents write structured Markdown reports to a shared directory. Later-phase agents read those files before starting their analysis.
- Zero orchestration code — No Python coordinator, no Agent SDK. Claude Code is the coordinator via CLAUDE.md + agents/.
- Dual distribution — Works as a Claude Code plugin (
claude plugin install) or as a local clone (--plugin-dir). Both modes use the samegeneral-purposedelegation pattern. - SQLite cognitive memory — Trades, predictions, and patterns stored in SQLite (
data/db/learning.db). Agents query only what they need viacrypto-learning-dbMCP, preventing context window overflow. Scales to unlimited trades.
Cognitive Learning System
The system learns from every trade through a SQLite-backed cognitive memory (crypto-learning-db MCP server).
Storage: SQLite Database (data/db/learning.db)
| Table | Purpose |
trades | All open and closed trades with full metadata |
predictions | Testable predictions from each agent (with NL evaluations) |
trade_modifications | SL/TP change history with NL reasons |
patterns | Named trading patterns with win rates |
summaries | Monthly/quarterly performance summaries |
portfolio_state | Current balances and aggregate stats |
Three Learning Layers
- Operational memory (SQLite queries): What the agent needs right now for a specific decision
- Strategic memory (summaries table): Compressed knowledge from past periods, generated via
generate_summary() - Meta-learning (
get_prediction_track_record()): "How reliable is this type of setup in these conditions?"
Adaptive Learning (NL-driven)
The system learns through natural language reasoning, not formulas. MCP tools store data; agents do all interpretation.
validate_prediction(evaluation="...")stores the learning-agent's NL analysis of how close a prediction was and why. No formulas, no credit scores — just the agent's written reasoning.get_prediction_track_record(symbol="...", strategy_type="...")provides setup-centric accuracy by time window (7d, 30d, 90d, global) PLUS recent NL evaluations. The key question is "how reliable is this setup?" not "how much do I trust this agent?"find_expired_predictions()surfaces predictions past their timeframe with price context. The agent evaluates each one and validates.- portfolio-manager reads track records + evaluations and reasons in NL about setup reliability. Claude is the consensus engine.
Learning Loop
Open trade → record_trade() + record_prediction() → close trade → close_trade() + validate_prediction(evaluation="...") → NL evaluation stored → upsert_pattern() → generate_summary() periodically → next trade: get_prediction_track_record() returns setup accuracy + evaluations → agent reasons about setup reliability → find_expired_predictions() catches missed validations.
Headless / Autopilot Mode
Skills are NOT invoked via /skill-name in -p (print) mode. For scheduled execution via cron, use bin/autopilot.sh which maps workflow names to detailed natural language prompts:
./bin/autopilot.sh monitor # Check SL/TP, close trades, evaluate
./bin/autopilot.sh quick "BTC ETH" # Fast market snapshot
./bin/autopilot.sh analyze "BTC" # Full 5-agent analysis
./bin/autopilot.sh portfolio # Portfolio statusThe wrapper handles PATH, working directory, tool permissions (--allowedTools), and logging.
Output Guidelines
- Data-driven analysis with specific numbers
- Actionable insights, not generic commentary
- Risk parameters on every trade suggestion
- Reports saved to
data/reports/for full analyses - Learning-agent builds pattern library over time via persistent memory
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

