# swarnabh31/bozo-thewatchdog architecture

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

- Interactive diagram: https://gitdiagram.com/swarnabh31/bozo-thewatchdog
- Repository: https://github.com/swarnabh31/bozo-thewatchdog

## Overview

BoZo is a local-first desktop companion that monitors the screen and machine, decides whether help is timely, then offers a short tip or responds to a user request. The README documents the main workflow from screen capture through OCR and a fast gate to vision-model advice, plus chat, resource status, feedback, tray controls, memory, draft checking, and proactive offers. Most components live in app.py; memory_store.py implements inspectable SQLite persistence. Relationships use README-documented behavior or the shown app.py-to-memory_store.py reference; unsampled implementation details are not inferred.

Main entry points: [`app.py`](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py) (Vision Advice), [`memory_store.py`](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/memory_store.py) (Memory Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_observe["Screen and System"]
  node_capture["Screen Capture<br/>[app.py]"]
  node_ocr["OCR and Errors<br/>[app.py]"]
  node_resources["Resource Monitor<br/>[app.py]"]
end

subgraph group_decide["Decision and Context"]
  node_gate["Timing Gate<br/>[app.py]"]
  node_policy["Interrupt Policy<br/>[app.py]"]
  node_context["Activity Context<br/>[app.py]"]
end

subgraph group_assist["AI Assistance"]
  node_vision["Vision Advice<br/>[app.py]"]
  node_chat["Chat Assistant<br/>[app.py]"]
  node_draft["Draft Check<br/>[app.py]"]
  node_offers["Proactive Offers<br/>[app.py]"]
end

subgraph group_interact["Desktop Experience"]
  node_tray["Tray Controls<br/>[app.py]"]
  node_chatui["Chat Window<br/>[app.py]"]
  node_toast["Whisper Toasts<br/>[app.py]"]
  node_resourcebar["Live Resource Bar<br/>[app.py]"]
  node_memoryui["Memory Manager<br/>[app.py]"]
end

subgraph group_state["Local Memory"]
  node_memory[("Memory Store<br/>[memory_store.py]")]
end

node_user(("User"))
node_desktop["Desktop Screen"]
node_ollama["Ollama"]

node_desktop -->|"captures"| node_capture
node_capture -->|"reads text"| node_ocr
node_ocr -->|"supplies OCR"| node_gate
node_ocr -->|"flags errors"| node_policy
node_capture -->|"tracks changes"| node_policy
node_resources -->|"updates status"| node_resourcebar
node_resources -->|"supplies stats"| node_context
node_gate -->|"scores timing"| node_policy
node_ollama -->|"runs classifier"| node_gate
node_context -->|"provides context"| node_vision
node_capture -->|"provides screenshot"| node_vision
node_policy -->|"requests advice"| node_vision
node_ollama -->|"generates advice"| node_vision
node_vision -->|"shows tip"| node_toast
node_vision -->|"logs tip"| node_chatui
node_user -->|"controls"| node_tray
node_tray -->|"triggers Look now"| node_policy
node_user -->|"asks"| node_chatui
node_chatui -->|"submits message"| node_chat
node_chat -->|"requests response"| node_ollama
node_user -->|"checks draft"| node_draft
node_draft -->|"scores draft"| node_ollama
node_context -->|"informs offers"| node_offers
node_offers -->|"presents offer"| node_chatui
node_user -->|"gives feedback"| node_toast
node_toast -->|"adjusts threshold"| node_policy
node_chatui -->|"records chat"| node_memory
node_vision -->|"records tip"| node_memory
node_memoryui -->|"manages records"| node_memory
node_memory -.->|"recalls context"| node_context

click node_capture "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_ocr "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_resources "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_gate "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_policy "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_context "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_vision "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_chat "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_draft "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_offers "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_tray "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_chatui "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_toast "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_resourcebar "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_memoryui "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py"
click node_memory "https://github.com/swarnabh31/bozo-thewatchdog/blob/main/memory_store.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_capture,node_ocr,node_resources,node_user,node_desktop toneBlue
class node_gate,node_policy,node_context toneAmber
class node_vision,node_chat,node_draft,node_offers toneMint
class node_tray,node_chatui,node_toast,node_resourcebar,node_memoryui toneRose
class node_memory,node_ollama toneIndigo
```

## Components

### Screen and System

- [Screen Capture](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [OCR and Errors](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Resource Monitor](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`

### Decision and Context

- [Timing Gate](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Interrupt Policy](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Activity Context](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`

### AI Assistance

- [Vision Advice](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Chat Assistant](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Draft Check](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Proactive Offers](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`

### Desktop Experience

- [Tray Controls](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Chat Window](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Whisper Toasts](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Live Resource Bar](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`
- [Memory Manager](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/app.py): `app.py`

### Local Memory

- [Memory Store](https://github.com/swarnabh31/bozo-thewatchdog/blob/main/memory_store.py): `memory_store.py`

### Other components

- **User**
- **Desktop Screen**
- **Ollama**

## Connections

- Desktop Screen → Screen Capture: captures (evidence: `README.md`)
- Screen Capture → OCR and Errors: reads text (evidence: `README.md`)
- OCR and Errors → Timing Gate: supplies OCR (evidence: `README.md`)
- OCR and Errors → Interrupt Policy: flags errors (evidence: `README.md`)
- Screen Capture → Interrupt Policy: tracks changes (evidence: `README.md`)
- Resource Monitor → Live Resource Bar: updates status (evidence: `README.md`)
- Resource Monitor → Activity Context: supplies stats (evidence: `README.md`)
- Timing Gate → Interrupt Policy: scores timing (evidence: `README.md`)
- Ollama → Timing Gate: runs classifier (evidence: `README.md`)
- Activity Context → Vision Advice: provides context (evidence: `README.md`)
- Screen Capture → Vision Advice: provides screenshot (evidence: `README.md`)
- Interrupt Policy → Vision Advice: requests advice (evidence: `README.md`)
- Ollama → Vision Advice: generates advice (evidence: `README.md`)
- Vision Advice → Whisper Toasts: shows tip (evidence: `README.md`)
- Vision Advice → Chat Window: logs tip (evidence: `README.md`)
- User → Tray Controls: controls (evidence: `README.md`)
- Tray Controls → Interrupt Policy: triggers Look now (evidence: `README.md`)
- User → Chat Window: asks (evidence: `README.md`)
- Chat Window → Chat Assistant: submits message (evidence: `README.md`)
- Chat Assistant → Ollama: requests response (evidence: `README.md`)
- User → Draft Check: checks draft (evidence: `README.md`)
- Draft Check → Ollama: scores draft (evidence: `README.md`)
- Activity Context → Proactive Offers: informs offers (evidence: `README.md`)
- Proactive Offers → Chat Window: presents offer (evidence: `README.md`)
- User → Whisper Toasts: gives feedback (evidence: `README.md`)
- Whisper Toasts → Interrupt Policy: adjusts threshold (evidence: `README.md`)
- Chat Window → Memory Store: records chat (evidence: `app.py`)
- Vision Advice → Memory Store: records tip (evidence: `app.py`)
- Memory Manager → Memory Store: manages records (evidence: `app.py`)
- Memory Store → Activity Context: recalls context (evidence: `app.py`)
