# garnser/codex-web architecture

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

- Interactive diagram: https://gitdiagram.com/garnser/codex-web
- Repository: https://github.com/garnser/codex-web

## Overview

Codex Web is a local-first AI engineering and organizational control plane. Its principal workflow turns a request, goal, issue, or event into scoped, policy-governed work; routes bounded execution; and records evidence and outcomes. The graph preserves major documented branches for executive reasoning, integrations, business operations, and operational controls. Most connections reflect README-level architecture; source-level evidence is limited to the sampled application, worker API, and autonomy excerpts.

Main entry points: [`codex_web/application.py`](https://github.com/garnser/codex-web/blob/main/codex_web/application.py) (FastAPI control plane), [`codex_web/api/authorization.py`](https://github.com/garnser/codex-web/blob/main/codex_web/api/authorization.py) (Authority and approvals), [`codex_web/services/work_items.py`](https://github.com/garnser/codex-web/blob/main/codex_web/services/work_items.py) (Work and goals), [`codex_web/storage/state_store.py`](https://github.com/garnser/codex-web/blob/main/codex_web/storage/state_store.py) (Canonical state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_browser["Browser UI<br/>[app.js]"]
  node_api["FastAPI control plane<br/>[application.py]"]
end

subgraph group_governance["Identity and governance"]
  node_identity["Identity and scope<br/>[identity.py]"]
  node_authority["Authority and approvals<br/>[authorization.py]"]
  node_canonical[("Canonical state<br/>[state_store.py]")]
end

subgraph group_work["Work orchestration"]
  node_workitems["Work and goals<br/>[work_items.py]"]
  node_decisions["Decisions and graphs<br/>[decisions.py]"]
  node_events["Events and scheduling<br/>[event_transport.py]"]
  node_autonomy["Autonomy controller"]
  node_executive["Executive workflows"]
end

subgraph group_execution["Agent execution"]
  node_routing["Agent routing<br/>[agent_routing.py]"]
  node_intents["Action intents<br/>[action_intents.py]"]
  node_workers["Execution workers"]
  node_localworker["Bounded local execution"]
end

subgraph group_knowledge["Evidence and outcomes"]
  node_evidence["Artifacts and evidence"]
  node_outcomes["Outcomes and KPIs<br/>[outcome_metrics.py]"]
  node_memory[("Organizational memory")]
end

subgraph group_extensions["Integrations and operations"]
  node_integrations["External integrations<br/>[task_sources.py]"]
  node_channels["Slack and Telegram"]
  node_business[("Business context")]
  node_operations["Operations and recovery<br/>[recovery.py]"]
end

node_user(("User or event"))

node_user -->|"submits work"| node_browser
node_browser -->|"sends requests"| node_api
node_api -->|"resolves scope"| node_identity
node_api -->|"enforces policy"| node_authority
node_api -->|"coordinates work"| node_workitems
node_api -->|"coordinates decisions"| node_decisions
node_api -->|"coordinates scheduling"| node_events
node_api -->|"serves workflows"| node_executive
node_workitems -->|"persists state"| node_canonical
node_decisions -->|"persists state"| node_canonical
node_authority -->|"stores controls"| node_canonical
node_events -->|"triggers cycles"| node_autonomy
node_autonomy -->|"creates intents"| node_intents
node_workitems -->|"routes execution"| node_routing
node_routing -->|"selects runtime"| node_workers
node_workers -->|"dispatches bounded work"| node_localworker
node_intents -->|"checks authorization"| node_authority
node_authority -->|"permits execution"| node_localworker
node_localworker -->|"records proof"| node_evidence
node_evidence -->|"supports measurement"| node_outcomes
node_outcomes -->|"informs reusable knowledge"| node_memory
node_integrations -->|"provides task events"| node_events
node_channels -->|"supplies intake"| node_api
node_executive -->|"delegates canonical work"| node_workitems
node_business -->|"supplies business context"| node_decisions
node_operations -->|"manages recovery state"| node_canonical

click node_browser "https://github.com/garnser/codex-web/blob/main/static/app.js"
click node_api "https://github.com/garnser/codex-web/blob/main/codex_web/application.py"
click node_identity "https://github.com/garnser/codex-web/blob/main/codex_web/identity.py"
click node_authority "https://github.com/garnser/codex-web/blob/main/codex_web/api/authorization.py"
click node_canonical "https://github.com/garnser/codex-web/blob/main/codex_web/storage/state_store.py"
click node_workitems "https://github.com/garnser/codex-web/blob/main/codex_web/services/work_items.py"
click node_decisions "https://github.com/garnser/codex-web/blob/main/codex_web/services/decisions.py"
click node_events "https://github.com/garnser/codex-web/blob/main/codex_web/services/event_transport.py"
click node_autonomy "https://github.com/garnser/codex-web/blob/main/codex_web/services/autonomy_controller.py"
click node_routing "https://github.com/garnser/codex-web/blob/main/codex_web/services/agent_routing.py"
click node_intents "https://github.com/garnser/codex-web/blob/main/codex_web/services/action_intents.py"
click node_workers "https://github.com/garnser/codex-web/blob/main/codex_web/services/execution_workers.py"
click node_localworker "https://github.com/garnser/codex-web/blob/main/codex_web/services/local_execution_worker.py"
click node_evidence "https://github.com/garnser/codex-web/blob/main/codex_web/services/artifact_evidence.py"
click node_outcomes "https://github.com/garnser/codex-web/blob/main/codex_web/services/outcome_metrics.py"
click node_memory "https://github.com/garnser/codex-web/blob/main/codex_web/services/organizational_memory.py"
click node_executive "https://github.com/garnser/codex-web/blob/main/codex_web/services/executive_management.py"
click node_integrations "https://github.com/garnser/codex-web/blob/main/codex_web/services/task_sources.py"
click node_channels "https://github.com/garnser/codex-web/blob/main/codex_web/services/conversation_channels.py"
click node_business "https://github.com/garnser/codex-web/blob/main/codex_web/services/business_context.py"
click node_operations "https://github.com/garnser/codex-web/blob/main/codex_web/services/recovery.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_browser,node_api,node_user toneBlue
class node_identity,node_authority,node_canonical toneAmber
class node_workitems,node_decisions,node_events,node_autonomy,node_executive toneMint
class node_routing,node_intents,node_workers,node_localworker toneRose
class node_evidence,node_outcomes,node_memory toneIndigo
class node_integrations,node_channels,node_business,node_operations toneTeal
```

## Components

### User interface

- [Browser UI](https://github.com/garnser/codex-web/blob/main/static/app.js): `static/app.js`
- [FastAPI control plane](https://github.com/garnser/codex-web/blob/main/codex_web/application.py): `codex_web/application.py`

### Identity and governance

- [Identity and scope](https://github.com/garnser/codex-web/blob/main/codex_web/identity.py): `codex_web/identity.py`
- [Authority and approvals](https://github.com/garnser/codex-web/blob/main/codex_web/api/authorization.py): `codex_web/api/authorization.py`
- [Canonical state](https://github.com/garnser/codex-web/blob/main/codex_web/storage/state_store.py): `codex_web/storage/state_store.py`

### Work orchestration

- [Work and goals](https://github.com/garnser/codex-web/blob/main/codex_web/services/work_items.py): `codex_web/services/work_items.py`
- [Decisions and graphs](https://github.com/garnser/codex-web/blob/main/codex_web/services/decisions.py): `codex_web/services/decisions.py`
- [Events and scheduling](https://github.com/garnser/codex-web/blob/main/codex_web/services/event_transport.py): `codex_web/services/event_transport.py`
- [Autonomy controller](https://github.com/garnser/codex-web/blob/main/codex_web/services/autonomy_controller.py): `codex_web/services/autonomy_controller.py`
- [Executive workflows](https://github.com/garnser/codex-web/blob/main/codex_web/services/executive_management.py): `codex_web/services/executive_management.py`

### Agent execution

- [Agent routing](https://github.com/garnser/codex-web/blob/main/codex_web/services/agent_routing.py): `codex_web/services/agent_routing.py`
- [Action intents](https://github.com/garnser/codex-web/blob/main/codex_web/services/action_intents.py): `codex_web/services/action_intents.py`
- [Execution workers](https://github.com/garnser/codex-web/blob/main/codex_web/services/execution_workers.py): `codex_web/services/execution_workers.py`
- [Bounded local execution](https://github.com/garnser/codex-web/blob/main/codex_web/services/local_execution_worker.py): `codex_web/services/local_execution_worker.py`

### Evidence and outcomes

- [Artifacts and evidence](https://github.com/garnser/codex-web/blob/main/codex_web/services/artifact_evidence.py): `codex_web/services/artifact_evidence.py`
- [Outcomes and KPIs](https://github.com/garnser/codex-web/blob/main/codex_web/services/outcome_metrics.py): `codex_web/services/outcome_metrics.py`
- [Organizational memory](https://github.com/garnser/codex-web/blob/main/codex_web/services/organizational_memory.py): `codex_web/services/organizational_memory.py`

### Integrations and operations

- [External integrations](https://github.com/garnser/codex-web/blob/main/codex_web/services/task_sources.py): `codex_web/services/task_sources.py`
- [Slack and Telegram](https://github.com/garnser/codex-web/blob/main/codex_web/services/conversation_channels.py): `codex_web/services/conversation_channels.py`
- [Business context](https://github.com/garnser/codex-web/blob/main/codex_web/services/business_context.py): `codex_web/services/business_context.py`
- [Operations and recovery](https://github.com/garnser/codex-web/blob/main/codex_web/services/recovery.py): `codex_web/services/recovery.py`

### Other components

- **User or event**

## Connections

- User or event → Browser UI: submits work
- Browser UI → FastAPI control plane: sends requests
- FastAPI control plane → Identity and scope: resolves scope
- FastAPI control plane → Authority and approvals: enforces policy (evidence: `codex_web/application.py`)
- FastAPI control plane → Work and goals: coordinates work
- FastAPI control plane → Decisions and graphs: coordinates decisions
- FastAPI control plane → Events and scheduling: coordinates scheduling
- FastAPI control plane → Executive workflows: serves workflows
- Work and goals → Canonical state: persists state
- Decisions and graphs → Canonical state: persists state
- Authority and approvals → Canonical state: stores controls
- Events and scheduling → Autonomy controller: triggers cycles
- Autonomy controller → Action intents: creates intents (evidence: `codex_web/services/autonomy_controller.py`)
- Work and goals → Agent routing: routes execution
- Agent routing → Execution workers: selects runtime
- Execution workers → Bounded local execution: dispatches bounded work (evidence: `codex_web/services/local_execution_worker.py`)
- Action intents → Authority and approvals: checks authorization
- Authority and approvals → Bounded local execution: permits execution
- Bounded local execution → Artifacts and evidence: records proof (evidence: `codex_web/services/local_execution_worker.py`)
- Artifacts and evidence → Outcomes and KPIs: supports measurement
- Outcomes and KPIs → Organizational memory: informs reusable knowledge
- External integrations → Events and scheduling: provides task events
- Slack and Telegram → FastAPI control plane: supplies intake
- Executive workflows → Work and goals: delegates canonical work
- Business context → Decisions and graphs: supplies business context
- Operations and recovery → Canonical state: manages recovery state
