# CLAUDE.md Operating manual for AI agents working in the **Rosea** repository. Read this together with [`HANDOVER.md`](HANDOVER.md) (where the last session left off), [`docs/GAMEPLAY.md`](docs/GAMEPLAY.md) (the play loop — **decided; read before any game code**), [`docs/ROADMAP.md`](docs/ROADMAP.md) (the phase plan and its gates), [`docs/PRINCIPLES.md`](docs/PRINCIPLES.md) (why the game is the way it is), [`docs/ART.md`](docs/ART.md) and [`art/STYLE.md`](art/STYLE.md) (how every illustration is made). [`docs/LETTER.md`](docs/LETTER.md) belongs to the author — agents scaffold it, never write its voice. For the engineering picture read [`.agents/GAP_ANALYSIS.md`](.agents/GAP_ANALYSIS.md), then [`.agents/FEATURES.md`](.agents/FEATURES.md), then the per-feature documents in [`.agents/features/`](.agents/features/). > **This repository is new, and this manual is partly borrowed.** Most of §5 was paid for in > NoAlgoTube, Aeterna, Ludus and Panda Domi, not here. Where a rule is imported, the source is named. > Where a trap is predicted rather than observed, it says **(predicted)** and must be confirmed with a > measurement or struck out. A predicted trap that survives six months unmeasured is superstition. > **The name is a working name.** `Rosea` (Latin, *rose-coloured*) is provisional. The product is > always **Rosea Domi** in public, and *Domi* never appears alone. In source the name lives in exactly > three places — `packages/schema/src/constants.ts`, `apps/rosea/index.html` and the web manifest — > plus the `@rosea/*` package scope and the IndexedDB database name, which change together with them. > The app shell adds a fourth: `apps/rosea-tauri/src-tauri/tauri.conf.json` (`productName`, window > title), which the shell's test holds equal to the constants (§2, *Four versions*). > Renaming must stay a one-commit operation until the name is confirmed. The bundle identifier is > the exception: once an APK or installer reaches a player it cannot change without making a > second, separate app, so it is chosen once, before the first release (§8). --- ## 1. What this project is **Rosea Domi** is a small game about a living rose, a fox, and the time we give to people. It ships as **four versions from one Svelte codebase** — a PWA, an Android app, an iOS app and a desktop app (§2, *Four versions*). It belongs to the Domi ecosystem and is linked from the parent mode of Panda Domi; the fox is a quiet nod to Ulfík the red panda (they look alike — an Easter egg, never an explanation). It is made **for lonely people**, and the word *loneliness* never appears anywhere in the product. Lonely people often do not call their state by that name; the game does not name it for them. It only lets them feel seen and needed. It **comforts the soul, not the mind.** It offers wisdom, hope and companionship. It is not therapy, it diagnoses nothing, it treats nothing, and no screen, store listing or help text may claim otherwise (§5.6). It is **its own game, by purpose**: practice for real friendship that leads into **Amicitia Domi**. It is not a *Little Prince* game. From Saint-Exupéry it takes one idea — taming makes you responsible, and tending is how you live that — plus a quiet echo of the book's structure (rose, fox, planets of lonely grown-ups; the desert pilot is skipped). **Never its text, title, names or drawings** (§5.6, §8). Tolkien is used the same way: Gandalf's spirit (comfort, wisdom and hope as his only weapons; patience as the cure; encouraging, never ruling), never a name or a quote. ### The shape of the game - **The rose** — one per player, with a soft cartoon face in the petals (small, often half-closed eyes, a tiny mouth, a blush when tended). She is alive and a little vain, with thorns that are part of her. Care has a touch of skill: water by feel (too much is as bad as too little), shade her from wind, pull weeds, gather fallen petals. She grows from the **total** time of care, never from a streak. Neglect makes her **drift** — turn away, close a little — never break. Short visits hold her; real time — calendar days on which care helped, never minutes on screen — brings full bloom. One tap shows her real numbers (water, warmth, days of care, trend). - **Her planet and the gardener** *(decided by the author, 2026-11-17)* — she lives on a round tiny planet of her own, cultivated as a garden, and **a gardener the player chooses** (a boy or a girl, dressed at the first open) does the care, animated. The player cares by hand: tap her to open the ring of care, tilt the can to pour, swipe weeds out, sweep petals, drag the windbreak, stroke her petals; every gesture also has a button. The guards against the book's likeness are in `art/STYLE.md` S2, S6, §3b and `.agents/features/planet-garden.md` §0. - **The planets** — a journey through lonely grown-ups (the king, the vain man, the businessman, the lamplighter, the geographer…). Each planet lets the player feel one shape of loneliness. - **The fox** — follows at a distance from the first planet and comes closer through touch (pet, brush) and food. The rose tells you what he wants today. His food is **berries**: first from the wild bush beside the player's own rose, later also from tending other players' forgotten roses — an addition, never a requirement (one harvest per bush per day, only when the care helped). Your own rose's growth sets berry quality: wild strawberries → blueberries → raspberries → blackberries → rose hips. After the taming he leads the player to real people. - **Teaching in play** — the rose and the fox explain and remind in speech bubbles, with text from the curated copy library. Nothing requires reading the Letter. - **Friends** — you tend their roses, they tend yours. When you tend someone's rose, their fox brings them a real trace of you and, now and then, words of comfort from the library. The person you helped can thank you with one gesture: their fox visits your rose. Between two roses a path grows — footprints, then a trail, then a road. - **The bridge to Amicitia** (promoted openly) — once a path is a road, either player may light a **lantern**. A one-sided lantern is invisible; when both are lit, the game says so and the two apps swap anonymous keys device to device. The lantern never passes through `lucerna`. Before a match, sentences carry the Amicitia icon and *a taste of Amicitia* — never "sent through Amicitia". Players are known only by their rose's name. Free conversation happens only in Amicitia, never in Rosea. Rosea has no doors: paths only grow, a lit lantern stays lit. - **The shared sky** — every act of care toward someone else adds light to one night sky that all players share. The sky is the **real** sky: real constellations. Every day at local sunset a wave of lamps follows the sunset around the globe. - **The sunset** — every day at the player's real local sunset the game invites them to put the phone down and look at the real one. **The day's sentence of hope comes from the rose**: she waits with a folded petal. Sunset is the best moment to open it, but it is **never lost** — no streak, and coming back on nearby days gives a little more. The in-game sunsets (move the chair, watch it again) are comfort and rehearsal. - **A Letter from the Gardener** — the help section: every feature, every principle, and the author's own philosophy, signed by him. ### The properties that are not negotiable These are load-bearing. A feature that needs one of them bent is the wrong feature. | Property | What it means in practice | |:--|:--| | **Local-first** | The rose, the planets, the fox, the sunset and the library all work with the network off. Network features degrade to a calm disabled state with an explanation, never a spinner or an error page. | | **Anonymous** | No account, no email, no password, no phone number, no real name. Identity is a locally generated keypair and a chosen display name. | | **No free text, ever** | Not between strangers, not between friends. Every word one player can send another is picked from the curated library (§6.1). There is no input field that reaches another person. | | **Never count people** | No follower counts, no like counts, no leaderboards, no "N people tended your rose". Numbers are about the player's own rose and time only — one tap away, never shouted, never compared. | | **Progress never disappears** | No streak resets, no decay that takes away what was earned. At worst the rose drifts — turns away, closes into a bud — and waits. The day's sentence waits too. | | **Gentle** | Hope is offered, never pushed. Comfort never promises an outcome. No guilt, no nagging, no notification about someone else's rose being neglected. | | **Points beyond the screen** | Every beauty in the game has a real twin outside: the real sunset, the real sunrise, the real constellations. The game's best moments send the player away from the screen. | | **Contributions only add** | Nothing a player does can overwrite, remove or diminish another player's work. | ### The author's philosophy — where it lives The author's own philosophy — *we do not choose the time we are given, only what we do with it*; the river of life in which every person is a whirlpool that shapes the flow and is shaped by it; Cicero's friendship and duty — lives **openly in the Letter from the Gardener, signed by him**. The mechanics stay universal: a river, stars and a sunset speak to a believer and a non-believer alike. Agents do not write the Letter; they leave clearly marked slots for the author. **What this is not**, so scope creep has somewhere to bounce off: not a social network, not a chat, not a dating or meeting app, not a therapy or wellness-tracking app, not a streak machine, not a feed of anything. --- ## 2. Repository layout Phase 0 scaffolded `schema`, `engine`, `content`, `ui`, `apps/rosea`, `tools/art-prep` and `art/`; Phase 1 added `storage` (`profile`, `events`, `keys`) and `identity` (a keypair). `sync` and `services/lucerna` arrive with their first feature, because an empty package has a test suite that runs nothing ([`phase0-workspace.md`](.agents/features/phase0-workspace.md) D1). ``` pnpm-workspace.yaml turbo.json packages/ schema/ # THE source of truth: JSON Schemas for the hope library, care events, traces. # Generated TS types. Validator. Zero runtime deps beyond ajv. engine/ # Pure. No I/O, no DOM, no Date.now(), no Math.random(). # growth/ (rose stages from total care; drift from absence, never loss) # care/ (skill acts: watering by feel, wind, weeds, petals) # forage/ (berries from forgotten roses; quality from own growth) # taming/ (fox distance from touch and food) # sky/ (shared-sky light, constellation completion) # sun/ (sunset/sunrise times, polar day/night) — astronomy is pure maths # time/ (localDay.ts — the ONLY place a day is computed) content/ # the hope library + planets' scripts as data, and their validator storage/ # Dexie. The ONLY module that touches IndexedDB. identity/ # keypair lifecycle. The ONLY module that holds key material. sync/ # friend-to-friend care "letters" over WebRTC; merge on meet (Phase 3) ui/ # Svelte components + tokens + copy/. No business logic. apps/ rosea/ # the game (Svelte 5 + Vite + workbox) -> @rosea/app. Built twice: # dist/ the PWA, under /Rosea/, with its service worker # dist-tauri/ for the shell: base /, no service worker, no manifest rosea-tauri/ # the Tauri 2 shell -> @rosea/tauri. Wraps apps/rosea/dist-tauri/; imports no package src-tauri/ # Rust (a window and nothing else), tauri.conf.json; no capabilities/, so no IPC android/ # what must survive `tauri android init` (gen/ is never committed): the backup rules, # and MainActivity.kt (the save bridge; the page kept between the system bars) scripts/ # icons from apps/rosea/public/icon.svg; the Android privacy patch services/ lucerna/ # OPTIONAL discovery service (Phase 4), Rust (Axum) + SQLite. # Anonymous traces only (§4). Self-hostable. Must be deletable. art/ STYLE.md # the style system prompt — see docs/ART.md manifest.json # every illustration the game needs, with size, purpose and status placeholders/ # Claude-made test art (SVG) for testing form and layout only final/ # approved, optimised illustrations (WebP/AVIF) tools/ art-prep/ # prompts, stand-ins and the art board's files from art/manifest.json; # the accept step into art/final/ (docs/ART.md). The board itself is a # private claude.ai page (decided 2026-11-01, docs/ART.md §3). content/ library/ # hope sentences, one file per source tradition fixtures/ # deliberately invalid entries the validator must reject .agents/ # agent contract, per-feature analysis, reviews, lessons docs/ # ROADMAP.md, ART.md, numbered milestone feature docs ``` `lucerna` — *lantern*: it only ever shows that someone was there. The lantern gesture (§1) shares the name and never passes through it. **Dependency direction (never violate):** ``` apps/rosea ──► packages/ui ──► packages/engine ──► packages/schema ├───────► packages/content ─────────┴──────────────┘ ├───────► packages/storage ──► packages/engine ├───────► packages/sync ──► packages/schema └───────► packages/identity ──► packages/schema services/lucerna ──► packages/schema (trace shape only, via generated JSON Schema) tools/art-prep ──► art/manifest.json, packages/content, packages/schema (never imported by the app) apps/rosea-tauri ──► apps/rosea's BUILT output (dist-tauri/) only — no package, no source file ``` - `packages/engine` is pure. Time and randomness are parameters. This is what makes growth, taming and the sunset maths testable and what makes a replay of the care log deterministic. - `apps/rosea` contains zero growth, taming or sky logic. It renders what the engine returns. - `services/lucerna` must be deletable. If removing it breaks the rose, the planets, the fox, friends or the sunset, the shared sky has stopped being optional and that is a **blocker**. - `.fabrica/` is how Fabrica releases both apps (`fabrica-release.md`): it reads this repository and this repository imports nothing of Fabrica's. The Windows installer also registers `domi-rosea://` for the user (an NSIS hook, no Rust code): any such address opens the garden and nothing else. - `apps/rosea-tauri` must be deletable too: removing it leaves the PWA whole. The game never asks which shell it is in except through one build-time constant, `__ROSEA_SHELL__` (`'web'` or `'tauri'`), read in `apps/rosea/src/App.svelte` only, for wiring (no service worker; the app counts as installed). No package ever reads it. ### Why Svelte, and where Rust earns its place Web first is the decision: the game must run from a link, on any phone, with no store. So the app is **Svelte 5 + Vite as a PWA**, the same stack as Ludus and Panda Domi. Rust is used only where it pays: - **`services/lucerna`** — a small, long-running, internet-facing service. Rust (Axum) gives memory safety and a tiny footprint on a home server. Its contract is the JSON Schema in `packages/schema`. - **A Tauri 2 shell, now (the platform track)** — same Svelte code, packaged for Android, iOS and the desktop, matching the ecosystem's move to Tauri. Its later gift (Phase 6) is **local notifications without a server** (see the notification trap in §8). - **Not** a Rust UI framework (Leptos, Dioxus, Yew) and **not** Rust→WASM for the sunset or star maths: both are small and fast in TypeScript. WASM enters only with a measurement that says it must. ### Four versions, one garden — decided by the author, 2026-11-17 | Version | Made from | Runs in | Where it can be built | |:--|:--|:--|:--| | **PWA** | `apps/rosea` → `dist/` | any browser; GitHub Pages under `/Rosea/` | any machine | | **Android** (APK) | `apps/rosea-tauri` → `pnpm tauri:android` | Android System WebView | Windows, macOS or Linux with the Android SDK, NDK 27, JDK 17 and the Rust Android targets | | **Desktop** | `apps/rosea-tauri` → `pnpm tauri:build` | WebView2 (Windows), WKWebView (macOS), WebKitGTK (Linux) | each on its own OS: an NSIS installer on Windows; `.app`/`.dmg` on macOS; `.deb`/AppImage on Linux | | **iOS** | `apps/rosea-tauri` → `pnpm tauri:ios` | WKWebView | **macOS with Xcode only**, and an Apple developer account to put it on a phone | - **One codebase.** The same Svelte 5 app, the same packages, the same IndexedDB code in all four. The shell adds a window around the built game and nothing else: no Tauri command, no plugin, no `@tauri-apps/api` in the game. Each plugin that arrives later (notifications in Phase 6) is reviewed for network access before it is added, as in Amicitia. - **Layout: `apps/rosea-tauri/src-tauri/`.** The Tauri 2 CLI looks for `src-tauri/tauri.conf.json` below the folder it runs in, so this is the layout it expects, one level down. Not Tauri's default `apps/rosea/src-tauri/`: that would put Rust and the Tauri CLI into the PWA's package. Here the shell is deletable, and its only input is a built folder — the same seam the e2e suites test (`tauri-platforms.md` D1). - **The shell's build of the game** (`vite build --mode tauri`, into `apps/rosea/dist-tauri/`): base `/`, because Tauri serves the files at the root of its own origin; **no service worker and no web manifest**, because the files are already on the device and a store or installer brings updates; the content-security policy delivered by Tauri (`app.security.csp`), the same string as the PWA's `` policy, held equal by a test (§8). - **The non-negotiable properties hold in all four.** Local-first, anonymous, no free text, never counting people, nothing written outside IndexedDB, no analytics — in any SDK either: the shell links no analytics, crash-reporting or ads library, and the webviews' own reporting is switched off where the platform allows it (§8, *the webview phones home*). The Android app asks for **no `INTERNET` permission** while Rosea has no network feature, so the kernel refuses it any socket. --- ## 3. Commands ```bash pnpm install --frozen-lockfile # also installs the git hooks (§5.2) pnpm --filter @rosea/schema build # schema first, always (generates the contract types) pnpm --filter @rosea/app dev # 127.0.0.1:5173 — never --host (§5.7) pnpm build # turbo: schema -> engine/content/ui -> app pnpm lint # ESLint, incl. the engine-purity rule (§7) pnpm typecheck # tsc + svelte-check, every package plus e2e/ and scripts/ pnpm test # vitest, all packages — quote counts per package pnpm --filter @rosea/engine test # incl. fast-check property tests and the sun golden tests tsx scripts/fetch-sun-golden.ts # re-records the sun's published tables (network; by hand, never in a test) pnpm test:e2e # builds, then Playwright against the BUILT app under /Rosea/ pnpm test:offline # builds, loads once, CLOSES the server, reloads pnpm validate:library # every hope sentence and candidate; fixtures must FAIL pnpm library:verify --by # the AUTHOR moves checked candidates into the library; agents never run it pnpm lint:copy # forbidden words and names (§5.6) pnpm guard:cpu # waits for, then refuses, a machine above 80 % CPU (§5.7) pnpm art:board # prompts + stand-ins -> tools/art-prep/dist/board/ (docs/ART.md) pnpm art:accept # an accepted picture -> art/final/*.webp, sheets cut tsx scripts/build-places.ts # rebuilds the town list from downloaded Natural Earth + tzdb (by hand) # The Tauri 2 shell (apps/rosea-tauri) — each builds the game for the shell first (dist-tauri/): pnpm tauri:dev # desktop window on the Vite dev server, 127.0.0.1:5173 pnpm tauri:build # desktop release: on Windows an NSIS installer and the .exe # needs Rust (MSVC), WebView2, VS Build Tools; macOS/Linux on their own OS pnpm tauri:android # Android debug APK (arm64); needs ANDROID_HOME, NDK 27, JDK 17, # the four Rust Android targets. Install: adb install -r pnpm tauri:ios # macOS + Xcode only — refuses elsewhere with the reason (§8) pnpm --filter @rosea/tauri test # the shell's tests: config (CSP, name, origin), privacy patch, shell build tsx e2e/apps/check-garden.ts desktop # the built .exe: water her, close, reopen, still watered (temp data folder) tsx e2e/apps/check-garden.ts android # the installed APK on the device over adb; `pm clear`s the TEST app first pnpm tauri:android-release # the release APK (unsigned; verified with aapt2); Fabrica signs it in Custos # Released through Fabrica (.fabrica/; .agents/features/fabrica-release.md): node scripts/check-version.mjs # the four version files agree; Fabrica's Deploy bumps what it names pnpm aula:shots # builds, then the Aula pictures on demo data -> e2e/aula/*.png fabrica artifex check # the pipelines, tests.yaml, aula.yaml and the brief fabrica tests run --target web # the e2e specs as Fabrica's target (build first) fabrica tests run --target phone # the debug APK on the test phone, ONLY through Fabrica's phone queue fabrica deploy rosea --part desktop # a release: bump, tag, the hub's run, Mark's Custos cards. Public: G6.1 first # Not yet — they arrive with their first feature: cargo test --manifest-path services/lucerna/Cargo.toml # Phase 4 onward ``` The build's base path is `/Rosea/` (GitHub Pages' project sub-path); `ROSEA_BASE=/x/` overrides it for the build and for both Playwright suites together. `pnpm --filter @rosea/app build:shell` builds the shell's copy instead (`--mode tauri`: base `/`, into `dist-tauri/`); the `tauri:*` commands run it. `pnpm tauri:android` ends by reading the built APK with `aapt2` and fails if it asks for any permission or allows backup (`tauri-platforms.md` D6). > **The `pnpm test` trap, imported from Aeterna.** Exit code 0 says the command succeeded, not that > tests ran. A filter that matched nothing and a green run look identical. **Quote the counts per > package, or do not claim green.** > **The offline suite is the product's central claim.** It loads the app once, cuts the network, then: > tends the rose, walks one planet, watches an in-game sunset, closes the tab, reopens it, and asserts > that everything survived. A local-first app tested only against a dev server has never been tested > offline — the dev server *is* the network. --- ## 4. Runtime state **On the device — IndexedDB database `rosea` (Dexie):** | Store | Contents | Written by | |:--|:--|:--| | `events` | **append-only** log: care given, care received, petals opened, planet steps, sunsets seen or missed, gestures | `packages/storage`, from the game loop | | `derived` | rose stage, fox distance, paths, sky light — rebuilt from `events` | `packages/storage`, from values the engine returns | | `profile` | the rose's name (the only name Rosea knows), chosen city for sunset (skippable; fallback is the device time zone; never GPS), settings, opt-ins | settings screen | | `keys` | the identity keypair | `packages/identity` | | `library` | the cached hope library and planets' content, versioned — not used yet: the library is bundled at build time (day-sentence.md P5) | `packages/content` | **`events` is the truth; `derived` is a cache.** Anything in `derived` must be reconstructible by replaying `events` through the engine. A number that cannot be derived from the log does not belong in `derived`. **Nothing else is written anywhere.** No cookies, no `localStorage`, no analytics of any kind, no third-party origin, no fonts or images from a CDN. This holds in the shell too: `localStorage` and `sessionStorage` stay forbidden there, and the Rust side writes no file of its own. (The webview keeps its own profile beside the database: caches, an empty Local Storage folder Chromium makes, and on Android hashed visit counters for its metrics, which are switched off and cannot be sent.) **Where IndexedDB lives in each version** (the webview owns the folder; Rosea writes only its database there — the webview keeps its own caches beside it): | Version | Where the `rosea` database is | |:--|:--| | PWA | the browser profile, per origin; evictable (§8) | | Windows | WebView2's user data folder: `%LOCALAPPDATA%\\EBWebView\` | | Android | the app's private data: `/data/data//app_webview/Default/IndexedDB/https_tauri.localhost_0.indexeddb.leveldb` (seen on the tablet) — no Auto Backup, no device transfer (`tauri-platforms.md` D6) | | macOS / iOS | WKWebView's website data in the app's container (`Library/WebKit/`) *(predicted)* | | Linux | WebKitGTK's data dir under `~/.local/share//` *(predicted)* | A rose made in the PWA and the same player's Android app are **two roses** until the player carries one across with *Keep her safe* (save to a file, bring her back). Nothing syncs them. **On `services/lucerna`, only when the player has opted in to the shared sky (Phase 4):** an anonymous trace id, a coarse geocell (~1 km), a day bucket (never a timestamp finer than a day), and the gesture kind. Traces auto-delete after a fixed window (assumption: 14 days — decided in the Phase 4 feature doc). No IP log, no user agent, no referrer, no push token joined to a location. A proposed extra column is a design discussion, not a migration. --- ## 5. Non-negotiable workflow rules ### 5.1 Every feature needs an analysis document **before it is done** — (D)TDD Documentation → tests → code. A feature is not complete until its analysis is committed alongside it. - **Location**: `.agents/features/.md`, or `docs/NN_.md` for numbered milestones. - **Required sections**: (1) why and what, in the player's terms; (2) technical architecture with a Mermaid diagram naming the packages; (3) **risk analysis** — here "risk" means *a lonely person feeling worse*, *someone's location*, or *someone being reachable who did not ask to be*; (4) gap analysis and the designed solution; (5) the verification matrix — happy-day **and** bad-weather cases mapped to unit / integration / e2e / offline, plus manual steps. - Then update `.agents/FEATURES.md` and `.agents/GAP_ANALYSIS.md`. A closed gap is struck through **with the evidence in the row**. There is no changelog file; `HANDOVER.md` is rewritten at the end of each session. ### 5.1b Lessons — one file per category of problem `.agents/lessons/.md`, indexed in `.agents/lessons/README.md`: | File | What belongs in it | |:--|:--| | `soul.md` | **The most important file here.** What comforts and what only looks like comfort. Every mechanic that turned out to cause guilt, comparison, rejection or dependence. Every sentence that rang hollow. | | `architecture.md` | Layering, ownership, seams. | | `design.md` | What the player is shown and why: wording, silence, empty states. | | `art.md` | What the image pipeline taught: prompts that drift, checks that missed, style that broke. | | `code.md` | TypeScript, Svelte reactivity, async ordering, Rust in `lucerna`. | | `technical.md` | The browser as a platform: storage eviction, service workers, notifications, timers. | | `testing.md` | What makes a test worth having, and how a passing test lies. | | `privacy.md` | Anything that could leave the device or make a person findable. | | `process.md` | Workflow, commits, reviews, releases, honesty about what shipped. | Shape of an entry: a heading, then **what happened** (concrete, with the file or measurement), **why it bit** (general enough to recognise elsewhere), **how to apply it** (imperative, testable). These files are the first thing to read when something behaves strangely. ### 5.2 Commit protocol ``` Format : [] : Example: [engine] RoseGrowth: Grow from total days of care, never from consecutive days Remote : GitHub (primary) — branch main; mirrored to gitea.marek-novak.cz, as in Panda Domi Deploy : GitHub Actions builds apps/rosea and publishes it to GitHub Pages on every merge to main Apps : the APK and the desktop installer are built by hand on this machine until CI can (G0.22); never committed. Release signing keys never enter the repository (§5.3's token rule) ``` PRs are opened and merged on GitHub. The Gitea mirror is a backup and must stay in sync — after every push, verify the mirror's `main` matches (`git ls-remote` on both remotes prints one hash). #### NO AI ATTRIBUTION IN COMMITS — EVER No `Co-Authored-By: Claude…`, no `Claude-Session:` link, no "Generated with" line — in any commit, merge commit, PR body or tag message. A commit message ends with its last substantive line. If a harness appends such a trailer, strip it. *(Imported from NoAlgoTube, which needed a history rewrite.)* #### Build output and oversized files are never committed `dist/`, `.turbo/`, `node_modules/`, `target/` and raw image exports are git-ignored from the first commit. A pre-commit hook installed by `pnpm install` rejects any staged file over 5 MB. Final art is committed only as optimised WebP/AVIF under `art/final/` (budget per image decided in `docs/ART.md`). `git add -f` on an ignored file is wrong on every branch. *(Imported from NoAlgoTube's 2 GB `.git`.)* ### 5.3 Branch, self-review, merge — every feature 1. **Branch**: `feature/`, `fix/`, `refactor/`, `docs/`, `art/`, `content/`. 2. **Build it**, committing as you go. The analysis doc is part of the branch. 3. **Open a PR and review it adversarially** in `.agents/reviews/.md`. A self-review that finds nothing is a failed review. Cover at minimum: - **Correctness** — second run, clock change, DST change, partial write, tab closed mid-action, two tabs open. - **Soul** — *can this make a lonely person feel worse?* Look for guilt (a neglected thing that blames), comparison (anything ranked or counted), rejection (a gesture that can go unanswered in a visible way), and dependence (a reason to stay in the app instead of going outside). Answer with a concrete scenario or say you looked and found none. - **Privacy** — every path by which a byte leaves the device: trigger, contents, what the player was told. "It sends nothing" needs evidence. - **Reachability** — can this let one person reach another who did not ask to be reached? - **Offline** — does it work with the network off? If not, what does the player see? - **Test honesty** — does each test fail when the bug is reintroduced? Say if you did not check. - **Scope** and **what you did NOT verify**, stated plainly. 4. **Address every finding** — fixed with the commit, or deferred with a reason. Never dropped silently. 5. **Merge with `--no-ff`**. 6. **Push immediately** and verify `git rev-parse HEAD origin/main` prints one hash twice. 7. **Run e2e and offline against the BUILT app** before calling anything done. Do not claim a PR was opened when it was not. The access token is a secret and never enters the repository, a review document or command output. ### 5.4 The deployed bundle is the only thing the player sees The player opens an installed PWA served from a precached shell. Source changes are invisible until the app is rebuilt, the service worker's bytes change, and the client picks up the new worker. In the Android, iOS and desktop apps the game is inside the package: a change reaches a player only with a new APK or installer, which must carry a higher version (`apps/rosea/package.json`, read by `tauri.conf.json`) or Android refuses it as a downgrade. When reporting a fix, **say whether the bundle was rebuilt and redeployed**. If a change is deliberately invisible (a refactor, a library update), say so explicitly — a fresh build that looks identical is otherwise indistinguishable from a stale one. *(Imported from NoAlgoTube and Aeterna, where it happened twice.)* ### 5.5 Test discipline - `pnpm test`, `test:e2e`, `test:offline`, `validate:library` and `lint:copy` are green before any commit, with counts quoted per package. - **The engine gets property tests.** `fast-check`: growth is monotonic in total care and never decreases; fox distance never jumps more than one step per day; replaying the same log twice gives byte-identical `derived` state; a missed sunset never changes the rose's stage; an unopened sentence is never lost; at most one harvest per bush per local day, and none when the care did not help; drift never lowers the stage earned. - **Sun maths gets golden tests** against published sunrise/sunset tables for a spread of cities: Prague, Reykjavík, Tromsø (polar day and polar night), Quito, Sydney, Anchorage — including both DST transition days. Tolerance is stated in the test, in minutes. - **The library validator's negative fixtures are the validator.** `content/fixtures/` holds entries that must fail, each with a message naming the problem: no source; source not verified public domain; a modern translation that is still under copyright; over the length cap; a promise of an outcome (flagged for human review); a forbidden name (§5.6); missing tradition tag. Adding a rule without the fixture that proves it fires is a **blocker**. - **E2E and offline run against the built bundle**, never the dev server. - **Tests needing a missing capability degrade to a no-op and say so** in the report. - **No test touches real user data or a real location.** ### 5.6 Content, words and privacy — absolute rules 1. **No free text reaches another person.** Every message between players is a library id (§6.1). There is no input field whose contents leave the device toward a person. 2. **The library is curated and sourced.** Every sentence has a source, an author or tradition, and a verified public-domain status (or is written by the author for Rosea). Bible quotations use only public-domain translations (e.g. KJV, Bible kralická). Hope may come from any tradition; the library stays mixed so a non-believer is at home too. No sentence promises an outcome. 3. **Forbidden in the product**: any name, quote or recognisable drawing from *The Little Prince* or from Tolkien's works; the words *therapy, therapeutic, treat, treatment, heal, cure, diagnose, symptom, patient, disorder* in any player-facing copy or store listing (EU medical-device scope is triggered by claims — the same positioning rule as Quies). `pnpm lint:copy` enforces the list. 4. **The word *loneliness* (and *lonely*) never appears in the product.** It may appear in `.agents/` and `docs/`. 5. **A quiet door to real help.** The Letter from the Gardener contains a calm, always-reachable link to real support lines. It is not advice and makes no clinical claim; it is a door. 6. **Location is a city the player chooses**, or a guess from the device time zone if skipped — never GPS, and never an IP lookup without a written decision (it is a network call). The shared sky (Phase 4) uses a coarse geocell and a day bucket only. 7. **Strangers are never reachable directly.** The path to strangers is a ladder of mutual consent (traces → a light → foxes meet only if both agree → group meetings in public places only). The game never arranges a one-to-one meeting. ### 5.7 A test run leaves the machine as it found it Nothing binds to anything but `127.0.0.1` — the shell's dev server and a webview's debugging port included; a phone reaches the dev server through `adb reverse`, never through `--host`. Every browser a test starts is closed in `finally`, and so is every app a test launches (the desktop `.exe`, the app on the tablet: `am force-stop`). Do not start a full run above ~80% CPU. *(Imported from Ludus and Aeterna.)* **Enforced, not trusted:** `pnpm test`, `test:e2e` and `test:offline` first run `pnpm guard:cpu`, which waits up to three minutes for the machine to calm and then refuses (`tools/cpu-guard`, lessons/process.md). A dedicated machine such as CI sets `ROSEA_CPU_MAX` (100 never refuses); never set it to get past a busy desktop. --- ## 6. The contracts A mismatch in any of these fails silently at runtime, which is why they are listed here. ### 6.1 A hope sentence (the library entry) ```jsonc { "id": "ps-23-4", "text": { "en": "…", "cs": "…" }, "source": { "work": "Psalms 23:4", "author": null, "tradition": "biblical", "translation": "KJV", "publicDomain": true, "verifiedBy": "Mark", "verifiedAt": "2026-…" }, "use": ["sunset", "comfort", "thanks"], // where it may appear "tone": "gentle", "promisesOutcome": false } ``` Sunset sentences: at least 365, so none repeats within a year. Comfort lines are the only words a player can send another player, and the sender picks one. ### 6.2 The care event (append-only, never edited) ```jsonc { "kind": "care", "ts": 1761500000000, "localDay": "2026-10-24", "from": "", "to": "", "act": "water" | "shade" | "weed" | "petals", "trace": "petal:", "messageId": "ps-23-4" | null, "clientVersion": "0.1.0" } // act applies to the player's own rose or another player's. (This example once // listed "wind" | "light"; §1's weeds and fallen petals won — phase0-workspace.md D5.) // "care" and "sentence-opened" are in packages/schema so far; each other kind arrives with the // feature doc that uses it. Other kinds: "sunset" (seen), "planet-step", "fox" (pet | brush | feed), // "harvest" (berry kind), "thanks", "lantern" (lit — never unlit) ``` Every number on screen is a pure function of this log, computed by `packages/engine`. Adding an event kind is the only sanctioned way to make a new thing derivable. ### 6.3 The trace (Phase 4, opt-in only) ```jsonc { "traceId": "", "geocell": "<~1 km cell>", "dayBucket": "2026-10-24", "gesture": "petal" | "light", "sig": "" } ``` No timestamp finer than a day, no precise location, no free text, no link to the friend graph. --- ## 7. Conventions - **TypeScript strict everywhere** (`strict`, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`). Types for the contracts are generated from JSON Schema, never hand-written. - **The engine is pure** — enforced by a lint rule, not by good intentions. - **One module computes a day** (`engine/src/time/localDay.ts`) and **one computes the sun** (`engine/src/sun/`). Never `toISOString().slice(0,10)`. - **Svelte 5 runes, no state library.** A component that decides growth, taming or anything in the sky is a layering violation and a review **blocker**. - **Three taps to action, one preferred.** From a cold open, tending the rose is one tap. - **Every string a player reads lives in `packages/ui/src/copy/`**, and passes `lint:copy` — except the Letter, which is the author's Markdown in `docs/LETTER.md` and passes `lint:copy` too. The interface language is plain English (Czech later). Latin is for the brand only. - **Silence is a feature.** Sunset, the thanks visit and the end of a planet have moments with no buttons at all. Do not fill them. - **Accessibility is not a phase.** Every action is keyboard- and screen-reader-operable from the commit that introduces it; motion respects `prefers-reduced-motion`. - **Never swallow an error.** `catch {}` without a logged reason is a review failure. - **Art comes only through the pipeline in `docs/ART.md`.** No image enters `art/final/` without the automatic checks, Claude's review and Mark's visual approval. --- ## 8. Known traps | Trap | Why it bites | |:--|:--| | **A PWA cannot schedule a local notification** *(predicted — verify first)* | The sunset invitation is time-based. A web app generally cannot fire a notification at a set time while closed without a **push server** sending it, and a push server that knows when someone's sunset is knows roughly where they are. On iOS, web push works only for a site added to the home screen. **Decided in Phase 0 (2026-11-01):** in-app sunset only for the web build — no push server — and local notifications through the Tauri shell later (Phase 6). The shell exists since 2026-11-17; its notification plugin is still Phase 6. | | **Polar day and polar night** *(measured 2026-11-01)* | Above the Arctic Circle the sun does not set in summer or rise in winter. "Every day at sunset" has no answer there. Measured: the almanac has no rise or set in Tromsø on 21 June and no events at all on 21 December. `engine/sun` returns `polar-day` or `polar-night` and a gentle moment for each (the lowest light; noon twilight) — `.agents/features/sun.md` D4. | | **DST and the local day** *(measured 2026-11-01)* | Sunset jumps an hour twice a year under a player who did nothing: Prague's is 18:28 on 28 March and 19:29 on the 29th, while the sun moved one minute. A day boundary computed in UTC records Monday-evening care as Tuesday's. One module computes the day; the sun works in instants. | | **Comfort becomes wallpaper** | The same words every day stop meaning anything. Comfort words are occasional; the real trace of a real person is constant. Track repetition in tests. | | **Guilt sneaks in through "gentle" reminders** | "Your rose misses you" is guilt wearing a ribbon. No notification ever refers to neglect — the player's or anyone else's. | | **Streak creep** | Someone will propose "just a small streak". Growth is from total care; a missed day never resets anything. | | **Drift that reads as blame** | A rose turned away can feel like an accusation. Drift is shown as waiting, never as hurt caused; she brightens on the first touch, and no copy ever says *you forgot*. | | **Berry farming** | Tending roses for food invites mindless tapping. One harvest per bush per local day — the player's own and each forgotten rose's — only when the care actually helped, enforced in `engine/forage`, property-tested. | | **A lantern as rejection** | A lit lantern that is visibly unanswered is the rejection this game exists to avoid. One-sided lanterns are invisible to the other player, always. | | **Location makes people findable** | Coarse cells next to a sparse population identify a house. Cell size must adapt to density, traces must be delayed and auto-deleted, and stranger contact is consent-only (§5.6). | | **The library as a scam channel** | If any field lets a sender attach free text, a lonely recipient can be manipulated. The id-only contract (§6.1) is the defence. | | **Copyright through the back door** | An image prompt "in the style of" the book's drawings, a fox or rose that looks like the original, or a famous line "paraphrased" too closely. All forbidden (§5.6); the art pipeline checks likeness (`docs/ART.md`). | | **A child on a small round planet with a rose** *(a risk the author accepted, 2026-11-17)* | It is the book's most recognisable image, and its estate holds trademarks. The author chose it knowingly. Keep every guard (STYLE.md S2, S6, §3b, review points 10–11: the gardener is the player's own, in work clothes, never a scarf, coat, cape, suit or crown; the planet is a cultivated garden, never volcanoes, baobabs or a lone lamp post), and **a legal check of the look comes before any public release** (G6.1). | | **Medical claims in a store listing** | One word like *heal* in marketing copy can pull the product toward medical-device rules. `lint:copy` also runs on store text kept in the repo. | | **IndexedDB is evictable** *(predicted; answered by `keep-her-safe.md`)* | WebKit can discard origin storage after seven days without interaction — exactly the shape of a player who drifted away and comes back. Call `navigator.storage.persist()` where it exists, prompt iOS players to install, and make export-my-rose a first-class feature. A player returning to find their rose gone is the cruellest bug this product could have. | | **The stale service worker** *(answered by `calm-refresh.md`)* | A precached shell keeps serving old JS to a player who has "updated". Detect a waiting worker and offer an explicit, calm *refresh* control. | | **Two tabs, one database** *(measured 2026-11-07; answered by `two-tabs.md`)* | Predicted: derived state drifts, use a lock. Measured: nothing stored drifts (the log is append-only, there is no `derived` store yet), so no lock — but each tab's **view** went stale, and a player could water her twice. `packages/storage` announces each committed write on a `BroadcastChannel`; the other tabs read again, keeping what they already show. When a `derived` store arrives, decide the lock again. | | **GitHub Pages serves under a sub-path** *(predicted)* | A project site lives at `//`, not `/`. Vite `base`, the web manifest `start_url` and `scope`, and the service worker scope must all agree, or the installed app opens a 404 or never updates. The offline suite runs against the same base path. | | **GitHub Pages cannot set response headers** *(predicted)* | No custom CSP or cache headers. The content-security policy goes in a `` tag; caching is controlled by the service worker and hashed filenames. | | **Pages hosts files, not services** | `services/lucerna` cannot live on Pages. It runs on Mark's own server (Phase 4), and the app must work fully without it. | | **`pnpm test` exits 0 having run nothing** | Quote counts per package. | | **Playwright against the dev server** | It never registers the service worker and has never reproduced a caching bug. | | **Base path in the shell** *(measured 2026-11-17)* | The PWA lives under `/Rosea/`; Tauri serves the game at the root of its own origin (`https://tauri.localhost/` on Windows and Android with `useHttpsScheme`, `tauri://localhost/` on macOS and iOS). A shell build with base `/Rosea/` would ask for `/Rosea/assets/…` and open a blank window. The shell's copy is built with base `/` into its own folder, so the two can never be mixed up; measured: the garden opens at `https://tauri.localhost/` on Windows and on Android. | | **A service worker inside a webview** *(answered 2026-11-17)* | Inside Tauri the files are already on the device; a worker would cache a second copy, could serve a stale game after an app update, and *A new version of the garden is ready* would offer a refresh that fetches nothing. The shell's build has no worker and no manifest: `vite-plugin-pwa` is disabled there and `registerSW` is its no-op. Measured: no registration in either app. | | **Two content-security policies** *(conflict predicted; the answer measured 2026-11-17)* | The PWA carries its policy in a `` tag (Pages sends no headers). Tauri can deliver its own policy and adds hashes for the scripts it injects; a page with **both** obeys both, and the `` would block what Tauri adds. So the shell's build has no `` policy and Tauri delivers the same string, held equal by `apps/rosea-tauri` test. Measured: no CSP violation and no request outside the origin, on Windows and on Android. | | **IndexedDB eviction in a webview** *(partly measured 2026-11-17)* | WebView2 and Android WebView are Chromium: best-effort storage can be cleared under disk pressure, and an app's data is wiped on uninstall (the Windows uninstaller offers to delete app data). WKWebView on iOS may purge website data of an app that is not used. `persist()` answers `false` in WebView2 and in Android WebView (measured). *Keep her safe* is the real defence. In the apps it speaks of the app, not a browser, and on Android it saves through Android's own save screen, because `` does nothing in Android WebView (measured; `keep-her-safe-apps.md`). | | **The webview phones home** *(measured in Amicitia, 2026-11-08; here: Android closed by construction, Windows unmeasured)* | A webview talks to its maker on its own: WebView2 to Microsoft and DNS-over-HTTPS providers, Android WebView to Google's metrics and an Autofill server as soon as a field takes focus. Desktop: `additionalBrowserArgs` switches these off (undocumented feature names a runtime update can break). Android: no `INTERNET` permission at all while Rosea has no network feature, plus metrics and Safe Browsing off in the manifest, applied by a committed patch because `gen/` is regenerated. Measure on every release build. | | **Auto Backup sends the garden to a cloud** *(answered 2026-11-17)* | A stock Tauri Android manifest lets Android copy the app's data — the care log, the keys, the chosen town — to the player's cloud backup, without the player choosing it. The patch sets `allowBackup="false"` and excludes every domain from cloud backup and device transfer; *Keep her safe* is how a rose moves. Measured: the installed package carries no `ALLOW_BACKUP` flag and no `INTERNET` permission (`dumpsys package`); `pnpm tauri:android` checks the APK itself with `aapt2`. | | **Android draws under the system bars** *(measured 2026-11-17)* | Tauri's stock activity turns edge-to-edge on, and the WebView does not reliably report the bars as `env(safe-area-inset-*)`: the clock sat over the title, the navigation bar over a button. Rosea's own `MainActivity` (`apps/rosea-tauri/android/java/`, copied into `gen/` by `android.ts`) keeps the page between the bars and paints them with `--paper`. | | **iOS cannot be built on Windows** *(known)* | `tauri ios init` and every iOS build need macOS and Xcode; installing on a phone needs an Apple developer account (free for one's own device, paid for TestFlight and the App Store). `pnpm tauri:ios` refuses on Windows with this reason. | | **The bundle identifier and the origin are forever** | An Android `applicationId` or iOS bundle id cannot change after a release without becoming a different app: the old one keeps the player's rose, the new one starts empty. Chosen once (`cz.mareknovak.domi.rosea`), before the first release, even though the product name may still change. The same holds for `useHttpsScheme` (`true`): flipping it changes the webview's origin, and IndexedDB is per origin, so the rose is left behind. The shell's test pins both. | --- ## 9. Where to look first | I need to… | Start here | |:--|:--| | Understand why something behaves strangely | `.agents/lessons/` — `soul.md` first | | Know what is planned and which gate we are at | `docs/ROADMAP.md` | | Make or replace an illustration | `docs/ART.md`, then `art/manifest.json` and `pnpm art:board` | | Change how the rose grows | `packages/engine/src/growth/` | | Change how the fox comes closer | `packages/engine/src/taming/` | | Change the sunset or sunrise | `packages/engine/src/sun/` — read the polar and DST traps first | | Add or edit hope sentences | Agents propose in `content/candidates/`; the author verifies with `pnpm library:verify`. Then `pnpm validate:library` | | Change what friends can send each other | `packages/schema` §6.1 — and re-read §5.6 rule 1 | | Change the shared sky | `services/lucerna/` — and re-read §4 and §5.6 rules 6–7 | | Build the Android, iOS or desktop app | `apps/rosea-tauri/`, then `.agents/features/tauri-platforms.md` and the shell traps in §8 | | Understand a past decision | `.agents/features/*.md`, `git log`, `.agents/reviews/*.md` |