# theacidjaguar/purrgram architecture

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

- Interactive diagram: https://gitdiagram.com/theacidjaguar/purrgram
- Repository: https://github.com/theacidjaguar/purrgram

## Overview

Purrgram is a native macOS desktop pet. The main workflow is a running menu-bar app that advances a simulated cat among the user’s windows and draws it on screen; users can interact with the cat and manage its needs and appearance. Cat behavior is separated into decision-making, interactions, and pose generation, while views and a pixel painter handle presentation. The README documents local saves and offline operation; sampled excerpts do not show the save implementation or all UI wiring, so those connections are omitted.

Main entry points: [`Sources/Cat.swift`](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Cat.swift) (Cat simulation), [`Sources/App.swift`](https://github.com/theacidjaguar/purrgram/blob/main/Sources/App.swift) (App runtime), [`Sources/World.swift`](https://github.com/theacidjaguar/purrgram/blob/main/Sources/World.swift) (Desktop world), [`Sources/Render.swift`](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Render.swift) (Offline rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_app["App runtime<br/>[App.swift]"]
  node_world["Desktop world<br/>[World.swift]"]
  node_main["App bootstrap<br/>[main.swift]"]
end

subgraph group_behavior["Cat behavior"]
  node_cat["Cat simulation<br/>[Cat.swift]"]
  node_brain["Behavior planning<br/>[CatBrain.swift]"]
  node_interactions["Cat interactions"]
  node_poses["Pose generation<br/>[CatPoses.swift]"]
  node_props["Toys and props<br/>[Props.swift]"]
end

subgraph group_presentation["Pixel presentation"]
  node_views["Cat and bowl views<br/>[Views.swift]"]
  node_painter["Pixel painter<br/>[Painter.swift]"]
  node_render["Offline rendering<br/>[Render.swift]"]
end

subgraph group_support["State and settings"]
  node_settings["Preferences UI<br/>[Settings.swift]"]
  node_state[("Saved state<br/>[State.swift]")]
  node_coats["Coat definitions<br/>[Coats.swift]"]
  node_sound["Sound effects<br/>[Sound.swift]"]
  node_helpers["Shared helpers<br/>[Helpers.swift]"]
end

node_user(("Mac user"))

node_user -->|"uses"| node_app
node_app -->|"manages"| node_cat
node_app -->|"uses"| node_world
node_app -->|"opens"| node_settings
node_cat -->|"queries"| node_world
node_brain -->|"extends"| node_cat
node_interactions -->|"extends"| node_cat
node_poses -->|"extends"| node_cat
node_props -->|"uses"| node_world
node_props -->|"uses"| node_cat
node_views -->|"uses"| node_cat
node_views -->|"uses"| node_painter
node_render -->|"uses"| node_world
node_render -->|"uses"| node_cat
node_render -->|"uses"| node_painter

click node_app "https://github.com/theacidjaguar/purrgram/blob/main/Sources/App.swift"
click node_world "https://github.com/theacidjaguar/purrgram/blob/main/Sources/World.swift"
click node_cat "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Cat.swift"
click node_brain "https://github.com/theacidjaguar/purrgram/blob/main/Sources/CatBrain.swift"
click node_interactions "https://github.com/theacidjaguar/purrgram/blob/main/Sources/CatInteractions.swift"
click node_poses "https://github.com/theacidjaguar/purrgram/blob/main/Sources/CatPoses.swift"
click node_props "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Props.swift"
click node_views "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Views.swift"
click node_painter "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Painter.swift"
click node_render "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Render.swift"
click node_settings "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Settings.swift"
click node_state "https://github.com/theacidjaguar/purrgram/blob/main/Sources/State.swift"
click node_coats "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Coats.swift"
click node_sound "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Sound.swift"
click node_helpers "https://github.com/theacidjaguar/purrgram/blob/main/Sources/Helpers.swift"
click node_main "https://github.com/theacidjaguar/purrgram/blob/main/Sources/main.swift"

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_world,node_main,node_user toneBlue
class node_cat,node_brain,node_interactions,node_poses,node_props toneAmber
class node_views,node_painter,node_render toneMint
class node_settings,node_state,node_coats,node_sound,node_helpers toneRose
```

## Components

### App runtime

- [App runtime](https://github.com/theacidjaguar/purrgram/blob/main/Sources/App.swift): `Sources/App.swift`
- [Desktop world](https://github.com/theacidjaguar/purrgram/blob/main/Sources/World.swift): `Sources/World.swift`
- [App bootstrap](https://github.com/theacidjaguar/purrgram/blob/main/Sources/main.swift): `Sources/main.swift`

### Cat behavior

- [Cat simulation](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Cat.swift): `Sources/Cat.swift`
- [Behavior planning](https://github.com/theacidjaguar/purrgram/blob/main/Sources/CatBrain.swift): `Sources/CatBrain.swift`
- [Cat interactions](https://github.com/theacidjaguar/purrgram/blob/main/Sources/CatInteractions.swift): `Sources/CatInteractions.swift`
- [Pose generation](https://github.com/theacidjaguar/purrgram/blob/main/Sources/CatPoses.swift): `Sources/CatPoses.swift`
- [Toys and props](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Props.swift): `Sources/Props.swift`

### Pixel presentation

- [Cat and bowl views](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Views.swift): `Sources/Views.swift`
- [Pixel painter](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Painter.swift): `Sources/Painter.swift`
- [Offline rendering](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Render.swift): `Sources/Render.swift`

### State and settings

- [Preferences UI](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Settings.swift): `Sources/Settings.swift`
- [Saved state](https://github.com/theacidjaguar/purrgram/blob/main/Sources/State.swift): `Sources/State.swift`
- [Coat definitions](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Coats.swift): `Sources/Coats.swift`
- [Sound effects](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Sound.swift): `Sources/Sound.swift`
- [Shared helpers](https://github.com/theacidjaguar/purrgram/blob/main/Sources/Helpers.swift): `Sources/Helpers.swift`

### Other components

- **Mac user**

## Connections

- Mac user → App runtime: uses (evidence: `README.md`)
- App runtime → Cat simulation: manages (evidence: `Sources/App.swift`)
- App runtime → Desktop world: uses (evidence: `Sources/App.swift`)
- App runtime → Preferences UI: opens (evidence: `Sources/App.swift`)
- Cat simulation → Desktop world: queries (evidence: `Sources/Cat.swift`)
- Behavior planning → Cat simulation: extends (evidence: `Sources/CatBrain.swift`)
- Cat interactions → Cat simulation: extends (evidence: `Sources/CatInteractions.swift`)
- Pose generation → Cat simulation: extends (evidence: `Sources/CatPoses.swift`)
- Toys and props → Desktop world: uses (evidence: `Sources/Props.swift`)
- Toys and props → Cat simulation: uses (evidence: `Sources/Props.swift`)
- Cat and bowl views → Cat simulation: uses (evidence: `Sources/Views.swift`)
- Cat and bowl views → Pixel painter: uses (evidence: `Sources/Views.swift`)
- Offline rendering → Desktop world: uses (evidence: `Sources/Render.swift`)
- Offline rendering → Cat simulation: uses (evidence: `Sources/Render.swift`)
- Offline rendering → Pixel painter: uses (evidence: `Sources/Render.swift`)
