# arienax/gxworks-agent architecture

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

- Interactive diagram: https://gitdiagram.com/arienax/gxworks-agent
- Repository: https://github.com/arienax/gxworks-agent
- Video tour (about a minute): https://gitdiagram.com/arienax/gxworks-agent/video

## Overview

GXWorks Agent provides MCP engineering tools and a browser workbench for Mitsubishi PLC projects. Users supply project context and requirements, then plan or generate Ladder, ST, or FBD work, review and validate candidates, and save or deliver engineering artifacts; GXW projects can also be inspected and edited offline. Separate capabilities include CPU-scoped engineering knowledge, simulation, and native GX Works2 operations. The README documents the product workflow; some subsystem links below are dashed where sampled source does not establish runtime wiring.

Main entry points: [`src/application/projects.py`](https://github.com/arienax/gxworks-agent/blob/main/src/application/projects.py) (Project workflow), [`src/application/generation.py`](https://github.com/arienax/gxworks-agent/blob/main/src/application/generation.py) (Program generation), [`src/integrations/mcp/server.py`](https://github.com/arienax/gxworks-agent/blob/main/src/integrations/mcp/server.py) (MCP server), [`src/integrations/web/app.py`](https://github.com/arienax/gxworks-agent/blob/main/src/integrations/web/app.py) (Web workbench)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_mcp["MCP server<br/>[server.py]"]
  node_web["Web workbench<br/>[app.py]"]
end

subgraph group_workflow["Engineering workflow"]
  node_session["Engineering sessions"]
  node_projects["Project workflow<br/>[projects.py]"]
  node_spec["Specification<br/>[spec_document.py]"]
  node_generation["Program generation<br/>[generation.py]"]
  node_inspection["Review and checks<br/>[engine.py]"]
  node_delivery["Artifact delivery<br/>[delivery.py]"]
  node_storage[("Project and session state")]
end

subgraph group_plc["PLC authoring"]
  node_plc_ir["PLC intermediate model<br/>[ir.py]"]
  node_plc_validation["PLC validation<br/>[validation.py]"]
  node_gxw_codec["GXW authoring and codec"]
  node_fbd["FBD workflows<br/>[fbd.py]"]
end

subgraph group_knowledge["Knowledge and simulation"]
  node_knowledge["Engineering knowledge"]
  node_simulator["Simulation workbench<br/>[service.py]"]
end

subgraph group_native["Native engineering"]
  node_native_app["Native operations"]
  node_live["Live engineering"]
  node_native_driver["GX Works2 driver"]
  node_offline["Offline GXW editing<br/>[gxw_files.py]"]
end

node_mcp_client(("MCP client"))
node_browser_user(("Workbench user"))

node_mcp_client -->|"requests tools"| node_mcp
node_mcp -->|"dispatches tools"| node_session
node_browser_user -->|"uses workbench"| node_web
node_web -.->|"accesses projects"| node_projects
node_session -->|"manages projects"| node_projects
node_projects -.->|"supports specification"| node_spec
node_projects -.->|"starts generation"| node_generation
node_generation -->|"uses CPU facts"| node_knowledge
node_generation -.->|"produces PLC model"| node_plc_ir
node_generation -.->|"submits candidates"| node_inspection
node_inspection -->|"checks programs"| node_plc_validation
node_projects -.->|"delivers artifacts"| node_delivery
node_projects -->|"stores versions"| node_storage
node_delivery -.->|"exports GXW artifacts"| node_gxw_codec
node_fbd -->|"uses GXW models"| node_gxw_codec
node_browser_user -->|"tests simulations"| node_simulator
node_projects -.->|"supports simulation"| node_simulator
node_mcp -->|"exposes GXW tools"| node_offline
node_web -->|"supports GXW import"| node_offline
node_projects -.->|"requests native work"| node_native_app
node_native_app -.->|"runs native operations"| node_native_driver
node_live -->|"coordinates live session"| node_native_driver

click node_mcp "https://github.com/arienax/gxworks-agent/blob/main/src/integrations/mcp/server.py"
click node_web "https://github.com/arienax/gxworks-agent/blob/main/src/integrations/web/app.py"
click node_session "https://github.com/arienax/gxworks-agent/blob/main/src/application/engineering_session.py"
click node_projects "https://github.com/arienax/gxworks-agent/blob/main/src/application/projects.py"
click node_spec "https://github.com/arienax/gxworks-agent/blob/main/src/application/spec_document.py"
click node_generation "https://github.com/arienax/gxworks-agent/blob/main/src/application/generation.py"
click node_inspection "https://github.com/arienax/gxworks-agent/blob/main/src/inspection/engine.py"
click node_delivery "https://github.com/arienax/gxworks-agent/blob/main/src/application/delivery.py"
click node_plc_ir "https://github.com/arienax/gxworks-agent/blob/main/src/plc/ir.py"
click node_plc_validation "https://github.com/arienax/gxworks-agent/blob/main/src/plc/validation.py"
click node_gxw_codec "https://github.com/arienax/gxworks-agent/tree/main/src/gxw"
click node_fbd "https://github.com/arienax/gxworks-agent/blob/main/src/application/fbd.py"
click node_knowledge "https://github.com/arienax/gxworks-agent/tree/main/src/knowledge"
click node_simulator "https://github.com/arienax/gxworks-agent/blob/main/src/simulator/service.py"
click node_native_app "https://github.com/arienax/gxworks-agent/blob/main/src/application/native_engineering.py"
click node_live "https://github.com/arienax/gxworks-agent/blob/main/src/application/live_engineering.py"
click node_native_driver "https://github.com/arienax/gxworks-agent/blob/main/src/gxworks2/engineering_driver.py"
click node_offline "https://github.com/arienax/gxworks-agent/blob/main/src/application/gxw_files.py"
click node_storage "https://github.com/arienax/gxworks-agent/tree/main/src/storage"

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_mcp,node_web,node_mcp_client,node_browser_user toneBlue
class node_session,node_projects,node_spec,node_generation,node_inspection,node_delivery,node_storage toneAmber
class node_plc_ir,node_plc_validation,node_gxw_codec,node_fbd toneMint
class node_knowledge,node_simulator toneRose
class node_native_app,node_live,node_native_driver,node_offline toneIndigo
```

## Components

### User interfaces

- [MCP server](https://github.com/arienax/gxworks-agent/blob/main/src/integrations/mcp/server.py): `src/integrations/mcp/server.py`
- [Web workbench](https://github.com/arienax/gxworks-agent/blob/main/src/integrations/web/app.py): `src/integrations/web/app.py`

### Engineering workflow

- [Engineering sessions](https://github.com/arienax/gxworks-agent/blob/main/src/application/engineering_session.py): `src/application/engineering_session.py`
- [Project workflow](https://github.com/arienax/gxworks-agent/blob/main/src/application/projects.py): `src/application/projects.py`
- [Specification](https://github.com/arienax/gxworks-agent/blob/main/src/application/spec_document.py): `src/application/spec_document.py`
- [Program generation](https://github.com/arienax/gxworks-agent/blob/main/src/application/generation.py): `src/application/generation.py`
- [Review and checks](https://github.com/arienax/gxworks-agent/blob/main/src/inspection/engine.py): `src/inspection/engine.py`
- [Artifact delivery](https://github.com/arienax/gxworks-agent/blob/main/src/application/delivery.py): `src/application/delivery.py`
- [Project and session state](https://github.com/arienax/gxworks-agent/tree/main/src/storage): `src/storage`

### PLC authoring

- [PLC intermediate model](https://github.com/arienax/gxworks-agent/blob/main/src/plc/ir.py): `src/plc/ir.py`
- [PLC validation](https://github.com/arienax/gxworks-agent/blob/main/src/plc/validation.py): `src/plc/validation.py`
- [GXW authoring and codec](https://github.com/arienax/gxworks-agent/tree/main/src/gxw): `src/gxw`
- [FBD workflows](https://github.com/arienax/gxworks-agent/blob/main/src/application/fbd.py): `src/application/fbd.py`

### Knowledge and simulation

- [Engineering knowledge](https://github.com/arienax/gxworks-agent/tree/main/src/knowledge): `src/knowledge`
- [Simulation workbench](https://github.com/arienax/gxworks-agent/blob/main/src/simulator/service.py): `src/simulator/service.py`

### Native engineering

- [Native operations](https://github.com/arienax/gxworks-agent/blob/main/src/application/native_engineering.py): `src/application/native_engineering.py`
- [Live engineering](https://github.com/arienax/gxworks-agent/blob/main/src/application/live_engineering.py): `src/application/live_engineering.py`
- [GX Works2 driver](https://github.com/arienax/gxworks-agent/blob/main/src/gxworks2/engineering_driver.py): `src/gxworks2/engineering_driver.py`
- [Offline GXW editing](https://github.com/arienax/gxworks-agent/blob/main/src/application/gxw_files.py): `src/application/gxw_files.py`

### Other components

- **MCP client**
- **Workbench user**

## Connections

- MCP client → MCP server: requests tools (evidence: `README.md`)
- MCP server → Engineering sessions: dispatches tools (evidence: `src/integrations/mcp/server.py`)
- Workbench user → Web workbench: uses workbench (evidence: `README.md`)
- Web workbench → Project workflow: accesses projects
- Engineering sessions → Project workflow: manages projects (evidence: `src/application/engineering_session.py`)
- Project workflow → Specification: supports specification (evidence: `src/application/projects.py`)
- Project workflow → Program generation: starts generation
- Program generation → Engineering knowledge: uses CPU facts (evidence: `README.md`)
- Program generation → PLC intermediate model: produces PLC model
- Program generation → Review and checks: submits candidates
- Review and checks → PLC validation: checks programs (evidence: `src/inspection/engine.py`)
- Project workflow → Artifact delivery: delivers artifacts
- Project workflow → Project and session state: stores versions (evidence: `src/application/projects.py`)
- Artifact delivery → GXW authoring and codec: exports GXW artifacts
- FBD workflows → GXW authoring and codec: uses GXW models (evidence: `src/application/gxw_files.py`)
- Workbench user → Simulation workbench: tests simulations (evidence: `README.md`)
- Project workflow → Simulation workbench: supports simulation
- MCP server → Offline GXW editing: exposes GXW tools (evidence: `README.md`)
- Web workbench → Offline GXW editing: supports GXW import (evidence: `README.md`)
- Project workflow → Native operations: requests native work (evidence: `src/application/native_engineering.py`)
- Native operations → GX Works2 driver: runs native operations
- Live engineering → GX Works2 driver: coordinates live session (evidence: `src/application/live_engineering.py`)
