# rongxinzy/rongxinai architecture

> Architecture diagram of the GitHub repository rongxinzy/rongxinai, 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/rongxinzy/rongxinai
- Repository: https://github.com/rongxinzy/rongxinai

## Overview

ZhiYuan Agent is a local-first desktop AI workspace. A user submits a task in the workspace, follows progress and approvals, and inspects generated files or other results. The documented work spans research, document and spreadsheet creation, coding, browser operation, and recurring tasks; skills and MCP extend those workflows, while configured messaging channels provide another way to use the agent. The graph combines README-described capabilities with paths in the supplied tree; sampled source gives narrower evidence for skill management and local-model loading, so unspecified internal wiring is omitted.

Main entry points: [`src/renderer`](https://github.com/rongxinzy/rongxinai/tree/main/src/renderer) (Workspace UI), [`src/main/libs/agentEngine/piWorkLoop.ts`](https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/agentEngine/piWorkLoop.ts) (Agent work loop), [`src/main/agentManager.ts`](https://github.com/rongxinzy/rongxinai/blob/main/src/main/agentManager.ts) (Agent manager), [`src/renderer/components/skills/SkillsManager.tsx`](https://github.com/rongxinzy/rongxinai/blob/main/src/renderer/components/skills/SkillsManager.tsx) (Skills manager UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Task workspace"]
  node_desktop["Desktop lifecycle<br/>[main.ts]"]
  node_renderer["Workspace UI"]
end

subgraph group_agent["Agent runtime"]
  node_agentmanager["Agent manager<br/>[agentManager.ts]"]
  node_agentloop["Agent work loop<br/>[piWorkLoop.ts]"]
  node_history[("Conversation history<br/>[service.ts]")]
end

subgraph group_integrations["Tools and extensions"]
  node_skillsui["Skills manager UI<br/>[SkillsManager.tsx]"]
  node_skillmanager["Skill management<br/>[skillManager.ts]"]
  node_mcpui["MCP manager UI<br/>[McpManager.tsx]"]
  node_mcpservice["MCP runtime"]
  node_search["Web search<br/>[index.ts]"]
  node_documenttools["Document and data skills"]
end

subgraph group_inference["Model inference"]
  node_inferenceui["Local inference settings"]
  node_inferenceipc["Inference IPC<br/>[llamacpp.ts]"]
  node_inferencepipeline["Model load pipeline"]
  node_modelservice["Local model service<br/>[llamacppServe.ts]"]
end

subgraph group_channels["Scheduling and messaging"]
  node_scheduler["Scheduled tasks<br/>[index.ts]"]
  node_taskprompt["Scheduled task guidance<br/>[enginePrompt.ts]"]
  node_im["Messaging channels<br/>[index.ts]"]
end

node_user(("User"))
node_externalchannels(("Configured channels"))

node_user -->|"submits task"| node_renderer
node_renderer -->|"starts work"| node_agentmanager
node_agentmanager -->|"runs loop"| node_agentloop
node_agentmanager -->|"manages conversation"| node_history
node_renderer -->|"manages skills"| node_skillsui
node_skillsui -->|"requests changes"| node_skillmanager
node_renderer -->|"manages MCP"| node_mcpui
node_mcpui -->|"configures servers"| node_mcpservice
node_agentloop -->|"searches web"| node_search
node_agentloop -->|"uses skills"| node_documenttools
node_renderer -->|"configures access"| node_inferenceui
node_inferenceui -->|"calls IPC"| node_inferenceipc
node_inferenceipc -->|"loads model"| node_inferencepipeline
node_inferencepipeline -->|"checks startup"| node_modelservice
node_agentloop -->|"manages schedules"| node_scheduler
node_scheduler -->|"uses guidance"| node_taskprompt
node_externalchannels -->|"sends messages"| node_im
node_im -->|"routes work"| node_agentmanager

click node_desktop "https://github.com/rongxinzy/rongxinai/blob/main/src/main/main.ts"
click node_renderer "https://github.com/rongxinzy/rongxinai/tree/main/src/renderer"
click node_agentmanager "https://github.com/rongxinzy/rongxinai/blob/main/src/main/agentManager.ts"
click node_agentloop "https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/agentEngine/piWorkLoop.ts"
click node_history "https://github.com/rongxinzy/rongxinai/blob/main/src/main/conversationHistory/service.ts"
click node_skillsui "https://github.com/rongxinzy/rongxinai/blob/main/src/renderer/components/skills/SkillsManager.tsx"
click node_skillmanager "https://github.com/rongxinzy/rongxinai/blob/main/src/main/skillManager.ts"
click node_mcpui "https://github.com/rongxinzy/rongxinai/blob/main/src/renderer/components/mcp/McpManager.tsx"
click node_mcpservice "https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/mcpIntegrationRuntime.ts"
click node_search "https://github.com/rongxinzy/rongxinai/blob/main/SKILLs/web-search/server/index.ts"
click node_documenttools "https://github.com/rongxinzy/rongxinai/tree/main/SKILLs"
click node_inferenceui "https://github.com/rongxinzy/rongxinai/blob/main/src/renderer/components/localInference/hooks/useLocalInferenceAccessSettings.ts"
click node_inferenceipc "https://github.com/rongxinzy/rongxinai/blob/main/src/main/ipcHandlers/llamacpp.ts"
click node_inferencepipeline "https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/llamacppModelLoadPipeline.ts"
click node_modelservice "https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/llamacppServe.ts"
click node_scheduler "https://github.com/rongxinzy/rongxinai/blob/main/src/main/ipcHandlers/scheduledTask/index.ts"
click node_taskprompt "https://github.com/rongxinzy/rongxinai/blob/main/src/scheduledTask/enginePrompt.ts"
click node_im "https://github.com/rongxinzy/rongxinai/blob/main/src/main/im/index.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_desktop,node_renderer,node_user toneBlue
class node_agentmanager,node_agentloop,node_history toneAmber
class node_skillsui,node_skillmanager,node_mcpui,node_mcpservice,node_search,node_documenttools toneMint
class node_inferenceui,node_inferenceipc,node_inferencepipeline,node_modelservice toneRose
class node_scheduler,node_taskprompt,node_im,node_externalchannels toneIndigo
```

## Components

### Task workspace

- [Desktop lifecycle](https://github.com/rongxinzy/rongxinai/blob/main/src/main/main.ts): `src/main/main.ts`
- [Workspace UI](https://github.com/rongxinzy/rongxinai/tree/main/src/renderer): `src/renderer`

### Agent runtime

- [Agent manager](https://github.com/rongxinzy/rongxinai/blob/main/src/main/agentManager.ts): `src/main/agentManager.ts`
- [Agent work loop](https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/agentEngine/piWorkLoop.ts): `src/main/libs/agentEngine/piWorkLoop.ts`
- [Conversation history](https://github.com/rongxinzy/rongxinai/blob/main/src/main/conversationHistory/service.ts): `src/main/conversationHistory/service.ts`

### Tools and extensions

- [Skills manager UI](https://github.com/rongxinzy/rongxinai/blob/main/src/renderer/components/skills/SkillsManager.tsx): `src/renderer/components/skills/SkillsManager.tsx`
- [Skill management](https://github.com/rongxinzy/rongxinai/blob/main/src/main/skillManager.ts): `src/main/skillManager.ts`
- [MCP manager UI](https://github.com/rongxinzy/rongxinai/blob/main/src/renderer/components/mcp/McpManager.tsx): `src/renderer/components/mcp/McpManager.tsx`
- [MCP runtime](https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/mcpIntegrationRuntime.ts): `src/main/libs/mcpIntegrationRuntime.ts`
- [Web search](https://github.com/rongxinzy/rongxinai/blob/main/SKILLs/web-search/server/index.ts): `SKILLs/web-search/server/index.ts`
- [Document and data skills](https://github.com/rongxinzy/rongxinai/tree/main/SKILLs): `SKILLs`

### Model inference

- [Local inference settings](https://github.com/rongxinzy/rongxinai/blob/main/src/renderer/components/localInference/hooks/useLocalInferenceAccessSettings.ts): `src/renderer/components/localInference/hooks/useLocalInferenceAccessSettings.ts`
- [Inference IPC](https://github.com/rongxinzy/rongxinai/blob/main/src/main/ipcHandlers/llamacpp.ts): `src/main/ipcHandlers/llamacpp.ts`
- [Model load pipeline](https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/llamacppModelLoadPipeline.ts): `src/main/libs/llamacppModelLoadPipeline.ts`
- [Local model service](https://github.com/rongxinzy/rongxinai/blob/main/src/main/libs/llamacppServe.ts): `src/main/libs/llamacppServe.ts`

### Scheduling and messaging

- [Scheduled tasks](https://github.com/rongxinzy/rongxinai/blob/main/src/main/ipcHandlers/scheduledTask/index.ts): `src/main/ipcHandlers/scheduledTask/index.ts`
- [Scheduled task guidance](https://github.com/rongxinzy/rongxinai/blob/main/src/scheduledTask/enginePrompt.ts): `src/scheduledTask/enginePrompt.ts`
- [Messaging channels](https://github.com/rongxinzy/rongxinai/blob/main/src/main/im/index.ts): `src/main/im/index.ts`

### Other components

- **User**
- **Configured channels**

## Connections

- User → Workspace UI: submits task
- Workspace UI → Agent manager: starts work
- Agent manager → Agent work loop: runs loop
- Agent manager → Conversation history: manages conversation
- Workspace UI → Skills manager UI: manages skills
- Skills manager UI → Skill management: requests changes
- Workspace UI → MCP manager UI: manages MCP
- MCP manager UI → MCP runtime: configures servers
- Agent work loop → Web search: searches web
- Agent work loop → Document and data skills: uses skills
- Workspace UI → Local inference settings: configures access
- Local inference settings → Inference IPC: calls IPC
- Inference IPC → Model load pipeline: loads model
- Model load pipeline → Local model service: checks startup
- Agent work loop → Scheduled tasks: manages schedules
- Scheduled tasks → Scheduled task guidance: uses guidance
- Configured channels → Messaging channels: sends messages
- Messaging channels → Agent manager: routes work
