# BaoLife — Make It a Balanced, Fun, Retentive Game

## Objective

Execute **every** recommendation from the 6-agent BaoLife game-design audit (Tier 0 broken-loop bug fixes, Tier 1 wire-existing-systems, Tier 2 missing-spine retention/progression, Tier 3 UX polish), and confirm each change works in the **iOS app (priority)** and the **Android app**. The TypeScript backend (`server/`) is the source of truth for game logic; iOS and Android must reflect the new behavior.

## Original Request

"Execute ALL the suggested changes — literally all of them. Set to-dos / a tracking .md file, set a goal so we're clear through multiple runs, use subagents as needed, confirm working in iOS and Android (iOS takes priority). Use as many tokens as needed. Getting it done is the key item."

## Intake Summary

- Input shape: `existing_plan` (a detailed audit with concrete file:line references) + `specific`
- Audience: BaoLife players (retention/fun) and Craig (shippable MVP toward TestFlight)
- Authority: `approved` — user explicitly said execute all of them, use subagents, use defaults
- Proof type: `test` + `demo` — backend vitest/tsc green AND in-app behavioral confirmation
- Completion proof: see Goal Oracle below
- Likely misfire: (1) building NEW systems instead of WIRING the ~200 events / retention plumbing / affinity that already exist; (2) declaring done after backend tests pass without confirming behavior in the actual iOS/Android apps; (3) fixing Tier 0 "bugs" that are actually intended design without root-cause confirmation; (4) iOS/backend drift where backend changes aren't surfaced in the client.
- Blind spots considered: dual game-loop paths (online `PlayerSession` vs offline `GameEngine`) — fixes usually need mirroring in BOTH; the legacy `ws/` Python backend is reference-only and must NOT be edited; "200+ events" exist but only ~35 are wired into the live v2 catalog; new-game resets (diamonds, etc.); production runs `tsx` directly (no build step) so type errors only surface via local `tsc`.
- Existing plan facts: preserved in `state.yaml` `goal.intake.existing_plan_facts` (the full tiered recommendation list with file references from all six agents).

## Goal Oracle

The oracle for this goal is:

`Backend vitest suite is green with no net regressions vs. the captured baseline AND tsc --noEmit is clean AND a documented in-app iOS walkthrough confirms each audit fix behaves correctly in the running app, AND the Android app builds with parity smoke confirmation.`

Concretely, the in-app walkthrough must demonstrate (at minimum):
1. An online/connected character accrues income and pays expenses over time (economy is no longer frozen).
2. A negative relationship (affinity < 0) persists across an overnight day-tick (no nightly reset to 0).
3. An event prompt pauses the simulation while awaiting a choice (online path).
4. Onboarding guided actions navigate to the correct, existing screens.
5. Death produces a life-summary / obituary + score and offers a New Life / legacy flow.
6. Reconnecting after offline time shows a "welcome back" digest of what happened.
7. Stat changes surface as visible feedback (floating deltas / numeric transitions) outside the event modal.
8. Player can initiate an activity / steer the daily plan (proactive agency exists).
9. Affinity meaningfully affects gameplay (favors/loans/inheritance/grief), not just a tracked number.
10. Forward-looking Life Goals/Aspirations are visible and progress; old-age/late-life content exists.

The PM must keep comparing receipts to this oracle. Backend-green alone is NOT completion — the iOS app must be exercised. The goal finishes only when a final Judge/PM audit maps receipts + verification + the in-app walkthrough back to this oracle and records `full_outcome_complete: true`.

## Goal Kind

`existing_plan`

## Current Tranche

Continuous execution to the FULL outcome: validate the audit against the live codebase, then complete successive safe verified Worker packages tier-by-tier (Tier 0 → 1 → 2 → 3), confirm each in iOS (priority) then Android, reviewing only at phase/risk/final boundaries, until every audit recommendation is implemented and behaviorally confirmed.

## Non-Negotiable Constraints

- **Never edit the legacy Python `ws/` backend** — reference only; production runs TypeScript `server/`.
- **Mirror loop fixes across BOTH paths** — online `game/PlayerSession.ts` AND offline `game/engine/{LoopManager,GameEngine}.ts` — and keep `player.events` dedup keys aligned (see project memory).
- **Confirm root cause before editing** any Tier 0 "bug" — verify the actual code path with file:line evidence (per global CLAUDE.md).
- **Verify schema before referencing** DB columns / fields (per global CLAUDE.md).
- **No production writes / no destructive ops** without explicit approval. Local dev + tests only. Do not deploy to `lichun-master` unless the user asks.
- **iOS is the priority platform.** Android parity follows iOS for each tier; Android may lag but must not be skipped.
- After backend changes: always run `npx tsc --noEmit` then `npx vitest run` in `server/` and compare test counts to baseline.
- Keep `notes/PROGRESS.md` updated as items complete (human-readable tracker the user requested).
- Prefer wiring existing systems over building new ones (the audit's central finding).

## Stop Rule

Stop only when a final audit proves the full original outcome (all tiers, iOS + Android confirmed) is complete with `full_outcome_complete: true`.

Do not stop after planning, Scout, or Judge selection. Do not stop after one tier when later tiers have safe local work. Missing simulator/credentials/device access blocks a specific task, not the goal — mark that slice blocked, spawn a safe workaround, and continue.

## Slice Sizing

Largest safe useful slice. A good Worker package = one coherent vertical (e.g., "online economy loop wired + tested" or "death → life-summary backend + iOS screen"). Group same-shape work (e.g., porting multiple legacy event arcs) into one package. Tiny tasks only when risk/scope demands.

## Canonical Board

Machine truth: `docs/goals/baolife-fun-balance/state.yaml`. Human tracker: `docs/goals/baolife-fun-balance/notes/PROGRESS.md`. If charter and `state.yaml` disagree, `state.yaml` wins.

## Run Command

```text
/goal Follow docs/goals/baolife-fun-balance/goal.md.
```

## PM Loop

On every `/goal` continuation: read this charter, read `state.yaml`, re-check intake + likely misfire, work only the active task, assign Scout/Judge/Worker/PM, write a compact receipt, update the board + `notes/PROGRESS.md`, advance to the next largest safe Worker package, review only at phase/risk/final boundaries, and finish only with a Judge/PM audit receipt that maps receipts + verification + the in-app walkthrough to the oracle and records `full_outcome_complete: true`.
