# zl0802/llm-wiki architecture

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

- Interactive diagram: https://gitdiagram.com/zl0802/llm-wiki
- Repository: https://github.com/zl0802/llm-wiki

## Overview

llm-wiki is a local-first knowledge-base product with a mature agent/Skill workflow and a developing web workbench; both are documented as using the same knowledge-base format and graph engine. The workbench’s user path is selecting or creating a knowledge base, searching and reading pages, then chatting or batch-digesting material, with retrieved context and generated artifacts tied to that knowledge base. The graph is a shared visualization capability. Sampled files support the UI/API boundary, retrieval, graph rendering, and rename scan; broader workflow links rely on README capabilities and listed module paths, not inspected implementations.

Main entry points: [`workbench/web/src/App.tsx`](https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/App.tsx) (Workbench UI), [`workbench/server/src/app.ts`](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/app.ts) (HTTP app), [`workbench/web/src/components/GraphPanel.tsx`](https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/components/GraphPanel.tsx) (Graph panel), [`workbench/server/src/retrieval.ts`](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/retrieval.ts) (Context retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workbench["Workbench"]
  node_web["Workbench UI<br/>[App.tsx]"]
  node_search["Page search<br/>[SearchPanel.tsx]"]
  node_api["API client<br/>[client.ts]"]
  node_server["HTTP app<br/>[app.ts]"]
end

subgraph group_knowledge["Knowledge workflows"]
  node_kb["Knowledge base service<br/>[knowledge-bases.ts]"]
  node_pages["Page service<br/>[pages.ts]"]
  node_retrieval["Context retrieval<br/>[retrieval.ts]"]
  node_agent["Agent conversation<br/>[agent.ts]"]
  node_digest["Batch digestion<br/>[batch.ts]"]
  node_wiki[("Wiki files")]
end

subgraph group_graph["Graph experience"]
  node_graphui["Graph panel<br/>[GraphPanel.tsx]"]
  node_graphapi["Graph routes<br/>[graph.ts]"]
  node_rename["Safe graph rename"]
  node_engine["Graph engine<br/>[index.ts]"]
  node_pipeline["Render pipeline<br/>[render-pipeline.ts]"]
  node_controller["Graph interaction<br/>[controller.ts]"]
  node_offline["Offline graph reader<br/>[offline-reader.ts]"]
end

subgraph group_shared["Shared contracts"]
  node_contracts["Workbench contracts<br/>[index.ts]"]
end

node_user(("Workbench user"))
node_model(("Model provider"))

node_user -->|"uses"| node_web
node_web -->|"opens"| node_search
node_web -->|"requests"| node_api
node_search -->|"selects pages"| node_web
node_api -->|"sends requests"| node_server
node_server -->|"validates envelopes"| node_contracts
node_web -->|"uses schemas"| node_contracts
node_server -->|"dispatches"| node_kb
node_server -->|"dispatches"| node_pages
node_server -->|"dispatches"| node_graphapi
node_web -->|"creates or selects"| node_kb
node_web -->|"starts batch"| node_digest
node_web -->|"sends conversation"| node_agent
node_agent -->|"retrieves context"| node_retrieval
node_retrieval -->|"loads page cache"| node_pages
node_retrieval -->|"reads pages"| node_wiki
node_agent -->|"requests generation"| node_model
node_digest -->|"processes knowledge"| node_wiki
node_graphui -->|"loads graph"| node_graphapi
node_graphapi -->|"reads graph data"| node_wiki
node_graphui -->|"renders through"| node_engine
node_engine -->|"prepares rendering"| node_pipeline
node_pipeline -->|"binds interactions"| node_controller
node_user -.->|"browses offline"| node_offline
node_graphui -->|"requests preview"| node_rename
node_rename -->|"scans and reads"| node_wiki

click node_web "https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/App.tsx"
click node_search "https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/components/SearchPanel.tsx"
click node_api "https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/lib/api/client.ts"
click node_server "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/app.ts"
click node_kb "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/knowledge-bases.ts"
click node_pages "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/pages.ts"
click node_retrieval "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/retrieval.ts"
click node_agent "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/agent.ts"
click node_digest "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/digest/batch.ts"
click node_graphui "https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/components/GraphPanel.tsx"
click node_graphapi "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/routes/graph.ts"
click node_rename "https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/graph-rename-preview.ts"
click node_engine "https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/index.ts"
click node_pipeline "https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/render/render-pipeline.ts"
click node_controller "https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/render/controller.ts"
click node_contracts "https://github.com/zl0802/llm-wiki/blob/main/packages/workbench-contracts/src/index.ts"
click node_offline "https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/render/offline-reader.ts"

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_web,node_search,node_api,node_server,node_user toneBlue
class node_kb,node_pages,node_retrieval,node_agent,node_digest,node_wiki toneAmber
class node_graphui,node_graphapi,node_rename,node_engine,node_pipeline,node_controller,node_offline toneMint
class node_contracts toneRose
class node_model toneIndigo
```

## Components

### Workbench

- [Workbench UI](https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/App.tsx): `workbench/web/src/App.tsx`
- [Page search](https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/components/SearchPanel.tsx): `workbench/web/src/components/SearchPanel.tsx`
- [API client](https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/lib/api/client.ts): `workbench/web/src/lib/api/client.ts`
- [HTTP app](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/app.ts): `workbench/server/src/app.ts`

### Knowledge workflows

- [Knowledge base service](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/knowledge-bases.ts): `workbench/server/src/knowledge-bases.ts`
- [Page service](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/pages.ts): `workbench/server/src/pages.ts`
- [Context retrieval](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/retrieval.ts): `workbench/server/src/retrieval.ts`
- [Agent conversation](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/agent.ts): `workbench/server/src/agent.ts`
- [Batch digestion](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/digest/batch.ts): `workbench/server/src/digest/batch.ts`
- **Wiki files**

### Graph experience

- [Graph panel](https://github.com/zl0802/llm-wiki/blob/main/workbench/web/src/components/GraphPanel.tsx): `workbench/web/src/components/GraphPanel.tsx`
- [Graph routes](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/routes/graph.ts): `workbench/server/src/routes/graph.ts`
- [Safe graph rename](https://github.com/zl0802/llm-wiki/blob/main/workbench/server/src/graph-rename-preview.ts): `workbench/server/src/graph-rename-preview.ts`
- [Graph engine](https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/index.ts): `packages/graph-engine/src/index.ts`
- [Render pipeline](https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/render/render-pipeline.ts): `packages/graph-engine/src/render/render-pipeline.ts`
- [Graph interaction](https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/render/controller.ts): `packages/graph-engine/src/render/controller.ts`
- [Offline graph reader](https://github.com/zl0802/llm-wiki/blob/main/packages/graph-engine/src/render/offline-reader.ts): `packages/graph-engine/src/render/offline-reader.ts`

### Shared contracts

- [Workbench contracts](https://github.com/zl0802/llm-wiki/blob/main/packages/workbench-contracts/src/index.ts): `packages/workbench-contracts/src/index.ts`

### Other components

- **Workbench user**
- **Model provider**

## Connections

- Workbench user → Workbench UI: uses
- Workbench UI → Page search: opens
- Workbench UI → API client: requests
- Page search → Workbench UI: selects pages
- API client → HTTP app: sends requests
- HTTP app → Workbench contracts: validates envelopes
- Workbench UI → Workbench contracts: uses schemas
- HTTP app → Knowledge base service: dispatches
- HTTP app → Page service: dispatches
- HTTP app → Graph routes: dispatches
- Workbench UI → Knowledge base service: creates or selects
- Workbench UI → Batch digestion: starts batch
- Workbench UI → Agent conversation: sends conversation
- Agent conversation → Context retrieval: retrieves context
- Context retrieval → Page service: loads page cache
- Context retrieval → Wiki files: reads pages
- Agent conversation → Model provider: requests generation
- Batch digestion → Wiki files: processes knowledge
- Graph panel → Graph routes: loads graph
- Graph routes → Wiki files: reads graph data
- Graph panel → Graph engine: renders through
- Graph engine → Render pipeline: prepares rendering
- Render pipeline → Graph interaction: binds interactions
- Workbench user → Offline graph reader: browses offline
- Graph panel → Safe graph rename: requests preview
- Safe graph rename → Wiki files: scans and reads
