# h100envy/gem-search architecture

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

- Interactive diagram: https://gitdiagram.com/h100envy/gem-search
- Repository: https://github.com/h100envy/gem-search

## Overview

Gem Search is a local-first research companion: the browser extension captures visible X posts, the local engine turns them into topic and emerging-signal leads, gathers evidence, and presents findings for review. Shortlisted narratives can also enter a bounded launch queue. The graph includes the documented crawler and dashboard, though their implementation details were not sampled; their links are therefore documented or marked unverified. Launch worker validation and delivery are shown separately from research. The README describes a browser-wallet launch page, but no corresponding client implementation is identifiable in this tree.

Main entry points: [`app.py`](https://github.com/h100envy/gem-search/blob/main/app.py) (Local engine), [`extension/background.js`](https://github.com/h100envy/gem-search/blob/main/extension/background.js) (Extension worker), [`launch/worker.mjs`](https://github.com/h100envy/gem-search/blob/main/launch/worker.mjs) (Launch worker), [`jev.py`](https://github.com/h100envy/gem-search/blob/main/jev.py) (Signal detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Feed capture"]
  node_extension_ui["Extension popup<br/>[popup.js]"]
  node_extension_worker["Extension worker<br/>[background.js]"]
  node_extractor["Post extractor<br/>[shared.js]"]
  node_spider_overlay["Spider overlay<br/>[spider-ui.js]"]
end

subgraph group_research["Local research"]
  node_local_engine["Local engine<br/>[app.py]"]
  node_signal_detector["Signal detector<br/>[jev.py]"]
  node_site_crawler["Evidence crawler<br/>[app.py]"]
  node_topic_rules["Topic rules<br/>[automation.py]"]
  node_local_store[("Local database<br/>[app.py]")]
end

subgraph group_review["Review workbench"]
  node_grok_review["Grok reviewers<br/>[grok.py]"]
  node_dashboard["Research dashboard<br/>[app.js]"]
end

subgraph group_launch["Launch execution"]
  node_launch_queue["Launch queue<br/>[automation.py]"]
  node_provider_router["Provider routing<br/>[launch_provider.py]"]
  node_launch_worker["Launch worker<br/>[worker.mjs]"]
  node_tx_guard["Transaction guard<br/>[guard.mjs]"]
  node_tx_delivery["Transaction delivery<br/>[transport.mjs]"]
end

node_researcher(("Researcher"))
node_x_feed["X feed"]
node_pinata["Pinata storage"]
node_solana_rpc["Solana RPC"]
node_grok_api["xAI API"]

node_researcher -->|"starts capture"| node_extension_ui
node_extension_ui -->|"sends actions"| node_extension_worker
node_extension_worker -->|"normalizes posts"| node_extractor
node_extractor -.->|"reads visible posts"| node_x_feed
node_extension_worker -->|"posts captures"| node_local_engine
node_extension_worker -->|"fetches status"| node_local_engine
node_extension_worker -->|"injects scripts"| node_spider_overlay
node_local_engine -->|"delegates detection"| node_signal_detector
node_local_engine -.->|"gathers evidence"| node_site_crawler
node_signal_detector -->|"uses topic patterns"| node_topic_rules
node_local_engine -.->|"requests reviews"| node_grok_review
node_grok_review -->|"submits evidence"| node_grok_api
node_local_engine -.->|"persists research"| node_local_store
node_signal_detector -->|"stores captures"| node_local_store
node_grok_review -->|"stores review cache"| node_local_store
node_researcher -->|"reviews findings"| node_dashboard
node_dashboard -.->|"uses local engine"| node_local_engine
node_local_engine -.->|"queues shortlist"| node_launch_queue
node_launch_queue -->|"selects provider"| node_provider_router
node_launch_queue -->|"runs worker"| node_launch_worker
node_launch_worker -->|"validates transaction"| node_tx_guard
node_launch_worker -->|"delivers transaction"| node_tx_delivery
node_launch_worker -->|"uploads metadata"| node_pinata
node_launch_worker -.->|"queries chain"| node_solana_rpc
node_provider_router -.->|"configures bridge"| node_researcher

click node_extension_ui "https://github.com/h100envy/gem-search/blob/main/extension/popup.js"
click node_extension_worker "https://github.com/h100envy/gem-search/blob/main/extension/background.js"
click node_extractor "https://github.com/h100envy/gem-search/blob/main/extension/shared.js"
click node_spider_overlay "https://github.com/h100envy/gem-search/blob/main/extension/spider-ui.js"
click node_local_engine "https://github.com/h100envy/gem-search/blob/main/app.py"
click node_signal_detector "https://github.com/h100envy/gem-search/blob/main/jev.py"
click node_site_crawler "https://github.com/h100envy/gem-search/blob/main/app.py"
click node_topic_rules "https://github.com/h100envy/gem-search/blob/main/automation.py"
click node_local_store "https://github.com/h100envy/gem-search/blob/main/app.py"
click node_grok_review "https://github.com/h100envy/gem-search/blob/main/grok.py"
click node_dashboard "https://github.com/h100envy/gem-search/blob/main/static/app.js"
click node_launch_queue "https://github.com/h100envy/gem-search/blob/main/automation.py"
click node_provider_router "https://github.com/h100envy/gem-search/blob/main/launch_provider.py"
click node_launch_worker "https://github.com/h100envy/gem-search/blob/main/launch/worker.mjs"
click node_tx_guard "https://github.com/h100envy/gem-search/blob/main/launch/guard.mjs"
click node_tx_delivery "https://github.com/h100envy/gem-search/blob/main/launch/transport.mjs"

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_extension_ui,node_extension_worker,node_extractor,node_spider_overlay toneBlue
class node_local_engine,node_signal_detector,node_site_crawler,node_topic_rules,node_local_store,node_pinata toneAmber
class node_grok_review,node_dashboard,node_grok_api toneMint
class node_launch_queue,node_provider_router,node_launch_worker,node_tx_guard,node_tx_delivery toneRose
class node_researcher,node_x_feed,node_solana_rpc toneIndigo
```

## Components

### Feed capture

- [Extension popup](https://github.com/h100envy/gem-search/blob/main/extension/popup.js): `extension/popup.js`
- [Extension worker](https://github.com/h100envy/gem-search/blob/main/extension/background.js): `extension/background.js`
- [Post extractor](https://github.com/h100envy/gem-search/blob/main/extension/shared.js): `extension/shared.js`
- [Spider overlay](https://github.com/h100envy/gem-search/blob/main/extension/spider-ui.js): `extension/spider-ui.js`

### Local research

- [Local engine](https://github.com/h100envy/gem-search/blob/main/app.py): `app.py`
- [Signal detector](https://github.com/h100envy/gem-search/blob/main/jev.py): `jev.py`
- [Evidence crawler](https://github.com/h100envy/gem-search/blob/main/app.py): `app.py`
- [Topic rules](https://github.com/h100envy/gem-search/blob/main/automation.py): `automation.py`
- [Local database](https://github.com/h100envy/gem-search/blob/main/app.py): `app.py`

### Review workbench

- [Grok reviewers](https://github.com/h100envy/gem-search/blob/main/grok.py): `grok.py`
- [Research dashboard](https://github.com/h100envy/gem-search/blob/main/static/app.js): `static/app.js`

### Launch execution

- [Launch queue](https://github.com/h100envy/gem-search/blob/main/automation.py): `automation.py`
- [Provider routing](https://github.com/h100envy/gem-search/blob/main/launch_provider.py): `launch_provider.py`
- [Launch worker](https://github.com/h100envy/gem-search/blob/main/launch/worker.mjs): `launch/worker.mjs`
- [Transaction guard](https://github.com/h100envy/gem-search/blob/main/launch/guard.mjs): `launch/guard.mjs`
- [Transaction delivery](https://github.com/h100envy/gem-search/blob/main/launch/transport.mjs): `launch/transport.mjs`

### Other components

- **Researcher**
- **X feed**
- **Pinata storage**
- **Solana RPC**
- **xAI API**

## Connections

- Researcher → Extension popup: starts capture (evidence: `README.md`)
- Extension popup → Extension worker: sends actions (evidence: `extension/background.js`)
- Extension worker → Post extractor: normalizes posts (evidence: `extension/background.js`)
- Post extractor → X feed: reads visible posts
- Extension worker → Local engine: posts captures (evidence: `extension/background.js`)
- Extension worker → Local engine: fetches status (evidence: `extension/background.js`)
- Extension worker → Spider overlay: injects scripts (evidence: `extension/background.js`)
- Local engine → Signal detector: delegates detection (evidence: `app.py`)
- Local engine → Evidence crawler: gathers evidence (evidence: `app.py`)
- Signal detector → Topic rules: uses topic patterns (evidence: `jev.py`)
- Local engine → Grok reviewers: requests reviews (evidence: `app.py`)
- Grok reviewers → xAI API: submits evidence (evidence: `grok.py`)
- Local engine → Local database: persists research (evidence: `app.py`)
- Signal detector → Local database: stores captures (evidence: `jev.py`)
- Grok reviewers → Local database: stores review cache (evidence: `grok.py`)
- Researcher → Research dashboard: reviews findings (evidence: `README.md`)
- Research dashboard → Local engine: uses local engine
- Local engine → Launch queue: queues shortlist (evidence: `app.py`)
- Launch queue → Provider routing: selects provider (evidence: `automation.py`)
- Launch queue → Launch worker: runs worker (evidence: `automation.py`)
- Launch worker → Transaction guard: validates transaction (evidence: `launch/worker.mjs`)
- Launch worker → Transaction delivery: delivers transaction (evidence: `launch/worker.mjs`)
- Launch worker → Pinata storage: uploads metadata (evidence: `launch/worker.mjs`)
- Launch worker → Solana RPC: queries chain
- Provider routing → Researcher: configures bridge
