Every memory in the bank¶
Written October 13, 2026. Stage 1 was built and run the same day; see each stage for where it stands.
The web app should show the complete list of a senior's memories, and every picture and video in that list should live in the senior's memory bank, not in the app's build or on Thomas's computer. Today it does not: a senior's memories are split between the app's own files and the bank, and the web shows the first kind from a copy compiled into the web app.
Where things are today¶
A memory is words and, usually, a picture or a video. For Tom and Nyna most of both come with the app; for Thomas and Lisa everything comes from the bank.
| Senior | Memories in the app | With a picture or video in the app | In the bank |
|---|---|---|---|
| Tom (1) | 29 | 12: 5 photos, 6 drawn illustrations, 1 video (the skydive) | Photos and videos added on the web, now 13 videos and the memory photos the family chose |
| Nyna (2) | 13 | 7 photos | Nothing yet |
| Lisa (4) | 2, no pictures | none | Nothing yet |
| Thomas (3) | none | none | Everything he has |
The app's 18 pictures and 1 video total about 9.5 MB and sit in
apps/mobile/assets/1/ and assets/2/ (Media). The
originals are on the shared drive, which also holds 13 photos that are in
no memory yet. The other files in those folders are not memories: Tom's
Faces deck pictures, and the three video-quiz clips.
What the bank can hold for a memory that comes with the app, keyed by the
memory's id (stories-skydiving): a replacement photo (memory_photos),
a song (memory_songs), and the fact that the family removed the app's
picture (memory_removed_pictures). It cannot hold the memory's words,
its year, a replacement video, or a memory with no picture at all. The
app's words and pictures reach the web only through
memory-screens.generated.json and a copy of the picture files compiled
into the web app (Memory screens). A video
memory cannot be changed on the web. Backups keep only what the family
changed; the app's own pictures are not in them.
The phone always starts from the words and pictures in the app and lays
the bank's changes over them (withMemoryPhotos, withMemorySongs in
src/features/bank/), so it works with no connection and keeps a cache of
the bank's lists. Only the lists are cached: the bank's pictures depend on
the image library's own cache, and videos stream every time.
The end state¶
- One list. The web app has one Memories page per senior: every memory, with or without a picture, in the order it happened, with its title, year, memory details, story, song, tags, and picture or video. Add, edit, and remove are all there. The Photos and Videos tabs become filters of that list, or go away.
- One home. Every picture and video is a file in the bank's storage. The app's build carries no memory media, and nothing about a memory is in the code.
- The phone still works offline. It fetches the bank's memories, keeps the words and a copy of the media on the phone, and plays from the copy.
- Nothing the family did is lost. Replaced pictures, chosen songs, removed pictures, memory details, and dates all carry over, and the memory ids stay what they are, so the phone's history of what Tom has seen and the songs chosen for a memory keep working.
Three stages get there, each one shipping on its own.
Stage 1: every picture and video into the bank¶
Built October 13, 2026. One change from the plan below: rather than
falling back to the app's file when the bank's copy cannot load, the phone
shows its own file whenever the bank holds an unchanged copy of it (the
copy's appMediaId names the memory's picture), so nothing is downloaded
for it and offline is untouched; a picture the family chose comes from the
bank. Replacing the app's picture deletes the bank's copy, as replacing any
memory photo always has; Stage 2 keeps the original.
No new table. The bank already keeps a photo for a memory under the memory's id; this stage lets it keep a video the same way, then copies every bundled picture and video in.
Worker. PUT /banks/:bankId/memory-photos/:memoryId accepts a video
file as well as a photo (the video rules apply: 80 MB, a poster, width and
height), so the row in memory_photos may point at a video asset. One
migration adds illustration to media_assets, sent with the upload and
returned with the asset, so a drawn picture keeps its label on the web and
the phone. The list route is unchanged in shape; a video asset simply has
kind: "video".
Phone. withMemoryPhotos lays a bank video over a memory as it lays a
photo today (remoteVideo instead of photo), and withoutRemovedPictures
drops a video too, so the family can remove any picture. The app's own file
stays as the fallback when the bank's copy cannot load, which keeps
offline working until Stage 3. A memory whose picture moved to the bank
comes first once in Tom's sessions, as a changed picture does today.
Web. The Memory screens page shows a bank video for a memory with the same player the Videos tab uses, lets a manager replace it or remove it (the one-minute and 80 MB limits apply), and shows the Illustration label from the asset.
The copy. pnpm memories:migrate <senior id> --bank <bank id>, built
like videos:upload (Media, "Uploading a batch of home
movies"): the logic in apps/api/src/, tested; the script signs in with
backup.env. For each memory in memory-screens.generated.json that has a
picture or video in the app, it uploads that file under the memory's id
with the memory's title, the catalog's description, credit, and
illustration flag, and, when the bank has no song for the memory yet, the
song the app plays (its Apple preview and artwork links are in
assets/songs/song-previews.json). A memory whose picture the family
already replaced is skipped: their choice wins. --dry-run prints the
plan. The export gains the fields it lacks (credit, topic, story is there
already), and the migration is run once for Tom and once for Nyna.
After Stage 1. Tom's and Nyna's 19 pictures and videos are in the bank; the web shows the bank's copy; the nightly backup holds every picture for the first time. The app's files are still in the build, as the offline fallback. Lisa and Thomas have nothing to copy.
Stage 2: the words into the bank, and one list on the web¶
Built October 13, 2026. Two changes from the plan below. The photos and
videos added on the Photos and Videos tabs keep their words where they are
(each asset row already holds them, and each is already a memory of its
own); the Memories page lists them below the bank's memories, videos now
included, rather than moving them into the new table. And the page keeps
the name Memory screens and the Photos and Videos tabs stay, so nothing a
family knows moves. The memories table, routes, copy, phone merge, edit
forms, and backups are as planned
(Memory screens, "The words in the bank").
A memories table. One row per memory, keyed by bank and memory id:
title, story (the senior's own words), memory details (a list), year,
topic, tags, an optional link to its picture or video in media_assets,
and a position for the order. The song stays in memory_songs. Memory ids
are kept: stories-skydiving for what came from the app, bank-photo-<id>
and bank-video-<id> for what was added on the Photos and Videos tabs, so
nothing on the phone or in memory_songs changes key. A memory added on
the web from now on gets a fresh id.
Routes. List, add, change, and remove a memory; give it a picture or a video, or take it away. The photo and video routes stay for serving files and for phone builds that predate this stage. Adding on the Photos or Videos tab creates a memory with a picture, as it does in effect today.
One migration, in the Worker. Every existing media_assets row that is
not a memory photo becomes a memory (its words move from the asset row to
the memory row); every memory_photos row becomes the picture of the
memory it was chosen for; a removed app picture becomes a memory with no
picture. Then memories:migrate runs a second time for Tom, Nyna, and
Lisa to write the words of every memory that came with the app, including
the ones with no picture yet (17 of Tom's), so the web finally lists them
all.
Phone. Fetch the bank's memories and build the session pool from them, with the words from the app used only until the first fetch has succeeded on a phone. The seed files lose their reminiscence items for a migrated senior in a later build; the quiz items are untouched.
Web. One Memories page: the decade filter and order from today's
Memory screens page, every card editable (title, year, details, story,
tags, song, picture or video), Add a memory with or without a picture.
memory-screens.generated.json and the compiled-in pictures retire; the
web reads the bank. Backups gain a memories/ section with the words, and
restore recreates memories before their pictures.
After Stage 2. The web shows the complete list for every senior, including memories waiting for a picture. Every word and every file is in the bank. The app still carries its copies of the pictures for offline play.
Stage 3: offline from the bank, and a smaller app¶
First half built October 13, 2026, on main: the phone keeps its own copy
of every bank picture, and of the videos up to 750 MB, under its documents
folder (src/features/bank/media-cache.ts), downloaded after each
successful fetch with the session's header, and plays from those copies
offline. The second half, removing the app's own memory files and words,
is on the memories-stage-3 branch, to be merged only after the
production copy has run for Tom, Nyna, and Lisa and a phone has played
from the bank. On that branch the seed files keep only their quiz
questions, the 19 memory pictures and the skydive leave
apps/mobile/assets and the catalog, the export test and its command
retire with memory-screens.generated.json frozen as a record, the web
stops bundling the app's pictures and shows the bank's copies (or says one
is missing), and an unpaired phone says no memories have been added yet.
The phone keeps a copy of each memory's picture and video in its own
files (downloaded after each successful fetch, in the background, videos
within a size budget) and plays from the copy, so a lost connection
changes nothing. Then the per-senior memory files leave the app's build
(assets/1/photos except the Faces pictures, 1/videos/skydiving.mp4,
assets/2/photos, 2/videos) along with their catalog entries, and the
app shrinks by about 9.5 MB. The Faces pictures and the video-quiz clips
are not memories and stay, or go with the quiz if it is dropped.
What to decide before Stage 1¶
- Nyna. Her 13 memories and 7 photos move into
bank-nynaas they are. Her profile is the test case for the memories of someone who has passed, and her words are written to her as "you" (Multiple seniors, "Nyna's profile"). The move changes where the words live, not what they say; the voice is a content question that can be settled after the move as easily as before. - The 13 drive photos in no memory (Lake Union, the NC beach in 1998,
the Whaler Inn, NYC, Thomas's condo, and Nyna's remaining prints) are
new memories, not a migration: they need words first, then they go in
through the web's Photos tab, or through a photo manifest for
videos:upload's sibling if there are many.DadandGary.HEICneeds converting to JPEG first; browsers do not show HEIC. - The wedding photo is in both Tom's and Nyna's memories. Each bank gets its own copy; that is fine.
- Old phone builds. Every change is additive at the routes, so a phone on an older build keeps playing what it played; it only misses the new video memories until it updates.
Checks that each stage must pass¶
- Stage 1: the migration's dry run lists exactly 12 memories for Tom and 7
for Nyna; after the run, the web's Memory screens page shows each
picture from the bank (the network tab shows
/photos/<id>/file, not a compiled asset), the skydive plays from the bank on the web and on the phone, a replaced picture is left alone, the nightly backup zip holds the 19 files, and the phone plays every memory with the network off. - Stage 2: the Memories page lists 29 for Tom, 13 for Nyna, 2 for Lisa, and
every bank photo and video; editing a title on the web shows on the phone
at the next session;
pnpm backup --dry-runreports the new section; restoring a backup into an empty bank rebuilds the list. - Stage 3: airplane mode, five memories play from the phone's own copies; the TestFlight build is smaller by the removed files.