← All repositories

reportage

A life-logging app for iPhone

git clone https://code.inqk.net/reportage.git


commit bbedf891669f64ae6bfe528bc1afa2fbf2490974
parent db59b0b0e84e874f5b1bbda2fe5066ef70f59da5
Author: Michael Camilleri <[email protected]>
Date:   Fri, 16 Oct 2026 19:24:14 +0900

Record the visual design and written entries

The design document described neither the Almanac look nor the written
entries, which now make up most of what sets Reportage apart from
Reporter, so the reasoning behind them existed only in the code and in
discussion.

This commit adds a Visual Design section and an Entries section. The
latter covers the display rules that build each draft, how activities
are cased mid-sentence, the proofreading pass with its placeholders and
its check, and when entries are written and rewritten. It also records
what the spikes with the on-device model found.

The data model gains the local narrative fields and a planned inline
form for tokens, the question model gains the plan for built-in and
custom questions, and the open questions now include the wording of the
built-in set, display rules for custom questions, inline forms and
entries in other languages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Diffstat

MNotes/Design.md | 166+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--

1 file changed, 163 insertions(+), 3 deletions(-)

diff --git a/Notes/Design.md b/Notes/Design.md

@@ -32,6 +32,9 @@ should work, and how the Reporter archive maps in.
 - CloudKit sync between iPhone and Watch.
 - Lossless import of the full Reporter archive.
 - On-demand JSON export with a documented, versioned format.
+- Written entries: each report reads as a short entry built from its answers,
+  such as 'Not working. Reading at the library, with Sam. Feeling great.' This
+  is what sets Reportage apart from Reporter. See [Entries](#entries).
 
 ### Not in scope yet
 
@@ -67,6 +70,32 @@ speaker. Reportage must never do this. See [Ambient noise](#ambient-noise).
   gitignored and never committed. Importer tests use a small hand-made fixture
   in `Tests/Support/` that mirrors the export's quirks.
 
+## Visual Design
+
+The look is called Almanac: ink on paper, like a printed journal.
+
+- **Colours** live in `Theme`: paper, ink, a muted grey for secondary text, a
+  hairline rule and one accent (ultramarine), each with a dark-mode value.
+  Text keeps at least 4.5:1 contrast against the paper in both modes.
+- **Type:** New York (the system serif) for what the user wrote: entries,
+  prompts, answers and token names. SF for everything around it. Labels such
+  as dates and report kinds use small spaced capitals. All sizes are Dynamic
+  Type styles.
+- **Home screen:** reports grouped under day headings, newest first. Each
+  shows its own local time (the period beneath on a 12-hour clock, so times
+  fit one column), its kind, its entry, any answers the entry doesn't cover,
+  and a line of context (locality and weather). Days are grouped in the
+  device's time zone: grouping by each report's own zone would put reports out
+  of order around midnight after a change of zone, which a sectioned fetch
+  can't show.
+- **Survey:** a flat header (Cancel, the kind and time, '3 / 6' and a progress
+  bar with a segment per question) instead of the glass toolbar, a serif
+  prompt, ink-outlined answer buttons, chips for chosen tokens and an
+  underlined search field.
+
+Spacing values are still set per view. A design pass, folding them into a few
+named values in `Theme`, waits until the Phase 2 screens settle.
+
 ## Data Model
 
 Persistence is Core Data with raw `CKSyncEngine`, as in Crossmate. It does not
@@ -106,6 +135,16 @@ devices that both seed them end up with the same questions after syncing.
 Their prompts are written in the user's language at seeding time and are
 ordinary data after that.
 
+**Built-in and custom questions (planned).** Each question needs a
+[display rule](#drafts) for its answers to read well in an entry. The plan is
+a fixed set of built-in questions whose prompts, options and display rules are
+app text (so they're translated when shown) and which can only be switched on
+or off and moved between surveys, plus custom questions the user writes with
+their own display rule. The built-in set should reuse Reporter's built-in
+question IDs, so imported answers map onto it directly: 7 of the 8 questions
+in the real export are Reporter's own. Today the default questions get their
+rules from `DisplayRule.builtIn`, keyed by ID.
+
 ### Report
 
 | Field         | Notes                                                        |
@@ -121,6 +160,8 @@ ordinary data after that.
 | `context`     | Encoded `Context` value (below).                             |
 | `legacy`      | For imported reports: the original Reporter snapshot JSON, compressed. This guarantees a lossless import without modelling every Reporter-specific field. |
 | `modifiedAt`  | Used for last-writer-wins on sync.                           |
+| `narrative`   | Local only. The polished entry (see [Entries](#entries)). Derived, so not exported or synced: each device writes its own. |
+| `narrativeDraft` | Local only. The draft `narrative` was made from. The narrative is current only while it matches the report's draft. |
 
 ### Response
 
@@ -152,6 +193,7 @@ past entry.
 | `place`       | For location tokens: a representative coordinate, names from the directory by language, and an optional external ID. |
 | `mergedInto`  | Set when the token has been merged into another. Answers referring to it read as referring to that token, so a merge rewrites no reports and can be undone. |
 | `archivedAt`  | Tokens are archived, never deleted.                          |
+| `inlineText`  | Planned. How the token reads mid-sentence when the automatic form is wrong: 'the park' for a place, or an activity's casing. |
 | `modifiedAt`  | Used for last-writer-wins on sync.                           |
 
 **Places** keep their names and coordinate, not just an external ID, so the
@@ -248,6 +290,113 @@ Context fields fall into two groups, and this shapes the whole capture design:
   Health samples, historical weather, photos taken in a time window. These are
   filled in lazily when possible, and can be backfilled.
 
+## Entries
+
+Each report reads as a short written entry. It's built deterministically from
+the answers, then lightly polished by the on-device model. The draft is always
+correct and always available, and the polish only improves its English: it
+can't add, drop or change anything the user said.
+
+### Drafts
+
+Each question has a `DisplayRule` saying how its answer reads:
+
+| Rule | Used for | Example |
+|------|----------|---------|
+| Activities | `tokens` questions | 'Reading, drinking coffee and watching Netflix…' |
+| Place | `location` questions | '…at Library…' |
+| People | `people` questions | '…, with Sam and Kai.' |
+| Phrases | yes/no | 'Yes' → 'Working', 'No' → 'Not working' |
+| Template | choice | 'Feeling %@' → 'Feeling great' |
+| Count | number | '1 coffee', '2 coffees' |
+| Quote | note | "Learned: 'The neighbours are nice people.'" |
+
+Activities, place and people join one clause, placed where the first of those
+answers comes in the survey. Other answers follow in survey order, one
+sentence each. An answer to a question with no rule is shown beneath the entry
+as its prompt and answer, so nothing is hidden.
+
+Notes are quoted exactly as written and never rewritten: free writing breaks
+templates in ways casing can't fix (several sentences, first person, lists).
+
+Later activities in a list are lowercased only when the first word is
+capitalised just at its start, its lowercase form is an ordinary English word
+(`UITextChecker`) and the language tagger doesn't mark it as a name. So
+'Drinking coffee' becomes 'drinking coffee', while 'Watching Netflix',
+'Studying Japanese' and 'TV' keep their capitals. People and places are shown
+as written.
+
+Drafts are English only for now, as is the polish.
+
+### Polishing
+
+`NarrativePolisher` sends the draft to the on-device model
+(`SystemLanguageModel`, with `permissiveContentTransformations` guardrails)
+with these instructions:
+
+    Proofread the input. Correct spelling, grammar and punctuation only.
+    Reply with the corrected text only.
+
+- **Protection.** People, quoted notes and every word with letters outside
+  ASCII are swapped for placeholders (`X1`, `X2`…) first and put back
+  afterwards. The model romanises Japanese names whatever it's told (吉祥寺駅
+  became 'Kyoji-ji Station', 'Yoshioji Station' and so on), and strips accents
+  ('Lumière'). Placeholders must look like ordinary words: bracketed ones such
+  as `[[1]]` were rewritten.
+- **The check.** `NarrativeCheck` accepts the output only if every placeholder
+  appears exactly once, the number of sentences is unchanged, no content word
+  is added or dropped (connecting words such as 'the', 'and' and 'with' may
+  change), a capital is only removed from an ordinary word, a place lowercased
+  after 'at' gains an article unless it reads without one ('home', 'work'),
+  and no article appears before a placeholder that didn't have one.
+- **Outcomes.** A passing output is stored. A failing one stores the draft, so
+  the report isn't retried every time it's shown. If the model is unavailable,
+  nothing is stored and it's tried again later.
+- One request runs at a time, responses are capped at 150 tokens (one input
+  once made the model generate until its 8,192-token limit), and scrolling
+  away cancels a waiting request.
+
+### When entries are written
+
+An entry is polished the first time it's shown: when its row appears and has
+no narrative, the row shows the draft with 'Writing narrative…' until the
+polish is stored. The narrative is stored with the draft it came from, so
+editing an answer or renaming a token changes the draft and the entry is
+rewritten the next time it's shown. A new report's entry is written as soon as
+the survey closes, because it appears at the top of the list. Entries for an
+imported archive are only ever written for the reports someone scrolls to.
+
+### What the spikes found
+
+Tested on the Mac's on-device model ('AFM 3 Core Advanced') with invented
+reports:
+
+- **Writing entries from scratch** invents details (a kitchen table, a date, a
+  time of night), changes what notes mean, drops answers and assigns people to
+  the wrong activities. Long cautious instructions made it either rewrite or
+  return the draft unchanged.
+- **A short proofreading request** does the right job: articles ('at the
+  library', 'at home'), casing and commas, consistently across runs. It's as
+  good as the Shortcuts Proofread action, which apps can't call: Writing Tools
+  (`UIWritingToolsCoordinator`) only works through its on-screen interface.
+- **With protection and the check,** 79 of 90 runs over 30 drafts passed, at
+  about 0.27 s each. Nine of the eleven failures were one stiff phrase in the
+  draft ('5.5 hours asleep', which the model always changed), so display rules
+  should be written in natural English.
+- The model doesn't fix every place ('Gardening at Park' stayed), and results
+  vary between runs, which is why the first passing result is stored.
+  Planned per-token inline forms cover what it misses.
+
+Other options looked at:
+
+- **Private Cloud Compute** (`PrivateCloudComputeLanguageModel`, new in iOS 27)
+  is off-device and rate-limited. It couldn't be tested from a command-line
+  script (`ModelManagerError 1046`); testing it would need a signed build.
+- **Custom adapters** for the system model were removed in iOS 27. An app can
+  instead plug its own model in through the now-public `LanguageModel`
+  protocol: a small model trained for this one task is a possible upgrade if
+  it clearly beats the current approach on a fixed test set.
+
 ## Prompt Scheduling
 
 ### Generating times
@@ -525,8 +674,8 @@ default); when included, each is the original JSON text as a string.
    tests, JSON export. This proves the model against real data before any UI
    depends on it.
 2. **Logging on iPhone.** Survey UI for every question type, wake, bedtime and
-   manual reports, the Unfinished list, and live context capture (location,
-   device, safe ambient noise).
+   manual reports, written entries, the Unfinished list, and live context
+   capture (location, device, safe ambient noise).
 3. **Prompts.** Scheduler, notification actions, background refresh.
 4. **Sync.** `CKSyncEngine`, both zones, first upload of the archive.
 5. **Watch.** Watch app, `LogPassiveReportIntent`, widgets and controls.
@@ -557,7 +706,18 @@ default); when included, each is the original JSON text as a string.
   coordinates permanently. Also recheck on iOS that lookup by ID ignores the
   app language (seen on macOS).
 - **Multi-select choice questions.** Reporter stores choice answers as arrays,
-  but every answer in the archive has a single value.
+  but every answer in the archive has a single value. The survey takes one
+  answer for now.
+- **The built-in question set.** Its prompts, options and display rules, and
+  whether the one custom question in the real export joins it. The wording
+  should come from the user rather than being copied from the export.
+- **Display rules for custom questions.** How the user writes one when adding
+  a question. The on-device model could suggest a rule for the user to check.
+- **Inline forms.** How the user sets a token's mid-sentence form ('the park'),
+  and whether the model should suggest one when a token is created, accepted
+  only if it changes nothing but case and a leading article. In a spike it got
+  common places right but also suggested 'the home' and 'the uniqlo'.
+- **Entries in other languages.** Drafts and the polish are English only.
 - **Vocabulary editing UI.** Renaming and merging are settled in the model
   (see [Token](#token)); how they're presented in the app isn't.
 - **App lock.** Should there be an optional Face ID lock? The data is personal.