Commit Graph
29 Commits
Author SHA1 Message Date
Claude c6ec069a67 WIP: access history, weekly digest and remaining back-office texts (helpers still working; not for review)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r
2026-11-30 18:57:12 +00:00
Claude 7c166d4714 Back office that prepares the work: drafted replies sent from inside, a one-line health verdict, the way in in plain German and English
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r
2026-11-30 18:53:37 +00:00
CatoandClaude 19f3218543 Back office: role-based access, invitations, and five screens in place of the owner page (#407)
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-30 07:37:14 +01:00
CatoandClaude Opus 5.5 c89a240672 Owner: one button mails a link to the owner address; no file to edit on the server (#405)
* Owner: one button mails a link to the owner address; no file to edit on the server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Health: the schema check covers the tables added this month

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-29 21:21:48 +01:00
CatoandClaude Opus 5.5 bf9e2afa64 Understanding test, word pages, sharing, what brings learners back, demo fixes, native-reader invitations (#403)
* Understanding test: does the chat get the meaning right, beside the same models without Heidi

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* A page for every word of the course, findable by the question people search

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Share an answer from the phone: the explanation and a link to Heidi, nothing stored

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* End of a sitting: what is due tomorrow, and the one step that brings this person back

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Demo fixes: options in one language when one has no gloss; verb forms repaired in place

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Owner page: where the native reading stands, and a message ready to send per place readers come from

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-29 18:37:26 +01:00
CatoandClaude 87ce804fe3 A landing page for every business type, with a pilot request form (#396)
One template for all six sectors: the moment, the cost, what exists today,
the situations from the pack that fit, a pilot for that sector and a form
that is kept and mailed to the owner. The home page names more of what the
product covers and opens a door for organisations.


Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 15:35:31 +01:00
CatoandClaude Opus 5.5 cb94dcbaaa Daily chat benchmark on /models; home page second pass (#392)
* Daily chat benchmark, and what the check is worth, on /models

Eight fixed messages through the real chat every night, and the texts to
be said in Zurich German also through the same models without Heidi; both
face the same rule check. The last seven nights are public on /models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Changelog: the benchmark entry, above the pages entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Changelog: the home page's second pass

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Home, second pass: show the message in the hero, name the reader, shorten

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 12:02:17 +01:00
CatoandClaude 5c6e1dd1a5 Review: a welcome, a fourth answer, invitations and standings (#389)
A reader who was sent the link is told why, is not asked about themselves
before the lines, and can say 'fine, but I say it differently' without
calling a line wrong. Several readers of one line give it a standing for
the owner; ?via= tells one invitation's readers from another's.


Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 09:54:06 +01:00
CatoandClaude 7a7d9317f5 Native speakers check the situations line by line (#388)
None of the 793 scene lines had been read by a native speaker. A reader now
goes through a scene with three buttons per line and an optional better
wording, without an account; the owner reads the verdicts and corrects the
pack. Linked from the organisations page and from each scene's line list.


Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 05:54:32 +01:00
CatoandClaude Fable 5.2 d2c9559ef5 Which one is Zurich German? Look-alikes with the reason; anonymous totals (#387)
* Owner check: why the owner pages do not open, for the person asking

The owner was named on the server and still got 404 on the numbers, with nothing to tell a missing sign-in from an unconfirmed address from a different address. /api/owner/check answers that about the caller only, and never says who the owner is.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Exercises: a review comes back in another form

Simulated over twelve daily sittings, a learner who got everything right met 52 different questions in 96: half of every sitting was the identical question on its review day. What is due is the subject, so where the scope has a never-answered question about the same subject in a different form, that one takes the review's seat (Plan.reviewOf) and its answer moves the card that was due (recordAnswer, siblings), so a subject keeps one schedule. New questions also prefer subjects not met yet. After: 83 different questions in 96; with half the answers wrong, 48 subjects instead of 30.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Situations: ask the word that matters, near-miss options, claims last

Reported from a phone on 2026-11-28 as useless: a heard line asked as a whole is read off its German cognates, with wrong options that are unrelated lines, or as a claim that is the German read back. Now the line is asked through its least German-looking pack word, in its sentence, with the pack's own four meanings (WordAsk; once per run; no cognates), else as three meanings whose wrong ones are near misses (negation out, day moved, number changed; German word tables with the packs), and as a claim only when neither is possible. Recorded against the line's own item, as pickOf is. Also: pagesFor for chat wayfinding, and no second printing of the German after a true claim.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Situations: a right answer moves on by itself, as in a sitting

Reported from a phone: the situation run waited for «Wiiter» after a right answer while a sitting moved on by itself. The pulse and the beat lived inside Verdict; they are now useAnswered, used by both. Touching the answer holds it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* wip: build your own sentence in the chat

* Chat: build your own sentence; a link to the page a question asks for

The moment a learner cares most about a Zurich sentence is when they asked for it, and the chat let them copy it without one act of recall. «Selber bauen» hides the line, deals its words out of order and has them rebuild it by tapping (build-own.ts; only lines the check passed; nothing stored). And a question that is really asking for a page gets a link to it under the answer (pagesFor, drawn; answers to questions only). Measured on a Pixel 7 viewport in de and ru: the line is hidden while building, no overflow.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Situations: take your turn by tapping or by writing, your choice

How much effort is the learner's choice: the turn opens on the word tiles, and «Lieber schreiben» swaps in the same line as the pack's typed, self-marked exercise (BuildStep.write). Recorded against the built item either way; kept for the run. Played through on a Pixel 7 viewport: toggle present, field shown, no overflow.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Near misses: read all of them, keep the safe kinds, add the ones care lines need

Measured: 57 of 156 heard lines in the care scenes fell back to unrelated wrong options. Added guarded swaps (noch nicht/schon, nicht mehr/noch, zweimal/dreimal, Nachmittag/Vormittag, gut before a participle, colours and heiss/kalt with their endings). Then read all 235 generated options: about a third were broken German or gave themselves away, so kein→ein, heute/morgen/gestern, früher/später and einmal are gone and the negation, schon and gut are guarded. 128 remain; a test pins nineteen rejects and checks every option in the pack is tidy.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Anonymous totals: what is started, finished and answered wrong

Practice lives in the browser, so nobody could say whether people finish a situation or which question everybody gets wrong. Decided by the owner on 2026-11-28: count it, anonymously. usage_counts holds a day, a key and a count; a key is built from a closed vocabulary and checked on the server against the scenes and questions that exist (usage/keys.ts), so nothing a client types is stored. /api/usage always answers 204. Runs, sittings, each first answer and the chat's own-sentence exercise report; the owner's numbers show 28 days and the hardest questions. The privacy page declares the flow in seven languages.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* One care word that cannot be guessed, and why four others were not added

The care scenes were mined for opaque words. «Strähl» (Kamm) is one; «Dokter», «Hämp», «Rugge» and «parat» are read off their German, and asking about them made the runs measurably worse. Recorded in the pack so the next attempt starts from the measurement.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

* Situations: which one is the variety? The line among its look-alikes, with the reason

The promise is the right dialect, and no exercise trained telling it from what is almost it. A look-alike is the line with one word changed, made only from a pack rule read backwards (a leak for the written standard, a regional or house rule for elsewhere), and kept only if the gate refuses it. The German is the question; after the answer the screen says why each wrong option is wrong (Which.notes). 312 of 491 heard lines have one; unrelated-option questions fall from 96 to 56 (everyday) and 41 to 23 (care). Recorded against the line's own item. Checked on a Pixel 7 viewport in de and ru.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-28 05:05:01 +01:00
CatoandClaude 28e9950014 Pass codes, a pass that buys a stronger model, and passes for organisations (#360)
A pass changed one number nobody reaches, was sold only for Bitcoin, and
was switched off. This makes a pass worth having and gives an organisation
a way to get one for each of its people.

- Pass codes (lib/pay/codes.ts, drizzle/0020_pass_codes.sql): the owner
  issues one code per person at /owner/pass-codes, each person redeems
  theirs on /pass. A code grants once, through paykit's extendEntitlement,
  and only its hash is stored. Needs no price and no OrangeCat.
- /pass takes a code whether or not passes are sold for Bitcoin; a pass is
  a pass without a price being set (hasPass no longer depends on one).
- The model a pass buys (lib/domain/model/pass-model.ts): one paid row in
  front of the free chain, named by HEIDI_PASS_MODELS, gated by ai-kit's
  spend rules. Off until configured; /pass promises it only then.
- Fixed: a pass tripled the allowance only in /api/chat. Saved
  conversations, where a pass holder writes, counted at the open rate.
- /organisations: a card for passes for a team, with a mail link.
- Wording in all seven interface languages; privacy page names pass_codes;
  account deletion keeps a redeemed code used and unattributed.


Claude-Session: https://claude.ai/code/session_019MDtmteJuDGFouA1itJ5tM

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-26 00:31:37 +01:00
CatoandClaude edf2cd32c5 release: informal address everywhere, engine clean-up, account limits, owner numbers (#358)
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 18:07:34 +01:00
CatoandClaude 38efcba8ed release: calmer shell, exercises that stay fresh, and the languages of Switzerland (#357)
* feat(practice): sittings that stay fresh, a level the learner moves, and a summary worth reading

Half of every sitting is new while the scope has anything new; reviews
that find no seat lead the next one. A question answered and not yet due
is not asked again, and a used-up scope says so and offers the wider
sitting. One question per word or line per sitting. The level of new
questions follows the learner's own setting (easier, just right, harder)
and moves by itself on a run of right answers or repeated misses, said in
a line with the way back. Five named modes over the existing kinds. The
end of a round names what was new, one thing to take away, tomorrow's
reviews and how far through the course.

Also: «Pack» is gone from what a learner reads, a typed answer is told
whether it counts with only the differing words marked, picked tiles are
outlined instead of filled, and the session screen cannot be double-tap
zoomed.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(shell): a calmer header, menu, footer and personal page; the languages of Switzerland; du in Swiss German

Header: on a phone the bar is the brand, the account and one menu control,
as plain glyphs. Language and light/dark moved into the menu sheet (and stay
in the settings and the footer); from 1024px the language stays in the bar
and its panel carries the appearance. site-header.tsx is 166 lines; the wide
bar is header-nav.tsx.

Menu sheet: rows with a line saying what is behind each page, one filled
action, language and theme at the foot. Footer: the menu's groups, said once.

Personal page: one action that names what it starts, one due line, three
facts (where you left off, course progress, your words) and everything else
behind one disclosure. Situations show their name, started ones only;
channels are grouped with dates as people write them; no filled status pills.

Languages: /languages and a home section from lib/config/languages.ts — one
available, the rest planned, no dates. A 'tell me' form stores address,
language, optional region, locale and time in language_interest (migration
0016, additive), rate-limited, listed on the privacy page, erased with the
account whose address it is. No confirmation mail is sent, and the form says so.

Feedback widget: drawn by the page (footer and menu entry, the widget's
data-fc-place=host contract) instead of a tab floating over the text.

Copy: Swiss German says du throughout; the German white paper and changelog
too. 'Pack' is gone from learner-facing text in all seven dictionaries.
French, Italian, Romansh and Russian still address the reader formally.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* fix(practice): a takeaway that is true on its own, the answered states in the responsive audit

The summary's takeaway and its list of new things read a pair that holds
by itself (a gap's word is no longer shown beside its whole sentence's
meaning) and prefer the line furthest from German. A wrong answer keeps
one short part in sight (the reason, else the rule, else the word) and
folds the rest under «more on this». «Stimmt» is outlined like every
other picked answer. The responsive audit now opens a typed answer, its
comparison and a revealed gap, the states a phone reported cut off.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 16:53:18 +01:00
CatoandClaude 083dd52f0d feat(engine): courses in data, pack-declared forms, level sources, and meanings in the learner's language (#355)
* feat(course): every stored record names its course, and today's progress is the Zurich course's

A course registry (lib/course/registry.ts) lists the one course there is;
lib/variety/active.ts resolves its pack. Browser stores that hold course
progress move to an envelope keyed by course under .v2 keys, and a value
under the old .v1 key is read as the default course without being rewritten.
progress_devices, certificates and entitlements gain a course column that
defaults to the Zurich course. Item ids are unique across courses, and the
default course's ids are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(variety): the pack declares its articles, persons, respellings, voices and prompt lines

Article, FormLabel and VocabularyGroup were closed unions of the Zurich
values, the answer comparison folded Zurich respellings for every language,
word distance lower-cased as German, the voice ranking named two German tags
and the prompt builder carried Swiss spelling advice. Each is now a field of
the pack, read by the engine; a contract test over every pack refuses a value
the pack did not declare, and the leak test also looks for the taught
language's own words in engine code. The Ukrainian pack gains one verb with
its own pronouns and no articles. The 2,956 published items and the system
prompt are byte-identical.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(practice): an item's level comes from a source the course chooses

A course entered from a sibling language measures each item's distance from
that language, exactly as before; a course entered from zero reads a declared
CEFR band on the word, the line or the topic. levels.ts exposes both as
LevelSource and picks by Course.entry. Every published item keeps its level.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* feat(meaning): a meaning can be shown in the learner's language

A meaning is the bridge form plus an optional gloss in the interface
language. One pure rule (lib/domain/meaning/meaning.ts) decides what is
printed from the learner's answer to «Wie gut ist dein Deutsch?»: good shows
German only, as before and by default; some shows German and the gloss; none
shows the gloss; without a gloss German is always shown. Every exercise, the
word list and the scene pages print meanings through one component. The
answer is a course store, set in the settings and asked once after the start
card, only in an interface language that has glosses. Gloss sets are one
file per course and language, loaded on demand.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* content(glosses): English and Russian meanings for every word and scene line; French and Italian for every word

Machine drafts from the Zurich form and its German meaning together, marked
unreviewed in the data. One file per language beside the pack, keyed by the
German the course gives. Tests refuse a key no entry carries, an empty gloss
and two glosses for one German form; pnpm run glosses:coverage prints what
is covered.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* content(glosses): French and Italian meanings for every scene line

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* docs: courses, pack-declared forms, level sources and glosses, as they now are

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

* refactor(variety): the pack says which grammatical person each of its labels is

The gloss check and the prompt's auxiliary table, both new on main, matched
the Zurich labels «ich» and «er» by name. The forms pass of the leak test
caught it on rebase. The pack now declares personOf, and both read it; the
system prompt and the published items are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-25 14:17:35 +01:00
CatoandClaude e80c8ade18 fix(db): one connection pool per server process, not one per route bundle (#301)
Routes are built separately and each bundle that imports lib/db gets its
own copy of the module. The handle lived in a module variable, so each
copy opened its own pool of up to ten connections against a Postgres the
box shares between products. The deploy of #299 was refused at its schema
step with "too many clients already".

The pool now lives on globalThis under a registered symbol (the same fix
lib/auth/sender.ts needed), with its ceiling stated.

Claude-Session: https://claude.ai/code/session_019MDtmsxWVjuhCQowciDEYR

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 05:41:18 +01:00
CatoandClaude 28d5e9f214 feat(pay): a time-boxed pass, paid in Bitcoin to Heidi's OrangeCat project through @bitbaum/paykit (off until configured) (#294)
* fix(privacy): never show an email address as a person's public name

Sign-up asks for no name, so requireActor's `name || email` made the email
the display name of nearly every account. It was stored on speaking topics,
rounds, attendance and group members, and the topics board is readable signed
out: GET /api/speaking/topics returned the proposer's address.

- publicName(): the chosen name, else a stable '#XXXX' handle from the actor id
- migration 0011 writes the same handle over stored addresses (UPDATE only)
- public topic/round lists return an account id only to its owner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(auth): account mail in the reader's language

The shared template is English only. Through accountkit's render slot, the
verify / sign-in link / reset mails are written in the language of the page
the link lands on (its callbackURL); locales without copy use German.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(header): render the account control at request time in every build

authEnabled is read at module load, so a build without BETTER_AUTH_SECRET
prerendered every page with no sign-in control, and CI's layout audit
measured a header narrower than production's. connection() + authStatus()
make the header the same in every build; CI now starts with a throwaway
secret so the audits see the real header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(ui): one primary action on the home fold; dock off phone auth forms

- 'Jetzt testen' jumps to the chat, which on desktop is the column beside it:
  shown on phones only, leaving one primary button in the desktop fold
- the floating dock launcher covered the sign-in form's buttons at 390px;
  hidden on phone-sized account forms only (guarded list updated)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(security): outbound fetches, feed parsing and upload limits

- channels: every feed/redirect/audio/transcript fetch goes through
  publicFetch (ai-kit validateFetchTarget per hop, 8 MB body ceiling); a
  signed-in user could previously make the box fetch internal addresses
- push: subscribe only accepts real browser push service endpoints
- sweep: one channel that throws is recorded as failed instead of failing
  the whole hourly sweep forever; entity decoder no longer throws or emits NUL
- a pasted transcript never replaces the publisher's/platform's
- feeds write at most 200 newest items (Postgres parameter limit)
- synced progress kept for at most 10 devices per learner
- transcribe routes refuse a declared oversize body before parsing it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* chore(packages): chatkit 0.23, plan bindings, experience ceiling, proxy.ts

- @bitbaum/chatkit ^0.23.0 (the registered release)
- package-plan: bindings matched to the code (createAuthMailer in mail.ts,
  ChatApp in workspace.tsx); experience ceiling set at zero
- the five dialect/transcript text boxes carry experience-exempt reasons:
  dictation would turn dialect into Standard German (HEIDI.md §6) or compete
  with the page's own recorder
- middleware.ts -> proxy.ts (Next 16 deprecation)
- drop the dead limitkit git allowBuilds entry (limitkit is on npm)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): 2026-11-09

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(design): adopt @bitbaum/design-tokens faces and composition grammar

The type stack asked for Helvetica Neue, which only Apple ships: Windows drew
Arial and Android Roboto. Inter and IBM Plex Mono are now self-hosted from
the package (app/fonts.ts, generated by design-tokens-next-fonts, latin,
latin-ext and cyrillic), and composition.css is loaded. Heidi keeps its own
palette, as the package README asks of a product with its own brand. Also
the keyframes for the sitting celebration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): ask what the learner needs Swiss German for

'Meine Situationen': a learner picks the situations they actually face, and
every practise button (Today, the dock, the welcome-back card) draws from
them through a new multi-scene scope (?scenes=a,b). One choice is the
ordinary scene scope; none is everything. Device-only, declared on the
privacy page. The signed-in home leads with it; the warm-up invite is a
quieter line under it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(home): shorter first screen, welcome back, a finish worth reaching

- home at 390px: 10,415px -> 7,270px; the personal moments stay without
  their paragraphs, society's moments move to /organisations
- a returning signed-out learner gets their next step above the intro
- the end of a sitting shows the day earned and the week filling (no score)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(voice): server voice when the device has no German voice

Read-aloud only used the browser synthesiser, so most Windows/Linux machines
said 'no voice'. /api/speak reads the line with a German Gemini voice
(GEMINI_API_KEY, already on the box): generateContent on
gemini-2.5-flash-preview-tts, then the interactions route on
gemini-3.8-flash-lite-tts; PCM wrapped as WAV; rate-limited, 600 chars,
small cache. The device's own voice is still tried first, the label stays
'german', and a failed server call reads exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(chat): 'sign in to keep it' keeps it without asking twice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): situations, voice, home

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): choose your situations on /practice too

A signed-out learner has no signed-in home, so /practice is where they say
what they need Swiss German for. The tiles drop their decorative checkbox:
at 390px it left 94px for «Treppenhaus» and «Вечернее беспокойство»; the
fill and aria-pressed carry the state. responsive audit: 1386 renders, 0
overflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): instant, unmistakable feedback on every answer

The right answer used to turn black whether or not it was picked, and
'wrong' had no colour, so a learner had to read the bar to know. Now:
the tapped option turns green with a tick or red with a cross (pop/shake,
off with reduced motion), the right one is outlined green, and the verdict
is a tinted strip with a varied word of encouragement. A right answer moves
on by itself after 1.3s (countdown on 'Weiter'; 'Warum?' holds it); a wrong
one keeps its explanation. A short vibration on phones. '3 in Folge' when
true. New correct/incorrect colour roles in light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): no two sittings alike

orderSession takes a seeded random and uses it only where the order was
arbitrary (the alphabetical tie-break between equally due, equally weak,
equally fresh questions and kinds); every new sitting gets a fresh seed.
Options, word banks and matching columns are laid out afresh each time a
question is shown (present.ts), answers remapped. Same seed = same sitting,
no seed = the old order; due and weak items still come first (tested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): build the sentence, 'Stimmt das?', and a recognise-then-produce ladder

- build: the Zurich words of a line the learner says (3-9 words), shuffled
  with one stranger from the same scene, tapped into order, marked by the
  app (134 items). Production that is objectively checkable.
- verify: a heard line with a meaning beside it, true or not, one tap; false
  meanings come from the same scene (275 items).
- ladderOf: until a line is recognised reliably, recognition forms come
  first; afterwards production forms. A tie-break after schedule and
  pressure, never before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): practice rebuilt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* style(practice): answer feedback in Heidi's own colours

No green: it belonged to no other screen. The feedback roles now alias the
palette: right is ink (the action colour, black / white in dark) with a
tick; wrong is the flag red the theme reserves for errors, as an outline on
the existing pale red tint rather than a red slab; the revealed answer is
outlined in ink. The verdict strip is neutral grey or pale red; the end-of-
sitting check and week cells are ink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): one measure of distance from German, and a level on every exercise

lib/domain/vocabulary/distance.ts classifies a Zurich word against its German
as same/close (incl. a dropped -ch/-n: au, no), rule (free once one of the
pack's sound correspondences is applied: Chind, chaufe), far (nöd, öppis) or
trap (the pack's mistakenFor: Estrich). The vocabulary page's 'guessable'
now delegates to it. levels.ts gives every generated item a level (1 like
German, 2 by a rule, 3 different) on source.level, server-side: 400 / 593 /
1964 of 2957.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): skills and levels tracked; sittings move up a level as it holds

- kinds/meta.ts: what each kind tests (understand, words, sounds, forms,
  articles, produce) and its rung, in one Record typed against the kinds;
  the ladder's private list of kind names is gone.
- the learner model gains skills and levels axes (old records load); its
  axes are one MODEL_AXES list that observing, decoding and device sums read.
- frontierOf: level 1 until it holds (>=12 answers, <=20% missed), then 2,
  then 3; stretch ranks after schedule, pressure and ladder. Skills and
  levels report; they do not add pressure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(home): 'Was sitzt' — answers by skill and by distance from German

Right/missed counts per skill and per level, 'holds' on the same bar as the
level frontier, and the level the learner is working at. Counts, not a
score. Seven languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(listening): dialect podcasts get a labelled German rendering and questions

Measured 2026-11-09: no product or public model writes spoken Zurich German
in dialect spelling reliably (best ~46% words right); Whisper renders it into
Standard German at ~23% WER, mostly rewordings. So a dialect episode with no
publisher transcript is no longer refused: the opening minutes are rendered
by the existing recogniser and stored as transcript.source 'rendering',
labelled on every screen as German 'sinngemäss — nicht der Dialekt, wie er
klingt' (lang=de); questions are asked about content only. Nothing reads a
dialect form from it (HEIDI.md updated).

- channels followed by feed/app are matched to the register by name on the
  publisher's domain (lib/channels/spoken.ts), also at request time for
  channels followed before
- migration 0012 re-offers episodes stored as 'none' (UPDATE only)
- question prompt stays variety-neutral (leak test)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(practice): what a walkthrough of every exercise found

Played a sitting end to end in a browser at 390px and fixed what read wrong:

- Self-check cloze said "which word is missing?" with nowhere to answer;
  it now says to answer aloud or in your head, then reveal.
- A word's "Why?" was the same advice for every word. It now follows the
  distance classification: close to German, a named sound rule with the
  pack's example (ruleBehind), or a word to learn.
- Match grids could be solved by shape (four "add an n" verbs) and could
  offer one meaning twice (Hoi/Salü = Hallo). Grids now mix closeness and
  hold at least two words German does not give away; tests pin both.
- A checked sentence build kept tile padding, scattering the words; it is
  now one line with misplaced words marked.
- Writing "nid" now notes the pack's house form "nöd" (preferredForms on
  the display projection; no component imports the full pack).
- The finish recap printed the German answer as the missed dialect word;
  recapOf gives both sides. "1 kommen nochmals" is pluralised in 7 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(account): ask once about progress sync; finish the walkthrough fixes

Signed up and used a new account on two browsers:

- A new account synced nothing and said nothing; the switch lived only in
  settings. The signed-in home asks once (SyncOffer), either answer is
  kept; sync stays off until chosen. turnSyncOn/keepSyncOff are shared with
  the settings switch.
- «Meine Situationen» joins synced progress as the `focus` key, decoded on
  the server like every other key, and adopted on a device only where
  nothing is chosen. Privacy register and sync copy say so in 7 languages.
  Two-device check: device two shows the situations, is not asked again.
- Verification mail no longer says it "finishes" sign-up for an account
  that already works. The OrangeCat one-click sentence shows only where
  the button is (methods.signin).
- Chat footer shows the model's name (modelLabel), not the route id; a
  German reader's gloss is not repeated; chat asks ai-kit for light
  reasoning so the first words come sooner.
- compareWords no longer offers a typed word that matches one pack word
  as another's near miss.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(mail): account mail as laid-out HTML through mail-kit 0.3.0

The verify, sign-in-link and reset mails were plain text. They now carry the
fleet's one layout (@bitbaum/mail-kit renderMail): Heidi's red and cow mark,
a heading, one button, the sign-in code to type on another device, a note,
and a footer that says why the mail arrived. Dark mode follows the reader's
client. The plain-text version is unchanged and still sent alongside.
Security mail carries no unsubscribe (footer.unsubscribe: null), by design.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(mail): an opt-in evening reminder that is quiet by construction

One email when questions are due, off until the learner switches it on in
the settings (offered with progress sync on, since the server reads what is
due only from a syncing device).

- lib/mail/reminder-policy.ts decides, and errs toward silence: opted in,
  verified address, not on day one, 18:00 in their own zone, at most every
  other day, five or more due, not if they practised today, and none after
  three in a row went unanswered. Pure, with tests.
- The mail uses the fleet layout (@bitbaum/mail-kit renderMail): count, the
  streak only from two days, one real due line from the pack, one button,
  the reason it came, preferences and unsubscribe. Six languages; worded as
  a good moment, never as loss (HEIDI.md §3), with a test on loss words.
- One-click unsubscribe: List-Unsubscribe + -Post headers (RFC 8058) and a
  footer link to a page with one button (a GET changes nothing, so a link
  scanner cannot unsubscribe anyone). Signed, non-expiring token.
- mail_preferences (migration 0013), /api/mail/preferences,
  /api/mail/unsubscribe, /api/cron/reminders (hourly, CRON_SECRET).
- Privacy register: the preference row and the mail vendor.
- Checked end to end against local Postgres: sends once at 18:00, refuses a
  duplicate hour, refuses the next day, counts an unanswered one, unsubscribes
  from the page and from the one-click POST, rejects forged tokens.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(account): deleting an account deletes the person; 404s lead home

Found by using Heidi as its users do (64-scenario run, then deleting a test
account and counting rows):

- Deleting an account removed the login but left the person's synced
  progress, reminder setting, language, conversations, group memberships,
  follows, push subscriptions and certificates in the database, attached to
  nobody. lib/domain/account/erase.ts now removes them in one transaction
  after the deletion succeeded (a wrong password erases nothing). A group
  they made passes to its longest-standing member; their group messages stay
  for the others, unattributed. erase.test.ts walks the schema and fails when
  a table with a person column is not handled. Verified against Postgres:
  wrong password 400 and nothing erased; right password, every row gone.
- Most unknown URLs (a typo, a removed page, /xx/…) showed Next's bare English
  "404" with no header and no way home, because the root layout lives under
  [locale]. app/global-not-found.tsx answers in the URL's or the browser's
  language and links home (experimental.globalNotFound).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(settings): no reminder switch for accounts that share no address

A person who signs in with Google or GitHub through the shared sign-in shares
no email address with Heidi by design, so a reminder could never reach them,
yet Settings offered the switch and it did nothing. It is not offered now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* wip: automated passes through paykit

* fix(dock): the bar never lies on a control, and the page ends clear of it

The Practise / Ask Heidi pill covered Start on /practice at 390px, the
password field on sign-in and the warm-up's Try it at 768px. It now checks
what is under its resting place and slides away while that is a control, at
every width. The footer ends one pill, its offset and the safe-area inset
higher, so the last row of links is never under it.

The lists the feedback widget's button sat on are marked data-fc-avoid,
which the widget honours.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(mail): send as Heidi's own domain once it is verified, and say which sender is in use

Account mail carried the retired FleetCrown name in its From line. A sender
cannot be renamed on faith: mail from a domain the key has not verified is
refused. Heidi now asks the mail service which domains this deployment's key
may send from and uses heidi.orangecat.ch, then orangecat.ch, as soon as one
is verified; until then the shared sender stays. /api/health reports the
From line in use and the domains the key knows.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(legal): the Impressum names the Heidi project, privacy gives each vendor's company and country, and the offer to care homes says where it stops

- Impressum: operated by the Heidi project (bitbaum), with the contact
  address; no person, no postal address, and no promise of one.
- Privacy: each company that answers messages is listed with its legal
  entity and country, linked to the page that states it; no row names a
  company twice.
- Organisations: a paragraph beside the offer says Heidi is for practising,
  not for the bedside, and that no personal or health details belong in it.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* docs(changelog): keep main's 10 November entries beside this branch's

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* docs: the recipe for cloning Heidi into a sibling language app, and one source for the product name

docs/clone-a-language-app.md: what is config, what is content and what stays
in packages, in the order the steps happen.

The product name was written in five places; the share card, the title
template, the landing config, the manifest and the account mail now read
ASSISTANT_NAME, so a clone changes it once.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(mail): the reminder carries the same verified sender as account mail

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* wip: privacy row for passes

* wip: service test for the whole payment path

* feat(pay): a time-boxed pass, paid in Bitcoin to Heidi's OrangeCat project through @bitbaum/paykit

Off until a price is configured. When on: a signed-in learner gets an invoice
from OrangeCat through paykit, Heidi stores which learner it was for, and the
pass is granted once when OrangeCat's payment.settled webhook arrives or the
open checkout page's poll sees it paid. A pass triples the chat allowance.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* chore: keep package-plan.json's formatting

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-11 17:11:30 +01:00
CatoandClaude a3f1255010 Commercial readiness: accounts and sync, practice rebuilt with levels, walkthrough fixes (#282)
* fix(privacy): never show an email address as a person's public name

Sign-up asks for no name, so requireActor's `name || email` made the email
the display name of nearly every account. It was stored on speaking topics,
rounds, attendance and group members, and the topics board is readable signed
out: GET /api/speaking/topics returned the proposer's address.

- publicName(): the chosen name, else a stable '#XXXX' handle from the actor id
- migration 0011 writes the same handle over stored addresses (UPDATE only)
- public topic/round lists return an account id only to its owner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(auth): account mail in the reader's language

The shared template is English only. Through accountkit's render slot, the
verify / sign-in link / reset mails are written in the language of the page
the link lands on (its callbackURL); locales without copy use German.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(header): render the account control at request time in every build

authEnabled is read at module load, so a build without BETTER_AUTH_SECRET
prerendered every page with no sign-in control, and CI's layout audit
measured a header narrower than production's. connection() + authStatus()
make the header the same in every build; CI now starts with a throwaway
secret so the audits see the real header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(ui): one primary action on the home fold; dock off phone auth forms

- 'Jetzt testen' jumps to the chat, which on desktop is the column beside it:
  shown on phones only, leaving one primary button in the desktop fold
- the floating dock launcher covered the sign-in form's buttons at 390px;
  hidden on phone-sized account forms only (guarded list updated)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(security): outbound fetches, feed parsing and upload limits

- channels: every feed/redirect/audio/transcript fetch goes through
  publicFetch (ai-kit validateFetchTarget per hop, 8 MB body ceiling); a
  signed-in user could previously make the box fetch internal addresses
- push: subscribe only accepts real browser push service endpoints
- sweep: one channel that throws is recorded as failed instead of failing
  the whole hourly sweep forever; entity decoder no longer throws or emits NUL
- a pasted transcript never replaces the publisher's/platform's
- feeds write at most 200 newest items (Postgres parameter limit)
- synced progress kept for at most 10 devices per learner
- transcribe routes refuse a declared oversize body before parsing it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* chore(packages): chatkit 0.23, plan bindings, experience ceiling, proxy.ts

- @bitbaum/chatkit ^0.23.0 (the registered release)
- package-plan: bindings matched to the code (createAuthMailer in mail.ts,
  ChatApp in workspace.tsx); experience ceiling set at zero
- the five dialect/transcript text boxes carry experience-exempt reasons:
  dictation would turn dialect into Standard German (HEIDI.md §6) or compete
  with the page's own recorder
- middleware.ts -> proxy.ts (Next 16 deprecation)
- drop the dead limitkit git allowBuilds entry (limitkit is on npm)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): 2026-11-09

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(design): adopt @bitbaum/design-tokens faces and composition grammar

The type stack asked for Helvetica Neue, which only Apple ships: Windows drew
Arial and Android Roboto. Inter and IBM Plex Mono are now self-hosted from
the package (app/fonts.ts, generated by design-tokens-next-fonts, latin,
latin-ext and cyrillic), and composition.css is loaded. Heidi keeps its own
palette, as the package README asks of a product with its own brand. Also
the keyframes for the sitting celebration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): ask what the learner needs Swiss German for

'Meine Situationen': a learner picks the situations they actually face, and
every practise button (Today, the dock, the welcome-back card) draws from
them through a new multi-scene scope (?scenes=a,b). One choice is the
ordinary scene scope; none is everything. Device-only, declared on the
privacy page. The signed-in home leads with it; the warm-up invite is a
quieter line under it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(home): shorter first screen, welcome back, a finish worth reaching

- home at 390px: 10,415px -> 7,270px; the personal moments stay without
  their paragraphs, society's moments move to /organisations
- a returning signed-out learner gets their next step above the intro
- the end of a sitting shows the day earned and the week filling (no score)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(voice): server voice when the device has no German voice

Read-aloud only used the browser synthesiser, so most Windows/Linux machines
said 'no voice'. /api/speak reads the line with a German Gemini voice
(GEMINI_API_KEY, already on the box): generateContent on
gemini-2.5-flash-preview-tts, then the interactions route on
gemini-3.8-flash-lite-tts; PCM wrapped as WAV; rate-limited, 600 chars,
small cache. The device's own voice is still tried first, the label stays
'german', and a failed server call reads exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(chat): 'sign in to keep it' keeps it without asking twice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): situations, voice, home

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): choose your situations on /practice too

A signed-out learner has no signed-in home, so /practice is where they say
what they need Swiss German for. The tiles drop their decorative checkbox:
at 390px it left 94px for «Treppenhaus» and «Вечернее беспокойство»; the
fill and aria-pressed carry the state. responsive audit: 1386 renders, 0
overflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): instant, unmistakable feedback on every answer

The right answer used to turn black whether or not it was picked, and
'wrong' had no colour, so a learner had to read the bar to know. Now:
the tapped option turns green with a tick or red with a cross (pop/shake,
off with reduced motion), the right one is outlined green, and the verdict
is a tinted strip with a varied word of encouragement. A right answer moves
on by itself after 1.3s (countdown on 'Weiter'; 'Warum?' holds it); a wrong
one keeps its explanation. A short vibration on phones. '3 in Folge' when
true. New correct/incorrect colour roles in light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): no two sittings alike

orderSession takes a seeded random and uses it only where the order was
arbitrary (the alphabetical tie-break between equally due, equally weak,
equally fresh questions and kinds); every new sitting gets a fresh seed.
Options, word banks and matching columns are laid out afresh each time a
question is shown (present.ts), answers remapped. Same seed = same sitting,
no seed = the old order; due and weak items still come first (tested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): build the sentence, 'Stimmt das?', and a recognise-then-produce ladder

- build: the Zurich words of a line the learner says (3-9 words), shuffled
  with one stranger from the same scene, tapped into order, marked by the
  app (134 items). Production that is objectively checkable.
- verify: a heard line with a meaning beside it, true or not, one tap; false
  meanings come from the same scene (275 items).
- ladderOf: until a line is recognised reliably, recognition forms come
  first; afterwards production forms. A tie-break after schedule and
  pressure, never before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* docs(changelog): practice rebuilt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* style(practice): answer feedback in Heidi's own colours

No green: it belonged to no other screen. The feedback roles now alias the
palette: right is ink (the action colour, black / white in dark) with a
tick; wrong is the flag red the theme reserves for errors, as an outline on
the existing pale red tint rather than a red slab; the revealed answer is
outlined in ink. The verdict strip is neutral grey or pale red; the end-of-
sitting check and week cells are ink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): one measure of distance from German, and a level on every exercise

lib/domain/vocabulary/distance.ts classifies a Zurich word against its German
as same/close (incl. a dropped -ch/-n: au, no), rule (free once one of the
pack's sound correspondences is applied: Chind, chaufe), far (nöd, öppis) or
trap (the pack's mistakenFor: Estrich). The vocabulary page's 'guessable'
now delegates to it. levels.ts gives every generated item a level (1 like
German, 2 by a rule, 3 different) on source.level, server-side: 400 / 593 /
1964 of 2957.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(practice): skills and levels tracked; sittings move up a level as it holds

- kinds/meta.ts: what each kind tests (understand, words, sounds, forms,
  articles, produce) and its rung, in one Record typed against the kinds;
  the ladder's private list of kind names is gone.
- the learner model gains skills and levels axes (old records load); its
  axes are one MODEL_AXES list that observing, decoding and device sums read.
- frontierOf: level 1 until it holds (>=12 answers, <=20% missed), then 2,
  then 3; stretch ranks after schedule, pressure and ladder. Skills and
  levels report; they do not add pressure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(home): 'Was sitzt' — answers by skill and by distance from German

Right/missed counts per skill and per level, 'holds' on the same bar as the
level frontier, and the level the learner is working at. Counts, not a
score. Seven languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(listening): dialect podcasts get a labelled German rendering and questions

Measured 2026-11-09: no product or public model writes spoken Zurich German
in dialect spelling reliably (best ~46% words right); Whisper renders it into
Standard German at ~23% WER, mostly rewordings. So a dialect episode with no
publisher transcript is no longer refused: the opening minutes are rendered
by the existing recogniser and stored as transcript.source 'rendering',
labelled on every screen as German 'sinngemäss — nicht der Dialekt, wie er
klingt' (lang=de); questions are asked about content only. Nothing reads a
dialect form from it (HEIDI.md updated).

- channels followed by feed/app are matched to the register by name on the
  publisher's domain (lib/channels/spoken.ts), also at request time for
  channels followed before
- migration 0012 re-offers episodes stored as 'none' (UPDATE only)
- question prompt stays variety-neutral (leak test)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(practice): what a walkthrough of every exercise found

Played a sitting end to end in a browser at 390px and fixed what read wrong:

- Self-check cloze said "which word is missing?" with nowhere to answer;
  it now says to answer aloud or in your head, then reveal.
- A word's "Why?" was the same advice for every word. It now follows the
  distance classification: close to German, a named sound rule with the
  pack's example (ruleBehind), or a word to learn.
- Match grids could be solved by shape (four "add an n" verbs) and could
  offer one meaning twice (Hoi/Salü = Hallo). Grids now mix closeness and
  hold at least two words German does not give away; tests pin both.
- A checked sentence build kept tile padding, scattering the words; it is
  now one line with misplaced words marked.
- Writing "nid" now notes the pack's house form "nöd" (preferredForms on
  the display projection; no component imports the full pack).
- The finish recap printed the German answer as the missed dialect word;
  recapOf gives both sides. "1 kommen nochmals" is pluralised in 7 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(account): ask once about progress sync; finish the walkthrough fixes

Signed up and used a new account on two browsers:

- A new account synced nothing and said nothing; the switch lived only in
  settings. The signed-in home asks once (SyncOffer), either answer is
  kept; sync stays off until chosen. turnSyncOn/keepSyncOff are shared with
  the settings switch.
- «Meine Situationen» joins synced progress as the `focus` key, decoded on
  the server like every other key, and adopted on a device only where
  nothing is chosen. Privacy register and sync copy say so in 7 languages.
  Two-device check: device two shows the situations, is not asked again.
- Verification mail no longer says it "finishes" sign-up for an account
  that already works. The OrangeCat one-click sentence shows only where
  the button is (methods.signin).
- Chat footer shows the model's name (modelLabel), not the route id; a
  German reader's gloss is not repeated; chat asks ai-kit for light
  reasoning so the first words come sooner.
- compareWords no longer offers a typed word that matches one pack word
  as another's near miss.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(mail): account mail as laid-out HTML through mail-kit 0.3.0

The verify, sign-in-link and reset mails were plain text. They now carry the
fleet's one layout (@bitbaum/mail-kit renderMail): Heidi's red and cow mark,
a heading, one button, the sign-in code to type on another device, a note,
and a footer that says why the mail arrived. Dark mode follows the reader's
client. The plain-text version is unchanged and still sent alongside.
Security mail carries no unsubscribe (footer.unsubscribe: null), by design.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* feat(mail): an opt-in evening reminder that is quiet by construction

One email when questions are due, off until the learner switches it on in
the settings (offered with progress sync on, since the server reads what is
due only from a syncing device).

- lib/mail/reminder-policy.ts decides, and errs toward silence: opted in,
  verified address, not on day one, 18:00 in their own zone, at most every
  other day, five or more due, not if they practised today, and none after
  three in a row went unanswered. Pure, with tests.
- The mail uses the fleet layout (@bitbaum/mail-kit renderMail): count, the
  streak only from two days, one real due line from the pack, one button,
  the reason it came, preferences and unsubscribe. Six languages; worded as
  a good moment, never as loss (HEIDI.md §3), with a test on loss words.
- One-click unsubscribe: List-Unsubscribe + -Post headers (RFC 8058) and a
  footer link to a page with one button (a GET changes nothing, so a link
  scanner cannot unsubscribe anyone). Signed, non-expiring token.
- mail_preferences (migration 0013), /api/mail/preferences,
  /api/mail/unsubscribe, /api/cron/reminders (hourly, CRON_SECRET).
- Privacy register: the preference row and the mail vendor.
- Checked end to end against local Postgres: sends once at 18:00, refuses a
  duplicate hour, refuses the next day, counts an unanswered one, unsubscribes
  from the page and from the one-click POST, rejects forged tokens.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(account): deleting an account deletes the person; 404s lead home

Found by using Heidi as its users do (64-scenario run, then deleting a test
account and counting rows):

- Deleting an account removed the login but left the person's synced
  progress, reminder setting, language, conversations, group memberships,
  follows, push subscriptions and certificates in the database, attached to
  nobody. lib/domain/account/erase.ts now removes them in one transaction
  after the deletion succeeded (a wrong password erases nothing). A group
  they made passes to its longest-standing member; their group messages stay
  for the others, unattributed. erase.test.ts walks the schema and fails when
  a table with a person column is not handled. Verified against Postgres:
  wrong password 400 and nothing erased; right password, every row gone.
- Most unknown URLs (a typo, a removed page, /xx/…) showed Next's bare English
  "404" with no header and no way home, because the root layout lives under
  [locale]. app/global-not-found.tsx answers in the URL's or the browser's
  language and links home (experimental.globalNotFound).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(settings): no reminder switch for accounts that share no address

A person who signs in with Google or GitHub through the shared sign-in shares
no email address with Heidi by design, so a reminder could never reach them,
yet Settings offered the switch and it did nothing. It is not offered now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12

* fix(dock): the bar never lies on a control, and the page ends clear of it

The Practise / Ask Heidi pill covered Start on /practice at 390px, the
password field on sign-in and the warm-up's Try it at 768px. It now checks
what is under its resting place and slides away while that is a control, at
every width. The footer ends one pill, its offset and the safe-area inset
higher, so the last row of links is never under it.

The lists the feedback widget's button sat on are marked data-fc-avoid,
which the widget honours.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(mail): send as Heidi's own domain once it is verified, and say which sender is in use

Account mail carried the retired FleetCrown name in its From line. A sender
cannot be renamed on faith: mail from a domain the key has not verified is
refused. Heidi now asks the mail service which domains this deployment's key
may send from and uses heidi.orangecat.ch, then orangecat.ch, as soon as one
is verified; until then the shared sender stays. /api/health reports the
From line in use and the domains the key knows.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(legal): the Impressum names the Heidi project, privacy gives each vendor's company and country, and the offer to care homes says where it stops

- Impressum: operated by the Heidi project (bitbaum), with the contact
  address; no person, no postal address, and no promise of one.
- Privacy: each company that answers messages is listed with its legal
  entity and country, linked to the page that states it; no row names a
  company twice.
- Organisations: a paragraph beside the offer says Heidi is for practising,
  not for the bedside, and that no personal or health details belong in it.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* docs(changelog): keep main's 10 November entries beside this branch's

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* docs: the recipe for cloning Heidi into a sibling language app, and one source for the product name

docs/clone-a-language-app.md: what is config, what is content and what stays
in packages, in the order the steps happen.

The product name was written in five places; the share card, the title
template, the landing config, the manifest and the account mail now read
ASSISTANT_NAME, so a clone changes it once.

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

* fix(mail): the reminder carries the same verified sender as account mail

Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-10 13:15:50 +01:00
CatoandClaude Fable 5.1 fb10722852 feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#205)
* feat(chat): the answer feedback loop — thumbs, transcript export, nightly review

Every answer in Heidi's chat now carries chatkit 0.14's thumbs. A thumb down
asks why in one tap (the reasons in all seven site languages) and the thumb
is kept in a new `chat_feedback` table through `POST /api/chat/feedback`
(zod, chat-rate limited, same-origin; a saved conversation's thumb needs its
owner, the browser-only draft's needs nobody). `GET /api/chat/review-export`
hands the fleet's nightly reviewer the saved conversations of the last day —
bearer `CHAT_REVIEW_TOKEN` compared in constant time, 401/503 as the spec
says, at most 50 conversations of 30 turns, no deleted ones, the gate's
verdicts as steps, the thumbs beside them, never an actor id, a name or an
address — with Heidi's scope read from her own system prompt rather than
typed twice.

The fleet's one row under an answer (Copy · Listen · thumbs) replaces the
second Speak Heidi drew on the explanation; her own Speak and its caveat stay
on the dialect lines, where which voice the device has is a claim worth
making. Migration 0009 via drizzle-kit; the export is tested against an
in-memory Postgres with Heidi's migrations applied.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* test(chat): the no-database cases take DATABASE_URL away, not assume it

CI runs the unit tests against a Postgres service with every migration
applied, so the two "no database on this deployment" cases met a database
and got the 201 and the 200 they guard against. Each now removes
DATABASE_URL for its own duration and restores it; the routes read it at
call time, so the 503 path is what runs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 14:33:53 +02:00
CatoandClaude Fable 5.1 0bbab8b516 feat(channels): podcasts in the follow loop, a leak gate for the packs, French recorded as the next product (#204)
* feat(channels): podcasts in the follow loop, a leak gate for the packs, and French recorded as the next product

Podcasts. A podcast is RSS with an audio enclosure per episode — the same
shape as a channel's Atom feed — so the same sweep reads it
(lib/channels/rss.ts, source.ts: one Source/Item shape both platforms
project onto). A pasted publisher page resolves to its feed through the
page's autodiscovery link, an Apple Podcasts link through Apple's keyless
lookup; Spotify publishes no feed and the form says so. Every podcast and
YouTube row on /listen carries «Folgen», and the channels page suggests
the register's podcasts first. An episode plays in the browser's own
<audio> element (seek, back five seconds, 0.75× with pitch kept). Its
transcript is the publisher's where the feed links one (SRT, WebVTT, the
namespace's JSON); otherwise Heidi transcribes the opening minutes herself
with the bridge recogniser — the first six megabytes of the enclosure by a
Range request, once per episode, shared, labelled as automatic with how far
it reaches — and only when the pack trusts a recogniser for the bridge and
the register does not call the source dialect, where the recogniser would
translate rather than transcribe (§8). Migration 0009 adds kind, feed_url,
spoken and image_url to channels and the enclosure columns to items.

The leak gate. HEIDI.md's house rule — nothing outside the packs names the
variety — now has lib/variety/leak.test.ts behind it: every string literal
in lib/ outside the packs, the seams, the dictionaries, the register and
the deployment's own config is checked, and the count per file is pinned
to a baseline that may only fall. The baseline is the to-do list for the
next product.

French next. HEIDI.md §4 records the decision (French for Romandie first,
Ukrainian after, the French product not named Heidi) and the six-step
recipe that makes "now build it" a command: a pack, two seams, the UI
languages, the deployment's own facts, the leak baseline, a repo. The
roadmap carries it in both languages and ROADMAP.md.

Checked signed in, on a 390px viewport, against a local Postgres: sign-up,
follow a podcast (Echo der Zeit, page → feed) and a channel (@srfnews),
the lists, an episode, a video, settings. No overflow, no console errors.
1207 tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKRxpcVWoZwtg6Gfr9m6Rb

* fix(listen): two rows that clipped at 320px in Russian

The layout audit (`pnpm run audit:responsive`, de/fr/ru × 320/360/390 ×
light/dark, 594 renders) found two, both on /listen in Russian at 320px,
both the same shape: a word wider than the column the button beside it
left.

- The «Follow channels» card put its title and «To your channels →» in one
  row; «Подписаться» alone was wider than the 90px the arrow left. The card
  stacks below `sm` and goes back to one row from there.
- A source row's name sits in a two-column header beside «Folgen»; with the
  Russian button the name's column is 142px and «Wissenschaftsmagazin» is
  177px. The name may now break inside a word, but only when the word alone
  is wider than the column (`wrap-anywhere`; `break-words` leaves a flex
  item's minimum at the whole word).

After the change the same 594 renders measure 0 with overflow.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKRxpcVWoZwtg6Gfr9m6Rb

* fix(auth): take accountkit 0.5.2, so signed-in pages see who is signed in

The signed-in walkthrough found every server component drawing the
signed-out state: accountkit's getSession() returned better-auth's raw
user, without the actorId Heidi's pages key on, while the API routes,
going through requireUser(), had it. The dashboard and «Your channels»
asked you to sign in while the follow itself worked.

bitbaum/accountkit#11 (v0.5.2) gives both readers one path. This pins it
and records the fix in the changelog.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKRxpcVWoZwtg6Gfr9m6Rb

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 19:31:29 +02:00
CatoandClaude 266e536b69 feat(channels): follow YouTube channels, get told about new videos, answer questions about them (#202)
The listening lab, built on the media that already exist. A learner follows
YouTube channels they watch anyway (a link, a video link or the @handle, or
one of the register's rows with what is spoken beside it); Heidi reads each
channel's public Atom feed — no API key — hourly on the box and inline when
the page opens, lists what is new since the last visit, and sends a Web Push
to the browsers that asked. Following rings for the next video, never the
back catalogue, and nothing here reminds anyone to practise.

One video is the lab's exercise in HEIDI.md's order: a gist question before
the first listen, three to five detail questions in the bridge after it,
each wrong answer answered with the line that was said and a button that
plays that second (IFrame API seek), then the transcript, tap a line to hear
it. A count with its denominator, no score. What was answered stays in the
browser (heidi.videos.v1) and feeds the streak.

The transcript is the platform's captions, in a language the pack accepts
(lib/channels/accepted.ts: the target, then sibling/roof bridges; never a
gloss language; automatic captions only where the pack trusts the
recogniser), and its source is printed every time: the publisher's,
automatic («bei Mundart oft falsch») or pasted. YouTube refuses data-centre
addresses the caption tracks often enough that the refusal is a first-class
state: the screen then shows the three steps to copy the transcript from
YouTube's own panel, and parsePasted reads that format, SRT and WebVTT.

Questions are written by the model from the transcript once per video, on
the first follower's request (never in the sweep — no background job spends
the free pool), refused unless every detail question cites a real line, and
shared with every follower.

Schema: channels, channel_videos, channel_follows, push_subscriptions
(drizzle/0008). Routes: /api/channels, /api/videos/[id]/{transcript,
questions}, /api/cron/channels (bearer CRON_SECRET), /api/push/*. Pages:
/channels, /channels/[video], a dashboard panel, a settings section, an
invitation on /listen. Seven dictionaries, privacy flows, HEIDI.md,
CHANGELOG. The box's hourly timer row is in loki's install-app-crons.sh;
CRON_SECRET and VAPID_* in .env.example.


Claude-Session: https://claude.ai/code/session_01RKRxpcVWoZwtg6Gfr9m6Rb

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 11:26:06 +02:00
CatoandClaude Opus 5.5 2093dd401a feat(accounts): Heidi has its own accounts; OrangeCat is one way in, not the only one (#191)
* wip(accounts): Heidi on @bitbaum/accountkit/auth (accountkit pin pending)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* feat(accounts): Heidi has its own accounts; OrangeCat is one way in, not the only one

Email and password, passkeys and two-step codes from @bitbaum/accountkit/auth,
with the shared screens in Heidi's seven languages. People whose first way in
was OrangeCat keep their actor id, so no row moves. next-auth removed; the
session secret falls back to the existing AUTH_SECRET.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-15 10:08:54 -07:00
CatoandCursor 25d45963c2 Heidi answers what you wrote last, Swiss German all the way through, and starting again is one tap (#146)
* fix(chat): Heidi answers the newest message, and starting again is one tap

- Render the model prompt ourselves: earlier turns marked as answered
  context, the newest message set apart. threadkit's flat transcript made
  «Pire» after three «Le Bilan» turns get a fourth «Le Bilan» sentence in
  4 of 6 live runs; none after.
- Heidi's past turns carry the dialect line she wrote; the draft route
  accepts it in history. Context capped at 20 turns on every surface.
- Prompt: answer only the newest message; a lone word asks about that word.
- decodeAnswer keeps mode 'answer' instead of collapsing it to 'understand'.
- One NewChatButton: phone toolbar above the chat, dock header icon, sidebar.
- Chats fit above the phone keyboard (interactive-widget + visualViewport).
- /chat gets a fresh key per request so the header's Chat link never
  re-renders the conversation just left; sidebar closes on Escape.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(i18n): Swiss German first, and Heidi explains in it in every conversation

- Language menu, footer and settings share MENU_ORDER: dialect first.
- A saved conversation follows the page's locale on every message instead
  of the one it was created in (stored locale is the fallback).
- Suggestion labels come from a closed list and render via the dictionary;
  tones are translated; 'bridge' is no longer printed as a label.
- Prompt: every 'english' field is written in the explanation language.
- forReader strips translations of dialect suggestions for readers whose
  locale is the taught variety.
- lang on explanation text is the reader's locale, not 'en'.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(i18n): a signed-in learner's language follows them to every device

Picking a language in the header, footer or settings saves it to the
account (new additive table `preferences`, migration 0006). Every sign-in
returns through /api/account/language, which puts the saved language into
the page the learner lands on. German stays the default; signed out,
nothing is stored.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(chat): the phone toolbar fits 320px in every language

«Nouvelle conversation» beside «Conversations» overflowed a 320px phone by
17px (layout audit, fr/chat). Both buttons now shrink to an ellipsis.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 07:13:08 -07:00
CatoandClaude Opus 5.5 f1d8e5cdad feat(teams): a group can be a team — focus, consented sharing, an organiser's overview (#132)
A group's organiser picks a focus (a situation domain, e.g. care). Each member
decides for themselves, per team, whether the organiser sees their standing
in those situations, and can take it back; until then the organiser sees a
name only. What is shown is the standing per situation (new/met/steady/sure)
and the number of certificates — never which lines or answers; the server
never sends them. A member who shares without sync shows as 'nothing to see
yet', not 'not started'.

Migration 0005 (study_groups.focus, group_members.shares_progress). Routes:
GET/PUT /api/groups/[id]/team (organiser only), PUT /api/groups/[id]/share
(the member themself). The organisations page leads with what a team can do
today instead of a disclaimer. Teams move from roadmap to changelog.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 05:14:10 -07:00
CatoandClaude Opus 5.5 110f6e5ab3 feat(progress): progress on every device (opt-in), and a certificate per situation (#131)
Sync: signed in, off by default. Each device stores only what it observed; the
server keeps each device's records apart (progress_devices) and pages show the
sum, so nothing is counted twice however often devices sync. Model: sum;
history: union; streak: newest record, best of all; saved words: the newest
list is adopted, so deletions stay deleted. Server-side, every value goes
through the browser's own decoder and is stored normalised. Off removes this
device's copy; 'delete everything synced' removes all.

Certificates: issued by the server from synced progress with the same
strengthOf the situation page uses, only at 'sure'. A public, noindex page per
certificate shows the situation, date and what was measured; no name (one can
be typed for printing and is not stored). The scope line says it is listening
comprehension in one situation, not a language diploma.

Migration 0004 (progress_devices, certificates); both in APP_TABLES. Privacy
flows declared; the practice note now says 'unless you switch sync on'.
Roadmap items move to the changelog.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 04:53:58 -07:00
CatoandClaude Opus 5.5 dcb82c8cf1 feat(feedback): the roadmap and changelog can be answered (bip-kit 0.4.0) (#130)
Every roadmap item can be marked 'I need this' or 'not for me' and commented
on; anything missing can be suggested, with similar suggestions shown while
typing; every changelog entry has a comment thread. No account: a random key
the browser keeps. Rules (spam, one vote per browser, duplicates, honeypot)
are bip-kit's; Heidi supplies a Postgres FeedbackStore (4 tables, migration
0003), the allowed ids, and rate limits. Roadmap items carry stable ids shared
by de/en; changelog entries are numbered within their day from the oldest.

Also: shipped items (situations, feedback) move from roadmap to changelog, and
the situations notice no longer claims Idiotikon attestation, which nothing
checks yet.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 04:36:43 -07:00
CatoandClaude Opus 5 92b023af19 feat: speaking rounds, and a take that is measured rather than scored (#69)
* feat(speaking): rounds people propose, and a take that is measured rather than scored

Study groups were a thread with more than one human in it. This is the same
social object with the medium changed, which is the half a diglossic variety
otherwise gives away for free.

WHAT IS HERE

Webinars (one voice, an audience) and circles (everyone in turn, eight max),
on topics proposed by the people who would come. "Regularly" is a field, which
made this a time-zone problem rather than a scheduling one: a round is an
absolute instant and a repeat is a wall-clock promise, and those disagree twice
a year. Adding seven days of milliseconds to a Tuesday in March produces a
Tuesday at 20:00 and an empty room, so the recurrence is computed in the zone's
calendar and the tests cross both Swiss changeovers in both directions.
Sittings are computed, never stored.

Heidi does not carry the meeting: `meetingUrl` is an https room the host
already has, and https only, because that string is rendered as a link for
every attendee and accepting the scheme as given would accept `javascript:`.

WHAT THE EVALUATION REFUSES TO DO

The obvious build for "AI evaluates your speaking" is a pronunciation score.
The overclaim register bans it by name, and no system transcribes Zurich German
reliably — the state of the art translates the dialect into Standard German on
the way, which is the exact information a learner needs. A score on top of that
is a number with nothing underneath it, handed to the one person who cannot
check it.

So: the signal is measured in the browser (durations, counts, mic clipping —
arithmetic over samples, no model, no ASR, and no speech rate because
syllables need a transcript); the learner writes down what they said, with the
reason on screen; and their own words go through the deterministic gate, then
one model suggestion over text they confirmed. Only `foreign` findings survive
— a `ß` is not something anybody pronounced, and flagging it would be
correcting spelling in a variety that has no standard spelling.

Two tests pin the ban: no field of the measurement reads as a rating, and no
speaking copy in any of the seven languages offers a score.

PRIVACY

The audio never leaves the page that recorded it and the takes are device-local
under `heidi.takes.v1` — no audio table, no upload endpoint for takes, no
transcript of anybody's speech. A table of how somebody sounds when they are
bad at a language is worse than a table of the words they looked up, and the
cheapest way to honour that is to never hold one.

Mobile first: one big record target, a live level so a dead microphone is
visible in the first second, single-column forms that pair up from `sm`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(speaking): the page now reads in the order its own lead promises

Four things found by looking at the running page rather than at the tests.

THE ORDER. The lead says "webinars and circles on topics you propose, and IN
BETWEEN practise out loud", and the page rendered practice first. The original
reasoning was real — practice is the half that works signed out, alone, with an
empty calendar above it — but it loses to a simpler test: read the lead, then
look at the page. A reader resolves that disagreement by deciding the page is
about something other than what it says it is about.

A HYDRATION MISMATCH. `recordingSupported()` reads `window`, so calling it in
the render body made the server draw the button disabled with "this browser
cannot record" underneath and the client draw it enabled. React threw the
server HTML away and said so in the console. It goes through `useClientValue`
now, the same primitive `useStorageReady` uses, with an optimistic server
value.

A ROUND IN PROGRESS FELL OFF THE LIST. "The next sitting at now" excludes one
that started five minutes ago, which is exactly when somebody running late
opens this page looking for the link — and for a weekly round it was worse than
vanishing, because the list would advertise next week while the thing was
happening. The question is asked from one duration ago now, and the answer
carries `live` so the row can say so. Computed server-side: a client-side
comparison is a hydration mismatch whose answer depends on the visitor's device
clock. Two regression tests.

AN UNCLICKABLE CALL TO ACTION. "Make a round of it" rendered as flat grey
caption text beside the interest count, reading as a button that was not one.

Also: `/de/speaking` joins the post-deploy smoke check, whose own rule is every
page a visitor can reach by name; and the third loop is written into the
canonical doc, ending in a room with other people rather than in a mark out of
ten.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat(privacy): the voice recording is named on the page that enumerates flows

The privacy page landed in #68 while this branch was open, and it works by
listing every place data goes with the storage key beside it, so a reader can
open their own dev tools and check. Speaking rounds landed at the same time and
were not on it.

That omission is the worst one available. The page's whole value is being
exhaustive, and the flow it was missing is the voice recording — which §10
itself names among the most private things a person owns. A privacy page that
enumerates nine flows and silently skips the microphone is worse than one that
never claimed to be complete.

Two flows now:

  speakingTakes       device, `heidi.takes.v1`, leavesDevice: false.
                      The audio is decoded and measured in the page that
                      recorded it and then dropped. No audio table, no upload
                      endpoint for takes, no transcript of anybody's speech.
  speakingSuggestion  vendor, `/api/speaking/take`, the confirmed sentence only.
                      Never the audio, never stored — one request, answered and
                      forgotten, exactly like a signed-out chat.

The existing test that every named `heidi.*` key still appears in the code now
covers `heidi.takes.v1` too, so renaming it would fail the build rather than
turn the page's invitation into a dead end.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 06:51:48 -07:00
CatoandClaude Opus 5 548faefc7b fix(nav): Start means start — plus a health check that runs, and the review foundation (#49)
* fix(nav): Start means start

Signed-in visitors were redirected from the locale root to /chat, on the theory
that somebody with an account wants the tool rather than the pitch.

The theory is fine. The implementation was wrong: "Start" is a link in the
navigation, and a person who presses a link labelled Start expects the start
page. Landing them somewhere else makes one of seven nav items a lie — and the
one people press when they are lost.

The right version of the idea is a different PAGE at the same address, not a
different address: signed in, `/` is your dashboard. That needs the dashboard
to exist, so it arrives with it, as a rewrite rather than a redirect.

`lib/i18n/landing.ts` goes rather than being left unwired. A pure function
nobody calls is the same defect as a health check nobody calls — see the
neighbouring commit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

* fix(health): the grant check now actually runs

`lib/db/usable.ts` has said since it was written that it "runs on every deploy
because the health endpoint is what the pipeline waits for". It did not.
Nothing outside the test suite called it.

That matters more than a stale comment, because the failure it catches is
invisible by construction: migrations run as `postgres`, so a new table is
owned by `postgres`, the app's own role is granted nothing on it, and every
query against it fails with "permission denied" while the process, the
connection and `select 1` all stay perfectly healthy. CI cannot see it either —
there the test user owns everything.

Confirmed by hand after shipping the conversations migration, which is the
moment that showed the gap: `/api/health` answered `{"ok":true}` and could not
have told anyone whether the two new tables were usable. They were, but only
psql on the box could say so.

It still answers 200. The process IS alive and a restart cannot fix a missing
GRANT, so 503 would only teach the watchdog to restart a healthy process
forever while the real problem sat in the database. The answer goes in the
body.

Computed once per process: a grant changes when a migration runs, a migration
runs during a deploy, and a deploy starts a new process — so once per process
is exactly right, and the watchdog's polling costs a cached value rather than a
catalogue query every few seconds. An unreachable database is not memoised as a
verdict, or one blip would brand the build broken until the next deploy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

* feat(review): kept words start coming back

Saving a word was the end of the story: the list grew and nothing ever asked
you about any of it. This is the layer that makes saving worth doing —
scheduling and analysis, both pure and tested, with the surfaces to follow.

**The schedule** is expanding fixed intervals (1, 3, 7, 16, 35 days), a wrong
answer returning to the start rather than back one step. Deliberately not SM-2
or FSRS: those model someone doing hundreds of reviews a day across thousands
of cards, and fitting a curve to a learner's eleven kept words produces
confident nonsense of exactly the kind HEIDI.md §8 forbids. Fixed intervals
carry the finding the evidence actually supports — later beats sooner — and
nothing beyond it. Kim & Webb 2022 (g ≈ 0.76 immediate, ≈ 1.15 delayed) and
Yang 2021 (g ≈ 0.50 for being asked over being shown), both already verified in
lib/research/sources.ts, which is why the surface will be prompt-then-reveal
and never a list of words with their meanings printed beside them.

A word nobody has asked about yet is DUE. Not a fallback — you kept it because
you did not know it, and it means the feature arrives with everyone's existing
list already populated instead of empty for a day.

**The schedule fields ride on SavedWord without bumping `version`.** A bump
makes `decode` treat every existing browser's list as absent, which is right
for a shape that CHANGED and wrong for one that only GREW — it would have
silently emptied every saved list in the wild in order to add a feature about
not losing things. The decoder had to learn to carry them: it rebuilds each
word field by field, so a field it does not name is dropped on every single
read, which would have reset the schedule on every page load and made spaced
review quietly do nothing. There is a test for exactly that.

**"What keeps catching you" is derived, not tracked.** The obvious build is a
lookup counter — new instrumentation, a new store, and a record of every word a
person failed to understand. The answer is already in the data: six kept words
that all turn `k` into `ch` IS the thing catching them.

Matching applies the correspondence and asks whether the result moved CLOSER to
the target, rather than testing for the letter. `bridge.includes("k")` would
claim *Kanton* and *Kaffee* as evidence of k → ch; the substitution test fires
only when the correspondence is what actually separates the two forms. A test
asserts every parseable rule in the pack explains its own example pair, so a
rule string that stops matching fails the build rather than producing a panel
that is empty for everyone forever.

308 tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 03:56:44 -07:00
CatoandClaude Opus 5 95d3ab3262 feat(chat): the chat gets a room of its own (#48)
* feat(chat): conversations that survive a reload, for people who signed in

The chat has been the product wearing a marketing site: the assistant works,
and then you reload and it is gone. This is the storage half — schema, rules,
queries and routes — with no UI yet, so the risky part lands reviewable on its
own.

Not reusing the group tables. `invite_token` is NOT NULL UNIQUE and is a
credential: every private chat would mint a joinable room key. And deletion
runs the opposite way — a group keeps `left_at` rows precisely so old messages
stay authored, while a private conversation must be destroyable.

Decisions the schema states out loud:

- `image_count`, never the images. Attachments would be the largest rows and
  the most private artefact the product touches. The count is enough for a
  reopened thread to say a picture was here.
- `locale` on the conversation. Reopening a thread from a browser negotiated
  to French must not switch Heidi mid-conversation.
- Delete destroys. The conversation row is tombstoned so a deleted id keeps
  answering a stable 404; the messages are hard-deleted in the same
  transaction. A `deleted_at` that leaves the words in the table is a lie the
  privacy section would then have to tell.
- The caps refuse; they never prune. Dropping someone's oldest thread to make
  room is data loss dressed as a feature.

`APP_TABLES` gains both tables — it is the only detector for the
postgres-owns-the-table grant failure, and missing it leaves /api/health green
while every write 500s. The new store suite asserts that check passes.

Nothing anonymous reaches the database: no cookie-minted pseudo-actor, which
would be a tracking id whose rows nobody can ever authenticate to delete.
`/api/conversations/import` adopts a signed-out draft only when asked, and
rebuilds every field — ids, authorship, timestamps and the decoded answer —
because a draft lives in localStorage, where anyone with a dev console writes.

`requireActor` moves to lib/domain/actor.ts; groups/session.ts stays as a thin
delegator on purpose, because groups/routes.test.ts stubs authorisation by
mocking that module at its resolved file URL.

Also ends a duplication the linter caught: MAX_IMAGES existed four times — two
routes, the composer, and a dead copy a refactor left behind. It now lives with
the server-side validation, which is the side that enforces it.

275 tests, 31 of them new.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

* feat(chat): the chat gets a room of its own

The assistant worked and then you reloaded and it was gone. `/chat` is the same
conversation with space to be one: a transcript that scrolls inside the
viewport, a composer that stays put, and — signed in — the thread you had
yesterday in a sidebar you can resume, rename and delete.

The home page box and the full-screen chat are ONE conversation, not two. Both
read the same store, so "Vollbild öffnen" continues the thread and coming back
to the home page finds it still going. Nothing is transferred: a transcript in
a query string would land in the access log, the Referer header and browser
history.

Signed out still works, and nothing anonymous reaches the database.

**Two bugs this found, both by reloading the page rather than by reading it:**

- The persist effect ran on mount with an empty thread and CLEARED the draft it
  was about to restore. Visiting the home page would have wiped a conversation
  without touching anything. Writing now waits for the seed.
- Seeding through the subscribed store value raced its own `ready` flag — two
  independent `useSyncExternalStore` subscriptions with nothing ordering them,
  so the draft could still be null on the tick `ready` flipped, seeding an
  empty thread and marking the job done. It reads the store directly instead.

**The chrome escape is one CSS rule**, keyed on `body:has([data-chrome="chat"])`,
not a second root layout. There can only be one root layout — `<html lang>` has
to carry the real language of the page — and navigating between two of them
costs a full document reload, so every trip from the home page into the chat
would throw the app away and start again. `min-height: 0` on `main` is the
load-bearing line: a flex child refuses to shrink below its content, so without
it the page grows instead of the transcript scrolling. `dvh`, not `vh`, or the
composer hides under iOS Safari's toolbar.

**Signed-in visitors land in the chat**, decided in middleware rather than in
the page. Calling `auth()` in `page.tsx` reads a cookie, which would opt the
`priority: 1` marketing page into dynamic rendering for every visitor. Crawlers
are always signed out, so they still get the home page — confirmed in the build
output, where `/[locale]` is still SSG. The decision itself is pure and tested
(`lib/i18n/landing.ts`), including the case that would have bounced `/de/chat`
to itself forever.

**The conversation row is created on the first message**, not when the page
opens, so a "new chat" button that gets pressed and abandoned leaves nothing
behind. Which row a transport writes to lives in its own closure with an
in-flight promise, because React state is not visible to the second message of
a fast double-send — which is how one conversation becomes two.

HEIDI.md §5, §9 and §10 rewritten. §10 was four sentences of intent written
when there was nothing to be private about; there is now, so it says what
actually happens — where a signed-out conversation lives, that delete destroys
the messages, that pictures are counted and forgotten, and that adoption is
offered rather than assumed.

Verified with `pnpm run verify` (290 tests) and against a production build in a
browser at 1280px and 390px: reload restores, home↔chat keeps the thread, the
body does not scroll, the footer is gone, the header is static.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 02:50:20 -07:00
CatoandClaude Opus 5 f317425ec8 feat(groups): humans and Heidi in one thread, on a real database (#29)
* feat(db): heidi gets a database, the way the fleet already does it

Study groups need two people to see one thread, which is the first thing in
this app that cannot live in a browser tab. So: Postgres — and following
the fleet's existing pattern rather than inventing a ninth one.

WHAT WAS ALREADY DECIDED, AND REUSED

fleetcrown's `apply-schema.sh` is a guarded, forward-only applier for
DRIZZLE apps: it applies only migrations absent from the app's
`_deploy_schema_history` ledger, refuses any migration carrying a
destructive statement, and runs the batch in one transaction. It resolves
the target database from apps.conf's `db` column — heidi's read `-`, which
is why botsmann and printcraft shipped green for months while the pipeline
never saw a migration file. That row is fixed in fleetcrown#682.

So the layout is not a preference: `drizzle.config.ts` writes to
`<app_dir>/drizzle` because that is one of the five paths the applier
probes, and heidi's app_dir is the repo root. The client is vitareba's
lazy-singleton-behind-a-Proxy, for its reason: `next build` imports every
module and the build environment has no DATABASE_URL.

PROVISIONING, AND THE BUG IT AVOIDS

The box now has a heidi role, database, pg_hba rules and credentials. The
schema step runs as the `postgres` superuser, so a table a migration
creates is OWNED by postgres and the app role is granted nothing on it —
the table exists, the connection works, every query says permission denied,
and CI cannot see it because CI's test user owns everything. vitareba has
26 tables, 10 of them postgres-owned, and an empty `pg_default_acl`: those
grants were repaired by hand afterwards.

heidi sets ALTER DEFAULT PRIVILEGES FOR ROLE postgres before the first
table exists. Verified on the box: the app role reads and writes a
postgres-owned table. `lib/db/usable.ts` asserts the same property at
runtime as the belt to that braces, since the deploy waits on health.

NO USERS TABLE

Identity stays federated; the OIDC `sub` is the actor id, stored as text
with no foreign key, because the row it would point at lives in OrangeCat.
The cost is a denormalised display name on the membership row — there is
nothing to join to — which is accepted knowingly and is cheaper than
mirroring an identity provider.

Heidi is not a member row. She is in every group by construction, so a row
for her could only ever say the same thing; she is composed into the
threadkit participant list at read time.

The rules are pure and tested without a database: a late joiner cannot read
the back catalogue (threadkit's safe default, asserted), a departed member
keeps their history and loses their voice, only the organiser hands out the
link, and the invite token is 192 CSPRNG bits kept separate from the id
because ids travel in URLs and logs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

* feat(groups): the queries, and a CI that actually runs the tests

The store is separate from the rules on purpose. The rules are decisions
and are tested with no database at all; this is plumbing and is tested by
using it, against a real Postgres — because every bug it can have is one
the database has an opinion about. An upsert that would violate a primary
key, a cascade that has to actually cascade, jsonb that must come back an
object and not a string: a mocked `db` asserts only that the mock agrees
with itself.

CI DID NOT RUN THE TESTS

Found while wiring the service container: the verify job ran type-check and
lint as separate steps and never ran `pnpm run test`. Every unit test in
this repository passed only on the machine of whoever remembered to run it
— 200 of them, including the dialect gate over the Swiss German copy and
the whole variety-pack suite.

That is the single failure a CI floor exists to prevent, and it is why the
house rule says CI calls the repo's own `verify` script verbatim instead of
a hand-maintained list of what it is assumed to contain. The two had
drifted, silently, in the direction that looks green.

Now: postgres:17 as a service (matching the box), the deploy's own
migrations applied to it rather than a schema written out by hand in the
workflow, and one `Verify` step.

WHAT THE STORE TESTS PIN

- Re-joining does NOT reset `joinedAt`. threadkit gates visibility on it, so
  refreshing it would hand a returning member a blank thread.
- Following an invite twice is an upsert, not a 500. (group, actor) is the
  primary key and a plain insert would break a thing that should just work.
- The group list never carries the invite token. It renders for every
  member; only the organiser holds the key to the room.
- Rotating the link kills the old one — the only way to un-invite a link
  already sitting in somebody's WhatsApp.
- The app can use its own tables, which is the postgres-owns-the-table
  failure asserted directly rather than hoped about.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

* feat(groups): humans and Heidi in one thread

The product ask was "invite humans, and humans and AI can be talked to
together — a group chat with Heidi in it". This is that.

WHAT THREADKIT ALREADY DECIDED

Heidi does NOT answer every message in a group. With two participants she
answers every turn because she IS the conversation; with three or more she
waits to be addressed by name, because two humans talking to each other is
not an invitation. That rule was already written months ago in
`lib/domain/chat/thread.ts` for exactly this feature and needed no change —
a group is the same object with a longer participant list, which is why the
thread was modelled with threadkit rather than an array in the first place.

The composer says so under the box, because a bot that silently declines to
answer reads as broken rather than as polite.

THE LINK IS THE CREDENTIAL

A self-organised group has no approval step, so the invite token is treated
as what it is: 192 CSPRNG bits, separate from the group id (ids travel in
URLs and logs), shape-checked before any query so a hostile string never
reaches Postgres, and rotatable — the only way to un-invite a link already
sitting in somebody's WhatsApp.

Only the organiser may see or rotate it. Narrow on purpose: if every member
can re-share the key then "who can get in" is unknowable to the person
responsible for the room. A non-organiser gets 404, and so does a stranger
asking about a group — whether an id is real is not theirs to learn.

WHAT THE ROUTE TESTS BUY

The rules are pure and the queries hit real Postgres, but neither covers
whether a route CALLS the right rule with the right arguments — which is
exactly where an authorisation check goes missing. A route that forgets to
ask `mayPost` passes every other test here. `caller()` is the seam, so the
real handlers now run against the real database as any actor, including a
stranger and a signed-out visitor.

Three components were rewritten on the way. The React Compiler lint refused
fetch-on-mount, and it was right to: the group thread, the group list and
the invite token are all things the SERVER already has a session to query.
Rendering them server-side removed three effects, three loading states and
the empty flash before data arrives. The invite panel's own comment claimed
a prop would leak the token into the page source — overstated, and now
corrected: the page is dynamic, noindex, membership-checked and shows the
token in an input on that very page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 05:38:54 -07:00