# nathanribeiroo/squad architecture

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

- Interactive diagram: https://gitdiagram.com/nathanribeiroo/squad
- Repository: https://github.com/nathanribeiroo/squad

## Overview

Torre is a local control tower for coding agents and shells: a Go server manages workspaces, agent terminals, and collaboration features, while a React interface presents them on an infinite canvas. The main workflow is to start a workspace, create and connect flights, send work to agents, and monitor their live screens and conversations. The README also documents sessions, isolated git-worktree flight levels, notes, roles, plans, portals, summaries, priority requests, and MCP. Several backend subsystems are represented from README or index references; their internal call paths were not sampled.

Main entry points: [`internal/app/app.go`](https://github.com/nathanribeiroo/squad/blob/main/internal/app/app.go) (App assembly), [`web/src/App.tsx`](https://github.com/nathanribeiroo/squad/blob/main/web/src/App.tsx) (App shell), [`web/src/canvas/Canvas.tsx`](https://github.com/nathanribeiroo/squad/blob/main/web/src/canvas/Canvas.tsx) (Canvas and flights), [`internal/server/server.go`](https://github.com/nathanribeiroo/squad/blob/main/internal/server/server.go) (Local API server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and transport"]
  node_cli["Torre CLI<br/>[main.go]"]
  node_app["App assembly<br/>[app.go]"]
  node_server["Local API server<br/>[server.go]"]
  node_webui["Web interface host<br/>[webui.go]"]
end

subgraph group_workspace["Workspace management"]
  node_store[("Workspace state<br/>[store.go]")]
  node_hub["Workspace sessions<br/>[sessions.go]"]
  node_floors["Git flight levels<br/>[floors.go]"]
  node_notes["NOTAMs<br/>[notes.go]"]
  node_plans["Flight plans<br/>[plans.go]"]
  node_portals["Live portals<br/>[portal.go]"]
end

subgraph group_agents["Agent operations"]
  node_agentbus["Agent messaging<br/>[bus.go]"]
  node_terminals["Terminal manager<br/>[manager.go]"]
  node_summary["Briefings<br/>[engine.go]"]
  node_roles["Agent roles<br/>[roles.go]"]
end

subgraph group_interface["Canvas interface"]
  node_webapp["App shell<br/>[App.tsx]"]
  node_api["API client<br/>[client.ts]"]
  node_canvas["Canvas and flights<br/>[Canvas.tsx]"]
  node_webstate["Canvas state<br/>[store.ts]"]
  node_terminalview["Terminal view<br/>[TerminalNode.tsx]"]
  node_termstream["Terminal sessions<br/>[session.ts]"]
  node_flightdialogs["Flight-level dialogs<br/>[FloorDialogs.tsx]"]
  node_synoptic["Synoptic view<br/>[Synoptic.tsx]"]
  node_visual["Canvas visuals<br/>[visual.ts]"]
end

node_user(("User"))
node_agentcli{{"Agent CLIs"}}

node_user -->|"starts serve"| node_cli
node_cli -->|"starts"| node_app
node_app -->|"assembles"| node_server
node_server -->|"hosts"| node_webui
node_user -->|"uses"| node_webapp
node_webapp -->|"requests"| node_api
node_api -->|"calls HTTP API"| node_server
node_webapp -->|"renders"| node_canvas
node_canvas -->|"reads state"| node_webstate
node_canvas -->|"renders flights"| node_terminalview
node_terminalview -.->|"shows screen"| node_termstream
node_webapp -->|"renders view"| node_synoptic
node_webapp -->|"connects events"| node_api
node_server -->|"persists workspace"| node_store
node_app -->|"creates messaging"| node_agentbus
node_app -->|"configures roles"| node_roles
node_app -->|"attaches summaries"| node_summary
node_app -->|"creates NOTAM service"| node_notes
node_app -->|"starts flight levels"| node_floors
node_app -->|"starts portals"| node_portals
node_hub -->|"switches sessions"| node_app
node_floors -->|"updates floor state"| node_store
node_agentbus -->|"uses terminals"| node_terminals
node_agentcli -.->|"runs in"| node_terminals
node_flightdialogs -->|"requests floor actions"| node_api
node_canvas -->|"uses visual data"| node_visual

click node_cli "https://github.com/nathanribeiroo/squad/blob/main/internal/cli/main.go"
click node_app "https://github.com/nathanribeiroo/squad/blob/main/internal/app/app.go"
click node_server "https://github.com/nathanribeiroo/squad/blob/main/internal/server/server.go"
click node_webui "https://github.com/nathanribeiroo/squad/blob/main/internal/webui/webui.go"
click node_store "https://github.com/nathanribeiroo/squad/blob/main/internal/store/store.go"
click node_hub "https://github.com/nathanribeiroo/squad/blob/main/internal/hub/sessions.go"
click node_floors "https://github.com/nathanribeiroo/squad/blob/main/internal/floors/floors.go"
click node_notes "https://github.com/nathanribeiroo/squad/blob/main/internal/notes/notes.go"
click node_plans "https://github.com/nathanribeiroo/squad/blob/main/internal/plans/plans.go"
click node_portals "https://github.com/nathanribeiroo/squad/blob/main/internal/portal/portal.go"
click node_agentbus "https://github.com/nathanribeiroo/squad/blob/main/internal/agentbus/bus.go"
click node_terminals "https://github.com/nathanribeiroo/squad/blob/main/internal/terminal/manager.go"
click node_summary "https://github.com/nathanribeiroo/squad/blob/main/internal/summary/engine.go"
click node_webapp "https://github.com/nathanribeiroo/squad/blob/main/web/src/App.tsx"
click node_api "https://github.com/nathanribeiroo/squad/blob/main/web/src/api/client.ts"
click node_canvas "https://github.com/nathanribeiroo/squad/blob/main/web/src/canvas/Canvas.tsx"
click node_webstate "https://github.com/nathanribeiroo/squad/blob/main/web/src/state/store.ts"
click node_terminalview "https://github.com/nathanribeiroo/squad/blob/main/web/src/canvas/nodes/TerminalNode.tsx"
click node_termstream "https://github.com/nathanribeiroo/squad/blob/main/web/src/term/session.ts"
click node_flightdialogs "https://github.com/nathanribeiroo/squad/blob/main/web/src/components/FloorDialogs.tsx"
click node_synoptic "https://github.com/nathanribeiroo/squad/blob/main/web/src/components/synoptic/Synoptic.tsx"
click node_visual "https://github.com/nathanribeiroo/squad/blob/main/web/src/lib/visual.ts"
click node_roles "https://github.com/nathanribeiroo/squad/blob/main/internal/roles/roles.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_cli,node_app,node_server,node_webui,node_user toneBlue
class node_store,node_hub,node_floors,node_notes,node_plans,node_portals toneAmber
class node_agentbus,node_terminals,node_summary,node_roles toneMint
class node_webapp,node_api,node_canvas,node_webstate,node_terminalview,node_termstream,node_flightdialogs,node_synoptic,node_visual toneRose
class node_agentcli toneIndigo
```

## Components

### Runtime and transport

- [Torre CLI](https://github.com/nathanribeiroo/squad/blob/main/internal/cli/main.go): `internal/cli/main.go`
- [App assembly](https://github.com/nathanribeiroo/squad/blob/main/internal/app/app.go): `internal/app/app.go`
- [Local API server](https://github.com/nathanribeiroo/squad/blob/main/internal/server/server.go): `internal/server/server.go`
- [Web interface host](https://github.com/nathanribeiroo/squad/blob/main/internal/webui/webui.go): `internal/webui/webui.go`

### Workspace management

- [Workspace state](https://github.com/nathanribeiroo/squad/blob/main/internal/store/store.go): `internal/store/store.go`
- [Workspace sessions](https://github.com/nathanribeiroo/squad/blob/main/internal/hub/sessions.go): `internal/hub/sessions.go`
- [Git flight levels](https://github.com/nathanribeiroo/squad/blob/main/internal/floors/floors.go): `internal/floors/floors.go`
- [NOTAMs](https://github.com/nathanribeiroo/squad/blob/main/internal/notes/notes.go): `internal/notes/notes.go`
- [Flight plans](https://github.com/nathanribeiroo/squad/blob/main/internal/plans/plans.go): `internal/plans/plans.go`
- [Live portals](https://github.com/nathanribeiroo/squad/blob/main/internal/portal/portal.go): `internal/portal/portal.go`

### Agent operations

- [Agent messaging](https://github.com/nathanribeiroo/squad/blob/main/internal/agentbus/bus.go): `internal/agentbus/bus.go`
- [Terminal manager](https://github.com/nathanribeiroo/squad/blob/main/internal/terminal/manager.go): `internal/terminal/manager.go`
- [Briefings](https://github.com/nathanribeiroo/squad/blob/main/internal/summary/engine.go): `internal/summary/engine.go`
- [Agent roles](https://github.com/nathanribeiroo/squad/blob/main/internal/roles/roles.go): `internal/roles/roles.go`

### Canvas interface

- [App shell](https://github.com/nathanribeiroo/squad/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [API client](https://github.com/nathanribeiroo/squad/blob/main/web/src/api/client.ts): `web/src/api/client.ts`
- [Canvas and flights](https://github.com/nathanribeiroo/squad/blob/main/web/src/canvas/Canvas.tsx): `web/src/canvas/Canvas.tsx`
- [Canvas state](https://github.com/nathanribeiroo/squad/blob/main/web/src/state/store.ts): `web/src/state/store.ts`
- [Terminal view](https://github.com/nathanribeiroo/squad/blob/main/web/src/canvas/nodes/TerminalNode.tsx): `web/src/canvas/nodes/TerminalNode.tsx`
- [Terminal sessions](https://github.com/nathanribeiroo/squad/blob/main/web/src/term/session.ts): `web/src/term/session.ts`
- [Flight-level dialogs](https://github.com/nathanribeiroo/squad/blob/main/web/src/components/FloorDialogs.tsx): `web/src/components/FloorDialogs.tsx`
- [Synoptic view](https://github.com/nathanribeiroo/squad/blob/main/web/src/components/synoptic/Synoptic.tsx): `web/src/components/synoptic/Synoptic.tsx`
- [Canvas visuals](https://github.com/nathanribeiroo/squad/blob/main/web/src/lib/visual.ts): `web/src/lib/visual.ts`

### Other components

- **User**
- **Agent CLIs**

## Connections

- User → Torre CLI: starts serve
- Torre CLI → App assembly: starts (evidence: `internal/cli/main.go`)
- App assembly → Local API server: assembles (evidence: `internal/app/app.go`)
- Local API server → Web interface host: hosts (evidence: `internal/server/server.go`)
- User → App shell: uses
- App shell → API client: requests (evidence: `web/src/App.tsx`)
- API client → Local API server: calls HTTP API (evidence: `web/src/api/client.ts`)
- App shell → Canvas and flights: renders (evidence: `web/src/App.tsx`)
- Canvas and flights → Canvas state: reads state (evidence: `web/src/canvas/Canvas.tsx`)
- Canvas and flights → Terminal view: renders flights (evidence: `web/src/canvas/Canvas.tsx`)
- Terminal view → Terminal sessions: shows screen
- App shell → Synoptic view: renders view (evidence: `web/src/App.tsx`)
- App shell → API client: connects events (evidence: `web/src/App.tsx`)
- Local API server → Workspace state: persists workspace (evidence: `internal/server/server.go`)
- App assembly → Agent messaging: creates messaging (evidence: `internal/app/app.go`)
- App assembly → Agent roles: configures roles (evidence: `internal/app/app.go`)
- App assembly → Briefings: attaches summaries (evidence: `internal/app/app.go`)
- App assembly → NOTAMs: creates NOTAM service (evidence: `internal/app/app.go`)
- App assembly → Git flight levels: starts flight levels (evidence: `internal/app/app.go`)
- App assembly → Live portals: starts portals (evidence: `internal/app/app.go`)
- Workspace sessions → App assembly: switches sessions (evidence: `internal/hub/sessions.go`)
- Git flight levels → Workspace state: updates floor state (evidence: `internal/floors/floors.go`)
- Agent messaging → Terminal manager: uses terminals
- Agent CLIs → Terminal manager: runs in
- Flight-level dialogs → API client: requests floor actions (evidence: `web/src/components/FloorDialogs.tsx`)
- Canvas and flights → Canvas visuals: uses visual data (evidence: `web/src/canvas/Canvas.tsx`)
