# gura105/operational-ontology architecture

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

- Interactive diagram: https://gitdiagram.com/gura105/operational-ontology
- Repository: https://github.com/gura105/operational-ontology

## Overview

Operational Ontology is a TypeScript reference implementation for modeling business objects, links, read functions, and governed actions over systems of record. The principal workflow integrates legacy data into a shared model, indexes it for reads and queries, then routes changes through validated, audited actions to ontology-owned storage or back to the source owner. MCP exposes model-derived tools to agent consumers. The README documents the orders example’s workflow; source excerpts show the core runtime, query helpers, and MCP adapter, but not the example adapter implementations.

Main entry points: [`src/core.ts`](https://github.com/gura105/operational-ontology/blob/main/src/core.ts) (Runtime and actions), [`src/mcp.ts`](https://github.com/gura105/operational-ontology/blob/main/src/mcp.ts) (MCP tools), [`src/index.ts`](https://github.com/gura105/operational-ontology/blob/main/src/index.ts) (Public API), [`examples/orders/integrate.ts`](https://github.com/gura105/operational-ontology/blob/main/examples/orders/integrate.ts) (Orders integration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Data integration"]
  node_integrator["Orders integration<br/>[integrate.ts]"]
  node_model["Orders ontology<br/>[ontology.ts]"]
end

subgraph group_runtime["Ontology runtime"]
  node_runtime["Runtime and actions<br/>[core.ts]"]
  node_store[("Ontology state<br/>[core.ts]")]
  node_writeback["ERP write-back<br/>[erp-adapter.ts]"]
  node_query["Sets and aggregates<br/>[query.ts]"]
end

subgraph group_consumption["Consumer interfaces"]
  node_mcp["MCP tools<br/>[mcp.ts]"]
  node_api["Public API<br/>[index.ts]"]
end

node_erp[("Legacy order ERPs")]
node_consumer(("Apps and agents"))

node_erp -->|"supplies data"| node_integrator
node_integrator -->|"integrates data"| node_runtime
node_model -->|"defines model"| node_runtime
node_runtime -->|"reads and writes"| node_store
node_runtime -->|"aggregates sets"| node_query
node_runtime -->|"writes to owner"| node_writeback
node_api -->|"exports runtime"| node_runtime
node_api -->|"exports adapter"| node_mcp
node_mcp -->|"dispatches tools"| node_runtime
node_mcp -->|"classifies fields"| node_query
node_consumer -->|"uses model"| node_api
node_consumer -->|"calls tools"| node_mcp

click node_integrator "https://github.com/gura105/operational-ontology/blob/main/examples/orders/integrate.ts"
click node_model "https://github.com/gura105/operational-ontology/blob/main/examples/orders/ontology.ts"
click node_runtime "https://github.com/gura105/operational-ontology/blob/main/src/core.ts"
click node_store "https://github.com/gura105/operational-ontology/blob/main/src/core.ts"
click node_writeback "https://github.com/gura105/operational-ontology/blob/main/examples/orders/erp-adapter.ts"
click node_query "https://github.com/gura105/operational-ontology/blob/main/src/query.ts"
click node_mcp "https://github.com/gura105/operational-ontology/blob/main/src/mcp.ts"
click node_api "https://github.com/gura105/operational-ontology/blob/main/src/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_integrator,node_model toneBlue
class node_runtime,node_store,node_writeback,node_query,node_erp toneAmber
class node_mcp,node_api toneMint
class node_consumer toneIndigo
```

## Components

### Data integration

- [Orders integration](https://github.com/gura105/operational-ontology/blob/main/examples/orders/integrate.ts): `examples/orders/integrate.ts`
- [Orders ontology](https://github.com/gura105/operational-ontology/blob/main/examples/orders/ontology.ts): `examples/orders/ontology.ts`

### Ontology runtime

- [Runtime and actions](https://github.com/gura105/operational-ontology/blob/main/src/core.ts): `src/core.ts`
- [Ontology state](https://github.com/gura105/operational-ontology/blob/main/src/core.ts): `src/core.ts`
- [ERP write-back](https://github.com/gura105/operational-ontology/blob/main/examples/orders/erp-adapter.ts): `examples/orders/erp-adapter.ts`
- [Sets and aggregates](https://github.com/gura105/operational-ontology/blob/main/src/query.ts): `src/query.ts`

### Consumer interfaces

- [MCP tools](https://github.com/gura105/operational-ontology/blob/main/src/mcp.ts): `src/mcp.ts`
- [Public API](https://github.com/gura105/operational-ontology/blob/main/src/index.ts): `src/index.ts`

### Other components

- **Legacy order ERPs**
- **Apps and agents**

## Connections

- Legacy order ERPs → Orders integration: supplies data (evidence: `README.md`)
- Orders integration → Runtime and actions: integrates data (evidence: `README.md`)
- Orders ontology → Runtime and actions: defines model (evidence: `README.md`)
- Runtime and actions → Ontology state: reads and writes (evidence: `src/core.ts`)
- Runtime and actions → Sets and aggregates: aggregates sets (evidence: `src/core.ts`)
- Runtime and actions → ERP write-back: writes to owner (evidence: `README.md`)
- Public API → Runtime and actions: exports runtime (evidence: `src/index.ts`)
- Public API → MCP tools: exports adapter (evidence: `src/index.ts`)
- MCP tools → Runtime and actions: dispatches tools (evidence: `src/mcp.ts`)
- MCP tools → Sets and aggregates: classifies fields (evidence: `src/mcp.ts`)
- Apps and agents → Public API: uses model (evidence: `README.md`)
- Apps and agents → MCP tools: calls tools (evidence: `README.md`)
