# eshanized/m31a architecture

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

- Interactive diagram: https://gitdiagram.com/eshanized/m31a
- Repository: https://github.com/eshanized/m31a

## Overview

M31A is an autonomous coding assistant exposed through a CLI/TUI, desktop app, and IDE-facing app server with SDKs. The main workflow takes a user objective, runs agent work against a code workspace, applies patches, and verifies results; continuous repair and speculative alternatives extend that loop. The graph also retains documented visual testing, orchestration, review, and integration capabilities. Relationships are limited to README claims or source-index references; unsampled subsystems use directory paths and are not treated as inspected implementation details.

Main entry points: [`crates/m31a-agent-engine/src/turn_loop.rs`](https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/turn_loop.rs) (Agent engine), [`crates/m31a-verify/src/engine.rs`](https://github.com/eshanized/m31a/blob/master/crates/m31a-verify/src/engine.rs) (Verification engine), [`crates/m31a-cli/src/main.rs`](https://github.com/eshanized/m31a/blob/master/crates/m31a-cli/src/main.rs) (CLI commands), [`crates/m31a-agent-engine/src/workflow.rs`](https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/workflow.rs) (Workflow orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interfaces"]
  node_cli["CLI commands<br/>[main.rs]"]
  node_tui["Terminal UI<br/>[app.rs]"]
  node_tui_views["TUI views<br/>[screens.rs]"]
  node_desktop["Desktop app<br/>[App.tsx]"]
  node_app_server["IDE app server<br/>[protocol.rs]"]
  node_sdk["SDK clients<br/>[client.ts]"]
end

subgraph group_agent["Agent execution"]
  node_agent_engine["Agent engine<br/>[turn_loop.rs]"]
  node_vibe_loop["Vibe repair loop<br/>[vibe_loop.rs]"]
  node_speculation["Speculative arena<br/>[speculative.rs]"]
  node_workflow["Workflow orchestration<br/>[workflow.rs]"]
  node_provider["Model providers<br/>[manager.rs]"]
end

subgraph group_engineering["Code engineering"]
  node_workspace_ast["Workspace analysis<br/>[workspace.rs]"]
  node_patch_engine["Patch synthesis<br/>[engine.rs]"]
  node_verification["Verification engine<br/>[engine.rs]"]
  node_browser["Browser validation<br/>[session.rs]"]
  node_review["Code review<br/>[engine.rs]"]
  node_visual_tdd["Visual TDD<br/>[visual_tdd.rs]"]
end

subgraph group_platform["Services and integration"]
  node_sandbox["Sandbox execution<br/>[process_manager.rs]"]
  node_storage[("Persistent storage")]
  node_mcp["MCP integrations"]
  node_maintenance["Maintenance automation"]
end

node_user(("Developer"))

node_user -->|"submits objective"| node_cli
node_cli -->|"opens interactive UI"| node_tui
node_cli -.->|"runs agent"| node_agent_engine
node_user -.->|"uses desktop"| node_desktop
node_user -->|"connects IDE"| node_app_server
node_sdk -->|"sends requests"| node_app_server
node_tui -->|"renders"| node_tui_views
node_agent_engine -.->|"requests model output"| node_provider
node_agent_engine -.->|"analyzes workspace"| node_workspace_ast
node_agent_engine -->|"synthesizes patches"| node_patch_engine
node_agent_engine -->|"executes isolated work"| node_sandbox
node_vibe_loop -->|"checks changes"| node_verification
node_vibe_loop -->|"repairs workspace"| node_patch_engine
node_speculation -->|"runs candidates"| node_sandbox
node_speculation -->|"promotes winner"| node_patch_engine
node_workflow -->|"verifies tasks"| node_verification
node_verification -->|"uses browser checks"| node_browser
node_verification -->|"gates blast radius"| node_workspace_ast
node_review -.->|"assesses changes"| node_workspace_ast
node_workflow -->|"persists checkpoints"| node_storage
node_app_server -.->|"uses durable state"| node_storage
node_agent_engine -.->|"uses tool integrations"| node_mcp
node_maintenance -.->|"schedules work"| node_workflow
node_visual_tdd -->|"validates visuals"| node_browser

click node_cli "https://github.com/eshanized/m31a/blob/master/crates/m31a-cli/src/main.rs"
click node_tui "https://github.com/eshanized/m31a/blob/master/crates/m31a-tui/src/app.rs"
click node_tui_views "https://github.com/eshanized/m31a/blob/master/crates/m31a-tui/src/screens.rs"
click node_desktop "https://github.com/eshanized/m31a/blob/master/apps/desktop/src/app/App.tsx"
click node_app_server "https://github.com/eshanized/m31a/blob/master/crates/m31a-app-server/src/protocol.rs"
click node_sdk "https://github.com/eshanized/m31a/blob/master/sdk/typescript/src/client.ts"
click node_agent_engine "https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/turn_loop.rs"
click node_vibe_loop "https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/vibe_loop.rs"
click node_speculation "https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/speculative.rs"
click node_workflow "https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/workflow.rs"
click node_provider "https://github.com/eshanized/m31a/blob/master/crates/m31a-provider/src/manager.rs"
click node_workspace_ast "https://github.com/eshanized/m31a/blob/master/crates/m31a-ast/src/workspace.rs"
click node_patch_engine "https://github.com/eshanized/m31a/blob/master/crates/m31a-patch/src/engine.rs"
click node_verification "https://github.com/eshanized/m31a/blob/master/crates/m31a-verify/src/engine.rs"
click node_browser "https://github.com/eshanized/m31a/blob/master/crates/m31a-browser/src/session.rs"
click node_review "https://github.com/eshanized/m31a/blob/master/crates/m31a-review/src/engine.rs"
click node_sandbox "https://github.com/eshanized/m31a/blob/master/crates/m31a-sandbox/src/process_manager.rs"
click node_storage "https://github.com/eshanized/m31a/tree/master/crates/m31a-storage"
click node_mcp "https://github.com/eshanized/m31a/tree/master/crates/m31a-mcp"
click node_maintenance "https://github.com/eshanized/m31a/tree/master/crates/m31a-maintenance"
click node_visual_tdd "https://github.com/eshanized/m31a/blob/master/crates/m31a-verify/src/visual_tdd.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_cli,node_tui,node_tui_views,node_desktop,node_app_server,node_sdk toneBlue
class node_agent_engine,node_vibe_loop,node_speculation,node_workflow,node_provider toneAmber
class node_workspace_ast,node_patch_engine,node_verification,node_browser,node_review,node_visual_tdd toneMint
class node_sandbox,node_storage,node_mcp,node_maintenance toneRose
class node_user toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/eshanized/m31a/blob/master/crates/m31a-cli/src/main.rs): `crates/m31a-cli/src/main.rs`
- [Terminal UI](https://github.com/eshanized/m31a/blob/master/crates/m31a-tui/src/app.rs): `crates/m31a-tui/src/app.rs`
- [TUI views](https://github.com/eshanized/m31a/blob/master/crates/m31a-tui/src/screens.rs): `crates/m31a-tui/src/screens.rs`
- [Desktop app](https://github.com/eshanized/m31a/blob/master/apps/desktop/src/app/App.tsx): `apps/desktop/src/app/App.tsx`
- [IDE app server](https://github.com/eshanized/m31a/blob/master/crates/m31a-app-server/src/protocol.rs): `crates/m31a-app-server/src/protocol.rs`
- [SDK clients](https://github.com/eshanized/m31a/blob/master/sdk/typescript/src/client.ts): `sdk/typescript/src/client.ts`

### Agent execution

- [Agent engine](https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/turn_loop.rs): `crates/m31a-agent-engine/src/turn_loop.rs`
- [Vibe repair loop](https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/vibe_loop.rs): `crates/m31a-agent-engine/src/vibe_loop.rs`
- [Speculative arena](https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/speculative.rs): `crates/m31a-agent-engine/src/speculative.rs`
- [Workflow orchestration](https://github.com/eshanized/m31a/blob/master/crates/m31a-agent-engine/src/workflow.rs): `crates/m31a-agent-engine/src/workflow.rs`
- [Model providers](https://github.com/eshanized/m31a/blob/master/crates/m31a-provider/src/manager.rs): `crates/m31a-provider/src/manager.rs`

### Code engineering

- [Workspace analysis](https://github.com/eshanized/m31a/blob/master/crates/m31a-ast/src/workspace.rs): `crates/m31a-ast/src/workspace.rs`
- [Patch synthesis](https://github.com/eshanized/m31a/blob/master/crates/m31a-patch/src/engine.rs): `crates/m31a-patch/src/engine.rs`
- [Verification engine](https://github.com/eshanized/m31a/blob/master/crates/m31a-verify/src/engine.rs): `crates/m31a-verify/src/engine.rs`
- [Browser validation](https://github.com/eshanized/m31a/blob/master/crates/m31a-browser/src/session.rs): `crates/m31a-browser/src/session.rs`
- [Code review](https://github.com/eshanized/m31a/blob/master/crates/m31a-review/src/engine.rs): `crates/m31a-review/src/engine.rs`
- [Visual TDD](https://github.com/eshanized/m31a/blob/master/crates/m31a-verify/src/visual_tdd.rs): `crates/m31a-verify/src/visual_tdd.rs`

### Services and integration

- [Sandbox execution](https://github.com/eshanized/m31a/blob/master/crates/m31a-sandbox/src/process_manager.rs): `crates/m31a-sandbox/src/process_manager.rs`
- [Persistent storage](https://github.com/eshanized/m31a/tree/master/crates/m31a-storage): `crates/m31a-storage`
- [MCP integrations](https://github.com/eshanized/m31a/tree/master/crates/m31a-mcp): `crates/m31a-mcp`
- [Maintenance automation](https://github.com/eshanized/m31a/tree/master/crates/m31a-maintenance): `crates/m31a-maintenance`

### Other components

- **Developer**

## Connections

- Developer → CLI commands: submits objective (evidence: `README.md`)
- CLI commands → Terminal UI: opens interactive UI (evidence: `crates/m31a-cli/src/main.rs`)
- CLI commands → Agent engine: runs agent
- Developer → Desktop app: uses desktop
- Developer → IDE app server: connects IDE (evidence: `README.md`)
- SDK clients → IDE app server: sends requests (evidence: `sdk/typescript/src/client.ts`)
- Terminal UI → TUI views: renders (evidence: `crates/m31a-tui/src/app.rs`)
- Agent engine → Model providers: requests model output
- Agent engine → Workspace analysis: analyzes workspace
- Agent engine → Patch synthesis: synthesizes patches (evidence: `README.md`)
- Agent engine → Sandbox execution: executes isolated work (evidence: `README.md`)
- Vibe repair loop → Verification engine: checks changes (evidence: `README.md`)
- Vibe repair loop → Patch synthesis: repairs workspace (evidence: `README.md`)
- Speculative arena → Sandbox execution: runs candidates (evidence: `README.md`)
- Speculative arena → Patch synthesis: promotes winner (evidence: `README.md`)
- Workflow orchestration → Verification engine: verifies tasks (evidence: `README.md`)
- Verification engine → Browser validation: uses browser checks (evidence: `README.md`)
- Verification engine → Workspace analysis: gates blast radius (evidence: `README.md`)
- Code review → Workspace analysis: assesses changes
- Workflow orchestration → Persistent storage: persists checkpoints (evidence: `README.md`)
- IDE app server → Persistent storage: uses durable state
- Agent engine → MCP integrations: uses tool integrations
- Maintenance automation → Workflow orchestration: schedules work
- Visual TDD → Browser validation: validates visuals (evidence: `README.md`)
