Files

8.9 KiB
Raw Permalink Blame History

The rose — care with a touch of skill, growth from days of care, drift instead of loss

Status: built on feature/rose-care. ROADMAP Phase 1: one rose with her face: care with a touch of skill (water by feel, shade, weeds, petals), moods, thorns, growth from total days of care, drift instead of loss, her numbers one tap away, and speech-bubble teaching (GAMEPLAY.md §1–2, §4). Review: feature-rose-care.md. Not yet here: the day's sentence and the folded petal (the library is empty, G0.18), the in-game sunset with the chair.


1. Why and what, in the player's terms

The garden now has the rose. She stands in her bed under the sunset line, with a face in her bloom, and she says, in a small bubble, what she needs.

  • Water by feel. Press and hold Water: the can pours slowly, and the rose's leaves lift when she has enough. Let go then. Pour too long and she is too full, which helps no more than too little. On a keyboard, hold Space or Enter; a screen reader hears when the leaves lift.
  • Weeds appear some mornings. Fallen petals some days, once she is opening. Wind comes on some days for an hour and a half: Shade her while it blows. Each button shows only when it is needed, so the screen stays quiet.
  • She grows from days of care that helped: a calendar day on which at least one act met a real need. Ten acts on one day count as one day. A long visit is worth no more than a short one. Bud → opening → half bloom → full bloom.
  • She drifts, never breaks. Some days without care and she turns a little away; a week, and she closes a little and waits. Her stage never goes down. The first helpful touch brings her back.
  • Her numbers are one tap away: water, warmth, days of care, and how she is doing. Nothing is counted against the player; there is no streak and no "missed".

2. Technical architecture

flowchart LR
  subgraph app["apps/rosea"]
    wire["App.svelte<br/>identity, zone, now, events"]
  end
  subgraph ui["packages/ui"]
    rose["Rose.svelte<br/>picture, bubble, care, numbers"]
  end
  subgraph engine["packages/engine (pure)"]
    model["rose/rose.ts<br/>roseAt(events, seed, now, zone)"]
    days["time/localDay.ts<br/>localDay, localMinutes"]
    model --> days
  end
  subgraph storage["packages/storage"]
    events[("events<br/>append-only")]
    keys[("keys")]
  end
  subgraph identity["packages/identity (new)"]
    id["createIdentity()<br/>ECDSA P-256, private key non-extractable"]
  end
  schema["packages/schema<br/>care event + amount"]
  wire --> rose --> model
  wire --> events & keys
  wire --> id
  model --> schema
  events --> schema
  • The log is the truth (CLAUDE.md §4). Every care act is one append-only care event. The rose at any moment is roseAt(events, seed, now, timeZone): a pure replay. Nothing about her is stored except the log; derived is not needed while the replay is this cheap.
  • Her hidden state is a water level that falls over time and rises when poured. Weeds, petals and wind come from a seeded hash of the rose's own key and the local day, so they are the same on every replay and every device, and no randomness enters the engine.
  • Identity arrives because the care event names from and to by public key. For her own rose both are the player's key. The private key is non-extractable and kept by @rosea/storage as an opaque CryptoKey; nothing signs anything yet.

Decisions

# Decision Why
R1 The care event gains amount (0–1, required for water, absent otherwise). "Pour slowly until the leaves lift; too much is as bad as too little" cannot be replayed from the act alone. The schema change is the sanctioned way to make it derivable (CLAUDE.md §6.2).
R2 Water: the level falls by 0.3 a day; a full pour (holding about 3 s) adds 0.6. She is thirsty below 0.25, needs water below 0.4, has enough from 0.4, and is too full above 0.95. A new rose starts at 0.3, so the first watering helps and teaches. Assumption for the author: one helpful watering about every day and a half.
R3 A pour helps only when she needed it (below 0.4) and it leaves her between 0.4 and 0.95. GAMEPLAY §1: too much is as bad as too little.
R4 Weeds grow overnight on about 40 % of days; fallen petals on about 30 % of days from the opening stage; wind on about 25 % of days, for 90 minutes starting between 9:00 and 18:00 local time. Each is a need until met that day. Assumption for the author. Seeded per rose and day (FNV-1a), so replays agree.
R5 Stages from days of care: bud 0–2, opening 3–9, half bloom 10–24, full bloom 25+. Assumption for the author: full bloom after about a month of real days.
R6 Drift from local days since the last helpful day: 0–2 none, 3–6 a little (turned away), 7+ more (closed a little, waiting). It changes her face, never her stage. GAMEPLAY §1 and CLAUDE.md §8, drift that reads as blame: drawn as waiting.
R7 Warmth is the number of days of care in the last seven, said as "3 days this week", and "resting" at none. Trend: growing (a day of care in the last two), steady, or waiting (drift). GAMEPLAY §2 asks for warmth and trend. Words that never say missed.
R8 The day of an act is the local day in the rose's zone: the sunset town's zone, or the device's if there is none. One zone for the sunset and the care, so a day means the same thing in both.
R9 ECDSA P-256 for the identity keypair, not Ed25519. Every browser that can install the PWA has it; Ed25519 arrived in Chrome only in 2025. Revisited with the Phase 3 identity doc.
R10 Her pictures are the art board's stand-ins until real art is accepted. A mood picture shows only at full bloom; before that, the stage picture. The stand-ins exist for every stage and mood; the moods are drawn at full bloom only (art manifest).

3. Risk analysis

Risk Answer
Guilt. A thirsty, closed rose after a week away can read as you neglected me. She is waiting, never hurt; her words never say forgot or missed; one touch brightens her. The bubble copy passes lint:copy and the soul review below.
Streak by another name. Warmth counts recent days. It is shown only on request, never counts absence (resting, not 0 of 7), and changes nothing about growth.
Compulsion. Tapping for growth. Growth is days, not acts: ten acts in one day are one day (property-tested). Buttons appear only when there is a need.
Skill as a barrier. Holding to pour is hard for some hands. Holding Space or Enter works; the leaves lifting is announced; a short pour can be topped up.
Location / reachability. None new. The events stay on the device; the key never leaves it.
A lost rose. IndexedDB eviction (CLAUDE.md §8). Not solved here: G0.11 (persist(), export-my-rose) is next. Stated in the review.

4. Gap analysis

Gap Solution State
G1.4 The rose: care, growth, drift, moods, numbers This feature Built
G0.15 identity deferred @rosea/identity: create and keep a keypair Built (minimal)
G0.19 Event kinds other than care Not needed yet Open
G0.11 Eviction: persist(), export-my-rose Next Open, more urgent now that there is a rose to lose
The day's sentence, the folded petal Needs the library (G0.18) Open
Speech-bubble lines from a curated library Lines live in ui/copy, passing lint:copy Built for the rose's needs

5. Verification matrix

Case Kind Where
Water falls over time, a pour raises it, too much is too full; a pour helps only when needed and in range unit engine/test/rose.test.ts
Weeds, petals and wind are the same on every replay, differ between roses, appear at about their rates unit, property same
Growth never decreases as events are added; many acts on one day count once; a gap never lowers the stage; replaying the same log twice gives identical state; drift never changes the stage property (fast-check) same
Drift levels at 0, 3 and 7 days; the first helpful act after a gap clears drift unit same
Schema: amount required for water, refused elsewhere, bounded 0–1 unit schema/test
Identity: a public key that fits the schema; the private key cannot be exported unit identity/test
Storage: events append and come back in order; a malformed event is refused; keys round-trip unit (fake-indexeddb) storage/test
UI: the rose shows her stage; holding Water pours and the leaves-lift announcement comes; Weed appears only with weeds; the numbers open on request unit (testing-library) ui/test/rose.test.ts
Built app: water the rose by holding, see 1 day of care, reload, still 1 e2e e2e/shell.spec.ts
Offline: tend the rose with the server gone, reload, the care survived offline e2e/offline.spec.ts