# sudheerdvn/lanegate architecture

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

- Interactive diagram: https://gitdiagram.com/sudheerdvn/lanegate
- Repository: https://github.com/sudheerdvn/lanegate

## Overview

LaneGate coordinates coding agents through a ticket-centered workflow: scope work, assign isolated worktrees, execute and inspect changes, require review and guards, then merge and optionally promote. Markdown tickets are the project-state source of truth; operational artifacts remain local. The graph also includes documented MCP and terminal-UI access, safeguards, and deployment promotion. API and several feature modules are represented from the tree and README capabilities; their internal wiring was not sampled, so uncertain call paths are omitted.

Main entry points: [`lanegate/orchestrate/loop.py`](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/orchestrate/loop.py) (Orchestration loop), [`lanegate/ticket.py`](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/ticket.py) (Markdown tickets), [`lanegate/cli.py`](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/cli.py) (Command-line interface), [`lanegate/lifecycle/merge.py`](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/lifecycle/merge.py) (Merge and recovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Ticket workflow"]
  node_tickets["Markdown tickets<br/>[ticket.py]"]
  node_scoping["Scoping and analysis<br/>[analyze.py]"]
  node_worktrees["Worktree isolation<br/>[worktree.py]"]
  node_lifecycle["Lifecycle commands<br/>[core_cmds.py]"]
end

subgraph group_control["Coordination and gates"]
  node_touch_locks["Touches and locks<br/>[touches.py]"]
  node_orchestrator["Orchestration loop<br/>[loop.py]"]
  node_dispatch["Executor dispatch<br/>[executor.py]"]
  node_routing["Pool routing<br/>[config_routing.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_safeguards["Safety checks<br/>[safeguards.py]"]
  node_review["Independent review<br/>[review.py]"]
end

subgraph group_delivery["Merge and delivery"]
  node_merge["Merge and recovery<br/>[merge.py]"]
  node_promotion["Staged promotion<br/>[promote.py]"]
  node_local_artifacts["Local run records<br/>[context_log.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_cli["Command-line interface<br/>[cli.py]"]
  node_mcp["MCP tools<br/>[mcp.py]"]
  node_api["Loopback API<br/>[api.py]"]
  node_tui["Terminal UI<br/>[update.go]"]
  node_tui_client["UI API client<br/>[client.go]"]
end

node_operator(("Operator"))
node_coding_agent(("Coding agent"))

node_operator -->|"issues commands"| node_cli
node_coding_agent -->|"requests work"| node_cli
node_cli -->|"analyzes requests"| node_scoping
node_scoping -->|"creates ticket specs"| node_tickets
node_cli -->|"starts runs"| node_orchestrator
node_orchestrator -->|"reads and updates"| node_tickets
node_orchestrator -->|"resolves executor"| node_routing
node_routing -->|"reads settings"| node_config
node_orchestrator -->|"assigns isolated worktrees"| node_worktrees
node_orchestrator -->|"checks file ownership"| node_touch_locks
node_orchestrator -->|"dispatches tasks"| node_dispatch
node_dispatch -->|"runs agent process"| node_coding_agent
node_coding_agent -->|"edits ticket work"| node_worktrees
node_orchestrator -->|"runs configured checks"| node_safeguards
node_orchestrator -->|"dispatches review"| node_review
node_review -->|"records verdict"| node_tickets
node_operator -->|"manages ticket state"| node_lifecycle
node_lifecycle -->|"updates status"| node_tickets
node_operator -->|"requests merge"| node_merge
node_merge -->|"records merge state"| node_tickets
node_merge -->|"removes worktree"| node_worktrees
node_operator -->|"promotes release"| node_promotion
node_orchestrator -->|"logs run costs"| node_local_artifacts
node_operator -->|"uses native tools"| node_mcp
node_mcp -->|"invokes commands"| node_lifecycle
node_operator -->|"views run and board"| node_tui
node_tui -->|"requests data"| node_tui_client
node_tui_client -->|"fetches API data"| node_api

click node_tickets "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/ticket.py"
click node_scoping "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/analyze.py"
click node_worktrees "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/worktree.py"
click node_touch_locks "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/lifecycle/touches.py"
click node_orchestrator "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/orchestrate/loop.py"
click node_dispatch "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/executor.py"
click node_routing "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/config_routing.py"
click node_config "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/config.py"
click node_safeguards "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/safeguards.py"
click node_review "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/orchestrate/review.py"
click node_lifecycle "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/lifecycle/core_cmds.py"
click node_merge "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/lifecycle/merge.py"
click node_promotion "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/promote.py"
click node_local_artifacts "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/context_log.py"
click node_cli "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/cli.py"
click node_mcp "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/mcp.py"
click node_api "https://github.com/sudheerdvn/lanegate/blob/main/lanegate/api.py"
click node_tui "https://github.com/sudheerdvn/lanegate/blob/main/tui/internal/app/update.go"
click node_tui_client "https://github.com/sudheerdvn/lanegate/blob/main/tui/internal/client/client.go"

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_tickets,node_scoping,node_worktrees,node_lifecycle toneBlue
class node_touch_locks,node_orchestrator,node_dispatch,node_routing,node_config,node_safeguards,node_review toneAmber
class node_merge,node_promotion,node_local_artifacts toneMint
class node_cli,node_mcp,node_api,node_tui,node_tui_client toneRose
class node_operator,node_coding_agent toneIndigo
```

## Components

### Ticket workflow

- [Markdown tickets](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/ticket.py): `lanegate/ticket.py`
- [Scoping and analysis](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/analyze.py): `lanegate/analyze.py`
- [Worktree isolation](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/worktree.py): `lanegate/worktree.py`
- [Lifecycle commands](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/lifecycle/core_cmds.py): `lanegate/lifecycle/core_cmds.py`

### Coordination and gates

- [Touches and locks](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/lifecycle/touches.py): `lanegate/lifecycle/touches.py`
- [Orchestration loop](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/orchestrate/loop.py): `lanegate/orchestrate/loop.py`
- [Executor dispatch](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/executor.py): `lanegate/executor.py`
- [Pool routing](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/config_routing.py): `lanegate/config_routing.py`
- [Configuration](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/config.py): `lanegate/config.py`
- [Safety checks](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/safeguards.py): `lanegate/safeguards.py`
- [Independent review](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/orchestrate/review.py): `lanegate/orchestrate/review.py`

### Merge and delivery

- [Merge and recovery](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/lifecycle/merge.py): `lanegate/lifecycle/merge.py`
- [Staged promotion](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/promote.py): `lanegate/promote.py`
- [Local run records](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/context_log.py): `lanegate/context_log.py`

### User interfaces

- [Command-line interface](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/cli.py): `lanegate/cli.py`
- [MCP tools](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/mcp.py): `lanegate/mcp.py`
- [Loopback API](https://github.com/sudheerdvn/lanegate/blob/main/lanegate/api.py): `lanegate/api.py`
- [Terminal UI](https://github.com/sudheerdvn/lanegate/blob/main/tui/internal/app/update.go): `tui/internal/app/update.go`
- [UI API client](https://github.com/sudheerdvn/lanegate/blob/main/tui/internal/client/client.go): `tui/internal/client/client.go`

### Other components

- **Operator**
- **Coding agent**

## Connections

- Operator → Command-line interface: issues commands
- Coding agent → Command-line interface: requests work
- Command-line interface → Scoping and analysis: analyzes requests
- Scoping and analysis → Markdown tickets: creates ticket specs
- Command-line interface → Orchestration loop: starts runs
- Orchestration loop → Markdown tickets: reads and updates
- Orchestration loop → Pool routing: resolves executor
- Pool routing → Configuration: reads settings
- Orchestration loop → Worktree isolation: assigns isolated worktrees
- Orchestration loop → Touches and locks: checks file ownership
- Orchestration loop → Executor dispatch: dispatches tasks
- Executor dispatch → Coding agent: runs agent process
- Coding agent → Worktree isolation: edits ticket work
- Orchestration loop → Safety checks: runs configured checks
- Orchestration loop → Independent review: dispatches review
- Independent review → Markdown tickets: records verdict
- Operator → Lifecycle commands: manages ticket state
- Lifecycle commands → Markdown tickets: updates status
- Operator → Merge and recovery: requests merge
- Merge and recovery → Markdown tickets: records merge state
- Merge and recovery → Worktree isolation: removes worktree
- Operator → Staged promotion: promotes release
- Orchestration loop → Local run records: logs run costs
- Operator → MCP tools: uses native tools
- MCP tools → Lifecycle commands: invokes commands
- Operator → Terminal UI: views run and board
- Terminal UI → UI API client: requests data
- UI API client → Loopback API: fetches API data
