# noshinip27-cyber/chief_of_staff architecture

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

## Overview

Chief of Staff — Draft Desk is a Streamlit email assistant that turns inbox threads into prioritized, reviewable drafts, with human approval before consequential actions. The main workflow runs through the app: choose a thread source, fetch and triage, draft replies for actionable threads, review or edit them, then inspect recorded activity and session proof. Calendar scheduling and the standalone approval-gate app are additional capabilities. Source excerpts and the index support the app’s module links; README statements support workflow and capability links where implementation details were not sampled.

Main entry points: [`app.py`](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/app.py) (Draft Desk UI), [`approval_gate.py`](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/approval_gate.py) (Approval Gate), [`draft_machine.py`](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/draft_machine.py) (Draft Generation), [`engine.py`](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/engine.py) (Gmail Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Inbox Workflow"]
  node_app["Draft Desk UI<br/>[app.py]"]
  node_thread_sources["Thread Sources<br/>[app.py]"]
  node_gmail_engine["Gmail Engine<br/>[engine.py]"]
  node_triage["Inbox Triage<br/>[triage.py]"]
end

subgraph group_drafting["Drafting and Review"]
  node_draft_machine["Draft Generation<br/>[draft_machine.py]"]
  node_context_builder["Draft Context<br/>[context_builder.py]"]
  node_approval_gate["Approval Gate<br/>[approval_gate.py]"]
  node_approved_drafts[("Approved Drafts")]
end

subgraph group_actions["Actions and Scheduling"]
  node_calendar_engine["Calendar Scheduling<br/>[calendar_engine.py]"]
end

subgraph group_records["Activity Records"]
  node_task_logger["Action Logging<br/>[task_logger.py]"]
  node_action_log[("Action Log<br/>[action_log.json]")]
  node_session_proof["Session Proof<br/>[app.py]"]
end

node_user(("User"))
node_gemini["Gemini API"]
node_gmail["Gmail"]
node_google_calendar["Google Calendar"]

node_user -->|"operates"| node_app
node_app -->|"selects source"| node_thread_sources
node_app -->|"fetches threads"| node_gmail_engine
node_gmail_engine -->|"reads inbox"| node_gmail
node_app -->|"triages threads"| node_triage
node_triage -->|"classifies with"| node_gemini
node_app -->|"generates drafts"| node_draft_machine
node_draft_machine -->|"assembles context"| node_context_builder
node_draft_machine -->|"generates with"| node_gemini
node_app -->|"reviews drafts"| node_approval_gate
node_approval_gate -->|"assembles context"| node_context_builder
node_approval_gate -->|"generates drafts"| node_draft_machine
node_approval_gate -->|"saves approvals"| node_approved_drafts
node_app -->|"sends approved replies"| node_gmail
node_app -->|"schedules meetings"| node_calendar_engine
node_calendar_engine -->|"checks and books"| node_google_calendar
node_app -->|"records actions"| node_task_logger
node_task_logger -->|"reads and writes"| node_action_log
node_app -->|"displays activity"| node_action_log
node_app -->|"exports proof"| node_session_proof

click node_app "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/app.py"
click node_thread_sources "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/app.py"
click node_gmail_engine "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/engine.py"
click node_triage "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/triage.py"
click node_draft_machine "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/draft_machine.py"
click node_context_builder "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/context_builder.py"
click node_approval_gate "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/approval_gate.py"
click node_approved_drafts "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/approved_drafts.json"
click node_calendar_engine "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/calendar_engine.py"
click node_task_logger "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/task_logger.py"
click node_action_log "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/action_log.json"
click node_session_proof "https://github.com/noshinip27-cyber/chief_of_staff/blob/master/app.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_app,node_thread_sources,node_gmail_engine,node_triage,node_user toneBlue
class node_draft_machine,node_context_builder,node_approval_gate,node_approved_drafts toneAmber
class node_calendar_engine,node_gemini toneMint
class node_task_logger,node_action_log,node_session_proof toneRose
class node_gmail,node_google_calendar toneIndigo
```

## Components

### Inbox Workflow

- [Draft Desk UI](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/app.py): `app.py`
- [Thread Sources](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/app.py): `app.py`
- [Gmail Engine](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/engine.py): `engine.py`
- [Inbox Triage](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/triage.py): `triage.py`

### Drafting and Review

- [Draft Generation](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/draft_machine.py): `draft_machine.py`
- [Draft Context](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/context_builder.py): `context_builder.py`
- [Approval Gate](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/approval_gate.py): `approval_gate.py`
- [Approved Drafts](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/approved_drafts.json): `approved_drafts.json`

### Actions and Scheduling

- [Calendar Scheduling](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/calendar_engine.py): `calendar_engine.py`

### Activity Records

- [Action Logging](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/task_logger.py): `task_logger.py`
- [Action Log](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/action_log.json): `action_log.json`
- [Session Proof](https://github.com/noshinip27-cyber/chief_of_staff/blob/master/app.py): `app.py`

### Other components

- **User**
- **Gemini API**
- **Gmail**
- **Google Calendar**

## Connections

- User → Draft Desk UI: operates (evidence: `README.md`)
- Draft Desk UI → Thread Sources: selects source (evidence: `README.md`)
- Draft Desk UI → Gmail Engine: fetches threads (evidence: `app.py`)
- Gmail Engine → Gmail: reads inbox (evidence: `engine.py`)
- Draft Desk UI → Inbox Triage: triages threads (evidence: `app.py`)
- Inbox Triage → Gemini API: classifies with (evidence: `triage.py`)
- Draft Desk UI → Draft Generation: generates drafts (evidence: `app.py`)
- Draft Generation → Draft Context: assembles context (evidence: `draft_machine.py`)
- Draft Generation → Gemini API: generates with (evidence: `draft_machine.py`)
- Draft Desk UI → Approval Gate: reviews drafts (evidence: `README.md`)
- Approval Gate → Draft Context: assembles context (evidence: `approval_gate.py`)
- Approval Gate → Draft Generation: generates drafts (evidence: `approval_gate.py`)
- Approval Gate → Approved Drafts: saves approvals (evidence: `approval_gate.py`)
- Draft Desk UI → Gmail: sends approved replies (evidence: `README.md`)
- Draft Desk UI → Calendar Scheduling: schedules meetings (evidence: `README.md`)
- Calendar Scheduling → Google Calendar: checks and books (evidence: `calendar_engine.py`)
- Draft Desk UI → Action Logging: records actions (evidence: `app.py`)
- Action Logging → Action Log: reads and writes (evidence: `task_logger.py`)
- Draft Desk UI → Action Log: displays activity (evidence: `app.py`)
- Draft Desk UI → Session Proof: exports proof (evidence: `README.md`)
