# zhuzhaoyun/molio architecture

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

- Interactive diagram: https://gitdiagram.com/zhuzhaoyun/molio
- Repository: https://github.com/zhuzhaoyun/molio

## Overview

Molio is a local-first knowledge-base and AI-agent workbench. Users collect or import material into Markdown vaults, browse and connect that knowledge, then run an agent against it; results can be deposited back into the vault. The desktop shell hosts the web console and local daemon, which manages conversations, agent runs, runtimes, and messaging channels. The README also describes cloud-backed accounts and a ready-made resource library, plus publishing. Some subsystem links below are documented capabilities rather than inspected call paths; those are marked as unverified.

Main entry points: [`apps/daemon/src/server.ts`](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/server.ts) (Local HTTP server), [`apps/web/src/App.tsx`](https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/App.tsx) (Web console), [`apps/daemon/src/core/RunManager.ts`](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/RunManager.ts) (Agent run manager), [`apps/web/src/components/kb/KnowledgeBasePage.tsx`](https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/kb/KnowledgeBasePage.tsx) (Knowledge workspace UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop and console"]
  node_desktop["Desktop shell<br/>[main.js]"]
  node_web["Web console<br/>[App.tsx]"]
end

subgraph group_local["Local agent service"]
  node_daemon["Local HTTP server<br/>[server.ts]"]
  node_conversations["Conversation routes<br/>[conversations.ts]"]
  node_conversation_service["Conversation service<br/>[service.ts]"]
  node_database[("Local database<br/>[db.ts]")]
  node_runs["Agent run manager<br/>[RunManager.ts]"]
  node_runtimes["Agent runtimes<br/>[registry.ts]"]
  node_channels["Messaging channels<br/>[dispatcher.ts]"]
  node_weixin["WeChat service<br/>[service.ts]"]
  node_feishu["Feishu service<br/>[service.ts]"]
end

subgraph group_knowledge["Knowledge workspace"]
  node_knowledge_ui["Knowledge workspace UI"]
  node_knowledge_api["Knowledge routes<br/>[knowledge.ts]"]
  node_vault_core["Knowledge services<br/>[knowledge.ts]"]
  node_wiki_engine["Wiki processing tools"]
  node_graph_ui["Knowledge graph<br/>[pixiGraphEngine.ts]"]
  node_publish["Publishing workflow<br/>[PublishWizard.tsx]"]
end

subgraph group_cloud["Cloud and resources"]
  node_auth_client["Account client<br/>[auth-client.ts]"]
  node_cloud_auth["Cloud account service<br/>[service.ts]"]
  node_resource_ui["Resource library UI<br/>[ResourcesPage.tsx]"]
  node_market["Resource market<br/>[service.ts]"]
end

node_user(("User"))

node_user -.->|"opens"| node_desktop
node_desktop -.->|"hosts"| node_web
node_web -.->|"requests"| node_daemon
node_daemon -->|"uses"| node_runs
node_daemon -->|"opens"| node_database
node_daemon -->|"creates"| node_conversation_service
node_daemon -->|"creates"| node_weixin
node_daemon -->|"creates"| node_feishu
node_runs -->|"resolves"| node_runtimes
node_user -.->|"chats and explores"| node_web
node_web -->|"opens"| node_knowledge_ui
node_knowledge_ui -.->|"uses"| node_knowledge_api
node_knowledge_api -.->|"delegates"| node_vault_core
node_user -.->|"processes material"| node_wiki_engine
node_knowledge_ui -.->|"explores links"| node_graph_ui
node_user -.->|"starts agent task"| node_runs
node_runs -.->|"uses knowledge"| node_vault_core
node_runs -.->|"records results"| node_conversation_service
node_user -.->|"messages"| node_weixin
node_user -.->|"messages"| node_feishu
node_auth_client -.->|"authenticates"| node_cloud_auth
node_web -->|"opens"| node_resource_ui
node_resource_ui -.->|"browses resources"| node_market
node_user -.->|"publishes results"| node_publish

click node_desktop "https://github.com/zhuzhaoyun/molio/blob/main/apps/desktop/src/main.js"
click node_web "https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/App.tsx"
click node_daemon "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/server.ts"
click node_conversations "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/routes/conversations.ts"
click node_conversation_service "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/conversations/service.ts"
click node_database "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/db.ts"
click node_runs "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/RunManager.ts"
click node_runtimes "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/runtimes/registry.ts"
click node_channels "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/channels/dispatcher.ts"
click node_weixin "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/weixin/service.ts"
click node_feishu "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/feishu/service.ts"
click node_knowledge_ui "https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/kb/KnowledgeBasePage.tsx"
click node_knowledge_api "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/routes/knowledge.ts"
click node_vault_core "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/knowledge.ts"
click node_wiki_engine "https://github.com/zhuzhaoyun/molio/tree/main/apps/daemon/src/tools/skills/wiki-build/scripts"
click node_graph_ui "https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/graph/engine/pixiGraphEngine.ts"
click node_auth_client "https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/auth/auth-client.ts"
click node_cloud_auth "https://github.com/zhuzhaoyun/molio/blob/main/apps/cloud/src/service.ts"
click node_resource_ui "https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/resources/ResourcesPage.tsx"
click node_market "https://github.com/zhuzhaoyun/molio/blob/main/apps/cloud/src/market/service.ts"
click node_publish "https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/resources/PublishWizard.tsx"

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_desktop,node_web,node_user toneBlue
class node_daemon,node_conversations,node_conversation_service,node_database,node_runs,node_runtimes,node_channels,node_weixin,node_feishu toneAmber
class node_knowledge_ui,node_knowledge_api,node_vault_core,node_wiki_engine,node_graph_ui,node_publish toneMint
class node_auth_client,node_cloud_auth,node_resource_ui,node_market toneRose
```

## Components

### Desktop and console

- [Desktop shell](https://github.com/zhuzhaoyun/molio/blob/main/apps/desktop/src/main.js): `apps/desktop/src/main.js`
- [Web console](https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`

### Local agent service

- [Local HTTP server](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/server.ts): `apps/daemon/src/server.ts`
- [Conversation routes](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/routes/conversations.ts): `apps/daemon/src/routes/conversations.ts`
- [Conversation service](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/conversations/service.ts): `apps/daemon/src/core/conversations/service.ts`
- [Local database](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/db.ts): `apps/daemon/src/core/db.ts`
- [Agent run manager](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/RunManager.ts): `apps/daemon/src/core/RunManager.ts`
- [Agent runtimes](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/runtimes/registry.ts): `apps/daemon/src/core/runtimes/registry.ts`
- [Messaging channels](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/channels/dispatcher.ts): `apps/daemon/src/core/channels/dispatcher.ts`
- [WeChat service](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/weixin/service.ts): `apps/daemon/src/core/weixin/service.ts`
- [Feishu service](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/feishu/service.ts): `apps/daemon/src/core/feishu/service.ts`

### Knowledge workspace

- [Knowledge workspace UI](https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/kb/KnowledgeBasePage.tsx): `apps/web/src/components/kb/KnowledgeBasePage.tsx`
- [Knowledge routes](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/routes/knowledge.ts): `apps/daemon/src/routes/knowledge.ts`
- [Knowledge services](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/knowledge.ts): `apps/daemon/src/core/knowledge.ts`
- [Wiki processing tools](https://github.com/zhuzhaoyun/molio/tree/main/apps/daemon/src/tools/skills/wiki-build/scripts): `apps/daemon/src/tools/skills/wiki-build/scripts`
- [Knowledge graph](https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/graph/engine/pixiGraphEngine.ts): `apps/web/src/components/graph/engine/pixiGraphEngine.ts`
- [Publishing workflow](https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/resources/PublishWizard.tsx): `apps/web/src/components/resources/PublishWizard.tsx`

### Cloud and resources

- [Account client](https://github.com/zhuzhaoyun/molio/blob/main/apps/daemon/src/core/auth/auth-client.ts): `apps/daemon/src/core/auth/auth-client.ts`
- [Cloud account service](https://github.com/zhuzhaoyun/molio/blob/main/apps/cloud/src/service.ts): `apps/cloud/src/service.ts`
- [Resource library UI](https://github.com/zhuzhaoyun/molio/blob/main/apps/web/src/components/resources/ResourcesPage.tsx): `apps/web/src/components/resources/ResourcesPage.tsx`
- [Resource market](https://github.com/zhuzhaoyun/molio/blob/main/apps/cloud/src/market/service.ts): `apps/cloud/src/market/service.ts`

### Other components

- **User**

## Connections

- User → Desktop shell: opens (evidence: `README.md`)
- Desktop shell → Web console: hosts (evidence: `README.md`)
- Web console → Local HTTP server: requests (evidence: `README.md`)
- Local HTTP server → Agent run manager: uses (evidence: `apps/daemon/src/server.ts`)
- Local HTTP server → Local database: opens (evidence: `apps/daemon/src/server.ts`)
- Local HTTP server → Conversation service: creates (evidence: `apps/daemon/src/server.ts`)
- Local HTTP server → WeChat service: creates (evidence: `apps/daemon/src/server.ts`)
- Local HTTP server → Feishu service: creates (evidence: `apps/daemon/src/server.ts`)
- Agent run manager → Agent runtimes: resolves (evidence: `apps/daemon/src/core/RunManager.ts`)
- User → Web console: chats and explores (evidence: `README.md`)
- Web console → Knowledge workspace UI: opens (evidence: `apps/web/src/App.tsx`)
- Knowledge workspace UI → Knowledge routes: uses (evidence: `README.md`)
- Knowledge routes → Knowledge services: delegates
- User → Wiki processing tools: processes material (evidence: `README.md`)
- Knowledge workspace UI → Knowledge graph: explores links (evidence: `README.md`)
- User → Agent run manager: starts agent task (evidence: `README.md`)
- Agent run manager → Knowledge services: uses knowledge (evidence: `README.md`)
- Agent run manager → Conversation service: records results
- User → WeChat service: messages (evidence: `README.md`)
- User → Feishu service: messages (evidence: `README.md`)
- Account client → Cloud account service: authenticates
- Web console → Resource library UI: opens (evidence: `apps/web/src/App.tsx`)
- Resource library UI → Resource market: browses resources (evidence: `README.md`)
- User → Publishing workflow: publishes results (evidence: `README.md`)
