# crow-hq/llm-wiki-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/crow-hq/llm-wiki-v2
- Repository: https://github.com/crow-hq/llm-wiki-v2

## Overview

LLM Wiki v2 turns documents into linked Markdown notes, then answers questions with citations to those notes. The main workflow enters through the CLI or browser/API, reaches the Wiki facade, and uses ingest or ask agents before returning results; notes and source provenance persist in a local bundle. The README also documents CROW classification, classic mode, sync, audit, health/taxonomy, graph and linting, settings, and usage reporting. Some subsystem links below rely on README descriptions or SOURCE INDEX references; unsampled implementations are not assumed to have been inspected.

Main entry points: [`src/llmw2/wiki.py`](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/wiki.py) (Wiki facade), [`src/llmw2/agents/steps.py`](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/steps.py) (Ingest and ask steps), [`src/llmw2/bundle/store.py`](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/store.py) (Bundle store), [`src/llmw2/cli.py`](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/cli.py) (CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI<br/>[cli.py]"]
  node_web["Web UI<br/>[app.js]"]
  node_api["HTTP API<br/>[server.py]"]
end

subgraph group_workflow["Wiki workflows"]
  node_wiki["Wiki facade<br/>[wiki.py]"]
  node_librarian["Ingest librarian<br/>[librarian.py]"]
  node_steps["Ingest and ask steps<br/>[steps.py]"]
  node_classic["Classic steps<br/>[steps_classic.py]"]
  node_crow["CROW steps<br/>[steps_crow.py]"]
  node_researcher["Question researcher<br/>[researcher.py]"]
end

subgraph group_models["Models and accounting"]
  node_llm["Writing model<br/>[llm.py]"]
  node_classifier["CROW classifier<br/>[classifier.py]"]
  node_usage["Usage tracker<br/>[usage.py]"]
  node_config["Configuration<br/>[config.py]"]
end

subgraph group_bundle["Wiki bundle"]
  node_store[("Bundle store<br/>[store.py]")]
  node_tree["Wiki tree<br/>[tree.py]"]
  node_document["Markdown documents<br/>[document.py]"]
  node_origin[("Origin tracking<br/>[origin_index.py]")]
end

subgraph group_operations["Management and sync"]
  node_sync["Folder sync<br/>[sync.py]"]
  node_audit["Routing audit<br/>[audit.py]"]
  node_check["Bundle lint and graph<br/>[check.py]"]
end

node_user(("Wiki user"))
node_provider{{"AI provider"}}

node_user -->|"runs commands"| node_cli
node_user -->|"uses wiki"| node_web
node_web -->|"calls endpoints"| node_api
node_cli -->|"runs operations"| node_wiki
node_api -->|"dispatches requests"| node_wiki
node_wiki -->|"ingests sources"| node_librarian
node_wiki -->|"answers questions"| node_researcher
node_librarian -->|"uses steps"| node_steps
node_steps -->|"dispatches classic"| node_classic
node_steps -->|"dispatches CROW"| node_crow
node_librarian -->|"files notes"| node_store
node_researcher -->|"reads notes"| node_store
node_store -->|"loads tree"| node_tree
node_store -->|"parses notes"| node_document
node_store -->|"tracks origins"| node_origin
node_classic -.->|"requests generation"| node_llm
node_crow -.->|"routes candidates"| node_classifier
node_steps -->|"asks model"| node_llm
node_steps -->|"classifies choices"| node_classifier
node_llm -->|"sends requests"| node_provider
node_classifier -->|"sends requests"| node_provider
node_llm -->|"records tokens"| node_usage
node_classifier -->|"records tokens"| node_usage
node_wiki -->|"uses settings"| node_config
node_cli -->|"starts sync"| node_sync
node_sync -->|"files sources"| node_wiki
node_cli -->|"runs audit"| node_audit
node_api -->|"serves audit"| node_audit
node_wiki -->|"checks bundle"| node_check
node_api -->|"serves interface"| node_web

click node_cli "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/cli.py"
click node_web "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/web/app.js"
click node_api "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/server.py"
click node_wiki "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/wiki.py"
click node_librarian "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/librarian.py"
click node_steps "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/steps.py"
click node_classic "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/steps_classic.py"
click node_crow "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/steps_crow.py"
click node_researcher "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/researcher.py"
click node_llm "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/models/llm.py"
click node_classifier "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/models/classifier.py"
click node_usage "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/models/usage.py"
click node_config "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/config.py"
click node_store "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/store.py"
click node_tree "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/tree.py"
click node_document "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/document.py"
click node_origin "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/origin_index.py"
click node_sync "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/sources/sync.py"
click node_audit "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/audit.py"
click node_check "https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/check.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_cli,node_web,node_api,node_user toneBlue
class node_wiki,node_librarian,node_steps,node_classic,node_crow,node_researcher toneAmber
class node_llm,node_classifier,node_usage,node_config toneMint
class node_store,node_tree,node_document,node_origin toneRose
class node_sync,node_audit,node_check,node_provider toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/cli.py): `src/llmw2/cli.py`
- [Web UI](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/web/app.js): `src/llmw2/web/app.js`
- [HTTP API](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/server.py): `src/llmw2/server.py`

### Wiki workflows

- [Wiki facade](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/wiki.py): `src/llmw2/wiki.py`
- [Ingest librarian](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/librarian.py): `src/llmw2/agents/librarian.py`
- [Ingest and ask steps](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/steps.py): `src/llmw2/agents/steps.py`
- [Classic steps](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/steps_classic.py): `src/llmw2/agents/steps_classic.py`
- [CROW steps](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/steps_crow.py): `src/llmw2/agents/steps_crow.py`
- [Question researcher](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/agents/researcher.py): `src/llmw2/agents/researcher.py`

### Models and accounting

- [Writing model](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/models/llm.py): `src/llmw2/models/llm.py`
- [CROW classifier](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/models/classifier.py): `src/llmw2/models/classifier.py`
- [Usage tracker](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/models/usage.py): `src/llmw2/models/usage.py`
- [Configuration](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/config.py): `src/llmw2/config.py`

### Wiki bundle

- [Bundle store](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/store.py): `src/llmw2/bundle/store.py`
- [Wiki tree](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/tree.py): `src/llmw2/bundle/tree.py`
- [Markdown documents](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/document.py): `src/llmw2/bundle/document.py`
- [Origin tracking](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/origin_index.py): `src/llmw2/bundle/origin_index.py`

### Management and sync

- [Folder sync](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/sources/sync.py): `src/llmw2/sources/sync.py`
- [Routing audit](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/audit.py): `src/llmw2/audit.py`
- [Bundle lint and graph](https://github.com/crow-hq/llm-wiki-v2/blob/main/src/llmw2/bundle/check.py): `src/llmw2/bundle/check.py`

### Other components

- **Wiki user**
- **AI provider**

## Connections

- Wiki user → CLI: runs commands (evidence: `README.md`)
- Wiki user → Web UI: uses wiki (evidence: `README.md`)
- Web UI → HTTP API: calls endpoints (evidence: `README.md`)
- CLI → Wiki facade: runs operations (evidence: `src/llmw2/cli.py`)
- HTTP API → Wiki facade: dispatches requests (evidence: `src/llmw2/server.py`)
- Wiki facade → Ingest librarian: ingests sources (evidence: `src/llmw2/wiki.py`)
- Wiki facade → Question researcher: answers questions (evidence: `src/llmw2/wiki.py`)
- Ingest librarian → Ingest and ask steps: uses steps (evidence: `src/llmw2/agents/librarian.py`)
- Ingest and ask steps → Classic steps: dispatches classic (evidence: `src/llmw2/agents/steps.py`)
- Ingest and ask steps → CROW steps: dispatches CROW (evidence: `src/llmw2/agents/steps.py`)
- Ingest librarian → Bundle store: files notes (evidence: `src/llmw2/agents/librarian.py`)
- Question researcher → Bundle store: reads notes (evidence: `src/llmw2/agents/researcher.py`)
- Bundle store → Wiki tree: loads tree (evidence: `src/llmw2/bundle/store.py`)
- Bundle store → Markdown documents: parses notes (evidence: `src/llmw2/bundle/store.py`)
- Bundle store → Origin tracking: tracks origins (evidence: `src/llmw2/bundle/store.py`)
- Classic steps → Writing model: requests generation
- CROW steps → CROW classifier: routes candidates (evidence: `src/llmw2/agents/steps_crow.py`)
- Ingest and ask steps → Writing model: asks model (evidence: `src/llmw2/agents/steps.py`)
- Ingest and ask steps → CROW classifier: classifies choices (evidence: `src/llmw2/agents/steps.py`)
- Writing model → AI provider: sends requests (evidence: `README.md`)
- CROW classifier → AI provider: sends requests (evidence: `README.md`)
- Writing model → Usage tracker: records tokens (evidence: `src/llmw2/models/llm.py`)
- CROW classifier → Usage tracker: records tokens (evidence: `src/llmw2/models/classifier.py`)
- Wiki facade → Configuration: uses settings (evidence: `src/llmw2/wiki.py`)
- CLI → Folder sync: starts sync (evidence: `src/llmw2/cli.py`)
- Folder sync → Wiki facade: files sources (evidence: `src/llmw2/sources/sync.py`)
- CLI → Routing audit: runs audit (evidence: `src/llmw2/cli.py`)
- HTTP API → Routing audit: serves audit (evidence: `src/llmw2/server.py`)
- Wiki facade → Bundle lint and graph: checks bundle (evidence: `src/llmw2/wiki.py`)
- HTTP API → Web UI: serves interface (evidence: `README.md`)
