# aatrey56/office architecture

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

- Interactive diagram: https://gitdiagram.com/aatrey56/office
- Repository: https://github.com/aatrey56/office

## Overview

office is a Claude Code plugin that turns live sessions into an animated pixel-art office, with a terminal session board and tools for routing and delegating work. The main display flow gathers session and worker state, maps participants to rooms and seats, animates and paints a frame, then encodes it for the pane. Separate command and pane workflows support task routing, background workers, manager coordination, Codex reviews, and manga reading. Some links rely on README statements or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`mod/hooks/scene.tsx`](https://github.com/aatrey56/office/blob/main/mod/hooks/scene.tsx) (Office pane), [`mod/hooks/jobs.tsx`](https://github.com/aatrey56/office/blob/main/mod/hooks/jobs.tsx) (Jobs and commands), [`mod/hooks/sessions.ts`](https://github.com/aatrey56/office/blob/main/mod/hooks/sessions.ts) (Session registry), [`mod/hooks/scene/model.ts`](https://github.com/aatrey56/office/blob/main/mod/hooks/scene/model.ts) (Crew model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_display["Office display"]
  node_office_pane["Office pane<br/>[scene.tsx]"]
  node_crew_model["Crew model<br/>[model.ts]"]
  node_motion["Actor motion<br/>[motion.ts]"]
  node_painter["Frame painter<br/>[paint.ts]"]
  node_scene_art["Scene art<br/>[art.ts]"]
  node_art_data["Art data<br/>[art-data.ts]"]
  node_frame_encoder["Frame encoder<br/>[encode.ts]"]
end

subgraph group_sessions["Sessions and jobs"]
  node_session_store[("Session registry<br/>[sessions.ts]")]
  node_agent_state["Agent state<br/>[agents.ts]"]
  node_jobs["Jobs and commands<br/>[jobs.tsx]"]
end

subgraph group_coordination["Task coordination"]
  node_router["Model router<br/>[router.ts]"]
  node_worker["Worker lifecycle<br/>[spawn.ts]"]
  node_budget["Worker budget<br/>[budget.ts]"]
  node_worktrees["Worker worktrees<br/>[worktree.ts]"]
  node_manager_ui["Manager commands<br/>[manage.tsx]"]
  node_manager_logic["Manager notebook<br/>[manager.ts]"]
  node_codex_review["Codex review<br/>[codex.ts]"]
  node_codex_budget["Codex budget<br/>[codex-budget.ts]"]
end

subgraph group_panes["User panes"]
  node_board["Session board<br/>[board.tsx]"]
  node_manga["Manga reader<br/>[manga.tsx]"]
end

node_user(("User"))
node_claude["Claude Code"]

node_user -->|"uses plugin"| node_claude
node_claude -->|"opens pane"| node_office_pane
node_user -->|"opens board"| node_board
node_board -->|"reads sessions"| node_session_store
node_office_pane -->|"reads sessions"| node_session_store
node_office_pane -->|"reads agents"| node_agent_state
node_office_pane -->|"derives crew"| node_crew_model
node_crew_model -->|"uses session data"| node_session_store
node_office_pane -->|"steps actors"| node_motion
node_office_pane -->|"paints frame"| node_painter
node_painter -->|"uses scene assets"| node_scene_art
node_scene_art -->|"decodes assets"| node_art_data
node_office_pane -->|"encodes frame"| node_frame_encoder
node_office_pane -->|"shows office"| node_user
node_user -->|"runs commands"| node_jobs
node_jobs -->|"routes tasks"| node_router
node_jobs -->|"starts workers"| node_worker
node_jobs -->|"checks worker budget"| node_budget
node_jobs -->|"manages worktrees"| node_worktrees
node_jobs -->|"starts review"| node_codex_review
node_jobs -->|"checks Codex budget"| node_codex_budget
node_jobs -.->|"registers commands"| node_manager_ui
node_manager_ui -->|"uses notebook logic"| node_manager_logic
node_user -->|"opens reader"| node_manga
node_office_pane -->|"reads worker context"| node_worktrees

click node_session_store "https://github.com/aatrey56/office/blob/main/mod/hooks/sessions.ts"
click node_board "https://github.com/aatrey56/office/blob/main/mod/hooks/board.tsx"
click node_office_pane "https://github.com/aatrey56/office/blob/main/mod/hooks/scene.tsx"
click node_crew_model "https://github.com/aatrey56/office/blob/main/mod/hooks/scene/model.ts"
click node_motion "https://github.com/aatrey56/office/blob/main/mod/hooks/scene/motion.ts"
click node_painter "https://github.com/aatrey56/office/blob/main/mod/hooks/scene/paint.ts"
click node_scene_art "https://github.com/aatrey56/office/blob/main/mod/hooks/scene/art.ts"
click node_art_data "https://github.com/aatrey56/office/blob/main/mod/hooks/scene/art-data.ts"
click node_frame_encoder "https://github.com/aatrey56/office/blob/main/mod/hooks/scene/encode.ts"
click node_agent_state "https://github.com/aatrey56/office/blob/main/mod/hooks/agents.ts"
click node_jobs "https://github.com/aatrey56/office/blob/main/mod/hooks/jobs.tsx"
click node_router "https://github.com/aatrey56/office/blob/main/mod/hooks/router.ts"
click node_worker "https://github.com/aatrey56/office/blob/main/mod/hooks/spawn.ts"
click node_budget "https://github.com/aatrey56/office/blob/main/mod/hooks/budget.ts"
click node_worktrees "https://github.com/aatrey56/office/blob/main/mod/hooks/worktree.ts"
click node_manager_ui "https://github.com/aatrey56/office/blob/main/mod/hooks/manage.tsx"
click node_manager_logic "https://github.com/aatrey56/office/blob/main/mod/hooks/manager.ts"
click node_codex_review "https://github.com/aatrey56/office/blob/main/mod/hooks/codex.ts"
click node_codex_budget "https://github.com/aatrey56/office/blob/main/mod/hooks/codex-budget.ts"
click node_manga "https://github.com/aatrey56/office/blob/main/mod/hooks/manga.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_office_pane,node_crew_model,node_motion,node_painter,node_scene_art,node_art_data,node_frame_encoder,node_user toneBlue
class node_session_store,node_agent_state,node_jobs toneAmber
class node_router,node_worker,node_budget,node_worktrees,node_manager_ui,node_manager_logic,node_codex_review,node_codex_budget toneMint
class node_board,node_manga toneRose
class node_claude toneIndigo
```

## Components

### Office display

- [Office pane](https://github.com/aatrey56/office/blob/main/mod/hooks/scene.tsx): `mod/hooks/scene.tsx`
- [Crew model](https://github.com/aatrey56/office/blob/main/mod/hooks/scene/model.ts): `mod/hooks/scene/model.ts`
- [Actor motion](https://github.com/aatrey56/office/blob/main/mod/hooks/scene/motion.ts): `mod/hooks/scene/motion.ts`
- [Frame painter](https://github.com/aatrey56/office/blob/main/mod/hooks/scene/paint.ts): `mod/hooks/scene/paint.ts`
- [Scene art](https://github.com/aatrey56/office/blob/main/mod/hooks/scene/art.ts): `mod/hooks/scene/art.ts`
- [Art data](https://github.com/aatrey56/office/blob/main/mod/hooks/scene/art-data.ts): `mod/hooks/scene/art-data.ts`
- [Frame encoder](https://github.com/aatrey56/office/blob/main/mod/hooks/scene/encode.ts): `mod/hooks/scene/encode.ts`

### Sessions and jobs

- [Session registry](https://github.com/aatrey56/office/blob/main/mod/hooks/sessions.ts): `mod/hooks/sessions.ts`
- [Agent state](https://github.com/aatrey56/office/blob/main/mod/hooks/agents.ts): `mod/hooks/agents.ts`
- [Jobs and commands](https://github.com/aatrey56/office/blob/main/mod/hooks/jobs.tsx): `mod/hooks/jobs.tsx`

### Task coordination

- [Model router](https://github.com/aatrey56/office/blob/main/mod/hooks/router.ts): `mod/hooks/router.ts`
- [Worker lifecycle](https://github.com/aatrey56/office/blob/main/mod/hooks/spawn.ts): `mod/hooks/spawn.ts`
- [Worker budget](https://github.com/aatrey56/office/blob/main/mod/hooks/budget.ts): `mod/hooks/budget.ts`
- [Worker worktrees](https://github.com/aatrey56/office/blob/main/mod/hooks/worktree.ts): `mod/hooks/worktree.ts`
- [Manager commands](https://github.com/aatrey56/office/blob/main/mod/hooks/manage.tsx): `mod/hooks/manage.tsx`
- [Manager notebook](https://github.com/aatrey56/office/blob/main/mod/hooks/manager.ts): `mod/hooks/manager.ts`
- [Codex review](https://github.com/aatrey56/office/blob/main/mod/hooks/codex.ts): `mod/hooks/codex.ts`
- [Codex budget](https://github.com/aatrey56/office/blob/main/mod/hooks/codex-budget.ts): `mod/hooks/codex-budget.ts`

### User panes

- [Session board](https://github.com/aatrey56/office/blob/main/mod/hooks/board.tsx): `mod/hooks/board.tsx`
- [Manga reader](https://github.com/aatrey56/office/blob/main/mod/hooks/manga.tsx): `mod/hooks/manga.tsx`

### Other components

- **User**
- **Claude Code**

## Connections

- User → Claude Code: uses plugin
- Claude Code → Office pane: opens pane
- User → Session board: opens board
- Session board → Session registry: reads sessions (evidence: `mod/hooks/board.tsx`)
- Office pane → Session registry: reads sessions (evidence: `mod/hooks/scene.tsx`)
- Office pane → Agent state: reads agents (evidence: `mod/hooks/scene.tsx`)
- Office pane → Crew model: derives crew (evidence: `mod/hooks/scene.tsx`)
- Crew model → Session registry: uses session data (evidence: `mod/hooks/scene/model.ts`)
- Office pane → Actor motion: steps actors (evidence: `mod/hooks/scene.tsx`)
- Office pane → Frame painter: paints frame (evidence: `mod/hooks/scene.tsx`)
- Frame painter → Scene art: uses scene assets (evidence: `mod/hooks/scene/art.ts`)
- Scene art → Art data: decodes assets (evidence: `mod/hooks/scene/art.ts`)
- Office pane → Frame encoder: encodes frame (evidence: `mod/hooks/scene.tsx`)
- Office pane → User: shows office
- User → Jobs and commands: runs commands
- Jobs and commands → Model router: routes tasks (evidence: `mod/hooks/jobs.tsx`)
- Jobs and commands → Worker lifecycle: starts workers (evidence: `mod/hooks/jobs.tsx`)
- Jobs and commands → Worker budget: checks worker budget (evidence: `mod/hooks/jobs.tsx`)
- Jobs and commands → Worker worktrees: manages worktrees (evidence: `mod/hooks/jobs.tsx`)
- Jobs and commands → Codex review: starts review (evidence: `mod/hooks/jobs.tsx`)
- Jobs and commands → Codex budget: checks Codex budget (evidence: `mod/hooks/jobs.tsx`)
- Jobs and commands → Manager commands: registers commands
- Manager commands → Manager notebook: uses notebook logic (evidence: `mod/hooks/manage.tsx`)
- User → Manga reader: opens reader
- Office pane → Worker worktrees: reads worker context (evidence: `mod/hooks/scene.tsx`)
