# moremeds/unusual-whales-skill architecture

> Architecture diagram of the GitHub repository moremeds/unusual-whales-skill, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moremeds/unusual-whales-skill
- Repository: https://github.com/moremeds/unusual-whales-skill

## Overview

1. This repository is not a standalone trading app; it is a **Claude Code skill package** that extends Claude into an **Unusual Whales–driven trading intelligence workflow**. The skill is installed into `~/.claude/skills/unusual-whales/` and invoked from Claude Code as `/unusual-whales ...`.

2. The top-level package boundary is very small: `package.json`, `install.js`, and `uninstall.js` exist to **copy/remove the skill files**. Operational behavior lives in `skill/SKILL.md` plus the reference docs under `skill/references/`. The `.claude-plugin` metadata indicates this is also publishable as a Claude plugin/marketplace asset.

3. The main runtime boundary is **Claude Code + MCP tools**, not a custom server. The skill depends on:
   - **Playwright MCP** to interact with Unusual Whales pages in Chrome
   - **Gmail MCP** for email delivery of full reports
   - a locally configured **Discord webhook** for short summaries
   - **DuckDB** for persistence and historical calibration  
   These external integrations materially shape the architecture because the skill orchestrates them rather than hosting its own backend.

4. The primary data acquisition subsystem is the **Unusual Whales page extractor**. The README says it pulls data from six page types using **React Fiber / Highcharts chart data** through Playwright. This implies the first stage is browser-based scraping of live site state, not API consumption. The extracted state becomes the raw input for all downstream scoring and report generation.

5. The core analytics pipeline is a **four-bucket composite score** on a ±100 scale:
   - Market Structure: GEX flip, gamma walls, DEX, vanna, charm
   - Volatility: IV rank, IV-HV spread, skew, term structure
   - Flow: net premium, put/call ratio, dark pool conviction
   - Positioning: OI changes, short interest, squeeze risk  
   This score is the central decision boundary that drives recommendation labels and trade selection.

6. Trade construction is a separate subsystem from signal scoring. The skill generates **defined-risk trade ideas only**, selecting strategy by direction and IV regime (for example, bullish + cheap IV vs bullish + expensive IV). Management rules are part of the output model: profit target, stop loss, GEX-anchored stop, and time stop. The README explicitly says unbounded risk is avoided.

7. The **VRP put-selling module** is an independent overlay, not just another score component. It uses z-score gating, regime awareness, and GEX-anchored strike selection. That means the system can produce a general directional view while also separately deciding whether premium-selling is favorable.

8. The reasoning layer is an **AI synthesis step** that turns metrics into narrative output: confluence, quality grade, and risk callouts. The repo’s docs suggest this is governed by a dedicated “analysis framework” and “AI reasoning” reference material, implying the skill separates deterministic calculations from explanatory synthesis.

9. Reporting and delivery are multi-channel:
   - **Email** delivers the full HTML report with charts and tables
   - **Discord** gets a compact summary
   - the **Claude conversation** gets a minimal confirmation  
   Payoff diagrams are rendered via **Chart.js + Playwright screenshot**, so the report pipeline includes a visualization/export step before delivery.

10. Persistence is a major architectural boundary. Analyses are stored in a local **DuckDB database** at `~/Library/Application Support/unusual-whales/analyses.duckdb`, with logical stores for:
    - analyses
    - trades
    - raw snapshots
    - outcomes  
    This enables replay, debugging, and historical queries without re-scraping Unusual Whales.

11. Outcome tracking and calibration form the self-improving loop. The system automatically checks **T+5 and T+30 prices** to score directional accuracy, then computes **per-bucket and per-ticker calibration** once enough history exists. This is the feedback layer that turns one-off analyses into a learning system.

12. There are several operational modes built on the same pipeline:
    - **single ticker** and **batch** analysis
    - **watchlists**
    - **fast** mode for GEX + volatility only
    - **scan** mode for screener-based setup discovery
    - **regime** mode for a quick SPY/QQQ market check
    - **brief**, **history**, **replay**, **calibrate**, and **check** for maintenance/intelligence workflows  
    These are different front doors into shared analysis, persistence, and delivery subsystems.

13. Configuration is intentionally externalized. The README says setup writes `~/.config/unusual-whales/config.yaml` for delivery settings like Discord webhook and email address. That keeps secrets and environment-specific data out of the repository and separates installation-time configuration from analysis logic.

14. The repository content is heavily documentation-driven. `skill/references/` contains the implementation guidance for extraction, scoring, alerts, history replay, persistence, regime dashboard, scan playbook, and delivery. The `docs/designs/` and `docs/strategy/` folders are research and architecture context, not runtime code, so the repo functions as a packaged operating manual for the skill as much as a software artifact.

Main entry points: [`skill/SKILL.md`](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/SKILL.md) (Skill guide), [`skill/references/analysis-framework.md`](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/analysis-framework.md) (Composite score), [`skill/references/persistence.md`](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/persistence.md) (DuckDB store), [`skill/references/extraction-strategies.md`](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/extraction-strategies.md) (Page extractor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Package"]
  node_n1["Plugin metadata<br/>manifest<br/>[plugin.json]"]
  node_n2["Installer<br/>npm script<br/>[install.js]"]
  node_n3["Uninstaller<br/>npm script<br/>[uninstall.js]"]
end

subgraph group_g2["Skill runtime"]
  node_n4["Skill guide<br/>claude skill<br/>[SKILL.md]"]
  node_n5["Reference playbooks<br/>docs set"]
  node_n6["Claude Code<br/>runtime"]
  node_n7["MCP tools<br/>integrations"]
end

subgraph group_g3["Analytics"]
  node_n8[("Unusual Whales pages<br/>source UI")]
  node_n9["Page extractor<br/>scraper"]
  node_n10{{"Composite score<br/>scoring engine"}}
  node_n11["Trade builder<br/>strategy engine"]
  node_n12["VRP overlay<br/>premium-selling<br/>[vrp-put-selling.md]"]
  node_n13["AI synthesis<br/>reasoning layer<br/>[ai-reasoning.md]"]
  node_n14["Modes<br/>front doors<br/>[batch-mode.md]"]
end

subgraph group_g4["State & delivery"]
  node_n15[("DuckDB store<br/>local db<br/>[persistence.md]")]
  node_n16(("Calibration loop<br/>feedback loop<br/>[calibration.md]"))
  node_n17["Email report<br/>delivery<br/>[email-delivery.md]"]
  node_n18["Discord summary<br/>delivery"]
  node_n19["Payoff charts<br/>visualization"]
end

node_n2 -->|"installs"| node_n4
node_n3 -->|"removes"| node_n4
node_n1 -->|"packages"| node_n2
node_n6 -->|"invokes"| node_n4
node_n4 -->|"orients"| node_n5
node_n4 -->|"uses"| node_n7
node_n7 -->|"browser scrape"| node_n9
node_n9 -->|"reads"| node_n8
node_n9 -->|"feeds"| node_n10
node_n10 -->|"drives"| node_n11
node_n10 -->|"gates"| node_n12
node_n10 -->|"interpreted by"| node_n13
node_n11 -->|"visualized by"| node_n19
node_n19 -->|"included in"| node_n17
node_n13 -->|"writes"| node_n17
node_n13 -->|"summarizes"| node_n18
node_n10 -->|"stores"| node_n15
node_n11 -->|"records"| node_n15
node_n15 -->|"enables"| node_n16
node_n16 -->|"tunes"| node_n10
node_n14 -->|"routes to"| node_n10
node_n14 -->|"replays"| node_n15
node_n4 -.->|"documents"| node_n17
node_n4 -.->|"documents"| node_n18

click node_n1 "https://github.com/moremeds/unusual-whales-skill/blob/main/.claude-plugin/plugin.json"
click node_n2 "https://github.com/moremeds/unusual-whales-skill/blob/main/install.js"
click node_n3 "https://github.com/moremeds/unusual-whales-skill/blob/main/uninstall.js"
click node_n4 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/SKILL.md"
click node_n5 "https://github.com/moremeds/unusual-whales-skill/tree/main/skill/references"
click node_n9 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/extraction-strategies.md"
click node_n10 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/analysis-framework.md"
click node_n11 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/analysis-framework.md"
click node_n12 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/vrp-put-selling.md"
click node_n13 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/ai-reasoning.md"
click node_n14 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/batch-mode.md"
click node_n15 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/persistence.md"
click node_n16 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/calibration.md"
click node_n17 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/email-delivery.md"
click node_n18 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/discord-delivery.md"
click node_n19 "https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/payoff-visualization.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n1,node_n2,node_n3 toneBlue
class node_n4,node_n5,node_n6,node_n7 toneAmber
class node_n8,node_n9,node_n10,node_n11,node_n12,node_n13,node_n14 toneMint
class node_n15,node_n16,node_n17,node_n18,node_n19 toneRose
```

## Components

### Package

Installable Claude skill and plugin wrapper.

- [Plugin metadata](https://github.com/moremeds/unusual-whales-skill/blob/main/.claude-plugin/plugin.json): manifest · Claude plugin and marketplace packaging metadata. · `.claude-plugin/plugin.json`
- [Installer](https://github.com/moremeds/unusual-whales-skill/blob/main/install.js): npm script · Copies the skill into the Claude skills directory. · `install.js`
- [Uninstaller](https://github.com/moremeds/unusual-whales-skill/blob/main/uninstall.js): npm script · Removes the installed skill package. · `uninstall.js`

### Skill runtime

Main operational boundary inside Claude Code and MCP tools.

- [Skill guide](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/SKILL.md): claude skill · Primary operational instructions for the Unusual Whales workflow. · `skill/SKILL.md`
- [Reference playbooks](https://github.com/moremeds/unusual-whales-skill/tree/main/skill/references): docs set · Implementation guidance for extraction, scoring, alerts, delivery, replay, and modes. · `skill/references`
- **Claude Code**: runtime · User-facing execution environment that invokes the skill.
- **MCP tools**: integrations · Tool layer used by the skill to act on browsers, email, and other external services.

### Analytics

Extraction, scoring, trade construction, and reasoning pipeline.

- **Unusual Whales pages**: source UI · Live market intelligence pages scraped through browser interaction.
- [Page extractor](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/extraction-strategies.md): scraper · Playwright-based extraction using React Fiber and chart data from multiple page types. · `skill/references/extraction-strategies.md`
- [Composite score](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/analysis-framework.md): scoring engine · Four-bucket ±100 scoring across structure, volatility, flow, and positioning. · `skill/references/analysis-framework.md`
- [Trade builder](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/analysis-framework.md): strategy engine · Produces defined-risk directional trade ideas with management rules. · `skill/references/analysis-framework.md`
- [VRP overlay](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/vrp-put-selling.md): premium-selling · Independent put-selling module with regime and z-score gating. · `skill/references/vrp-put-selling.md`
- [AI synthesis](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/ai-reasoning.md): reasoning layer · Turns metrics into narrative, grade, and risk callouts. · `skill/references/ai-reasoning.md`
- [Modes](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/batch-mode.md): front doors · Single, batch, watchlist, fast, scan, regime, brief, history, replay, calibrate, and check workflows. · `skill/references/batch-mode.md`

### State & delivery

Persistence, calibration, and outbound reporting channels.

- [DuckDB store](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/persistence.md): local db · Persistent store for analyses, trades, raw snapshots, and outcomes. · `skill/references/persistence.md`
- [Calibration loop](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/calibration.md): feedback loop · T+5 and T+30 outcome tracking plus per-bucket and per-ticker calibration. · `skill/references/calibration.md`
- [Email report](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/email-delivery.md): delivery · Full HTML report delivery with charts and tables. · `skill/references/email-delivery.md`
- [Discord summary](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/discord-delivery.md): delivery · Compact webhook summary for quick sharing. · `skill/references/discord-delivery.md`
- [Payoff charts](https://github.com/moremeds/unusual-whales-skill/blob/main/skill/references/payoff-visualization.md): visualization · Chart.js payoff diagrams rendered and captured for reports. · `skill/references/payoff-visualization.md`

## Connections

- Installer → Skill guide: installs · Installer places the skill package for Claude Code to use.
- Uninstaller → Skill guide: removes · Uninstaller deletes the installed skill package.
- Plugin metadata → Installer: packages · Plugin metadata supports installation and marketplace distribution.
- Claude Code → Skill guide: invokes · Claude Code enters the skill through the skill guide.
- Skill guide → Reference playbooks: orients · Skill guide points to deeper operating references.
- Skill guide → MCP tools: uses · Skill delegates work through MCP and external integrations.
- MCP tools → Page extractor: browser scrape · Playwright MCP supports browser-based extraction.
- Page extractor → Unusual Whales pages: reads · Extractor pulls live state from Unusual Whales pages.
- Page extractor → Composite score: feeds · Extracted market data becomes scoring input.
- Composite score → Trade builder: drives · Composite score informs directional trade construction.
- Composite score → VRP overlay: gates · Score and regime context influence the VRP overlay.
- Composite score → AI synthesis: interpreted by · Deterministic metrics are turned into narrative synthesis.
- Trade builder → Payoff charts: visualized by · Trade outputs are turned into payoff diagrams.
- Payoff charts → Email report: included in · Charts are embedded in the full email report.
- AI synthesis → Email report: writes · Narrative analysis is assembled into the report.
- AI synthesis → Discord summary: summarizes · Short-form synthesis becomes the Discord summary.
- Composite score → DuckDB store: stores · Analyses and snapshots are persisted locally.
- Trade builder → DuckDB store: records · Trade ideas are stored for replay and tracking.
- DuckDB store → Calibration loop: enables · Historical records support automated outcome calibration.
- Calibration loop → Composite score: tunes · Calibration feeds back into scoring thresholds and confidence.
- Modes → Composite score: routes to · Different modes reuse the same scoring core.
- Modes → DuckDB store: replays · History, replay, and calibrate modes query stored data.
- Skill guide → Email report: documents · Skill instructions define full report delivery.
- Skill guide → Discord summary: documents · Skill instructions define quick summary delivery.
