# wshrepo/oc-notify architecture

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

- Interactive diagram: https://gitdiagram.com/wshrepo/oc-notify
- Repository: https://github.com/wshrepo/oc-notify

## Overview

oc-notify is a Windows desktop notification companion for the opencode CLI. The principal flow is opencode events through the plugin’s filtering and enrichment into a named-pipe message; the desktop app accepts it, applies configuration and notification policy, then presents an animated, dismissible bubble. The graph also shows configuration hot reload, category styling, window placement, and idle shutdown. Edges are limited to sampled source or README evidence; unsampled implementation details are not inferred.

Main entry points: [`src/OcNotify/App.xaml.cs`](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/App.xaml.cs) (App Lifecycle), [`src/plugin/notify-bubble.ts`](https://github.com/wshrepo/oc-notify/blob/master/src/plugin/notify-bubble.ts) (Event Plugin), [`src/OcNotify/Services/NotificationManager.cs`](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/NotificationManager.cs) (Notification Manager), [`src/OcNotify/MainWindow.xaml.cs`](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/MainWindow.xaml.cs) (Bubble Window)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["opencode Plugin"]
  node_event_plugin["Event Plugin<br/>[notify-bubble.ts]"]
  node_five_events["Five Event Types<br/>[notify-bubble.ts]"]
  node_session_context["Session Context<br/>[notify-bubble.ts]"]
end

subgraph group_transport["Message Transport"]
  node_pipe_protocol["Pipe Message<br/>[NotifyMessage.cs]"]
  node_pipe_server["Named Pipe Server<br/>[PipeServer.cs]"]
end

subgraph group_runtime["Notification Runtime"]
  node_app["App Lifecycle<br/>[App.xaml.cs]"]
  node_manager["Notification Manager"]
  node_item["Notification State"]
  node_config_service["Configuration Service<br/>[ConfigService.cs]"]
  node_config_model["Configuration Model<br/>[NotifyConfig.cs]"]
end

subgraph group_presentation["Bubble Presentation"]
  node_main_window["Bubble Window<br/>[MainWindow.xaml.cs]"]
  node_card["Notification Card"]
  node_category["Category Styling<br/>[CategoryInfo.cs]"]
  node_dwm["Windows DWM<br/>[DwmHelper.cs]"]
end

node_opencode(("opencode CLI"))

node_opencode -->|"loads plugin"| node_event_plugin
node_event_plugin -->|"handles events"| node_five_events
node_event_plugin -->|"looks up session"| node_session_context
node_event_plugin -->|"writes pipe"| node_pipe_server
node_event_plugin -->|"launches app"| node_app
node_pipe_server -->|"parses messages"| node_pipe_protocol
node_app -->|"starts server"| node_pipe_server
node_pipe_server -->|"raises messages"| node_app
node_app -->|"forwards messages"| node_manager
node_app -->|"creates window"| node_main_window
node_app -->|"initializes service"| node_config_service
node_app -->|"reads idle settings"| node_config_service
node_manager -->|"loads settings"| node_config_service
node_manager -->|"gets category"| node_category
node_manager -->|"creates state"| node_item
node_config_service -->|"loads config"| node_config_model
node_manager -->|"notifies card changes"| node_main_window
node_main_window -->|"creates and binds"| node_card
node_card -->|"gets category"| node_category
node_main_window -->|"refreshes on change"| node_config_service
node_main_window -->|"sets window attributes"| node_dwm

click node_event_plugin "https://github.com/wshrepo/oc-notify/blob/master/src/plugin/notify-bubble.ts"
click node_five_events "https://github.com/wshrepo/oc-notify/blob/master/src/plugin/notify-bubble.ts"
click node_session_context "https://github.com/wshrepo/oc-notify/blob/master/src/plugin/notify-bubble.ts"
click node_pipe_protocol "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Models/NotifyMessage.cs"
click node_pipe_server "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/PipeServer.cs"
click node_app "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/App.xaml.cs"
click node_manager "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/NotificationManager.cs"
click node_item "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Models/NotificationItem.cs"
click node_config_service "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/ConfigService.cs"
click node_config_model "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Models/NotifyConfig.cs"
click node_main_window "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/MainWindow.xaml.cs"
click node_card "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Controls/NotificationCard.xaml.cs"
click node_category "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Helpers/CategoryInfo.cs"
click node_dwm "https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/DwmHelper.cs"

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_event_plugin,node_five_events,node_session_context toneBlue
class node_pipe_protocol,node_pipe_server toneAmber
class node_app,node_manager,node_item,node_config_service,node_config_model toneMint
class node_main_window,node_card,node_category,node_dwm toneRose
class node_opencode toneIndigo
```

## Components

### opencode Plugin

- [Event Plugin](https://github.com/wshrepo/oc-notify/blob/master/src/plugin/notify-bubble.ts): `src/plugin/notify-bubble.ts`
- [Five Event Types](https://github.com/wshrepo/oc-notify/blob/master/src/plugin/notify-bubble.ts): `src/plugin/notify-bubble.ts`
- [Session Context](https://github.com/wshrepo/oc-notify/blob/master/src/plugin/notify-bubble.ts): `src/plugin/notify-bubble.ts`

### Message Transport

- [Pipe Message](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Models/NotifyMessage.cs): `src/OcNotify/Models/NotifyMessage.cs`
- [Named Pipe Server](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/PipeServer.cs): `src/OcNotify/Services/PipeServer.cs`

### Notification Runtime

- [App Lifecycle](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/App.xaml.cs): `src/OcNotify/App.xaml.cs`
- [Notification Manager](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/NotificationManager.cs): `src/OcNotify/Services/NotificationManager.cs`
- [Notification State](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Models/NotificationItem.cs): `src/OcNotify/Models/NotificationItem.cs`
- [Configuration Service](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/ConfigService.cs): `src/OcNotify/Services/ConfigService.cs`
- [Configuration Model](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Models/NotifyConfig.cs): `src/OcNotify/Models/NotifyConfig.cs`

### Bubble Presentation

- [Bubble Window](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/MainWindow.xaml.cs): `src/OcNotify/MainWindow.xaml.cs`
- [Notification Card](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Controls/NotificationCard.xaml.cs): `src/OcNotify/Controls/NotificationCard.xaml.cs`
- [Category Styling](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Helpers/CategoryInfo.cs): `src/OcNotify/Helpers/CategoryInfo.cs`
- [Windows DWM](https://github.com/wshrepo/oc-notify/blob/master/src/OcNotify/Services/DwmHelper.cs): `src/OcNotify/Services/DwmHelper.cs`

### Other components

- **opencode CLI**

## Connections

- opencode CLI → Event Plugin: loads plugin (evidence: `README.md`)
- Event Plugin → Five Event Types: handles events (evidence: `README.md`)
- Event Plugin → Session Context: looks up session (evidence: `src/plugin/notify-bubble.ts`)
- Event Plugin → Named Pipe Server: writes pipe
- Event Plugin → App Lifecycle: launches app (evidence: `README.md`)
- Named Pipe Server → Pipe Message: parses messages (evidence: `src/OcNotify/Services/PipeServer.cs`)
- App Lifecycle → Named Pipe Server: starts server (evidence: `src/OcNotify/App.xaml.cs`)
- Named Pipe Server → App Lifecycle: raises messages (evidence: `src/OcNotify/App.xaml.cs`)
- App Lifecycle → Notification Manager: forwards messages (evidence: `src/OcNotify/App.xaml.cs`)
- App Lifecycle → Bubble Window: creates window (evidence: `src/OcNotify/App.xaml.cs`)
- App Lifecycle → Configuration Service: initializes service (evidence: `src/OcNotify/App.xaml.cs`)
- App Lifecycle → Configuration Service: reads idle settings (evidence: `src/OcNotify/App.xaml.cs`)
- Notification Manager → Configuration Service: loads settings (evidence: `src/OcNotify/Services/NotificationManager.cs`)
- Notification Manager → Category Styling: gets category (evidence: `src/OcNotify/Services/NotificationManager.cs`)
- Notification Manager → Notification State: creates state (evidence: `src/OcNotify/Services/NotificationManager.cs`)
- Configuration Service → Configuration Model: loads config (evidence: `src/OcNotify/Services/ConfigService.cs`)
- Notification Manager → Bubble Window: notifies card changes (evidence: `src/OcNotify/MainWindow.xaml.cs`)
- Bubble Window → Notification Card: creates and binds (evidence: `src/OcNotify/MainWindow.xaml.cs`)
- Notification Card → Category Styling: gets category (evidence: `src/OcNotify/Controls/NotificationCard.xaml.cs`)
- Bubble Window → Configuration Service: refreshes on change (evidence: `src/OcNotify/MainWindow.xaml.cs`)
- Bubble Window → Windows DWM: sets window attributes (evidence: `src/OcNotify/MainWindow.xaml.cs`)
