# matank001/clodfarm architecture

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

- Interactive diagram: https://gitdiagram.com/matank001/clodfarm
- Repository: https://github.com/matank001/clodfarm

## Overview

Clodfarm is a multi-account farm for long-running coding agents, with a web UI and CLI for people and agent-to-agent coordination. A typical flow is a person submits work, the farm queues and dispatches it to an agent, and the agent works in a branch before changes are merged. The product also includes usage pacing, sessions and policy controls, model-provider bots, browser access, shared boards, dashboards, and business integrations. The graph follows documented relationships and indexed imports; unsampled internals leave some wiring unspecified.

Main entry points: [`clodfarm/web.py`](https://github.com/matank001/clodfarm/blob/main/clodfarm/web.py) (Farm UI), [`clodfarm/agents.py`](https://github.com/matank001/clodfarm/blob/main/clodfarm/agents.py) (Agent runs), [`clodfarm/supervisor.py`](https://github.com/matank001/clodfarm/blob/main/clodfarm/supervisor.py) (Farm supervisor), [`clodfarm/store.py`](https://github.com/matank001/clodfarm/blob/main/clodfarm/store.py) (Task queue and state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_ui["Farm UI<br/>[web.py]"]
  node_cli["Farm CLI<br/>[cli.py]"]
end

subgraph group_runtime["Agent runtime"]
  node_supervisor["Farm supervisor<br/>[supervisor.py]"]
  node_agents["Agent runs<br/>[agents.py]"]
  node_prompts["Agent guidance<br/>[prompts.py]"]
  node_providers["Model bots<br/>[bots.py]"]
  node_relay["Provider relay<br/>[relay.py]"]
  node_processes["Process control<br/>[procs.py]"]
  node_gitops["Git worktrees<br/>[gitops.py]"]
end

subgraph group_coordination["Farm coordination"]
  node_queue[("Task queue and state<br/>[store.py]")]
  node_backends[("State backends<br/>[backends.py]")]
  node_governor["Usage governor<br/>[governor.py]"]
  node_schedule["Task schedules<br/>[schedule.py]"]
  node_sessions[("Session history<br/>[sessions.py]")]
  node_policy["Tool policies<br/>[policy.py]"]
end

subgraph group_capabilities["Farm capabilities"]
  node_boards["Shared whiteboards<br/>[boards.py]"]
  node_dashboards["Live dashboards<br/>[dashboards.py]"]
  node_connectors["Business connectors<br/>[connectors.py]"]
  node_awsapps["AWS app deployment<br/>[awsapps.py]"]
  node_browser["Shared browser<br/>[browser.py]"]
  node_planner["Work planner<br/>[planner.py]"]
  node_slack["Slack integration<br/>[slack.py]"]
end

node_person(("Person"))

node_person -->|"requests work"| node_ui
node_person -->|"runs commands"| node_cli
node_ui -->|"views farm state"| node_queue
node_cli -->|"manages tasks"| node_queue
node_supervisor -->|"starts runs"| node_agents
node_agents -->|"claims tasks"| node_queue
node_agents -->|"controls processes"| node_processes
node_agents -->|"loads guidance"| node_prompts
node_agents -->|"selects bot"| node_providers
node_agents -->|"uses relay"| node_relay
node_queue -->|"persists state"| node_backends
node_supervisor -->|"paces agents"| node_governor
node_supervisor -->|"runs schedules"| node_schedule
node_supervisor -->|"manages branches"| node_gitops
node_supervisor -->|"refreshes dashboards"| node_dashboards
node_supervisor -->|"runs planner"| node_planner
node_queue -->|"tracks sessions"| node_sessions
node_cli -->|"configures controls"| node_policy
node_ui -->|"serves boards"| node_boards
node_ui -->|"manages connections"| node_connectors
node_ui -->|"serves browser UI"| node_browser
node_ui -->|"manages AWS apps"| node_awsapps
node_ui -->|"integrates Slack"| node_slack
node_agents -->|"works in branches"| node_gitops
node_providers -->|"routes model calls"| node_relay

click node_ui "https://github.com/matank001/clodfarm/blob/main/clodfarm/web.py"
click node_cli "https://github.com/matank001/clodfarm/blob/main/clodfarm/cli.py"
click node_supervisor "https://github.com/matank001/clodfarm/blob/main/clodfarm/supervisor.py"
click node_agents "https://github.com/matank001/clodfarm/blob/main/clodfarm/agents.py"
click node_prompts "https://github.com/matank001/clodfarm/blob/main/clodfarm/prompts.py"
click node_providers "https://github.com/matank001/clodfarm/blob/main/clodfarm/bots.py"
click node_relay "https://github.com/matank001/clodfarm/blob/main/clodfarm/relay.py"
click node_processes "https://github.com/matank001/clodfarm/blob/main/clodfarm/procs.py"
click node_queue "https://github.com/matank001/clodfarm/blob/main/clodfarm/store.py"
click node_backends "https://github.com/matank001/clodfarm/blob/main/clodfarm/backends.py"
click node_governor "https://github.com/matank001/clodfarm/blob/main/clodfarm/governor.py"
click node_schedule "https://github.com/matank001/clodfarm/blob/main/clodfarm/schedule.py"
click node_sessions "https://github.com/matank001/clodfarm/blob/main/clodfarm/sessions.py"
click node_policy "https://github.com/matank001/clodfarm/blob/main/clodfarm/policy.py"
click node_gitops "https://github.com/matank001/clodfarm/blob/main/clodfarm/gitops.py"
click node_boards "https://github.com/matank001/clodfarm/blob/main/clodfarm/boards.py"
click node_dashboards "https://github.com/matank001/clodfarm/blob/main/clodfarm/dashboards.py"
click node_connectors "https://github.com/matank001/clodfarm/blob/main/clodfarm/connectors.py"
click node_awsapps "https://github.com/matank001/clodfarm/blob/main/clodfarm/awsapps.py"
click node_browser "https://github.com/matank001/clodfarm/blob/main/clodfarm/browser.py"
click node_planner "https://github.com/matank001/clodfarm/blob/main/clodfarm/planner.py"
click node_slack "https://github.com/matank001/clodfarm/blob/main/clodfarm/slack.py"

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_ui,node_cli toneBlue
class node_supervisor,node_agents,node_prompts,node_providers,node_relay,node_processes,node_gitops toneAmber
class node_queue,node_backends,node_governor,node_schedule,node_sessions,node_policy toneMint
class node_boards,node_dashboards,node_connectors,node_awsapps,node_browser,node_planner,node_slack toneRose
class node_person toneIndigo
```

## Components

### User entry

- [Farm UI](https://github.com/matank001/clodfarm/blob/main/clodfarm/web.py): `clodfarm/web.py`
- [Farm CLI](https://github.com/matank001/clodfarm/blob/main/clodfarm/cli.py): `clodfarm/cli.py`

### Agent runtime

- [Farm supervisor](https://github.com/matank001/clodfarm/blob/main/clodfarm/supervisor.py): `clodfarm/supervisor.py`
- [Agent runs](https://github.com/matank001/clodfarm/blob/main/clodfarm/agents.py): `clodfarm/agents.py`
- [Agent guidance](https://github.com/matank001/clodfarm/blob/main/clodfarm/prompts.py): `clodfarm/prompts.py`
- [Model bots](https://github.com/matank001/clodfarm/blob/main/clodfarm/bots.py): `clodfarm/bots.py`
- [Provider relay](https://github.com/matank001/clodfarm/blob/main/clodfarm/relay.py): `clodfarm/relay.py`
- [Process control](https://github.com/matank001/clodfarm/blob/main/clodfarm/procs.py): `clodfarm/procs.py`
- [Git worktrees](https://github.com/matank001/clodfarm/blob/main/clodfarm/gitops.py): `clodfarm/gitops.py`

### Farm coordination

- [Task queue and state](https://github.com/matank001/clodfarm/blob/main/clodfarm/store.py): `clodfarm/store.py`
- [State backends](https://github.com/matank001/clodfarm/blob/main/clodfarm/backends.py): `clodfarm/backends.py`
- [Usage governor](https://github.com/matank001/clodfarm/blob/main/clodfarm/governor.py): `clodfarm/governor.py`
- [Task schedules](https://github.com/matank001/clodfarm/blob/main/clodfarm/schedule.py): `clodfarm/schedule.py`
- [Session history](https://github.com/matank001/clodfarm/blob/main/clodfarm/sessions.py): `clodfarm/sessions.py`
- [Tool policies](https://github.com/matank001/clodfarm/blob/main/clodfarm/policy.py): `clodfarm/policy.py`

### Farm capabilities

- [Shared whiteboards](https://github.com/matank001/clodfarm/blob/main/clodfarm/boards.py): `clodfarm/boards.py`
- [Live dashboards](https://github.com/matank001/clodfarm/blob/main/clodfarm/dashboards.py): `clodfarm/dashboards.py`
- [Business connectors](https://github.com/matank001/clodfarm/blob/main/clodfarm/connectors.py): `clodfarm/connectors.py`
- [AWS app deployment](https://github.com/matank001/clodfarm/blob/main/clodfarm/awsapps.py): `clodfarm/awsapps.py`
- [Shared browser](https://github.com/matank001/clodfarm/blob/main/clodfarm/browser.py): `clodfarm/browser.py`
- [Work planner](https://github.com/matank001/clodfarm/blob/main/clodfarm/planner.py): `clodfarm/planner.py`
- [Slack integration](https://github.com/matank001/clodfarm/blob/main/clodfarm/slack.py): `clodfarm/slack.py`

### Other components

- **Person**

## Connections

- Person → Farm UI: requests work
- Person → Farm CLI: runs commands (evidence: `clodfarm/cli.py`)
- Farm UI → Task queue and state: views farm state (evidence: `clodfarm/web.py`)
- Farm CLI → Task queue and state: manages tasks (evidence: `clodfarm/cli.py`)
- Farm supervisor → Agent runs: starts runs (evidence: `clodfarm/supervisor.py`)
- Agent runs → Task queue and state: claims tasks (evidence: `clodfarm/store.py`)
- Agent runs → Process control: controls processes (evidence: `clodfarm/agents.py`)
- Agent runs → Agent guidance: loads guidance (evidence: `clodfarm/agents.py`)
- Agent runs → Model bots: selects bot (evidence: `clodfarm/agents.py`)
- Agent runs → Provider relay: uses relay (evidence: `clodfarm/agents.py`)
- Task queue and state → State backends: persists state (evidence: `clodfarm/store.py`)
- Farm supervisor → Usage governor: paces agents (evidence: `clodfarm/supervisor.py`)
- Farm supervisor → Task schedules: runs schedules (evidence: `clodfarm/supervisor.py`)
- Farm supervisor → Git worktrees: manages branches (evidence: `clodfarm/supervisor.py`)
- Farm supervisor → Live dashboards: refreshes dashboards (evidence: `clodfarm/supervisor.py`)
- Farm supervisor → Work planner: runs planner (evidence: `clodfarm/supervisor.py`)
- Task queue and state → Session history: tracks sessions (evidence: `clodfarm/store.py`)
- Farm CLI → Tool policies: configures controls (evidence: `clodfarm/cli.py`)
- Farm UI → Shared whiteboards: serves boards (evidence: `clodfarm/web.py`)
- Farm UI → Business connectors: manages connections (evidence: `clodfarm/web.py`)
- Farm UI → Shared browser: serves browser UI (evidence: `clodfarm/web.py`)
- Farm UI → AWS app deployment: manages AWS apps (evidence: `clodfarm/web.py`)
- Farm UI → Slack integration: integrates Slack (evidence: `clodfarm/web.py`)
- Agent runs → Git worktrees: works in branches
- Model bots → Provider relay: routes model calls (evidence: `clodfarm/relay.py`)
