# sixhq/overture architecture

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

- Interactive diagram: https://gitdiagram.com/sixhq/overture
- Repository: https://github.com/sixhq/overture

## Overview

**Overture is a local “MCP server”** (Node/TypeScript) that **intercepts an AI coding agent’s planning phase**, turns the plan into a **structured graph**, and serves an **interactive web UI** to review/approve the plan, enrich nodes with context, and **stream execution status in real time**.

From the tree + README, it’s best understood as:
- A **local server-side integration adapter** (MCP) that talks to external AI agents (Claude Code, Cursor, Cline, Sixth, etc.)
- A **web application** (static UI assets) served by the server
- A **WebSocket channel** for live graph/status updates
- A **plan parsing + state management** core (XML parser → in-memory store + history storage)

##### Read the repo structure as architecture signals
This is a **monorepo**:
- **Top level**
- `packages/` (actual products)
- `prompts/` and `packages/mcp-server/prompts/` (integration instructions / agent-specific prompts)
- `examples/` (e.g., `ecommerce-plan.xml` suggests plan input format)
- `package.json`, `pnpm-lock.yaml`, `tsconfig.json` (Node/TS workspace tooling)

- **Core runtime package: `packages/mcp-server/`**
- `src/cli.ts` → entrypoint for `npx overture-mcp` / global binary
- `src/index.ts` → likely bootstraps services
- `src/http/server.ts` → HTTP server (serves UI at `OVERTURE_HTTP_PORT` default **3031**)
- `src/websocket/ws-server.ts` → WS server (default **3030**)
- `src/parser/xml-parser.ts` → plan XML → internal graph model
- `src/store/plan-store.ts` → in-memory canonical state of plan graph + node statuses + selections
- `src/storage/history-storage.ts` → persistence of past plans / events (local disk most likely)
- `src/tools/handlers.ts` → MCP tool endpoints/handlers (what the agent calls)
- `src/utils/plan-diff.ts` → changesets between plan versions / incremental updates
- `src/types.ts` → shared domain types

- **UI artifacts**
- `packages/mcp-server/public/` and `packages/mcp-server/ui-dist/` contain built static assets (`index.html`, bundled JS/CSS). For system design, treat UI as a **static SPA** served by the HTTP server.
- `packages/ui/` exists but file tree doesn’t show contents; still, it implies a separate UI package feeding `ui-dist`.

##### Agent → MCP Tool Handlers
- The agent “sends” (or triggers) the plan to Overture via MCP tool calls.

##### Architectural patterns to call out
- **Adapter/Integration pattern:** MCP Tool Handlers are the adapter between *external agents* and *Overture’s domain model*.
- **Event-driven UI updates:** WebSocket pushes store changes; `plan-diff` suggests incremental/event updates rather than full refresh.
- **Single source of truth:** `plan-store` is the canonical state; parser/handlers mutate it; UI observes it.
- **Ports split by concern:** HTTP (UI) vs WebSocket (live updates), controlled by env vars.

- The UI is likely a **prebuilt SPA** (`ui-dist/`, `public/`). Show it as “static assets served by HTTP server,” not a separate always-running frontend dev server (unless you confirm later).
- The **agent integration is via MCP**, not generic REST; label that interface clearly as “MCP tools / MCP protocol” (even if transport details aren’t visible in tree).
- **two channels to UI**: HTTP for initial load, WebSocket for live updates.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Diagram 1 — System Context
  %% =========================
  subgraph "Diagram 1 — System Context (Local-first)"
    direction TB

    Agent["MCP-compatible AI Agent\n(Claude Code / Cursor / Cline / Sixth / etc.)"]:::external
    Browser["Developer Browser\nhttp://localhost:3031"]:::external
    FS[("Local File System")]:::storageExt

    Overture["Overture MCP Server\n(Local Node/TypeScript process)"]:::container

    Agent -->|"MCP_tools:Plan(XML)/planning_events"| Overture
    Overture -->|"MCP_tools:approval+selected_branch+attached_context"| Agent
    Agent -->|"MCP_tools:execution_status_events"| Overture

    Browser -->|"HTTP_load_UI_assets(:3031)"| Overture
    Browser -->|"WebSocket_live_updates(:3030)"| Overture

    Overture -.->|"persist_history(plans/events)"| FS
  end

  %% ===================================
  %% Diagram 2 — Container/Runtime Layout
  %% ===================================
  subgraph "Diagram 2 — Container Diagram (Overture runtime)"
    direction TB

    subgraph "Overture (Node/TS)"
      direction TB

      CLI2["CLI + Bootstrap\n(Starts servers, reads env vars)"]:::runtime
      MCP2["MCP Tool Interface\n(Adapter for agents)"]:::runtime

      subgraph "Core Domain (Single source of truth)"
        direction TB
        Parser2["Plan XML Parser"]:::domain
        Store2["Plan Store\n(canonical in-memory state)"]:::domain
        Diff2["Plan Diff Engine\n(incremental changes)"]:::domain
        Types2["Shared Plan Types"]:::domain
        History2[("History Storage\n(local persistence)")]:::storage
      end

      HTTP2["HTTP Server\nOVERTURE_HTTP_PORT=3031\n(serves static SPA)"]:::runtime
      WS2["WebSocket Server\nOVERTURE_WS_PORT=3030\n(streams updates)"]:::runtime

      UI2["Web UI (Static SPA)\n(ui-dist/ or public/)"]:::ui

      CLI2 -->|"start_http"| HTTP2
      CLI2 -->|"start_ws"| WS2
      CLI2 -.->|"auto_open_UI(OVERTURE_AUTO_OPEN=true)"| Browser

      MCP2 -->|"plan_XML_to_parse"| Parser2
      Parser2 -->|"graph_model"| Store2
      Store2 -->|"state_change"| Diff2
      Store2 -->|"persist_plans/events"| History2
      History2 -.->|"read/write"| FS

      HTTP2 -->|"serve_assets"| UI2
      Browser -->|"GET_/ (index.html/js/css)"| HTTP2
      Browser -->|"WS_connect/live_updates"| WS2
      WS2 -->|"push_graph+status"| Browser

      UI2 -->|"approve/select_branch/attach_context"| WS2
      WS2 -->|"mutate_state"| Store2

      Store2 -->|"notify_changes"| WS2
      Diff2 -->|"incremental_updates"| WS2

      Store2 -->|"approval+context"| MCP2
      MCP2 -->|"execution_events"| Store2

      Types2 -.->|"typed_models"| Parser2
      Types2 -.->|"typed_state"| Store2
      Types2 -.->|"typed_updates"| Diff2
      Types2 -.->|"typed_messages"| MCP2
    end
  end

  %% ==========================================
  %% Diagram 3 — Component Diagram (Repo-mapped)
  %% ==========================================
  subgraph "Diagram 3 — Component Diagram (packages/mcp-server/src)"
    direction TB

    subgraph "Bootstrap"
      direction TB
      CLI3["CLI / Process Bootstrap\nsrc/cli.ts"]:::runtime
      IDX3["Runtime Bootstrap / Main Entry\nsrc/index.ts"]:::runtime
      PKG3["Package Metadata\npackages/mcp-server/package.json"]:::meta
      DOC3["Documentation\npackages/mcp-server/README.md"]:::meta
      PRM3["Agent Integration Prompts\npackages/mcp-server/prompts/"]:::meta
    end

    subgraph "Integration Adapter (MCP)"
      direction TB
      HAND3["MCP Tool Handlers\nsrc/tools/handlers.ts"]:::runtime
    end

    subgraph "Plan Processing + State (Single source of truth)"
      direction TB
      XML3["Plan Parser (XML → graph)\nsrc/parser/xml-parser.ts"]:::domain
      TYPES3["Plan Domain + Shared Types\nsrc/types.ts"]:::domain
      STORE3["State Store\nsrc/store/plan-store.ts"]:::domain
      DIFF3["Diff/Change Engine\nsrc/utils/plan-diff.ts"]:::domain
      HIST3[("History/Persistence\nsrc/storage/history-storage.ts")]:::storage
      EXXML3["Example Plan Input\nexamples/ecommerce-plan.xml"]:::example
    end

    subgraph "Transport / UI Delivery"
      direction TB
      HTTP3["HTTP Server\nsrc/http/server.ts\n(:3031)"]:::runtime
      WS3["WebSocket Server\nsrc/websocket/ws-server.ts\n(:3030)"]:::runtime
      UIDIST3["Web UI Build Assets\npackages/mcp-server/ui-dist/"]:::ui
      PUB3["Legacy/Alt Public Assets\npackages/mcp-server/public/"]:::ui
    end

    %% Component interactions (vertical, explicit lifecycle)
    CLI3 -->|"invokes"| IDX3
    IDX3 -->|"start_servers"| HTTP3
    IDX3 -->|"start_servers"| WS3

    HAND3 -->|"plan_XML/planning_events"| XML3
    XML3 -->|"graph_model"| STORE3
    STORE3 -->|"compute_diff"| DIFF3
    STORE3 -->|"persist_history"| HIST3

    HTTP3 -->|"serve_SPA_assets"| UIDIST3
    HTTP3 -->|"serve_static_assets"| PUB3

    STORE3 -->|"publish_changes"| WS3
    DIFF3 -->|"incremental_updates"| WS3

    WS3 -->|"push_graph+status_updates"| UIDIST3

    UIDIST3 -->|"approve/select_branch/attach_context"| WS3
    WS3 -->|"update_state"| STORE3

    STORE3 -->|"approval+context"| HAND3
    HAND3 -->|"execution_progress_events"| STORE3

    TYPES3 -.->|"types_used_by"| XML3
    TYPES3 -.->|"types_used_by"| STORE3
    TYPES3 -.->|"types_used_by"| HAND3
    TYPES3 -.->|"types_used_by"| DIFF3

    EXXML3 -.->|"sample_input_for_parser"| XML3
    DOC3 -.->|"documents_tools+usage"| HAND3
    PRM3 -.->|"agent_setup_instructions"| HAND3
    PKG3 -.->|"bin/entrypoints_config"| CLI3
  end

  %% ==================
  %% Click Events (paths)
  %% ==================
  click CLI3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/cli.ts"
  click IDX3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/index.ts"
  click HAND3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/tools/handlers.ts"
  click XML3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/parser/xml-parser.ts"
  click TYPES3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/types.ts"
  click STORE3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/store/plan-store.ts"
  click DIFF3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/utils/plan-diff.ts"
  click HIST3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/storage/history-storage.ts"
  click HTTP3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/http/server.ts"
  click WS3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/src/websocket/ws-server.ts"
  click UIDIST3 "https://github.com/sixhq/overture/tree/main/packages/mcp-server/ui-dist/"
  click PUB3 "https://github.com/sixhq/overture/tree/main/packages/mcp-server/public/"
  click PRM3 "https://github.com/sixhq/overture/tree/main/packages/mcp-server/prompts/"
  click EXXML3 "https://github.com/sixhq/overture/blob/main/examples/ecommerce-plan.xml"
  click PKG3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/package.json"
  click DOC3 "https://github.com/sixhq/overture/blob/main/packages/mcp-server/README.md"

  %% ==================
  %% Styles (color-coded)
  %% ==================
  classDef external fill:#E5E7EB,stroke:#6B7280,stroke-width:1px,color:#111827,rx:10,ry:10
  classDef container fill:#DBEAFE,stroke:#1D4ED8,stroke-width:1px,color:#0B1B3A
  classDef runtime fill:#BFDBFE,stroke:#2563EB,stroke-width:1px,color:#0B1B3A
  classDef domain fill:#DCFCE7,stroke:#16A34A,stroke-width:1px,color:#052E16
  classDef storage fill:#FFEDD5,stroke:#F97316,stroke-width:1px,color:#431407
  classDef storageExt fill:#FED7AA,stroke:#EA580C,stroke-width:1px,color:#431407
  classDef ui fill:#E9D5FF,stroke:#7C3AED,stroke-width:1px,color:#2E1065
  classDef meta fill:#FDE68A,stroke:#D97706,stroke-width:1px,color:#451A03
  classDef example fill:#FFE4E6,stroke:#E11D48,stroke-width:1px,color:#4C0519
```
