# arturitu/the-delegation architecture

> Architecture diagram of the GitHub repository arturitu/the-delegation, 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/arturitu/the-delegation
- Repository: https://github.com/arturitu/the-delegation

## Overview

The Delegation is a no-code playground for designing multi-agent teams and observing them collaborate in a 3D office. Users configure a team, interact with agents, review proposed work, and inspect generated outputs and activity. The runtime combines agent reasoning and tool actions with a Three.js simulation of embodied characters. The README documents multimodal generation, per-agent models, cost tracking, guardrails, and review workflows; unsampled implementation details and their wiring are represented only where the tree or excerpts support them.

Main entry points: [`src/simulation/SceneManager.ts`](https://github.com/arturitu/the-delegation/blob/main/src/simulation/SceneManager.ts) (Scene Coordinator), [`src/App.tsx`](https://github.com/arturitu/the-delegation/blob/main/src/App.tsx) (Application Shell), [`src/simulation/CharacterController.ts`](https://github.com/arturitu/the-delegation/blob/main/src/simulation/CharacterController.ts) (Character Control), [`src/simulation/core/AgentSimulation.ts`](https://github.com/arturitu/the-delegation/blob/main/src/simulation/core/AgentSimulation.ts) (Agent Simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Product Experience"]
  node_app["Application Shell<br/>[App.tsx]"]
  node_simulation_view["3D Workspace<br/>[SimulationView.tsx]"]
  node_review_ui["Review &amp; Outputs"]
  node_activity_ui["Activity &amp; Tasks<br/>[ActionLogPanel.tsx]"]
end

subgraph group_teams["Team Design &amp; State"]
  node_visual_config["Team Editor"]
  node_team_templates["Team Templates<br/>[agents.ts]"]
  node_team_store["Team State<br/>[teamStore.ts]"]
  node_ui_store["UI State<br/>[uiStore.ts]"]
  node_core_store["Workflow State<br/>[coreStore.ts]"]
end

subgraph group_agents["Agent Workflow"]
  node_agent_sim["Agent Simulation<br/>[AgentSimulation.ts]"]
  node_agent_brain["Agent Reasoning<br/>[AgentBrain.ts]"]
  node_prompt_builder["Prompt Builder<br/>[PromptBuilder.ts]"]
  node_tool_registry["Tool Registry<br/>[ToolRegistry.ts]"]
  node_task_tools["Task Actions<br/>[proposeTask.ts]"]
  node_deliver_tool["Project Delivery<br/>[deliverProject.ts]"]
end

subgraph group_llm["Model Integration"]
  node_llm_provider["Gemini Provider<br/>[GeminiProvider.ts]"]
  node_pricing["Usage Pricing<br/>[pricing.ts]"]
end

subgraph group_simulation["Embodied Simulation"]
  node_scene_manager["Scene Coordinator<br/>[SceneManager.ts]"]
  node_world_manager["Office World<br/>[WorldManager.ts]"]
  node_character_controller["Character Control"]
  node_driver_manager["Agent Drivers<br/>[DriverManager.ts]"]
  node_character_manager["Character Rendering"]
  node_navmesh["Navigation Mesh<br/>[NavMeshManager.ts]"]
  node_poi_manager["Workspace Locations<br/>[PoiManager.ts]"]
  node_state_machine["Character States"]
end

node_user(("User"))
node_gemini(("Gemini API"))

node_user -->|"interacts"| node_app
node_app -->|"renders"| node_visual_config
node_app -->|"renders"| node_simulation_view
node_app -->|"creates"| node_scene_manager
node_app -->|"renders"| node_review_ui
node_app -->|"renders"| node_activity_ui
node_visual_config -->|"configures"| node_team_store
node_team_templates -->|"supplies teams"| node_team_store
node_scene_manager -->|"reads active team"| node_team_store
node_scene_manager -->|"creates"| node_agent_sim
node_scene_manager -->|"creates"| node_world_manager
node_scene_manager -->|"creates"| node_character_manager
node_scene_manager -->|"creates"| node_character_controller
node_scene_manager -->|"creates"| node_driver_manager
node_scene_manager -->|"updates chat state"| node_ui_store
node_agent_sim -->|"runs agents"| node_agent_brain
node_agent_brain -->|"builds prompts"| node_prompt_builder
node_agent_brain -->|"dispatches tools"| node_tool_registry
node_tool_registry -->|"dispatches task actions"| node_task_tools
node_tool_registry -->|"dispatches delivery"| node_deliver_tool
node_agent_brain -->|"requests generation"| node_llm_provider
node_llm_provider -->|"sends requests"| node_gemini
node_agent_sim -->|"estimates usage"| node_pricing
node_agent_sim -->|"records workflow"| node_core_store
node_world_manager -->|"loads navigation"| node_navmesh
node_world_manager -->|"loads locations"| node_poi_manager
node_character_controller -->|"queries paths"| node_navmesh
node_character_controller -->|"claims locations"| node_poi_manager
node_character_controller -->|"moves characters"| node_character_manager
node_character_controller -->|"changes states"| node_state_machine
node_driver_manager -->|"controls characters"| node_character_controller
node_scene_manager -->|"updates drivers"| node_driver_manager
node_character_manager -->|"renders in"| node_simulation_view
node_review_ui -->|"reads workflow"| node_core_store
node_activity_ui -->|"reads activity"| node_core_store

click node_app "https://github.com/arturitu/the-delegation/blob/main/src/App.tsx"
click node_visual_config "https://github.com/arturitu/the-delegation/blob/main/src/interface/VisualConfigurator/VisualConfigurator.tsx"
click node_team_templates "https://github.com/arturitu/the-delegation/blob/main/src/data/agents.ts"
click node_team_store "https://github.com/arturitu/the-delegation/blob/main/src/integration/store/teamStore.ts"
click node_ui_store "https://github.com/arturitu/the-delegation/blob/main/src/integration/store/uiStore.ts"
click node_core_store "https://github.com/arturitu/the-delegation/blob/main/src/integration/store/coreStore.ts"
click node_scene_manager "https://github.com/arturitu/the-delegation/blob/main/src/simulation/SceneManager.ts"
click node_agent_sim "https://github.com/arturitu/the-delegation/blob/main/src/simulation/core/AgentSimulation.ts"
click node_agent_brain "https://github.com/arturitu/the-delegation/blob/main/src/core/agent/AgentBrain.ts"
click node_prompt_builder "https://github.com/arturitu/the-delegation/blob/main/src/core/agent/PromptBuilder.ts"
click node_tool_registry "https://github.com/arturitu/the-delegation/blob/main/src/core/agent/ToolRegistry.ts"
click node_task_tools "https://github.com/arturitu/the-delegation/blob/main/src/core/agent/tools/proposeTask.ts"
click node_deliver_tool "https://github.com/arturitu/the-delegation/blob/main/src/core/agent/tools/deliverProject.ts"
click node_llm_provider "https://github.com/arturitu/the-delegation/blob/main/src/core/llm/providers/GeminiProvider.ts"
click node_pricing "https://github.com/arturitu/the-delegation/blob/main/src/core/llm/pricing.ts"
click node_simulation_view "https://github.com/arturitu/the-delegation/blob/main/src/interface/SimulationView.tsx"
click node_world_manager "https://github.com/arturitu/the-delegation/blob/main/src/simulation/world/WorldManager.ts"
click node_character_controller "https://github.com/arturitu/the-delegation/blob/main/src/simulation/CharacterController.ts"
click node_driver_manager "https://github.com/arturitu/the-delegation/blob/main/src/simulation/drivers/DriverManager.ts"
click node_character_manager "https://github.com/arturitu/the-delegation/blob/main/src/simulation/entities/CharacterManager.ts"
click node_navmesh "https://github.com/arturitu/the-delegation/blob/main/src/simulation/pathfinding/NavMeshManager.ts"
click node_poi_manager "https://github.com/arturitu/the-delegation/blob/main/src/simulation/world/PoiManager.ts"
click node_state_machine "https://github.com/arturitu/the-delegation/blob/main/src/simulation/behavior/CharacterStateMachine.ts"
click node_review_ui "https://github.com/arturitu/the-delegation/blob/main/src/interface/OutputReviewModal.tsx"
click node_activity_ui "https://github.com/arturitu/the-delegation/blob/main/src/interface/ActionLogPanel.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_app,node_simulation_view,node_review_ui,node_activity_ui,node_user toneBlue
class node_visual_config,node_team_templates,node_team_store,node_ui_store,node_core_store toneAmber
class node_agent_sim,node_agent_brain,node_prompt_builder,node_tool_registry,node_task_tools,node_deliver_tool,node_gemini toneMint
class node_llm_provider,node_pricing toneRose
class node_scene_manager,node_world_manager,node_character_controller,node_driver_manager,node_character_manager,node_navmesh,node_poi_manager,node_state_machine toneIndigo
```

## Components

### Product Experience

- [Application Shell](https://github.com/arturitu/the-delegation/blob/main/src/App.tsx): `src/App.tsx`
- [3D Workspace](https://github.com/arturitu/the-delegation/blob/main/src/interface/SimulationView.tsx): `src/interface/SimulationView.tsx`
- [Review & Outputs](https://github.com/arturitu/the-delegation/blob/main/src/interface/OutputReviewModal.tsx): `src/interface/OutputReviewModal.tsx`
- [Activity & Tasks](https://github.com/arturitu/the-delegation/blob/main/src/interface/ActionLogPanel.tsx): `src/interface/ActionLogPanel.tsx`

### Team Design & State

- [Team Editor](https://github.com/arturitu/the-delegation/blob/main/src/interface/VisualConfigurator/VisualConfigurator.tsx): `src/interface/VisualConfigurator/VisualConfigurator.tsx`
- [Team Templates](https://github.com/arturitu/the-delegation/blob/main/src/data/agents.ts): `src/data/agents.ts`
- [Team State](https://github.com/arturitu/the-delegation/blob/main/src/integration/store/teamStore.ts): `src/integration/store/teamStore.ts`
- [UI State](https://github.com/arturitu/the-delegation/blob/main/src/integration/store/uiStore.ts): `src/integration/store/uiStore.ts`
- [Workflow State](https://github.com/arturitu/the-delegation/blob/main/src/integration/store/coreStore.ts): `src/integration/store/coreStore.ts`

### Agent Workflow

- [Agent Simulation](https://github.com/arturitu/the-delegation/blob/main/src/simulation/core/AgentSimulation.ts): `src/simulation/core/AgentSimulation.ts`
- [Agent Reasoning](https://github.com/arturitu/the-delegation/blob/main/src/core/agent/AgentBrain.ts): `src/core/agent/AgentBrain.ts`
- [Prompt Builder](https://github.com/arturitu/the-delegation/blob/main/src/core/agent/PromptBuilder.ts): `src/core/agent/PromptBuilder.ts`
- [Tool Registry](https://github.com/arturitu/the-delegation/blob/main/src/core/agent/ToolRegistry.ts): `src/core/agent/ToolRegistry.ts`
- [Task Actions](https://github.com/arturitu/the-delegation/blob/main/src/core/agent/tools/proposeTask.ts): `src/core/agent/tools/proposeTask.ts`
- [Project Delivery](https://github.com/arturitu/the-delegation/blob/main/src/core/agent/tools/deliverProject.ts): `src/core/agent/tools/deliverProject.ts`

### Model Integration

- [Gemini Provider](https://github.com/arturitu/the-delegation/blob/main/src/core/llm/providers/GeminiProvider.ts): `src/core/llm/providers/GeminiProvider.ts`
- [Usage Pricing](https://github.com/arturitu/the-delegation/blob/main/src/core/llm/pricing.ts): `src/core/llm/pricing.ts`

### Embodied Simulation

- [Scene Coordinator](https://github.com/arturitu/the-delegation/blob/main/src/simulation/SceneManager.ts): `src/simulation/SceneManager.ts`
- [Office World](https://github.com/arturitu/the-delegation/blob/main/src/simulation/world/WorldManager.ts): `src/simulation/world/WorldManager.ts`
- [Character Control](https://github.com/arturitu/the-delegation/blob/main/src/simulation/CharacterController.ts): `src/simulation/CharacterController.ts`
- [Agent Drivers](https://github.com/arturitu/the-delegation/blob/main/src/simulation/drivers/DriverManager.ts): `src/simulation/drivers/DriverManager.ts`
- [Character Rendering](https://github.com/arturitu/the-delegation/blob/main/src/simulation/entities/CharacterManager.ts): `src/simulation/entities/CharacterManager.ts`
- [Navigation Mesh](https://github.com/arturitu/the-delegation/blob/main/src/simulation/pathfinding/NavMeshManager.ts): `src/simulation/pathfinding/NavMeshManager.ts`
- [Workspace Locations](https://github.com/arturitu/the-delegation/blob/main/src/simulation/world/PoiManager.ts): `src/simulation/world/PoiManager.ts`
- [Character States](https://github.com/arturitu/the-delegation/blob/main/src/simulation/behavior/CharacterStateMachine.ts): `src/simulation/behavior/CharacterStateMachine.ts`

### Other components

- **User**
- **Gemini API**

## Connections

- User → Application Shell: interacts
- Application Shell → Team Editor: renders
- Application Shell → 3D Workspace: renders
- Application Shell → Scene Coordinator: creates
- Application Shell → Review & Outputs: renders
- Application Shell → Activity & Tasks: renders
- Team Editor → Team State: configures
- Team Templates → Team State: supplies teams
- Scene Coordinator → Team State: reads active team
- Scene Coordinator → Agent Simulation: creates
- Scene Coordinator → Office World: creates
- Scene Coordinator → Character Rendering: creates
- Scene Coordinator → Character Control: creates
- Scene Coordinator → Agent Drivers: creates
- Scene Coordinator → UI State: updates chat state
- Agent Simulation → Agent Reasoning: runs agents
- Agent Reasoning → Prompt Builder: builds prompts
- Agent Reasoning → Tool Registry: dispatches tools
- Tool Registry → Task Actions: dispatches task actions
- Tool Registry → Project Delivery: dispatches delivery
- Agent Reasoning → Gemini Provider: requests generation
- Gemini Provider → Gemini API: sends requests
- Agent Simulation → Usage Pricing: estimates usage
- Agent Simulation → Workflow State: records workflow
- Office World → Navigation Mesh: loads navigation
- Office World → Workspace Locations: loads locations
- Character Control → Navigation Mesh: queries paths
- Character Control → Workspace Locations: claims locations
- Character Control → Character Rendering: moves characters
- Character Control → Character States: changes states
- Agent Drivers → Character Control: controls characters
- Scene Coordinator → Agent Drivers: updates drivers
- Character Rendering → 3D Workspace: renders in
- Review & Outputs → Workflow State: reads workflow
- Activity & Tasks → Workflow State: reads activity
