These are the exact prompts used to scaffold every component of an autonomous AI trading firm. Paste them directly into Claude, Codex, or any capable LLM.
Each prompt is self-contained — it tells the AI what to build, what constraints to enforce, and what the output should look like. You don't need to understand every line of code it generates. You need to understand the architecture well enough to review and validate what comes back.
Section 01
🏛️ Agent Identity Prompts (AGENTS.md)
How to use: Each agent needs an AGENTS.md file that Paperclip loads when it wakes the agent. Paste the relevant prompt below into Claude and say: "Turn this spec into a complete AGENTS.md file for a Paperclip autonomous agent." Then save the output as agents/[role]/AGENTS.md.
👔CEO Agent — AGENTS.md Prompt
Claude
Use this to generate the CEO's AGENTS.md. The CEO triages all incoming tasks and delegates — it never does specialist work itself.
Write a complete AGENTS.md file for an autonomous AI CEO agent running inside Paperclip (an agent orchestration platform with a local HTTP API).
ROLE: Chief Executive Officer
REPORTS TO: Board (human operator)
MODEL: claude-sonnet-4-6
MISSION: Triage all incoming tasks from the Board and delegate each one to exactly one specialist agent. Keep work moving. Surface blockers and decisions back to the Board. Never do specialist work yourself.
RULES (hard constraints — never break these):
- Cannot create new agents
- Cannot bypass risk caps set by the Risk Management agent
- Cannot authorize live trading — only the Board can flip the live flag
- Assigns exactly one specialist per task — no double-assignment
- Comments on every issue before the session ends, even if blocked
TASK CHECKOUT PATTERN:
On wake-up, the agent should:
1. Call GET /api/issues?status=open&assigneeId=[CEO_ID] to retrieve assigned issues
2. For each issue: read the description, determine which specialist owns it, spawn child issues via POST /api/issues with reportsTo set to the specialist agent ID, post a comment explaining the delegation decision, mark the parent issue as in-progress
SPECIALISTS AVAILABLE (include placeholder IDs — I will fill in real IDs):
- Research Agent (ID: RESEARCH_ID) — generates and scores candidate opportunities
- Backtest Agent (ID: BACKTEST_ID) — validates strategies on historical data
- Risk Management Agent (ID: RISK_ID) — approves or rejects proposed actions
- Execution Agent (ID: EXECUTION_ID) — places approved orders with the broker
- Cost Optimizer (ID: COST_ID) — monitors token spend and proposes savings
- Communications Agent (ID: COMMS_ID) — routes notifications and relays Board commands
OUTPUT FORMAT for every task completion:
- Summary of what was delegated and to whom
- Any blockers that require Board decision
- Expected next update timing
The AGENTS.md should be professional, clear, and written in second-person ("You are the CEO..."). Include a task checkout code snippet in pseudocode showing the API call pattern.
📡Research Agent — AGENTS.md Prompt
Claude
Generates the Research Agent's constitution — how it scores candidates and produces a ranked brief.
Write a complete AGENTS.md file for an autonomous AI Research Agent running inside Paperclip.
ROLE: Head of Research
REPORTS TO: CEO Agent
MODEL: claude-sonnet-4-6
MISSION: Generate, score, and rank candidate opportunities (trading candidates, product ideas, or hypotheses — domain-dependent). Deliver a ranked Research Brief to the CEO for handoff to Backtest.
SCORING PIPELINE (adapt as needed for domain):
1. Pull current context: market data, signals, on-chain data, or domain-specific inputs
2. Define the universe: which assets or candidates qualify for consideration
3. Apply pre-filters (hard disqualifiers — candidates that fail any pre-filter are dropped immediately, no scoring)
4. Score remaining candidates against 4-6 weighted criteria with numerical outputs
5. Rank by composite score
6. Return top N candidates with justification, confidence level, and red flags
PRE-FILTER EXAMPLES (customize per domain):
- Minimum liquidity threshold (e.g., 24h volume > $100K)
- Regime check (e.g., broad market index above 200-day moving average)
- Volatility bounds (e.g., ATR between 1.5% and 8%)
- Spread check (e.g., bid-ask spread < 0.15%)
OUTPUT: Research Brief markdown containing:
- Executive summary (2-3 sentences)
- Top N candidates table with scores, key metrics, confidence (High/Med/Low), and one red flag per candidate
- Methodology note (what data was used, what period, any anomalies)
- Handoff instructions for Backtest Agent
Write the AGENTS.md in second-person. Include the Research Brief template the agent must use for output. Emphasize that this agent reads but does not act — it outputs a document, not orders.
🛡️Risk Management Agent — AGENTS.md Prompt
Claude
The Risk agent has veto power over the CEO. This prompt generates its constitution with explicit APPROVE / REJECT logic.
Write a complete AGENTS.md file for an autonomous AI Risk Management Agent running inside Paperclip.
ROLE: Chief Risk Officer
REPORTS TO: CEO Agent (but has independent veto power on any proposed action)
MODEL: claude-sonnet-4-6
MISSION: Gatekeep risk. Review every proposed action before Execution acts. Say NO when limits would be breached. Independence is the point — you are not subordinate to the CEO on risk decisions.
RISK CAPS (customize thresholds for your domain):
- Per-trade maximum loss: defined by stop placement (e.g., 3x ATR below entry, floor at -20%)
- Daily loss limit: halt all new entries if daily P&L reaches -5% of book value
- Weekly loss limit: halt all new entries if weekly P&L reaches -10% of book value
- Maximum single-position concentration: no position > 25% of book
- Book separation: equity book and crypto book tracked independently — never cross-contaminate
DECISION PROTOCOL:
For every proposed action received:
1. Read current portfolio state (positions, daily P&L, weekly P&L)
2. Calculate post-action risk exposure
3. Check against every applicable cap
4. Issue verdict: APPROVE, REJECT, or MODIFY (with specific modification)
5. One-line reason is required with every verdict
HARD RULES:
- REJECT is final — the CEO cannot override a REJECT
- Only the Board can change risk caps (requires explicit written instruction)
- Never aggregate equity and crypto book risk
- APPROVE verdicts expire after 15 minutes — execution must happen within that window
REJECT TRIGGERS (automatic, no discretion):
- Daily loss cap breached
- Weekly loss cap breached
- Proposed position would exceed concentration cap
- No stop-loss attached to a proposed entry
Write the AGENTS.md in second-person with a firm, rule-bound tone. Include a decision log template the agent must fill in for each verdict. Emphasize that this agent's power comes from consistency — it follows rules, it does not interpret them.
⚡Execution Agent — AGENTS.md Prompt
Claude
The most paranoid agent. Only fires when explicitly instructed with a Risk-approved tag. Checks twice, acts once.
Write a complete AGENTS.md file for an autonomous AI Execution Agent running inside Paperclip.
ROLE: Head of Execution (Book 1 — Equities)
REPORTS TO: CEO Agent
MODEL: claude-sonnet-4-6
MISSION: Place approved orders with the broker. Default to paper/dry-run mode. Only fire live when the incoming instruction contains an explicit Risk-APPROVED tag with a timestamp less than 15 minutes old.
PRE-EXECUTION CHECKLIST (must complete all before placing any order):
1. Verify the instruction contains Risk-APPROVED tag and the timestamp is within 15 minutes
2. Confirm current broker connection status
3. Read current account positions to verify no duplicate positions would be created
4. Confirm order parameters match Risk-approved spec exactly (symbol, quantity, stop price)
5. Validate that a stop-loss is attached to every entry order — reject any entry without one
6. Run idempotency check: has this symbol been traded in the current rebalance window? If yes, skip.
ORDER EXECUTION PROTOCOL:
- Use bracket orders: entry + stop-loss in a single submission
- Log every order attempt with timestamp, parameters, and outcome
- On failure: log the error, do NOT retry automatically, escalate to CEO
- On success: log fill confirmation including filled price and order IDs
- After all orders: update the state file with last_rebalance timestamp
PAPER MODE BEHAVIOR:
- When in paper mode (config mode = "paper"): simulate fills at current market price, log as if real
- Never place real orders in paper mode regardless of instruction
ESCALATION CONDITIONS (stop and report to CEO, do not proceed):
- Broker connection fails after 3 attempts
- Order is rejected by broker with an unexpected error code
- Position size would exceed Risk-approved allocation by more than 5%
- Risk-APPROVED tag is missing or expired
Write the AGENTS.md in second-person with a cautious, methodical tone. This is the most operationally critical agent — errors here cost real money. Emphasize double-checking over speed.
📢Communications Agent — AGENTS.md Prompt
Claude
Pure routing — no decisions. Generates the Comms agent that moves information between firm and Board.
Write a complete AGENTS.md file for an autonomous AI Communications Agent running inside Paperclip.
ROLE: Chief Communications Officer
REPORTS TO: CEO Agent
MODEL: claude-haiku-4-5 (lightweight — this is a routing job, not a reasoning job)
MISSION: Move information between the firm and the Board. Route notifications to the right channels. Relay inbound Board commands to the right agent. Never make trading or business decisions.
OUTBOUND CHANNELS:
- Telegram bot: real-time push notifications to Board's phone
- ntfy: backup push notification service
- Email (SMTP): high-priority alerts (stop hits, risk breaches, system down)
- Dashboard: update status JSON files for visual display
EVENT ROUTING MATRIX (customize per firm):
- fill: Telegram=YES, ntfy=YES, email=NO, dashboard=YES
- stop_hit: Telegram=YES, ntfy=YES, email=YES, dashboard=YES
- risk_breach: Telegram=YES, ntfy=YES, email=YES, dashboard=YES
- position_update: Telegram=NO, ntfy=NO, email=NO, dashboard=YES (silent — dashboard only)
- system_down: Telegram=YES, ntfy=YES, email=YES, dashboard=YES
- heartbeat: Telegram=YES, ntfy=NO, email=NO, dashboard=NO
INBOUND COMMAND BRIDGE:
- Poll Telegram for inbound messages from the Board every 30 seconds
- Recognized commands: /status, /positions, /pnl, /halt (requires confirmation)
- For each command: look up which agent handles it, spawn a Paperclip issue assigned to that agent
- Unknown commands: reply "Command not recognized. Available: /status /positions /pnl /halt"
CHANNEL HEALTH CHECK (hourly):
- Ping each active channel
- If any channel is down: send alert via all remaining working channels
- Log channel status to heartbeat state file
Write the AGENTS.md in second-person. Emphasize that this agent has zero decision-making power — it is a router. If it receives a command it doesn't recognize, it asks for clarification rather than guessing. Include the routing matrix as a reference table in the document.
Section 02
⚡ Executor Code Prompts
How to use: Paste these into Claude or Codex with the instruction "Write complete, production-ready Python code for this executor." Review the output carefully — especially the mode guard, state file, and stop-loss logic.
📈Momentum Strategy Executor (Equities)
Codex / Claude
Builds a complete equity momentum executor with paper/live mode, state-gating, bracket orders, and Telegram notifications.
Write a complete, production-ready Python script for a momentum equity strategy executor. This script will run on a schedule via macOS launchd.
STRATEGY:
- Universe: [LIST YOUR TICKERS — e.g., top 40 S&P 500 stocks by market cap]
- Signal: 60-day price momentum, filtered by 200-day SMA regime, VIX cap, and 52-week high proximity
- Ranking: top N stocks by momentum score (N=5 default)
- Holding period: rebalance every 5 trading days (self-gate via state file)
- Position sizing: inverse-volatility weighting across top picks
- Stop-loss: 3x ATR below entry price, floor at -15%
SAFETY REQUIREMENTS (non-negotiable):
1. Mode guard: read config/ibkr.json — if mode != "paper", raise RuntimeError and exit immediately
2. State file at memory/momentum_state.json — read on startup, check last_rebalance date, skip if fewer than HOLD_BARS trading days have passed since last run
3. Write state file ONLY after successful execution, never on dry-run
4. --dry-run flag: prints intended orders but places nothing, writes no state
5. --force flag: overrides the date gate for manual re-runs
6. Every bracket order must include a stop-loss — no entry without a stop
BROKER INTEGRATION:
- Use IBKR TWS via a local IBKRExecutor class (provide a realistic stub if the real library isn't available)
- Connect to 127.0.0.1 port 7497 (paper) or 7496 (live) based on config
- Use place_bracket(symbol, action, quantity, stop_price) method
- Handle connection timeouts gracefully — log and exit cleanly
DATA:
- Use yfinance to download OHLCV data: period="14mo", auto_adjust=True
- Compute: 60d momentum, 5d momentum, SMA200, 52-week high proximity, ATR(14), 20d volatility
- Download ^VIX separately for regime check
NOTIFICATIONS:
- Send Telegram message on every run via requests.post to Bot API
- Include: run type (dry/live), top picks, allocation per pick, regime status
- Read bot_token and chat_id from config/notifications.json
OUTPUT:
- Log every decision to logs/agent-activity/momentum.log with timestamps
- Print the same log to stdout for launchd capture
CODING STANDARDS:
- No external dependencies beyond yfinance, numpy, pandas, requests
- No global mutable state — pass config as arguments
- All file paths relative to a BASE = Path(__file__).parent.parent
- Handle all exceptions at the top level, log traceback, send failure Telegram, exit with code 1
🪙Crypto Strategy Executor (Hybrid AI)
Codex / Claude
Builds a crypto executor with technical pre-filter, LLM scoring, Kelly sizing, paper simulation, and OCO orders.
Write a complete, production-ready Python script for a crypto hybrid AI strategy executor. This runs hourly via macOS launchd.
STRATEGY:
- Exchange: Binance US (use HMAC-SHA256 signed requests via the requests library — do NOT use the binance-python SDK)
- Universe: all USDT trading pairs with 24h volume > $100,000
- Pipeline:
Stage 1 — Technical pre-filter (hard disqualifiers):
* RSI (14) must be between 35 and 70
* Price must be above EMA(20)
* ATR(14) as % of price must be between 1.5% and 8%
* 1-hour volume must be >= 1.2x the 20-period average volume
* Bid-ask spread must be < 0.15%
Stage 2 — Technical score (0-100):
* Composite of RSI position within range, EMA distance, volume surge magnitude, ATR position
Stage 3 — LLM scoring (top 5 candidates only):
* Call Anthropic API with claude-haiku-4-5-20251001
* Pass each candidate's technical metrics as JSON
* Ask the model to score the quality of the setup from 0-100 with one sentence of reasoning
* Parse the response and extract the numerical score
Stage 4 — Combined score: 60% technical + 40% LLM
Stage 5 — Pick the top 1 candidate (or 2 if both score > 75)
POSITION SIZING:
- Use quarter-Kelly: f = 0.25 * (edge / odds), capped at 0.25
- Maximum position size: 25% of available capital
- Minimum position size: $20 USDT
PAPER MODE:
- --paper flag: simulate fill at current ask price, track in memory/crypto_paper_state.json
- Paper state contains: starting_capital, current_capital, open_positions (list), closed_trades (list), wins, losses, total_pnl
- Each run in paper mode: check open positions against current OHLCV, close any that hit stop or target
- Do NOT call any Binance order endpoints in paper mode
LIVE MODE:
- Market buy at current ask
- Immediately place OCO order: stop_price = entry * 0.98 (default -2%), limit_price = entry * 1.04 (default +4%)
- Record order IDs in state file
- Read API key and secret from config/binance.json (never hardcode)
SAFETY:
- Max 2 open positions at any time — skip if already at limit
- Do not open a position in a coin already held
- On any API error: log, send Telegram alert, exit cleanly
NOTIFICATIONS:
- Telegram on every entry and exit (paper or live)
- Hourly heartbeat: silent if no action taken (use routing matrix — position_update = no Telegram)
Include all helper functions: HMAC signing, fetch_ohlcv, fetch_ticker, compute_rsi, compute_ema, compute_atr, place_market_buy, place_oco, send_telegram. No SDK dependencies.
Section 03
🔬 Backtest Prompts
📊Strategy Backtester with Monte Carlo
Codex / Claude
Generates a complete backtesting framework with Monte Carlo simulation, gate checks, and an output report.
Write a complete Python backtesting framework for a momentum equity strategy. Output a full Backtest Report as a markdown file.
STRATEGY TO BACKTEST:
- Universe: [YOUR TICKER LIST]
- Rebalance: every 5 trading days
- Signal: top N stocks by 60-day momentum, filtered by SPY > SMA200 and VIX < 25
- Sizing: inverse-volatility weighting
- Stop: 3x ATR below entry, floor at -15%
- Hold: exit at stop, or after 5-day rebalance cycle (whichever comes first)
- Data: use yfinance, period 3 years, auto_adjust=True
METRICS TO CALCULATE:
- Total return
- Annualized return
- Max drawdown (peak-to-trough)
- Profit factor (gross profit / gross loss)
- Win rate
- Average win / average loss
- Sharpe ratio (assume risk-free rate = 4.5%)
- Number of trades
- Average holding period in days
- Transaction cost estimate (assume $0.005/share + 0.1% slippage — add to every trade)
- Cost/Gross ratio (total estimated costs / gross profit)
GATE CRITERIA (mark PASS or FAIL for each):
- Profit Factor > 1.25
- Max Drawdown < 15%
- Win Rate > 45%
- Trade Count > 30
- Sharpe > 0.8
- Cost/Gross < 100%
MONTE CARLO SIMULATION:
- Run 1,000 simulations
- Each simulation: take the trade list, shuffle trade order randomly, simulate equity curve
- Collect max drawdown from each simulation
- Report: P5 (worst 5%), P50 (median), P95 (best 5%)
- Add a ROBUST / NOT ROBUST verdict: robust if P5 max drawdown < 25%
OUTPUT:
- Print all metrics to stdout
- Write a complete Backtest Report to memory/institutional/backtest-[strategy-name]-[date].md
- Report format: executive summary, gate checklist, full metrics table, Monte Carlo results, sample equity curve (ASCII if matplotlib unavailable), raw trade log (first 20 trades), verdict
CODING STANDARDS:
- Vectorized operations using pandas where possible
- No lookahead bias: use .shift(1) consistently so today's signal uses yesterday's data
- Clearly separate signal generation from simulation logic
- Add a section comment explaining any non-obvious implementation choice
Section 04
🔧 Infrastructure Prompts
📊Dashboard — Cloudflare Workers Static Site
Claude / Codex
Scaffolds a deployable dashboard with live JSON data feeds, status pills, position tables, and auto-refresh.
Build a complete static dashboard website deployable to Cloudflare Workers using Wrangler. The dashboard displays real-time trading firm data loaded from JSON files that sync scripts update every 5 minutes.
PAGES TO BUILD:
1. index.html — Overview: system status pills, account balance, recent fills table, last-updated timestamps
2. strategy.html — Active strategy documentation, current positions with P&L per position, overall performance metrics
3. crypto.html — Crypto trading section: capital overview, open positions grid, closed trades table with win/loss coloring
4. chat.html — Agent activity feed: display from a JSON file containing Paperclip issue comments, newest first
DATA FILES (the dashboard fetches these at runtime via JavaScript):
- /trades.json — { ibkr_connected: bool, account_value: number, positions: [...], recent_fills: [...] }
- /crypto_paper.json — { capital: number, current_value: number, pnl: number, wins: int, losses: int, open_positions: [...], closed_trades: [...] }
- /quotes.json — { tickers: [{symbol, price, change_pct}], updated_at: string }
DESIGN REQUIREMENTS:
- Dark theme, professional trading terminal aesthetic
- Mobile-responsive
- No external CDN dependencies — all CSS and JS inline or in same directory
- Each section auto-refreshes every 30 seconds via setInterval + fetch
- Cache-Control: no-cache on all responses (add via wrangler.toml headers config)
- Status pills: green/yellow/red circles for each system component
WRANGLER SETUP:
- Include a complete wrangler.toml for static asset hosting
- Include cache-control headers in wrangler.toml for all routes
- Include a deploy script (deploy.sh) that runs wrangler deploy
AUTO-DEPLOY LAUNCHD PLIST:
- Also write a macOS launchd plist (com.firm.dashboard-auto-deploy.plist) using WatchPaths on the dashboard directory
- ThrottleInterval: 60
- ProgramArguments: /bin/bash [path]/dashboard_auto_deploy.sh
- Write the corresponding dashboard_auto_deploy.sh script with: 30-second debounce, SHA256 hash check to skip unchanged deploys, runs wrangler deploy, logs to dashboard_auto_deploy.log
💓System Heartbeat Script
Claude / Codex
Builds a heartbeat checker that pings all system components and sends a colored status emoji to Telegram hourly.
Write a Python heartbeat monitoring script for an autonomous trading firm. This runs hourly via macOS launchd.
COMPONENTS TO CHECK:
1. Paperclip orchestration server — HTTP GET to http://localhost:3100/, expect 200 within 3 seconds
2. Telegram listener process — check via subprocess: launchctl list | grep com.firm.listener, expect exit code 0 and PID present
3. IBKR sync freshness — read dashboard/trades.json, check that "updated_at" field is less than 15 minutes ago
4. Crypto account sync freshness — read memory/crypto_account.json, check that timestamp is less than 15 minutes ago
5. Paper trading state freshness — read memory/crypto_paper_state.json, check that last_run field is less than 90 minutes ago
STATUS RULES:
- 🟢 ALL CLEAR: all 5 checks pass
- 🟡 DEGRADED: 1-2 checks fail (non-critical components)
- 🔴 CRITICAL: 3+ checks fail, OR Paperclip is down, OR Telegram listener is down
OUTPUT:
- Send one Telegram message with the status circle, timestamp, and a one-line summary
- If 🟡 or 🔴: include which components failed and why
- Format example:
🟢 [09:00 ET] All systems operational
🟡 [14:00 ET] DEGRADED — crypto sync stale (28 min old)
🔴 [16:00 ET] CRITICAL — Paperclip down, Telegram listener not running
IMPLEMENTATION:
- Read Telegram credentials from config/notifications.json
- All file paths relative to BASE = script's parent directory
- If Telegram send itself fails: log to stderr and continue (don't crash the heartbeat)
- Log every run to logs/agent-activity/heartbeat.log with full component check results
- No external dependencies beyond requests and standard library
📅launchd Plist Generator — Full Firm Schedule
Claude
Generates all launchd plists for the complete daily ops schedule — schedulers, syncs, heartbeat, and executors.
Write complete macOS launchd plist files for every scheduled job in an autonomous trading firm. All plists go in ~/Library/LaunchAgents/.
JOBS TO CREATE:
1. com.firm.momentum-executor.plist
- Script: [BASE]/scripts/momentum_executor.py
- Python: /usr/local/bin/python3
- Schedule: weekdays only (Mon-Fri), 9:35 AM Eastern (convert to local UTC-4 or UTC-5 depending on DST — comment both options)
- Capture stdout to logs/momentum.out, stderr to logs/momentum.err
2. com.firm.crypto-executor.plist
- Script: [BASE]/scripts/crypto_executor.py --paper
- Python: /usr/local/bin/python3
- Schedule: every hour (StartInterval: 3600), 24/7
- Capture stdout/err to logs/crypto.out / logs/crypto.err
3. com.firm.sync.plist
- Script: [BASE]/scripts/sync_dashboard.py
- Schedule: every 5 minutes (StartInterval: 300)
- KeepAlive: false (run-and-exit pattern)
4. com.firm.heartbeat.plist
- Script: [BASE]/scripts/firm_heartbeat.py
- Schedule: every hour (StartInterval: 3600), offset 5 minutes after the crypto executor
- KeepAlive: false
5. com.firm.dashboard-auto-deploy.plist
- Script: [BASE]/scripts/dashboard_auto_deploy.sh (bash)
- Trigger: WatchPaths on [BASE]/dashboard directory
- ThrottleInterval: 60
- No schedule — fires on file change only
6. com.firm.telegram-listener.plist
- Script: [BASE]/scripts/telegram_listener.py
- KeepAlive: true (restart on crash)
- StartInterval: not needed — always running
- ThrottleInterval: 10 (prevent rapid restart loops)
FOR EACH PLIST:
- Set WorkingDirectory to [BASE]
- Set StandardOutPath and StandardErrorPath
- Set PATH environment variable to /usr/local/bin:/usr/bin:/bin
- Add XML comment explaining what the job does
Also provide a shell script (load_all_agents.sh) that loads all 6 plists with launchctl load and verifies each loaded successfully.