# mobiusquant/openmobius-skill architecture

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

- Interactive diagram: https://gitdiagram.com/mobiusquant/openmobius-skill
- Repository: https://github.com/mobiusquant/openmobius-skill

## Overview

OpenMobius-skill is an AI-agent trading-analysis skill combining scoped, attributable knowledge Q&A with supported current-market analysis, annotation, and chart generation. The principal workflow resolves intent and analytical scope, checks capabilities, retrieves knowledge, then—when supported and needed—uses market data and structural analysis to produce a grounded answer or chart. The README documents the routing and feature branches; source excerpts show retrieval and embedding internals, but not the market-data implementation, so those links are documented rather than inferred from unsampled code.

Main entry points: [`SKILL.md`](https://github.com/mobiusquant/openmobius-skill/blob/main/SKILL.md) (Capability gate), [`scripts/_lib/retriever.py`](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/_lib/retriever.py) (Scoped retrieval), [`scripts/chart_render/renderer.js`](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/chart_render/renderer.js) (Chart renderer), [`scripts/kb_retrieve.py`](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/kb_retrieve.py) (Retrieval interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Intent and routing"]
  node_skill["Skill instructions<br/>[SKILL.md]"]
  node_route["Intent and scope<br/>[SKILL.md]"]
  node_gate["Capability gate<br/>[SKILL.md]"]
  node_registry["Knowledge registry"]
end

subgraph group_knowledge["Knowledge retrieval"]
  node_retrieve_cli["Retrieval interface<br/>[kb_retrieve.py]"]
  node_retriever["Scoped retrieval<br/>[retriever.py]"]
  node_projections["School projections<br/>[knowledge_v2.py]"]
  node_corpus[("Knowledge cards")]
  node_embedder["Query embeddings<br/>[embedder.py]"]
end

subgraph group_market["Market analysis"]
  node_market_data[("Market data")]
  node_kline["K-line analysis<br/>[kb_klines.py]"]
  node_annotation["Image annotation"]
end

subgraph group_visuals["Charts and annotations"]
  node_renderer["Chart renderer<br/>[renderer.js]"]
  node_chart_lib["Chart primitives"]
end

node_user(("User"))
node_agent(("Host AI agent"))
node_browser["Playwright"]
node_answer["Grounded answer"]

node_user -->|"asks"| node_agent
node_agent -->|"uses"| node_skill
node_skill -->|"resolves intent"| node_route
node_route -->|"checks capability"| node_gate
node_gate -->|"reads capabilities"| node_registry
node_gate -->|"routes Q&amp;A"| node_retrieve_cli
node_retrieve_cli -->|"queries"| node_retriever
node_retriever -->|"loads projections"| node_projections
node_projections -.->|"projects cards"| node_corpus
node_retriever -->|"searches"| node_corpus
node_retriever -.->|"embeds query"| node_embedder
node_gate -->|"requests fresh data"| node_market_data
node_market_data -.->|"supplies series"| node_kline
node_gate -->|"runs analysis"| node_kline
node_user -->|"provides chart"| node_annotation
node_gate -->|"routes annotation"| node_annotation
node_gate -->|"requests chart"| node_renderer
node_renderer -.->|"uses primitives"| node_chart_lib
node_renderer -->|"renders with"| node_browser
node_retrieve_cli -->|"returns evidence"| node_agent
node_agent -->|"synthesizes"| node_answer
node_renderer -->|"produces chart"| node_answer

click node_skill "https://github.com/mobiusquant/openmobius-skill/blob/main/SKILL.md"
click node_route "https://github.com/mobiusquant/openmobius-skill/blob/main/SKILL.md"
click node_gate "https://github.com/mobiusquant/openmobius-skill/blob/main/SKILL.md"
click node_registry "https://github.com/mobiusquant/openmobius-skill/tree/main/knowledge_base/schemas"
click node_retrieve_cli "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/kb_retrieve.py"
click node_retriever "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/_lib/retriever.py"
click node_projections "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/_lib/knowledge_v2.py"
click node_corpus "https://github.com/mobiusquant/openmobius-skill/tree/main/knowledge_base"
click node_embedder "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/_lib/embedder.py"
click node_kline "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/kb_klines.py"
click node_annotation "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/kb_draw_annotation.py"
click node_renderer "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/chart_render/renderer.js"
click node_chart_lib "https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/chart_render/rectangle_primitive.js"

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_skill,node_route,node_gate,node_registry,node_user toneBlue
class node_retrieve_cli,node_retriever,node_projections,node_corpus,node_embedder toneAmber
class node_market_data,node_kline,node_annotation toneMint
class node_renderer,node_chart_lib toneRose
class node_agent,node_browser,node_answer toneIndigo
```

## Components

### Intent and routing

- [Skill instructions](https://github.com/mobiusquant/openmobius-skill/blob/main/SKILL.md): `SKILL.md`
- [Intent and scope](https://github.com/mobiusquant/openmobius-skill/blob/main/SKILL.md): `SKILL.md`
- [Capability gate](https://github.com/mobiusquant/openmobius-skill/blob/main/SKILL.md): `SKILL.md`
- [Knowledge registry](https://github.com/mobiusquant/openmobius-skill/tree/main/knowledge_base/schemas): `knowledge_base/schemas`

### Knowledge retrieval

- [Retrieval interface](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/kb_retrieve.py): `scripts/kb_retrieve.py`
- [Scoped retrieval](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/_lib/retriever.py): `scripts/_lib/retriever.py`
- [School projections](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/_lib/knowledge_v2.py): `scripts/_lib/knowledge_v2.py`
- [Knowledge cards](https://github.com/mobiusquant/openmobius-skill/tree/main/knowledge_base): `knowledge_base`
- [Query embeddings](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/_lib/embedder.py): `scripts/_lib/embedder.py`

### Market analysis

- **Market data**
- [K-line analysis](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/kb_klines.py): `scripts/kb_klines.py`
- [Image annotation](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/kb_draw_annotation.py): `scripts/kb_draw_annotation.py`

### Charts and annotations

- [Chart renderer](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/chart_render/renderer.js): `scripts/chart_render/renderer.js`
- [Chart primitives](https://github.com/mobiusquant/openmobius-skill/blob/main/scripts/chart_render/rectangle_primitive.js): `scripts/chart_render/rectangle_primitive.js`

### Other components

- **User**
- **Host AI agent**
- **Playwright**
- **Grounded answer**

## Connections

- User → Host AI agent: asks (evidence: `README.md`)
- Host AI agent → Skill instructions: uses (evidence: `README.md`)
- Skill instructions → Intent and scope: resolves intent (evidence: `README.md`)
- Intent and scope → Capability gate: checks capability (evidence: `README.md`)
- Capability gate → Knowledge registry: reads capabilities (evidence: `README.md`)
- Capability gate → Retrieval interface: routes Q&A (evidence: `README.md`)
- Retrieval interface → Scoped retrieval: queries (evidence: `scripts/kb_retrieve.py`)
- Scoped retrieval → School projections: loads projections (evidence: `scripts/_lib/retriever.py`)
- School projections → Knowledge cards: projects cards
- Scoped retrieval → Knowledge cards: searches (evidence: `scripts/_lib/retriever.py`)
- Scoped retrieval → Query embeddings: embeds query
- Capability gate → Market data: requests fresh data (evidence: `README.md`)
- Market data → K-line analysis: supplies series
- Capability gate → K-line analysis: runs analysis (evidence: `README.md`)
- User → Image annotation: provides chart (evidence: `README.md`)
- Capability gate → Image annotation: routes annotation (evidence: `README.md`)
- Capability gate → Chart renderer: requests chart (evidence: `README.md`)
- Chart renderer → Chart primitives: uses primitives
- Chart renderer → Playwright: renders with (evidence: `README.md`)
- Retrieval interface → Host AI agent: returns evidence (evidence: `scripts/kb_retrieve.py`)
- Host AI agent → Grounded answer: synthesizes (evidence: `README.md`)
- Chart renderer → Grounded answer: produces chart (evidence: `README.md`)
