# xiaolai/vmark architecture

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

- Interactive diagram: https://gitdiagram.com/xiaolai/vmark
- Repository: https://github.com/xiaolai/vmark

## Overview

VMark is a local-first desktop workspace for editing plain-text artifacts and collaborating with AI. The principal workflow is to open a file or workspace, initialize its window state, render the artifact in an appropriate editor or preview, then save or act on it. The graph also preserves documented workflow execution, MCP integration, browser automation, content serving, and Genie assistance. Several subsystem paths come from the repository tree and README rather than inspected implementation; those links are marked unverified where needed.

Main entry points: [`src/components/Editor`](https://github.com/xiaolai/vmark/tree/main/src/components/Editor) (Editor surfaces), [`src/App.tsx`](https://github.com/xiaolai/vmark/blob/main/src/App.tsx) (Window application), [`src/contexts/WindowContext.tsx`](https://github.com/xiaolai/vmark/blob/main/src/contexts/WindowContext.tsx) (Window bootstrap), [`src/lib/formats/adapters/yamlEngineRenderer.tsx`](https://github.com/xiaolai/vmark/blob/main/src/lib/formats/adapters/yamlEngineRenderer.tsx) (Workflow preview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop application"]
  node_app["Window application<br/>[App.tsx]"]
  node_window["Window bootstrap<br/>[WindowContext.tsx]"]
  node_workspace["Workspace setup"]
  node_settings["Settings<br/>[settingsStore.ts]"]
end

subgraph group_editing["Editing and formats"]
  node_editor["Editor surfaces"]
  node_format["Format adapters"]
  node_workflow["Workflow preview"]
  node_workflow_parse["Workflow parser<br/>[parser.ts]"]
end

subgraph group_automation["AI and automation"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_mcp_tools["MCP tools"]
  node_browser["Browser automation<br/>[commands.rs]"]
  node_genies["AI Genies"]
end

subgraph group_runtime["Native runtime"]
  node_mcp_bridge["MCP bridge<br/>[server.rs]"]
  node_content["Content server<br/>[manager.rs]"]
  node_content_service["Content service<br/>[createServer.ts]"]
  node_native["Tauri runtime<br/>[lib.rs]"]
end

subgraph group_state["Workspace state"]
  node_persistence[("Workspace persistence")]
  node_hot_exit[("Session recovery<br/>[storage.rs]")]
  node_coherence["Coherence tracking"]
end

node_user(("Workspace user"))
node_files["Plain-text artifacts"]
node_result["Rendered or saved work"]

node_user -->|"opens workspace"| node_app
node_files -.->|"opens artifact"| node_editor
node_app -->|"renders editor"| node_editor
node_app -.->|"bootstraps window"| node_window
node_window -->|"opens workspace"| node_workspace
node_window -->|"prepares storage"| node_persistence
node_window -.->|"loads documents"| node_editor
node_editor -.->|"selects preview"| node_format
node_format -->|"renders workflow"| node_workflow
node_workflow -->|"parses content"| node_workflow_parse
node_workflow -->|"checks engine setting"| node_settings
node_workflow -.->|"runs workflow"| node_native
node_settings -.->|"persists settings"| node_persistence
node_editor -->|"edits artifacts"| node_result
node_user -->|"invokes assistant"| node_mcp
node_mcp -.->|"dispatches tools"| node_mcp_tools
node_mcp -.->|"bridges requests"| node_mcp_bridge
node_mcp_bridge -.->|"routes browser actions"| node_browser
node_mcp_tools -.->|"works on artifacts"| node_editor
node_user -->|"requests assistance"| node_genies
node_workspace -.->|"tracks workspace claims"| node_coherence
node_app -.->|"manages content service"| node_content
node_content -.->|"starts service"| node_content_service
node_native -.->|"stores recovery session"| node_hot_exit
node_persistence -.->|"saves workspace state"| node_result

click node_app "https://github.com/xiaolai/vmark/blob/main/src/App.tsx"
click node_window "https://github.com/xiaolai/vmark/blob/main/src/contexts/WindowContext.tsx"
click node_workspace "https://github.com/xiaolai/vmark/blob/main/src/services/workspaces/openWorkspaceWithConfig.ts"
click node_editor "https://github.com/xiaolai/vmark/tree/main/src/components/Editor"
click node_format "https://github.com/xiaolai/vmark/tree/main/src/lib/formats"
click node_workflow "https://github.com/xiaolai/vmark/blob/main/src/lib/formats/adapters/yamlEngineRenderer.tsx"
click node_workflow_parse "https://github.com/xiaolai/vmark/blob/main/src/lib/workflow/parser.ts"
click node_settings "https://github.com/xiaolai/vmark/blob/main/src/stores/settingsStore.ts"
click node_persistence "https://github.com/xiaolai/vmark/blob/main/src/services/persistence/workspaceStorage.ts"
click node_hot_exit "https://github.com/xiaolai/vmark/blob/main/src-tauri/src/hot_exit/storage.rs"
click node_mcp "https://github.com/xiaolai/vmark/blob/main/server/mcp/src/server.ts"
click node_mcp_tools "https://github.com/xiaolai/vmark/tree/main/server/mcp/src/tools"
click node_mcp_bridge "https://github.com/xiaolai/vmark/blob/main/src-tauri/src/mcp_bridge/server.rs"
click node_browser "https://github.com/xiaolai/vmark/blob/main/src-tauri/src/browser/commands.rs"
click node_genies "https://github.com/xiaolai/vmark/tree/main/src-tauri/src/genies"
click node_coherence "https://github.com/xiaolai/vmark/tree/main/src-tauri/src/coherence"
click node_content "https://github.com/xiaolai/vmark/blob/main/src-tauri/src/content_server/manager.rs"
click node_content_service "https://github.com/xiaolai/vmark/blob/main/server/content/src/server/createServer.ts"
click node_native "https://github.com/xiaolai/vmark/blob/main/src-tauri/src/lib.rs"

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_app,node_window,node_workspace,node_settings,node_user toneBlue
class node_editor,node_format,node_workflow,node_workflow_parse toneAmber
class node_mcp,node_mcp_tools,node_browser,node_genies toneMint
class node_mcp_bridge,node_content,node_content_service,node_native toneRose
class node_persistence,node_hot_exit,node_coherence,node_files,node_result toneIndigo
```

## Components

### Desktop application

- [Window application](https://github.com/xiaolai/vmark/blob/main/src/App.tsx): `src/App.tsx`
- [Window bootstrap](https://github.com/xiaolai/vmark/blob/main/src/contexts/WindowContext.tsx): `src/contexts/WindowContext.tsx`
- [Workspace setup](https://github.com/xiaolai/vmark/blob/main/src/services/workspaces/openWorkspaceWithConfig.ts): `src/services/workspaces/openWorkspaceWithConfig.ts`
- [Settings](https://github.com/xiaolai/vmark/blob/main/src/stores/settingsStore.ts): `src/stores/settingsStore.ts`

### Editing and formats

- [Editor surfaces](https://github.com/xiaolai/vmark/tree/main/src/components/Editor): `src/components/Editor`
- [Format adapters](https://github.com/xiaolai/vmark/tree/main/src/lib/formats): `src/lib/formats`
- [Workflow preview](https://github.com/xiaolai/vmark/blob/main/src/lib/formats/adapters/yamlEngineRenderer.tsx): `src/lib/formats/adapters/yamlEngineRenderer.tsx`
- [Workflow parser](https://github.com/xiaolai/vmark/blob/main/src/lib/workflow/parser.ts): `src/lib/workflow/parser.ts`

### AI and automation

- [MCP server](https://github.com/xiaolai/vmark/blob/main/server/mcp/src/server.ts): `server/mcp/src/server.ts`
- [MCP tools](https://github.com/xiaolai/vmark/tree/main/server/mcp/src/tools): `server/mcp/src/tools`
- [Browser automation](https://github.com/xiaolai/vmark/blob/main/src-tauri/src/browser/commands.rs): `src-tauri/src/browser/commands.rs`
- [AI Genies](https://github.com/xiaolai/vmark/tree/main/src-tauri/src/genies): `src-tauri/src/genies`

### Native runtime

- [MCP bridge](https://github.com/xiaolai/vmark/blob/main/src-tauri/src/mcp_bridge/server.rs): `src-tauri/src/mcp_bridge/server.rs`
- [Content server](https://github.com/xiaolai/vmark/blob/main/src-tauri/src/content_server/manager.rs): `src-tauri/src/content_server/manager.rs`
- [Content service](https://github.com/xiaolai/vmark/blob/main/server/content/src/server/createServer.ts): `server/content/src/server/createServer.ts`
- [Tauri runtime](https://github.com/xiaolai/vmark/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Workspace state

- [Workspace persistence](https://github.com/xiaolai/vmark/blob/main/src/services/persistence/workspaceStorage.ts): `src/services/persistence/workspaceStorage.ts`
- [Session recovery](https://github.com/xiaolai/vmark/blob/main/src-tauri/src/hot_exit/storage.rs): `src-tauri/src/hot_exit/storage.rs`
- [Coherence tracking](https://github.com/xiaolai/vmark/tree/main/src-tauri/src/coherence): `src-tauri/src/coherence`

### Other components

- **Workspace user**
- **Plain-text artifacts**
- **Rendered or saved work**

## Connections

- Workspace user → Window application: opens workspace
- Plain-text artifacts → Editor surfaces: opens artifact
- Window application → Editor surfaces: renders editor (evidence: `src/App.tsx`)
- Window application → Window bootstrap: bootstraps window (evidence: `src/App.tsx`)
- Window bootstrap → Workspace setup: opens workspace (evidence: `src/contexts/WindowContext.tsx`)
- Window bootstrap → Workspace persistence: prepares storage
- Window bootstrap → Editor surfaces: loads documents
- Editor surfaces → Format adapters: selects preview (evidence: `src/components/Editor/SplitPaneEditor/usePreviewModel.ts`)
- Format adapters → Workflow preview: renders workflow (evidence: `src/lib/formats/adapters/yamlEngineRenderer.tsx`)
- Workflow preview → Workflow parser: parses content (evidence: `src/lib/formats/adapters/yamlEngineRenderer.tsx`)
- Workflow preview → Settings: checks engine setting (evidence: `src/lib/formats/adapters/yamlEngineRenderer.tsx`)
- Workflow preview → Tauri runtime: runs workflow
- Settings → Workspace persistence: persists settings
- Editor surfaces → Rendered or saved work: edits artifacts
- Workspace user → MCP server: invokes assistant
- MCP server → MCP tools: dispatches tools
- MCP server → MCP bridge: bridges requests
- MCP bridge → Browser automation: routes browser actions
- MCP tools → Editor surfaces: works on artifacts
- Workspace user → AI Genies: requests assistance
- Workspace setup → Coherence tracking: tracks workspace claims
- Window application → Content server: manages content service
- Content server → Content service: starts service
- Tauri runtime → Session recovery: stores recovery session
- Workspace persistence → Rendered or saved work: saves workspace state
