# State & config by pillar

Paths are under the operator home unless noted. Writers are authoritative for
who owns mutations.

## Library

| Artifact | Path | Writer | Reader |
|----------|------|--------|--------|
| Library snapshot | `~/.local/state/tv-anarchy/library.json` | `LibraryStore` | App |
| Metadata sidecars | `~/.local/state/tv-anarchy/meta/<sha256(path)>.json` | `MetaWriter` | `MetadataController` |
| **Title Library** | `~/.local/state/tv-anarchy/titles/` | `TitleLibrary` | `LibraryDisplayNames`, scan |
| Title refiner cache (legacy) | `~/.local/state/tv-anarchy/title-refinements.json` | `LocalLLMTitleRefiner` | migrate → Title Library |
| Central index | index on the always-on host | `LibraryIndex` via SSH | `LibraryScanner` |

## Watch

| Artifact | Path | Writer | Reader |
|----------|------|--------|--------|
| App settings (`watch` section) | `~/.local/state/tv-anarchy/settings.json` | `SettingsStore` | App |
| Winamp skin cache | `~/.local/state/tv-anarchy/skins/<sha256>/` | `WinampSkinLoader` | `WinampSkinStore` |
| Cross settings (theme) | `settings.json` → `cross` or flat `appTheme` | `SettingsStore` | `RootView` |
| Winamp skin cache | `~/.local/state/tv-anarchy/skins/<sha256>/` | `WinampSkinLoader` | `WinampSkinStore` |
| Resume map on the always-on host | local state on the always-on host | mpv Lua hook | Watch history on central host |
| VLC recents | macOS VLC plist | VLC | `WatchHistory` |
| Offline cache files | configured cache dir *(legacy — → extension tier)* | `OfflineCacheController` | `DownloadsIndex`, players |

## Devices

| Artifact | Path | Writer | Reader |
|----------|------|--------|--------|
| Device registry | `~/.config/tv-anarchy/devices.json` | Devices tab | `PlayerController`, governor |
| Install registry | `~/.config/tv-anarchy/fleet.json` | Operator / mesh join | Governor |
| Engine state | `~/.local/state/tv-anarchy/fleet-state.json` | Governor | `fleet *` CLI |
| Storage pool config | `~/.local/state/tv-anarchy/devices/storage-pools.json` *(planned)* | Devices UI | Placement |
| Media placement index | `~/.local/state/tv-anarchy/media-placement.json` *(planned)* | PlacementController | `MediaPaths`, Library |
| VPN profiles | app support + Keychain | `VPNController` | Settings → Devices |
| Adult rotation state | app-managed | `PornCollectionService` | Adult tab |

## Download

| Artifact | Path | Writer | Reader |
|----------|------|--------|--------|
| Watch log (append) | `~/.local/state/tv-anarchy-mcp/watched.jsonl` | Governor, mcp | `WatchHistory`, governor |
| Governor config | `~/.config/portable-net-tv/config.json` | Operator | Governor, `VLCConfig` |
| Prefetch buffer | `config.buffer.dir` | Governor keeper | Local VLC path (optional) |
| Fleet registry | `~/.config/tv-anarchy/fleet.json` | Operator / app | Governor fleet engine |
| Fleet engine state | `~/.local/state/tv-anarchy/fleet-state.json` | Governor | `fleet *` CLI |
| Transmission torrents | transmission on the always-on host | transmission | `TorrentService`, fleet |
| Completed media tree | media root on the always-on host | transmission | `LibraryScanner` |
| Holdings / re-pin records | fleet-state (actuate) | `fleet repin` | `fleet custody` |

## Net (planned)

| Artifact | Path | Writer | Reader |
|----------|------|--------|--------|
| Net subscriptions | `fleet.json` → `net.subscriptions[]` | Operator | Net publisher (TBD) |
| Local observation queue | `~/.local/state/tv-anarchy/net/observations.jsonl` | App | Net publisher (TBD) |
| Merged part views | `~/.local/state/tv-anarchy/net/merged/<part>.json` | Net merge (TBD) | Watch, Download |
| Edition torrents | swarm / cache dir | Net publisher (TBD) | Subscribers |

## Cross-cutting

| Artifact | Path | Pillars |
|----------|------|---------|
| Forgejo token | `~/.config/tv-anarchy/forgejo-token` | X (release) |
| Bridge env | `~/.config/tvanarchy-bridge/bridge.env` | X (iOS bridge) |
| Build stamp | `Sources/TVAnarchyCore/BuildStamp.swift` (gitignored) | X |
| Theme + Winamp skin pointers | `settings.json` → `cross` (or flat legacy) | X + Watch (heavy chrome) |
| Winamp skin cache | `~/.local/state/tv-anarchy/skins/<sha256>/` | X (cross) + Watch |

## Migration notes (v1 → v2 naming)

No path changes in v2 phase 0 — documentation only. Future Net state lives
under `~/.local/state/tv-anarchy/net/` to keep pillar boundaries obvious.