# Live Ops Remote Config Runbook

This runbook covers the `LiveOpsSubsystem` remote config and feature flag
workflow for shipped games.

## Config Workflow

1. Author config entries with stable keys such as `enemy.health.goblin`,
   `loot.dropRate.legendary`, and `xp.curve.multiplier`.
2. Add segment overrides only when the segment has a clear player-facing
   purpose, such as platform rollout, region tuning, veteran-player tuning, or
   an A/B group.
3. Build a staging preview with representative player contexts.
4. Run validation before publish.
5. Publish a new immutable version with actor, reason, timestamp, and changed
   keys in the audit log.
6. Use config deltas for client delivery so clients download only changed keys.
7. Keep the last known-good version available for rollback.

## Feature Flags

Feature flags support:

- enabled/disabled state
- percent rollout
- segment targeting
- weighted variants
- client-side caching for offline play
- kill switch activation

Clients should bootstrap from cache when it is fresh, refresh periodically when
online, and continue using the last cached snapshot if the flag endpoint is not
reachable.

## Validation Rules

The default validation rules protect common balance keys:

- health must be at least 1
- damage must be non-negative
- drop rates must remain below the configured maximum
- XP values must be non-negative

Game teams can add stricter project-specific rules for economy, matchmaking, AI,
or event tuning keys.

## Emergency Operations

Use the kill switch for a critical feature-specific issue. It disables the flag,
sets rollout to zero, records a reason, and makes evaluation return disabled for
every client without a patch.

Use maintenance mode when all clients need to be redirected during an outage or
server update. Operator accounts can be allowed through with bypass tags for
verification.

Use message-of-the-day announcements for events, downtime, patch notes, and
player-facing incident updates. Messages are filtered by time window and
segment, then sorted by priority.

## Release Gates

Run these checks before shipping remote config or flag changes:

```bash
pnpm --dir libs/aphrodite/game-rpg exec tsc -p tsconfig.spec.json --noEmit
pnpm --dir libs/aphrodite/game-rpg lint
pnpm --dir libs/aphrodite/game-rpg build
pnpm --dir libs/aphrodite/game-rpg test
```

Operational signoff should include:

- validation report with zero blocking issues
- staging preview for at least one default player and one targeted player
- audit entry with actor, reason, and changed keys
- delta size estimate
- rollback target identified
- kill switch owner identified for risky features
- dashboard snapshot reviewed before production publish
