Repository navigation
Rebuild INNERWORLD around the daily loop: Notice, Reflect, Make, Keep - #1
Conversation
Replaces the v1 theme-and-prompt studio with the loop from the design canvas, and clears the findings from the v1 audit. The loop - A daily question chosen by date, with a pigment of the day and three ways in: Read, Drift and Wander. Each way keeps one accent colour from the Today tile through to its own screen. - Reflect is private, on its own ground, and autosaves as you type. - Make derives the palette from the question and the feeling words, and says in plain words which colour came from where. Mark style stays a separate, taste-only choice. - Keep files the portrait in a nameable chapter. Quiet days are drawn as quiet days; today is drawn as still open. Nothing counts a run. Painting now works with no key and no network. The portrait is drawn on device with Canvas 2D from a seeded plan, so the same day, palette, mark and variant always redraw the same picture. A painting model is opt-in and receives the question, the palette and the mark style only. Audit fixes - Readable modules under src/ (app.js was 26 lines, longest 2,453 chars). - --host / INNERWORLD_HOST=lan answers on private addresses, so the app can be opened on a phone; public hostnames are still refused. - Reflections persist: a serialised write queue, a synchronous localStorage mirror and a flush on pagehide. - Feeling words now reach the paint instead of being collected and discarded. - alt text is a short human description; the prompt moved to "Why this?". - The provider adapter handles both b64_json and url responses, and names the configured model when one is unusable. - Per-piece Blobs, so saving one portrait no longer rewrites every image. - The 2.23 MB concept PNG is now an 86 KB WebP. - Content-Security-Policy with no unsafe-inline; dynamic pigment colours are applied through CSSOM. - 41 unit tests, plus a 16-step browser walk of the whole loop. Found while running it in a browser: the entrance animation re-ran on every re-render and moved controls under the reader's finger; paging controls shifted with body-text length; a tap immediately before navigation could be lost; viridian and malachite failed label contrast. All fixed, and a test holds every pigment to AA. Storage moves to a new database and is not migrated from v1. /api/generate is now /api/paint. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GgtNsRnu5yKbEqiiPDqfJF
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a5d7fa87e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const result = await response.json().catch(() => ({})); | ||
| if (!response.ok) throw new Error(result.error || 'The painting model could not be reached.'); | ||
|
|
||
| const blob = await (await fetch(result.image)).blob(); |
There was a problem hiding this comment.
Decode model images without a CSP-blocked fetch
When a painting model is configured and /api/paint succeeds, the server always returns the image as a data: URL, but this second fetch() is governed by the page's connect-src 'self' policy and data: is not self. Consequently every model-generated painting is rejected by CSP before it can be stored; decode the returned data directly or return/fetch it through a same-origin URL.
Useful? React with 👍 / 👎.
| const way = day.ways[kind]; | ||
| const meta = ways[kind]; | ||
| const note = kind === 'read' ? `${meta.label} · ${way.minutes} min` : `${meta.label} · ${way.minutes} min · ${kindNote(kind)}`; | ||
| return `<a class="wayin" href="#${kind === 'read' ? 'read' : 'practice'}"> |
There was a problem hiding this comment.
Route each practice link to the selected kind
Both Drift and Wander link to the identical #practice route, which neither carries the kind nor updates state.practiceKind. On a fresh session Wander therefore opens Drift, and after switching practices either link can open whichever kind was previously selected rather than the one the user clicked.
Useful? React with 👍 / 👎.
| if (state.readSlide >= piece.slides.length - 1) { | ||
| go('reflect'); | ||
| return; |
There was a problem hiding this comment.
Reflect on the question opened from Explore
After opening any non-today question from Explore and reaching its final reading slide, this always navigates to the ordinary Reflect route. That view and the subsequent painting use state.content (today's question), not state.reading, so “Reflect on this” abruptly presents an unrelated prompt and creates a portrait for the wrong question.
Useful? React with 👍 / 👎.
| const isToday = day === today; | ||
| // Today is still open. Calling it quiet before it is over would be a | ||
| // judgement the app has no business making. | ||
| const state = byDay.has(day) ? 'portrait' : ahead ? 'upcoming' : isToday ? 'open' : 'quiet'; |
There was a problem hiding this comment.
Keep text-only days out of portrait cells
Using “Save without a portrait” creates a kept, chapter-assigned piece with painting: false, but this condition classifies every chapter record as a portrait. My World then counts and renders that day as a clickable portrait, and opening it leads to “Nothing painted yet today” instead of representing the promised quiet day.
Useful? React with 👍 / 👎.
| const { actions } = ctx; | ||
|
|
||
| document.getElementById('rename').onclick = () => actions.renameChapter(); | ||
| document.getElementById('print').onclick = () => window.print(); |
There was a problem hiding this comment.
Render printable portrait details before printing
The My World print action invokes the browser dialog on the existing chapter overview, whose portrait cells are empty links and which contains no portrait images, titles, or questions. Thus the printed result cannot contain the “portraits with your titles and lines” promised immediately above this handler; a print-specific chapter layout must be rendered first.
Useful? React with 👍 / 👎.
| const state = { | ||
| day: localDay(), | ||
| content: null, |
There was a problem hiding this comment.
Refresh the daily state after midnight
The local day is captured once when the module loads and is never recomputed on routing, visibility changes, or focus. If the app remains open across local midnight, it continues showing the previous question and saves new reflections and paintings under yesterday's date until the page is manually reloaded.
Useful? React with 👍 / 👎.
Rebuilds INNERWORLD around the loop from the INNERWORLD Core Loop design canvas — Notice → Reflect → Make → Keep — and clears the findings from the v1 build audit. Patterns borrowed from the Humane Space field report are noted where they landed.
The loop
Each way keeps one accent colour from the Today tile through to its own screen, so a colour means one thing everywhere. All four tabs carry a visible label at all times.
Painting now works with no key and no network
The portrait is drawn on device with Canvas 2D from a seeded plan. The same day, palette, mark style and variant always redraw the same picture, so a kept portrait is never lost to randomness; Repaint moves to the next variation. A painting model is opt-in and receives the question, the palette and the mark style only — never the reflection.
The feedback loop closes
The v1 audit's most significant finding was that
look/fitfeedback was collected and read by nothing. Feeling words now choose the pigments, and Make states the derivation in plain words:Taste and resonance stay separate: mark style changes how paint is laid down, feeling words change which pigments appear.
Audit fixes
app.js14.5 KB in 26 lines, longest line 2,453 chars)src/(580 lines, longest 210)Host— the app could not be opened on a phone at all--host/INNERWORLD_HOST=lananswers on private addresses; public hostnames still refusedlocalStoragemirror, and a flush onpagehidealtwas the full 404-character prompt, negative-prompt boilerplate includedb64_jsonaccepted; a URL response reported "no image was returned"data-*innerHTMLdefault-src 'none',script-src 'self',style-src 'self'— nounsafe-inlineapp.js(70.6% of the JS)Found by running it, not by reading it
The browser check earned its place immediately:
Testing
npm test— 41 unit and server tests, no dependencies, Node 22.npm run e2e— 16-step browser walk, green twice in a row with no page or console errors.evil.example.comand8.8.8.8refused.Breaking
Storage moves to a new database (
innerworldv2); v1 Folio entries are not migrated and there is no import path yet./api/generateis now/api/paint.Not implemented
Accounts, cloud storage, sync, backup restore (export only), narrated audio for Drift, shared chapters, printed books, payments. No astrology or prediction of any kind. Artwork credits in Read are deliberate
[PLACEHOLDER]s until real public-domain images are chosen and their accession records verified — a wrong credit would cost more than a visible blank.Generated by Claude Code