Select the types of activity you want to include in your feed.
docs: update project context for user-theme-preferences branch
Document the theme resolution waterfall (now 5 steps with user preference cookies) and the cookie protocol contract for atbb-light-theme / atbb-dark-theme in CLAUDE.md.
···181181 }
182182 ```
183183184184+## Theme Resolution & Cookie Protocol
185185+186186+<!-- freshness: 2026-03-20 -->
187187+188188+The web app resolves which theme to render via a 5-step waterfall in `apps/web/src/lib/theme-resolution.ts`:
189189+190190+1. **Detect color scheme** -- `atbb-color-scheme` cookie or `Sec-CH-Prefers-Color-Scheme` hint (default: `light`)
191191+2. **Fetch theme policy** -- `GET /api/theme-policy` from AppView (cached in-memory with TTL)
192192+3. **User preference** -- `atbb-light-theme` / `atbb-dark-theme` cookie (validated against `policy.availableThemes`; ignored when `policy.allowUserChoice` is false)
193193+4. **Forum default** -- `defaultLightThemeUri` / `defaultDarkThemeUri` from policy
194194+5. **Hardcoded fallback** -- neobrutal-light or neobrutal-dark bundled presets
195195+196196+**Cookie contracts:**
197197+198198+| Cookie | Written by | Contains | Max-Age |
199199+|--------|-----------|----------|---------|
200200+| `atbb-color-scheme` | Client-side JS (toggle button) | `light` or `dark` | 1 year |
201201+| `atbb-light-theme` | `POST /settings/appearance` | AT URI of chosen light theme | 1 year |
202202+| `atbb-dark-theme` | `POST /settings/appearance` | AT URI of chosen dark theme | 1 year |
203203+204204+**Invariants:**
205205+- User preference cookies are always validated against the current `policy.availableThemes` on read. Stale or removed theme URIs silently fall through to the forum default.
206206+- `resolveTheme()` never throws -- it always returns a usable `ResolvedTheme`.
207207+- Settings routes (`/settings`, `/settings/appearance`, `/settings/preview`) require authentication. The preference form is only rendered when `policy.allowUserChoice` is true.
208208+184209## Middleware Patterns
185210186211### Middleware Composition