# galleonlabs/hypergrok-trading-desk architecture

> Architecture diagram of the GitHub repository galleonlabs/hypergrok-trading-desk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/galleonlabs/hypergrok-trading-desk
- Repository: https://github.com/galleonlabs/hypergrok-trading-desk

## Overview

HyperGrok is an AI-assisted Hyperliquid trading desk delivered as role profiles and portable skills, with a small set of read-only Python tools. The documented user workflow moves an idea through evidence, risk sign-off, explicit user approval, a single execution, exchange reconciliation, and review; separate capabilities cover market briefs, research/backtesting, monitoring, and desk readiness. Source excerpts show the read-only tools and shared CLI contract, but not the role or skill implementations, so those links reflect README-documented behavior and are cited there.

Main entry points: [`agents/desk-lead.md`](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/desk-lead.md) (Desk Lead), [`agents/execution-trader.md`](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/execution-trader.md) (Execution Trader), [`scripts/opening_bell.py`](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/opening_bell.py) (Opening snapshot), [`scripts/cli_contract.py`](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/cli_contract.py) (CLI contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desk["Desk workflow"]
  node_lead["Desk Lead<br/>[desk-lead.md]"]
  node_analyst["Market Analyst<br/>[market-analyst.md]"]
  node_researcher["Research Analyst"]
  node_strategist["Strategist<br/>[strategist.md]"]
  node_risk["Risk Manager<br/>[risk-manager.md]"]
  node_execution["Execution Trader"]
  node_reviewer["Trade Reviewer<br/>[trade-reviewer.md]"]
  node_lifecycle["Trade lifecycle<br/>[SKILL.md]"]
end

subgraph group_research["Market and research"]
  node_market_skill["Market data<br/>[SKILL.md]"]
  node_strategy_skill["Strategy lab<br/>[SKILL.md]"]
  node_research_data["Dataset collect and verify"]
end

subgraph group_tools["Read-only tools"]
  node_opening["Opening snapshot<br/>[opening_bell.py]"]
  node_doctor["Desk readiness<br/>[desk_doctor.py]"]
  node_stop_cost["Stop cost estimate<br/>[stop_cost.py]"]
  node_contract["CLI contract<br/>[cli_contract.py]"]
end

subgraph group_integrations["Exchange integration"]
  node_hyperliquid{{"Hyperliquid API"}}
  node_websocket_skill["WebSocket monitoring<br/>[SKILL.md]"]
  node_write_gate["Exchange write gate"]
end

node_user(("User"))

node_user -->|"starts desk"| node_lead
node_lead -->|"requests brief"| node_analyst
node_lead -->|"requests research"| node_researcher
node_lead -->|"develops rules"| node_strategist
node_lead -->|"requests sign-off"| node_risk
node_risk -->|"presents ticket"| node_user
node_user -->|"approves ticket"| node_execution
node_execution -->|"sends order"| node_hyperliquid
node_hyperliquid -->|"returns record"| node_execution
node_execution -->|"provides outcome"| node_reviewer
node_analyst -->|"uses"| node_market_skill
node_researcher -->|"uses"| node_strategy_skill
node_strategist -->|"requests history"| node_research_data
node_analyst -->|"gets snapshot"| node_opening
node_lead -->|"checks readiness"| node_doctor
node_risk -->|"estimates stop cost"| node_stop_cost
node_opening -->|"reads market data"| node_hyperliquid
node_research_data -->|"reads history"| node_hyperliquid
node_doctor -->|"checks connectivity"| node_hyperliquid
node_opening -->|"uses"| node_contract
node_research_data -->|"uses"| node_contract
node_doctor -->|"uses"| node_contract
node_stop_cost -->|"uses"| node_contract
node_stop_cost -->|"reuses market logic"| node_opening
node_user -->|"requests monitoring"| node_websocket_skill
node_websocket_skill -->|"subscribes feed"| node_hyperliquid
node_execution -.->|"write backstop"| node_write_gate

click node_lead "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/desk-lead.md"
click node_analyst "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/market-analyst.md"
click node_researcher "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/research-analyst.md"
click node_strategist "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/strategist.md"
click node_risk "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/risk-manager.md"
click node_execution "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/execution-trader.md"
click node_reviewer "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/trade-reviewer.md"
click node_lifecycle "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/desk-trade-lifecycle/SKILL.md"
click node_market_skill "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/hyperliquid-market-data/SKILL.md"
click node_strategy_skill "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/desk-strategy-lab/SKILL.md"
click node_research_data "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/research_dataset.py"
click node_opening "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/opening_bell.py"
click node_doctor "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/desk_doctor.py"
click node_stop_cost "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/stop_cost.py"
click node_contract "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/cli_contract.py"
click node_websocket_skill "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/hyperliquid-websocket/SKILL.md"
click node_write_gate "https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/hooks/exchange_write_gate.py"

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_lead,node_analyst,node_researcher,node_strategist,node_risk,node_execution,node_reviewer,node_lifecycle,node_user toneBlue
class node_market_skill,node_strategy_skill,node_research_data toneAmber
class node_opening,node_doctor,node_stop_cost,node_contract toneMint
class node_hyperliquid,node_websocket_skill,node_write_gate toneRose
```

## Components

### Desk workflow

- [Desk Lead](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/desk-lead.md): `agents/desk-lead.md`
- [Market Analyst](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/market-analyst.md): `agents/market-analyst.md`
- [Research Analyst](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/research-analyst.md): `agents/research-analyst.md`
- [Strategist](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/strategist.md): `agents/strategist.md`
- [Risk Manager](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/risk-manager.md): `agents/risk-manager.md`
- [Execution Trader](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/execution-trader.md): `agents/execution-trader.md`
- [Trade Reviewer](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/agents/trade-reviewer.md): `agents/trade-reviewer.md`
- [Trade lifecycle](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/desk-trade-lifecycle/SKILL.md): `skills/desk-trade-lifecycle/SKILL.md`

### Market and research

- [Market data](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/hyperliquid-market-data/SKILL.md): `skills/hyperliquid-market-data/SKILL.md`
- [Strategy lab](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/desk-strategy-lab/SKILL.md): `skills/desk-strategy-lab/SKILL.md`
- [Dataset collect and verify](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/research_dataset.py): `scripts/research_dataset.py`

### Read-only tools

- [Opening snapshot](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/opening_bell.py): `scripts/opening_bell.py`
- [Desk readiness](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/desk_doctor.py): `scripts/desk_doctor.py`
- [Stop cost estimate](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/stop_cost.py): `scripts/stop_cost.py`
- [CLI contract](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/scripts/cli_contract.py): `scripts/cli_contract.py`

### Exchange integration

- **Hyperliquid API**
- [WebSocket monitoring](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/skills/hyperliquid-websocket/SKILL.md): `skills/hyperliquid-websocket/SKILL.md`
- [Exchange write gate](https://github.com/galleonlabs/hypergrok-trading-desk/blob/main/hooks/exchange_write_gate.py): `hooks/exchange_write_gate.py`

### Other components

- **User**

## Connections

- User → Desk Lead: starts desk (evidence: `README.md`)
- Desk Lead → Market Analyst: requests brief (evidence: `README.md`)
- Desk Lead → Research Analyst: requests research (evidence: `README.md`)
- Desk Lead → Strategist: develops rules (evidence: `README.md`)
- Desk Lead → Risk Manager: requests sign-off (evidence: `README.md`)
- Risk Manager → User: presents ticket (evidence: `README.md`)
- User → Execution Trader: approves ticket (evidence: `README.md`)
- Execution Trader → Hyperliquid API: sends order (evidence: `README.md`)
- Hyperliquid API → Execution Trader: returns record (evidence: `README.md`)
- Execution Trader → Trade Reviewer: provides outcome (evidence: `README.md`)
- Market Analyst → Market data: uses (evidence: `README.md`)
- Research Analyst → Strategy lab: uses (evidence: `README.md`)
- Strategist → Dataset collect and verify: requests history (evidence: `README.md`)
- Market Analyst → Opening snapshot: gets snapshot (evidence: `README.md`)
- Desk Lead → Desk readiness: checks readiness (evidence: `README.md`)
- Risk Manager → Stop cost estimate: estimates stop cost (evidence: `scripts/stop_cost.py`)
- Opening snapshot → Hyperliquid API: reads market data (evidence: `scripts/opening_bell.py`)
- Dataset collect and verify → Hyperliquid API: reads history (evidence: `scripts/research_dataset.py`)
- Desk readiness → Hyperliquid API: checks connectivity (evidence: `scripts/desk_doctor.py`)
- Opening snapshot → CLI contract: uses (evidence: `scripts/opening_bell.py`)
- Dataset collect and verify → CLI contract: uses (evidence: `scripts/research_dataset.py`)
- Desk readiness → CLI contract: uses (evidence: `scripts/desk_doctor.py`)
- Stop cost estimate → CLI contract: uses (evidence: `scripts/stop_cost.py`)
- Stop cost estimate → Opening snapshot: reuses market logic (evidence: `scripts/stop_cost.py`)
- User → WebSocket monitoring: requests monitoring (evidence: `README.md`)
- WebSocket monitoring → Hyperliquid API: subscribes feed (evidence: `README.md`)
- Execution Trader → Exchange write gate: write backstop
