# stephen-os/sift architecture

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

- Interactive diagram: https://gitdiagram.com/stephen-os/sift
- Repository: https://github.com/stephen-os/sift

## Overview

sift is a Windows tray app and CLI for sorting OBS clips into game-specific folders. Users configure watched and fallback folders and register games, then launch the watcher. Its runtime waits for new clips to finish writing, identifies a running game, chooses a destination and filename, and moves the clip; the tray reports activity and supports live settings reload. The README also documents database refresh, start-on-login, and console mode. Edges reflect shown calls or README-described behavior; no other unsampled internals are inferred.

Main entry points: [`src/sift/watcher.py`](https://github.com/stephen-os/sift/blob/main/src/sift/watcher.py) (Folder watcher), [`src/sift/tray.py`](https://github.com/stephen-os/sift/blob/main/src/sift/tray.py) (System tray), [`src/sift/cli.py`](https://github.com/stephen-os/sift/blob/main/src/sift/cli.py) (CLI commands), [`src/sift/gamedb.py`](https://github.com/stephen-os/sift/blob/main/src/sift/gamedb.py) (Game database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User controls"]
  node_cli["CLI commands<br/>[cli.py]"]
end

subgraph group_settings["Configuration and identity"]
  node_settings_store[("Settings<br/>[config.py]")]
  node_game_db[("Game database<br/>[gamedb.py]")]
  node_game_data[("Bundled game data")]
end

subgraph group_sorting["Clip processing"]
  node_watcher["Folder watcher<br/>[watcher.py]"]
  node_router["Game and destination routing<br/>[router.py]"]
end

subgraph group_interface["Tray and notifications"]
  node_tray["System tray<br/>[tray.py]"]
  node_notifications["Desktop alerts<br/>[notify.py]"]
  node_autostart["Login startup<br/>[autostart.py]"]
end

node_user(("User"))
node_online_db["Game data source"]
node_obs_folder[("OBS output folder")]
node_processes["Running processes"]
node_clip_folders[("Clip destination folders")]
node_windows_registry[("Windows registry")]

node_user -->|"runs commands"| node_cli
node_cli -->|"edits settings"| node_settings_store
node_cli -->|"lists or updates"| node_game_db
node_cli -->|"launches console mode"| node_watcher
node_cli -->|"launches tray mode"| node_tray
node_cli -->|"shows fatal errors"| node_notifications
node_game_db -->|"loads bundled data"| node_game_data
node_game_db -->|"downloads updates"| node_online_db
node_watcher -->|"watches new clips"| node_obs_folder
node_watcher -->|"reads running executables"| node_processes
node_watcher -->|"routes stable clips"| node_router
node_router -->|"uses game settings"| node_settings_store
node_router -->|"identifies unmatched executables"| node_game_db
node_watcher -->|"moves clips"| node_clip_folders
node_tray -->|"starts and controls"| node_watcher
node_tray -->|"reloads settings"| node_settings_store
node_tray -->|"refreshes database"| node_game_db
node_watcher -->|"reports moves and errors"| node_tray
node_tray -->|"toggles login launch"| node_autostart
node_autostart -->|"writes startup entry"| node_windows_registry
node_tray -.->|"shows fatal errors"| node_notifications

click node_cli "https://github.com/stephen-os/sift/blob/main/src/sift/cli.py"
click node_settings_store "https://github.com/stephen-os/sift/blob/main/src/sift/config.py"
click node_game_db "https://github.com/stephen-os/sift/blob/main/src/sift/gamedb.py"
click node_game_data "https://github.com/stephen-os/sift/tree/main/src/sift/data"
click node_watcher "https://github.com/stephen-os/sift/blob/main/src/sift/watcher.py"
click node_router "https://github.com/stephen-os/sift/blob/main/src/sift/router.py"
click node_tray "https://github.com/stephen-os/sift/blob/main/src/sift/tray.py"
click node_notifications "https://github.com/stephen-os/sift/blob/main/src/sift/notify.py"
click node_autostart "https://github.com/stephen-os/sift/blob/main/src/sift/autostart.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_cli,node_user toneBlue
class node_settings_store,node_game_db,node_game_data,node_obs_folder,node_clip_folders,node_windows_registry toneAmber
class node_watcher,node_router toneMint
class node_tray,node_notifications,node_autostart toneRose
class node_online_db,node_processes toneIndigo
```

## Components

### User controls

- [CLI commands](https://github.com/stephen-os/sift/blob/main/src/sift/cli.py): `src/sift/cli.py`

### Configuration and identity

- [Settings](https://github.com/stephen-os/sift/blob/main/src/sift/config.py): `src/sift/config.py`
- [Game database](https://github.com/stephen-os/sift/blob/main/src/sift/gamedb.py): `src/sift/gamedb.py`
- [Bundled game data](https://github.com/stephen-os/sift/tree/main/src/sift/data): `src/sift/data`

### Clip processing

- [Folder watcher](https://github.com/stephen-os/sift/blob/main/src/sift/watcher.py): `src/sift/watcher.py`
- [Game and destination routing](https://github.com/stephen-os/sift/blob/main/src/sift/router.py): `src/sift/router.py`

### Tray and notifications

- [System tray](https://github.com/stephen-os/sift/blob/main/src/sift/tray.py): `src/sift/tray.py`
- [Desktop alerts](https://github.com/stephen-os/sift/blob/main/src/sift/notify.py): `src/sift/notify.py`
- [Login startup](https://github.com/stephen-os/sift/blob/main/src/sift/autostart.py): `src/sift/autostart.py`

### Other components

- **User**
- **Game data source**
- **OBS output folder**
- **Running processes**
- **Clip destination folders**
- **Windows registry**

## Connections

- User → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Settings: edits settings (evidence: `src/sift/cli.py`)
- CLI commands → Game database: lists or updates (evidence: `src/sift/cli.py`)
- CLI commands → Folder watcher: launches console mode (evidence: `src/sift/cli.py`)
- CLI commands → System tray: launches tray mode (evidence: `src/sift/cli.py`)
- CLI commands → Desktop alerts: shows fatal errors (evidence: `src/sift/cli.py`)
- Game database → Bundled game data: loads bundled data (evidence: `src/sift/gamedb.py`)
- Game database → Game data source: downloads updates (evidence: `src/sift/gamedb.py`)
- Folder watcher → OBS output folder: watches new clips (evidence: `src/sift/watcher.py`)
- Folder watcher → Running processes: reads running executables (evidence: `src/sift/watcher.py`)
- Folder watcher → Game and destination routing: routes stable clips (evidence: `src/sift/watcher.py`)
- Game and destination routing → Settings: uses game settings (evidence: `src/sift/router.py`)
- Game and destination routing → Game database: identifies unmatched executables (evidence: `src/sift/router.py`)
- Folder watcher → Clip destination folders: moves clips (evidence: `src/sift/watcher.py`)
- System tray → Folder watcher: starts and controls (evidence: `src/sift/tray.py`)
- System tray → Settings: reloads settings (evidence: `src/sift/tray.py`)
- System tray → Game database: refreshes database (evidence: `src/sift/tray.py`)
- Folder watcher → System tray: reports moves and errors (evidence: `src/sift/watcher.py`)
- System tray → Login startup: toggles login launch (evidence: `src/sift/tray.py`)
- Login startup → Windows registry: writes startup entry (evidence: `src/sift/autostart.py`)
- System tray → Desktop alerts: shows fatal errors
