# pascalorg/editor architecture

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

- Interactive diagram: https://gitdiagram.com/pascalorg/editor
- Repository: https://github.com/pascalorg/editor

## Overview

Pascal is a local-first 3D building editor with browser and CLI entry points, scene modeling and visualization, and MCP access for AI agents. The main user workflow is to open or create a project, edit a building scene, and view or share the result; agents can perform scene work through MCP. The graph also captures the editor’s interaction layer and documented local/self-hosted modes. Some API and persistence implementation details were not sampled, so links to those components are limited to documented relationships.

Main entry points: [`packages/editor/src/components/editor/selection-manager.tsx`](https://github.com/pascalorg/editor/blob/main/packages/editor/src/components/editor/selection-manager.tsx) (Selection and editing), [`packages/core/src/store/use-scene.ts`](https://github.com/pascalorg/editor/blob/main/packages/core/src/store/use-scene.ts) (Scene state), [`packages/cli/src/bin/pascal.ts`](https://github.com/pascalorg/editor/blob/main/packages/cli/src/bin/pascal.ts) (Local CLI), [`apps/editor/app/page.tsx`](https://github.com/pascalorg/editor/blob/main/apps/editor/app/page.tsx) (Web editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Product entry"]
  node_webapp["Web editor<br/>[page.tsx]"]
  node_cli["Local CLI<br/>[pascal.ts]"]
  node_ifc["IFC converter<br/>[scene-to-ifc.ts]"]
end

subgraph group_editor["Editor experience"]
  node_selection["Selection and editing"]
  node_tooling["Editor tools<br/>[tool-manager.tsx]"]
  node_interaction["Interaction state<br/>[scope.ts]"]
  node_editorstate["Editor state<br/>[use-editor.tsx]"]
  node_paint["Paint mode"]
  node_rooms["Room selection"]
end

subgraph group_scene["Scene engine"]
  node_corestore[("Scene state<br/>[use-scene.ts]")]
  node_spatial["Spatial indexing"]
  node_viewer["3D viewer"]
  node_snapshot["Scene snapshots"]
end

subgraph group_agents["Agent access"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_agenttools["Scene agent tools<br/>[index.ts]"]
  node_operations["Scene operations<br/>[index.ts]"]
end

subgraph group_storage["Projects and sharing"]
  node_scenesapi["Scene API<br/>[route.ts]"]
  node_sceneapiitem["Scene API routes<br/>[route.ts]"]
  node_storedb[("Local project database")]
  node_sharing["Public embeds and sharing<br/>[page.tsx]"]
end

node_user(("Editor user"))
node_agent(("AI agent"))

node_user -->|"opens editor"| node_webapp
node_webapp -.->|"edits scene"| node_selection
node_selection -->|"reads scene"| node_corestore
node_selection -.->|"resolves interactions"| node_interaction
node_selection -->|"resolves room hits"| node_rooms
node_selection -->|"resolves paint targets"| node_paint
node_tooling -.->|"selects tool modes"| node_interaction
node_editorstate -.->|"tracks editor state"| node_interaction
node_rooms -->|"indexes scene nodes"| node_corestore
node_corestore -.->|"indexes scene geometry"| node_spatial
node_corestore -.->|"renders scene"| node_viewer
node_viewer -.->|"captures view"| node_snapshot
node_user -->|"starts locally"| node_cli
node_cli -->|"starts editor"| node_webapp
node_cli -->|"starts service"| node_mcp
node_agent -->|"connects to"| node_mcp
node_mcp -->|"creates operations"| node_operations
node_mcp -->|"registers tools"| node_agenttools
node_operations -.->|"edits scene"| node_corestore
node_user -.->|"converts model"| node_ifc
node_webapp -.->|"manages projects"| node_scenesapi
node_scenesapi -.->|"serves scene routes"| node_sceneapiitem
node_cli -->|"stores projects"| node_storedb
node_user -->|"opens public embed"| node_sharing

click node_webapp "https://github.com/pascalorg/editor/blob/main/apps/editor/app/page.tsx"
click node_cli "https://github.com/pascalorg/editor/blob/main/packages/cli/src/bin/pascal.ts"
click node_ifc "https://github.com/pascalorg/editor/blob/main/packages/ifc-converter/src/export/scene-to-ifc.ts"
click node_selection "https://github.com/pascalorg/editor/blob/main/packages/editor/src/components/editor/selection-manager.tsx"
click node_tooling "https://github.com/pascalorg/editor/blob/main/packages/editor/src/components/tools/tool-manager.tsx"
click node_interaction "https://github.com/pascalorg/editor/blob/main/packages/editor/src/lib/interaction/scope.ts"
click node_editorstate "https://github.com/pascalorg/editor/blob/main/packages/editor/src/store/use-editor.tsx"
click node_paint "https://github.com/pascalorg/editor/blob/main/packages/editor/src/lib/paint-region-mode.ts"
click node_rooms "https://github.com/pascalorg/editor/blob/main/packages/editor/src/hooks/use-selected-room.ts"
click node_corestore "https://github.com/pascalorg/editor/blob/main/packages/core/src/store/use-scene.ts"
click node_spatial "https://github.com/pascalorg/editor/blob/main/packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts"
click node_viewer "https://github.com/pascalorg/editor/blob/main/packages/viewer/src/components/viewer/glb-walkthrough-controller.tsx"
click node_snapshot "https://github.com/pascalorg/editor/blob/main/packages/viewer/src/lib/snapshot-pipeline.ts"
click node_mcp "https://github.com/pascalorg/editor/blob/main/packages/mcp/src/server.ts"
click node_agenttools "https://github.com/pascalorg/editor/blob/main/packages/core/src/agent-tools/index.ts"
click node_operations "https://github.com/pascalorg/editor/blob/main/packages/mcp/src/operations/index.ts"
click node_scenesapi "https://github.com/pascalorg/editor/blob/main/apps/editor/app/api/scenes/route.ts"
click node_sceneapiitem "https://github.com/pascalorg/editor/blob/main/apps/editor/app/api/scenes/%5Bid%5D/route.ts"
click node_sharing "https://github.com/pascalorg/editor/blob/main/apps/editor/app/embed/%5Bid%5D/page.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_webapp,node_cli,node_ifc,node_user toneBlue
class node_selection,node_tooling,node_interaction,node_editorstate,node_paint,node_rooms toneAmber
class node_corestore,node_spatial,node_viewer,node_snapshot toneMint
class node_mcp,node_agenttools,node_operations toneRose
class node_scenesapi,node_sceneapiitem,node_storedb,node_sharing,node_agent toneIndigo
```

## Components

### Product entry

- [Web editor](https://github.com/pascalorg/editor/blob/main/apps/editor/app/page.tsx): `apps/editor/app/page.tsx`
- [Local CLI](https://github.com/pascalorg/editor/blob/main/packages/cli/src/bin/pascal.ts): `packages/cli/src/bin/pascal.ts`
- [IFC converter](https://github.com/pascalorg/editor/blob/main/packages/ifc-converter/src/export/scene-to-ifc.ts): `packages/ifc-converter/src/export/scene-to-ifc.ts`

### Editor experience

- [Selection and editing](https://github.com/pascalorg/editor/blob/main/packages/editor/src/components/editor/selection-manager.tsx): `packages/editor/src/components/editor/selection-manager.tsx`
- [Editor tools](https://github.com/pascalorg/editor/blob/main/packages/editor/src/components/tools/tool-manager.tsx): `packages/editor/src/components/tools/tool-manager.tsx`
- [Interaction state](https://github.com/pascalorg/editor/blob/main/packages/editor/src/lib/interaction/scope.ts): `packages/editor/src/lib/interaction/scope.ts`
- [Editor state](https://github.com/pascalorg/editor/blob/main/packages/editor/src/store/use-editor.tsx): `packages/editor/src/store/use-editor.tsx`
- [Paint mode](https://github.com/pascalorg/editor/blob/main/packages/editor/src/lib/paint-region-mode.ts): `packages/editor/src/lib/paint-region-mode.ts`
- [Room selection](https://github.com/pascalorg/editor/blob/main/packages/editor/src/hooks/use-selected-room.ts): `packages/editor/src/hooks/use-selected-room.ts`

### Scene engine

- [Scene state](https://github.com/pascalorg/editor/blob/main/packages/core/src/store/use-scene.ts): `packages/core/src/store/use-scene.ts`
- [Spatial indexing](https://github.com/pascalorg/editor/blob/main/packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts): `packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts`
- [3D viewer](https://github.com/pascalorg/editor/blob/main/packages/viewer/src/components/viewer/glb-walkthrough-controller.tsx): `packages/viewer/src/components/viewer/glb-walkthrough-controller.tsx`
- [Scene snapshots](https://github.com/pascalorg/editor/blob/main/packages/viewer/src/lib/snapshot-pipeline.ts): `packages/viewer/src/lib/snapshot-pipeline.ts`

### Agent access

- [MCP server](https://github.com/pascalorg/editor/blob/main/packages/mcp/src/server.ts): `packages/mcp/src/server.ts`
- [Scene agent tools](https://github.com/pascalorg/editor/blob/main/packages/core/src/agent-tools/index.ts): `packages/core/src/agent-tools/index.ts`
- [Scene operations](https://github.com/pascalorg/editor/blob/main/packages/mcp/src/operations/index.ts): `packages/mcp/src/operations/index.ts`

### Projects and sharing

- [Scene API](https://github.com/pascalorg/editor/blob/main/apps/editor/app/api/scenes/route.ts): `apps/editor/app/api/scenes/route.ts`
- [Scene API routes](https://github.com/pascalorg/editor/blob/main/apps/editor/app/api/scenes/%5Bid%5D/route.ts): `apps/editor/app/api/scenes/[id]/route.ts`
- **Local project database**
- [Public embeds and sharing](https://github.com/pascalorg/editor/blob/main/apps/editor/app/embed/%5Bid%5D/page.tsx): `apps/editor/app/embed/[id]/page.tsx`

### Other components

- **Editor user**
- **AI agent**

## Connections

- Editor user → Web editor: opens editor (evidence: `README.md`)
- Web editor → Selection and editing: edits scene
- Selection and editing → Scene state: reads scene (evidence: `packages/editor/src/components/editor/selection-manager.tsx`)
- Selection and editing → Interaction state: resolves interactions (evidence: `packages/editor/src/components/editor/selection-manager.tsx`)
- Selection and editing → Room selection: resolves room hits (evidence: `packages/editor/src/components/editor/selection-manager.tsx`)
- Selection and editing → Paint mode: resolves paint targets (evidence: `packages/editor/src/components/editor/selection-manager.tsx`)
- Editor tools → Interaction state: selects tool modes (evidence: `packages/editor/src/components/tools/tool-manager.tsx`)
- Editor state → Interaction state: tracks editor state
- Room selection → Scene state: indexes scene nodes (evidence: `packages/editor/src/hooks/use-selected-room.ts`)
- Scene state → Spatial indexing: indexes scene geometry (evidence: `packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts`)
- Scene state → 3D viewer: renders scene
- 3D viewer → Scene snapshots: captures view
- Editor user → Local CLI: starts locally (evidence: `README.md`)
- Local CLI → Web editor: starts editor (evidence: `README.md`)
- Local CLI → MCP server: starts service (evidence: `README.md`)
- AI agent → MCP server: connects to (evidence: `README.md`)
- MCP server → Scene operations: creates operations (evidence: `packages/mcp/src/server.ts`)
- MCP server → Scene agent tools: registers tools (evidence: `packages/mcp/src/server.ts`)
- Scene operations → Scene state: edits scene
- Editor user → IFC converter: converts model
- Web editor → Scene API: manages projects
- Scene API → Scene API routes: serves scene routes
- Local CLI → Local project database: stores projects (evidence: `README.md`)
- Editor user → Public embeds and sharing: opens public embed (evidence: `README.md`)
