# t54-labs/agent-commons architecture

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

- Interactive diagram: https://gitdiagram.com/t54-labs/agent-commons
- Repository: https://github.com/t54-labs/agent-commons

## Overview

Commons is a self-hosted control plane for independently started coding agents. The main workflow is to resolve a workspace’s local/remote/disabled scope, identify and register an agent, coordinate plans, tasks, messages and resource leases, then record activity and expose it in the private Console. The CLI and Skill are the agent-facing entry points; local service state and the remote Relay provide coordination backends. The README documents product capabilities beyond the sampled excerpts; links for those areas are included only where supported by its statements or the source index.

Main entry points: [`commons/service.py`](https://github.com/t54-labs/agent-commons/blob/main/commons/service.py) (Local service), [`commons/cli.py`](https://github.com/t54-labs/agent-commons/blob/main/commons/cli.py) (Commons CLI), [`commons/relay.py`](https://github.com/t54-labs/agent-commons/blob/main/commons/relay.py) (Private Relay), [`web/src/AgentVillage.tsx`](https://github.com/t54-labs/agent-commons/blob/main/web/src/AgentVillage.tsx) (Agent Village)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Agent entry"]
  node_cli["Commons CLI<br/>[cli.py]"]
  node_scope["Workspace scope<br/>[scope.py]"]
  node_identity["Human identity<br/>[identity.py]"]
  node_skill["Agent Skill"]
end

subgraph group_coord["Coordination"]
  node_service["Local service<br/>[service.py]"]
  node_tasks["Plans and tasks<br/>[service.py]"]
  node_leases["Resource leases<br/>[service.py]"]
  node_messages["Messages and handoffs<br/>[service.py]"]
  node_audit["Audit history<br/>[service.py]"]
end

subgraph group_storage["State and transport"]
  node_localdb[("Local database<br/>[db.py]")]
  node_board[("Local board<br/>[board.py]")]
  node_paths["State paths<br/>[paths.py]"]
  node_remote["Relay client<br/>[remote.py]"]
  node_relay["Private Relay<br/>[relay.py]"]
  node_http["HTTP server<br/>[http_server.py]"]
end

subgraph group_console["Private Console"]
  node_console["Web Console<br/>[App.tsx]"]
  node_api["Console API client<br/>[api.ts]"]
  node_village["Agent Village<br/>[AgentVillage.tsx]"]
  node_village_level["Village map<br/>[villageLevel.ts]"]
  node_village_nav["Village navigation"]
end

node_agent(("Coding agents"))
node_video["Product tour<br/>[scenes.tsx]"]

node_agent -->|"uses"| node_cli
node_agent -->|"follows guidance"| node_skill
node_cli -->|"resolves scope"| node_scope
node_cli -->|"manages identity"| node_identity
node_cli -->|"dispatches operations"| node_service
node_service -->|"uses"| node_localdb
node_service -->|"uses"| node_board
node_service -->|"uses"| node_paths
node_service -->|"handles"| node_tasks
node_service -->|"handles"| node_leases
node_service -->|"handles"| node_messages
node_service -->|"records"| node_audit
node_cli -->|"dispatches remote"| node_remote
node_remote -->|"calls over HTTP"| node_relay
node_cli -->|"starts server"| node_relay
node_relay -.->|"uses server"| node_http
node_console -->|"requests data"| node_api
node_api -->|"fetches Console data"| node_relay
node_console -->|"renders"| node_village
node_village -->|"loads map"| node_village_level
node_village -->|"plans paths"| node_village_nav
node_video -->|"depicts coordination"| node_agent

click node_cli "https://github.com/t54-labs/agent-commons/blob/main/commons/cli.py"
click node_scope "https://github.com/t54-labs/agent-commons/blob/main/commons/scope.py"
click node_identity "https://github.com/t54-labs/agent-commons/blob/main/commons/identity.py"
click node_skill "https://github.com/t54-labs/agent-commons/tree/main/commons/skill_template"
click node_service "https://github.com/t54-labs/agent-commons/blob/main/commons/service.py"
click node_tasks "https://github.com/t54-labs/agent-commons/blob/main/commons/service.py"
click node_leases "https://github.com/t54-labs/agent-commons/blob/main/commons/service.py"
click node_messages "https://github.com/t54-labs/agent-commons/blob/main/commons/service.py"
click node_audit "https://github.com/t54-labs/agent-commons/blob/main/commons/service.py"
click node_localdb "https://github.com/t54-labs/agent-commons/blob/main/commons/db.py"
click node_board "https://github.com/t54-labs/agent-commons/blob/main/commons/board.py"
click node_paths "https://github.com/t54-labs/agent-commons/blob/main/commons/paths.py"
click node_remote "https://github.com/t54-labs/agent-commons/blob/main/commons/remote.py"
click node_relay "https://github.com/t54-labs/agent-commons/blob/main/commons/relay.py"
click node_http "https://github.com/t54-labs/agent-commons/blob/main/commons/http_server.py"
click node_console "https://github.com/t54-labs/agent-commons/blob/main/web/src/App.tsx"
click node_api "https://github.com/t54-labs/agent-commons/blob/main/web/src/api.ts"
click node_village "https://github.com/t54-labs/agent-commons/blob/main/web/src/AgentVillage.tsx"
click node_village_level "https://github.com/t54-labs/agent-commons/blob/main/web/src/villageLevel.ts"
click node_village_nav "https://github.com/t54-labs/agent-commons/blob/main/web/src/villageNavigation.ts"
click node_video "https://github.com/t54-labs/agent-commons/blob/main/video/src/scenes.tsx"

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_scope,node_identity,node_skill toneBlue
class node_service,node_tasks,node_leases,node_messages,node_audit toneAmber
class node_localdb,node_board,node_paths,node_remote,node_relay,node_http toneMint
class node_console,node_api,node_village,node_village_level,node_village_nav toneRose
class node_agent toneIndigo
class node_video toneTeal
```

## Components

### Agent entry

- [Commons CLI](https://github.com/t54-labs/agent-commons/blob/main/commons/cli.py): `commons/cli.py`
- [Workspace scope](https://github.com/t54-labs/agent-commons/blob/main/commons/scope.py): `commons/scope.py`
- [Human identity](https://github.com/t54-labs/agent-commons/blob/main/commons/identity.py): `commons/identity.py`
- [Agent Skill](https://github.com/t54-labs/agent-commons/tree/main/commons/skill_template): `commons/skill_template`

### Coordination

- [Local service](https://github.com/t54-labs/agent-commons/blob/main/commons/service.py): `commons/service.py`
- [Plans and tasks](https://github.com/t54-labs/agent-commons/blob/main/commons/service.py): `commons/service.py`
- [Resource leases](https://github.com/t54-labs/agent-commons/blob/main/commons/service.py): `commons/service.py`
- [Messages and handoffs](https://github.com/t54-labs/agent-commons/blob/main/commons/service.py): `commons/service.py`
- [Audit history](https://github.com/t54-labs/agent-commons/blob/main/commons/service.py): `commons/service.py`

### State and transport

- [Local database](https://github.com/t54-labs/agent-commons/blob/main/commons/db.py): `commons/db.py`
- [Local board](https://github.com/t54-labs/agent-commons/blob/main/commons/board.py): `commons/board.py`
- [State paths](https://github.com/t54-labs/agent-commons/blob/main/commons/paths.py): `commons/paths.py`
- [Relay client](https://github.com/t54-labs/agent-commons/blob/main/commons/remote.py): `commons/remote.py`
- [Private Relay](https://github.com/t54-labs/agent-commons/blob/main/commons/relay.py): `commons/relay.py`
- [HTTP server](https://github.com/t54-labs/agent-commons/blob/main/commons/http_server.py): `commons/http_server.py`

### Private Console

- [Web Console](https://github.com/t54-labs/agent-commons/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Console API client](https://github.com/t54-labs/agent-commons/blob/main/web/src/api.ts): `web/src/api.ts`
- [Agent Village](https://github.com/t54-labs/agent-commons/blob/main/web/src/AgentVillage.tsx): `web/src/AgentVillage.tsx`
- [Village map](https://github.com/t54-labs/agent-commons/blob/main/web/src/villageLevel.ts): `web/src/villageLevel.ts`
- [Village navigation](https://github.com/t54-labs/agent-commons/blob/main/web/src/villageNavigation.ts): `web/src/villageNavigation.ts`

### Other components

- **Coding agents**
- [Product tour](https://github.com/t54-labs/agent-commons/blob/main/video/src/scenes.tsx): `video/src/scenes.tsx`

## Connections

- Coding agents → Commons CLI: uses
- Coding agents → Agent Skill: follows guidance
- Commons CLI → Workspace scope: resolves scope (evidence: `commons/cli.py`)
- Commons CLI → Human identity: manages identity (evidence: `commons/cli.py`)
- Commons CLI → Local service: dispatches operations (evidence: `commons/cli.py`)
- Local service → Local database: uses (evidence: `commons/service.py`)
- Local service → Local board: uses (evidence: `commons/service.py`)
- Local service → State paths: uses (evidence: `commons/service.py`)
- Local service → Plans and tasks: handles (evidence: `commons/service.py`)
- Local service → Resource leases: handles (evidence: `commons/service.py`)
- Local service → Messages and handoffs: handles (evidence: `commons/service.py`)
- Local service → Audit history: records (evidence: `commons/service.py`)
- Commons CLI → Relay client: dispatches remote (evidence: `commons/cli.py`)
- Relay client → Private Relay: calls over HTTP
- Commons CLI → Private Relay: starts server (evidence: `commons/cli.py`)
- Private Relay → HTTP server: uses server (evidence: `commons/relay.py`)
- Web Console → Console API client: requests data (evidence: `web/src/App.tsx`)
- Console API client → Private Relay: fetches Console data
- Web Console → Agent Village: renders (evidence: `web/src/App.tsx`)
- Agent Village → Village map: loads map (evidence: `web/src/AgentVillage.tsx`)
- Agent Village → Village navigation: plans paths (evidence: `web/src/AgentVillage.tsx`)
- Product tour → Coding agents: depicts coordination
