Commit Graph
234 Commits
Author SHA1 Message Date
CatoandClaude 8757d532b6 feat(widget): fixes go as one change, watch sees what taps do, ◎ shows Loki (#1112)
The owner, on loki.orangecat.ch from a phone (2026-10-09): "if it proposes
five fixes and I click fix, where is it going? … how do I keep track?",
"I don't know when it's noticing something", "it should be easy to draw
its attention", and the panel still had a lot going on.

- Suggested changes are ONE decision (widget/suggestions.ts): every row
  ticked, a tap unticks, "Build these 3 as one change →" files one note —
  one agent, one PR, one row in Your changes. It used to be a Build per
  row: N runs queued in the project's one lane with nothing saying so.
  The owner's builds start without a confirmation card ("Edit first"
  opens it); a visitor's still confirm.
- Your changes: one summary line that opens ("1 building · 1 in line ·
  1 live"); each row is its own link. A change waiting behind another
  reads "In line" (owner-view.ts), not "Starting".
- Watch sees what a tap DID: for 1.5 s after a tap on a button or link it
  waits for the page to change, ask the server or navigate, notes which
  ("↳ It asked the server"), and says at once — after one tap, not three
  — when nothing visibly happened.
- ◎ beside the launcher while watching: point at anything on the page,
  the panel opens with it attached.
- Phone sheet (widget/sheet.ts): drag the top up for full screen, down to
  peek at the page, further to put it away.
- Shorter greeting.
- Tests: widget-suggestions, widget-sheet, widget-changes (summary, In
  line), widget-thoughts (results); watch-browser covers the tap results
  and the one-change build. Unit 360/360; watch/embed/host-avoid browser
  suites pass locally.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 05:33:56 -07:00
CatoandClaude Fable 5.1 c40abffc50 feat(voice): make no-screen mode pleasant to leave on — studio voice, music bed, earcons, talk-over (#1113)
A voice is a serial channel at ~150 words a minute, and an AI voice that
talks too much is the fastest way to make someone take the headphones out.
This round is the art and science of that channel:

- Studio voice. /api/voice/speak reads short pieces through Groq's Orpheus
  endpoint (lib/voice/tts.ts); lib/voice/speaker.ts cuts a briefing at
  sentence ends (speak-chunks, ≤200 chars), fetches one piece ahead of the
  one playing, decodes into the soundscape, and hands the rest to the
  phone's own voice on any failure (then stops asking for two minutes).
  Six voices + "phone" in config/no-screen.ts.
- Music the phone composes (hooks/use-soundscape.ts, numbers in
  lib/voice/soundscape.ts): six chords in D on detuned sine+triangle pairs
  through a drifting low-pass and a feedback delay, nothing above F#4, level
  0.09 at rest and 0.025 under the voice. No file, no licence, no stream.
- Earcons: rising for finished, falling for failed, a knock for something
  that needs you, a blip when a take is sent, low falling/rising for the
  line dropping and returning. Each under 0.6 s; a test pins that.
- One output: the whole graph leaves through one MediaStream that the
  media-session <audio> plays, so lock-screen controls and screen-off
  playback follow the platform's rules for a track; direct output is the
  fallback (and the public demo's mode). Never both.
- Talk-over: while Loki speaks the analyser keeps running; a burst above
  2.5× the room's bar for 350 ms cancels the voice and hands over the mic.
- Fewer, better sentences (lib/voice/announce.ts, pure, tested):
  coalesced by kind, urgency first, two or three phrasings rotated by a
  counter, "details" on request, and an "only what needs me" mode that
  holds finished runs for one sentence every five minutes. A dropped line
  is said once, and once when it is back.
- Settings on the start screen, kept per device (voice, music, talk-over,
  mode).
- /no-screen: a "Hear twenty seconds of it" demo on the visitor's own phone
  and a section on why it is pleasant.
- Essays, anyone first: a ```deep fence renders as a closed <details>
  (components/thoughts/DeepBlock.tsx); the fleet-in-your-ear essay is
  rewritten that way, style guide updated. ROADMAP + CHANGELOG.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 05:30:30 -07:00
CatoandClaude Fable 5.1 5bc05bbef4 feat: the first day is the whole product — three ways in, /build, your website in onboarding, Loki on it, help when a build stalls, and the owner's phone fixes (#1110)
* feat(widget): the owner's way into Loki — Continue in Loki, an advisor that knows whose site it is, a header that fits a phone

On 2026-10-09 the owner of heidi.orangecat.ch opened the widget on their
phone and asked for one new page. The widget treated them as a stranger:
it told them which heading to insert and to "keep the structure in a data
file (JSON/YAML)", wrote five invented sentences in the site's own language,
and answered "switch to Loki so I can develop it there with either chat or
terminal" with the same advice a third time. The owner's sign-in lived only
behind "Watch". Once signed in, Review + Stop watching pushed ✕ off the
right edge of the screen.

- widget/continue.ts + src/lib/widget/continue.ts: the thread as one
  message (newest kept, ≤1800 chars) and where it lands in Loki.
- GET /api/widget/continue: signs the person in if needed, checks
  getProjectAccess on the widget's project, resolves the project key and
  redirects into /loki?project=&q= or /terminal?project=&view=terminal;
  a stranger goes back to the site with #loki-owner-denied.
- widget/conversation.ts: "Continue in Loki · Chat → · Terminal →" under
  the composer for the owner; one sign-in link for anyone else after their
  first message; "This is my site — sign in with Loki →" under Loki's
  greeting, on the first screen. The owner pass travels with each question.
- /api/widget/advise + advisor.ts: the pass is verified as ingest verifies
  it; with it the advisor knows the person OWNS the site and Build this
  builds. For everyone, four hands-off rules: never explain how to edit the
  site, never write its content, a build request becomes the one change to
  tap, and "take this into Loki" is answered with where that control is.
- widget/theme.ts: the header's text column shrinks before the actions do;
  Stop watching stays on one line; the continue row wraps on a phone.
- widget/main.ts: the owner is not offered to hide their own tool.
- scripts/test/widget-continue.ts (new), widget-advise.ts: pinned.
- docs/architecture/feedback-widget.md: the row and the route.

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

* feat(widget): the loop closes on the site — Your changes, a live announcement, an honest Follow link

"On it — Loki tells you when" was the end of the widget's story, and on the
site Loki never told anyone: the telling went to push and Telegram, the page
the owner came back to said nothing, and "Follow the build" toured the
unchanged page with "let me show you what changed".

- widget/changes.ts: "Your changes" above the thread for the owner — the
  project's recent changes with one word each (Building · On its way · Live ·
  Needs you …), See it → once live, Open in Loki → when something needs them,
  asked for on arrival and every 30 s while something moves. A change this
  browser saw building that is now live is announced once: in the thread when
  the panel is open, beside the launcher (bubble + unread) when it is not.
- POST /api/widget/owner/changes: the one read with the owner pass. Same
  attachFeedbackWork the inbox uses, then src/lib/feedback/owner-view.ts
  writes the owner's words; the work view never leaves the server. No valid
  pass → no rows.
- /feedback/<id>/watch-fix lands on the inbox row while the change is still
  being built; the walkthrough only once it is live.
- The owner's repeated note keeps its follow link.
- widget/continue-row.ts, widget/greeting.ts: split out of createConversation
  (the lint rule caps it at 510 lines; CI caught it at 543).
- scripts/test/widget-changes.ts (new); widget-continue.ts updated.
- docs/architecture/feedback-widget.md.

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

* fix(widget): the owner's door is not an .act — the embed test counts those

widget-embed-browser asserts exactly one "as written" link (.act) under the
visitor's last message; the sign-in door under the greeting shared the class
and made it two. Its own class, same look.

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

* feat(public): three ways in — build it yourself, with a partner, or let the studio — and every stranger's door ends at /build

The ways to get something built were scattered: the landing page offered
only "Start a project", hiring the studio was a word in the nav, the partner
directory was reachable from OrangeCat's careers page and nowhere here, and
a stranger who watched a fix land on someone else's site was sent to a bare
homepage. "Start a project" at the bottom of six marketing pages went to
sign-IN, and so did a stranger arriving with a brief.

- src/config/build-paths.ts: the one list — yourself (sign-up), with a
  partner (bitbaum.orangecat.ch/partners/), the studio (the commission
  config's hire address) — plus buildPageHref/fromHost.
- /build (public, allowlisted): the invitation, naming the site the person
  came from (validated host only) and the three doors (BuildPaths cards).
- Landing: the "Three ways in" section after "Who it is for"; the closing
  line and FinalCta name the other two ways; FinalCta → sign-up.
- /change and /take send a signed-out person to sign-up with the brief kept.
- Widget: "Made with Loki — build something of your own →" as the last line
  for anyone who is not the owner (/build?from=<host>); the tour's "Get this
  for your site" lands on /build naming the site; the concierge gets the
  same door (appended last — the test addresses the others by index).
- scripts/test/build-paths.ts pins all of it.

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

* fix(widget): /api/widget/continue is public — it signs the person in itself

Live, the merged route answered a bare 401: the session middleware caught it
before the route could send the person to sign-in. Same list entry as
/api/widget/owner, pinned by widget-continue.ts.

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

* test(audit): /build is measured by the responsive audit

A new page has to be a decision — measured, or excluded with a reason.
Measured: it is a public page a stranger lands on from a phone.

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

* fix(widget): yours means yours, a review that picks three, the composer above the keyboard

From the owner's phone on 2026-10-09:
- "Your changes" listed a stranger's "so nice picture!" as the owner's own
  request. The strip now shows what the owner asked for and what Loki filed
  itself; visitors' notes are counted ("3 notes from visitors, in Loki →").
- Review answered with five nits (alt text, a renamed button, a table) and
  five identical buttons. The rubric now asks for at most three changes a
  visitor would notice or that fix something broken, and says none is fine.
- With the keyboard open the box being typed into sat half behind it; it
  scrolls into view once the keyboard has settled.

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

* feat: the first day is the whole product — your website in onboarding, Loki on it, help doors when a build stalls, the terminal hand-off with its text, a launcher that stays in the corner

From the owner's phone on 2026-10-09, and the three follow-ups named then:

- Onboarding asks for the website (optional). A project created with one
  (`liveUrl` on POST /api/user-projects) gets its widget token at once, so
  the token's origin is the site's; the new step "Put Loki on your site"
  shows the one line to paste, lets an agent add it when there is a repo,
  and opens the site with the owner pass (`openSiteUrl` on the token
  route). Finishing lands on the project, not Control. A refused project
  no longer advances the step in silence.
- A stalled build and a failed kickoff offer the other two ways to get it
  built — find a partner, hire the studio — from the same list as the
  landing page (GetHelpLine), the studio with the brief.
- "Continue in Loki → Terminal" carries the thread: /terminal?q= prefills
  the rail's composer as an unsent draft, and opens the rail sheet on a
  phone (the same path ?explain=1 takes).
- The launcher stays in the corner: a near slot over plain text beats a
  free slot mid-page (heidi.orangecat.ch: the site's own bar took one
  corner and the launcher floated beside a heading). A near sheet still
  sends it climbing.
- Page checks: a small-caps label by design is not a defect, 11.84px is
  not under 12, and one kind of finding is one card (the signature drops
  counts and examples; "30 pieces" then "6 pieces" were two cards).

Tests: onboarding-site-step.ts (new), widget-placement.ts, widget-watch.ts,
widget-continue.ts, build-paths.ts; all widget browser suites pass locally.

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

* refactor(widget): keepInViewOnFocus lives in dom.ts — createConversation back under the 510-line cap after the merge

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

* fix(widget): import keepInViewOnFocus — the panel threw at mount and boot swallowed it

An unimported identifier compiles fine with esbuild and fails at run time;
boot's catch hid it, so the launcher rendered and the panel never opened.
Caught by widget-embed-browser.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 05:10:30 -07:00
CatoandClaude Opus 5.5 be5752994c feat(widget): one integrated panel — watch says what it sees, in Loki's own spiral (#1111)
* feat(widget): watch says what it sees, in Loki's own spiral

From the owner's phone on heidi.orangecat.ch (2026-10-09): "It's not clear
what it thinks when it watches", and the logo is barely used.

- What Loki sees: one row under the panel header ("Watching · 2 pages,
  1 tap · nothing wrong so far") that opens into the trail worded as notes
  — pages opened, taps, what the page sent, what it noticed. Each settled
  page now records a `look` step even when clean, so "looked, all fine"
  is visible instead of silent. widget/thoughts.ts (pure) +
  thoughts-view.ts.
- The status light is the logo's spiral, generated from
  src/config/brand-mark.ts into widget/brand-mark.generated.ts (the widget
  may not import src/). It turns slowly while watching, spins while Loki
  thinks (header and the pending answer), and goes still and grey when
  paused — in the launcher, the panel header and the walkthrough card.
- Loki's answers render paragraphs, bullets, headings and bold
  (widget/rich-text.ts) from text nodes — "* The headline …" no longer
  shows its asterisks.
- Tests: widget-thoughts, widget-rich-text, widget-brand-mark (drift);
  watch/embed/host-avoid browser suites pass locally.

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

* feat(widget): one surface, not a stack of boxes and buttons

"No Frankenstein elements. Integrated experience. Not a bunch of big
unaligned buttons" (owner, 2026-10-09). The panel had grown one bordered
control at a time; this is a layout pass over all of it, with one rule:
at most one filled accent button per region, every other action is
quiet text aligned in its row.

- Header: who and where, and ✕. Review and Stop watching are gone from
  it — Review is the conversation's first suggestion, and watching is
  shown AND paused from the notes row (Pause / Resume), status and its
  control together. A visitor keeps one quiet "Watch".
- Notes and Your changes are hairline strips, not nested cards.
- Thread: Loki's words are prose on the panel; yours are a pill.
  Noticed/sent remarks carry a left rule instead of a box.
- Suggested changes: a hairline list, "Build this →" as accent text at
  each row's end (was five filled buttons down the right edge). "Fix
  this →" and "Why does it matter?" sit on one baseline.
- Composer: ONE card — About tabs (underlined when chosen), the words,
  screenshots, then tools left and Build it / Ask Loki right, compact.
- Starters and links share one pill style; buttons are compact; the
  ghost button has no frame.
- Tests follow the moved controls (watch-browser: Review via the
  starter, Pause/Resume via the notes row; theme test checks the new
  rules). watch/embed/host-avoid browser suites pass locally.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 04:49:19 -07:00
CatoandClaude Fable 5.1 6c6380efb7 feat(widget): the owner's way into Loki — Continue in Loki, an advisor that knows whose site it is, a header that fits a phone (#1107)
* feat(widget): the owner's way into Loki — Continue in Loki, an advisor that knows whose site it is, a header that fits a phone

On 2026-10-09 the owner of heidi.orangecat.ch opened the widget on their
phone and asked for one new page. The widget treated them as a stranger:
it told them which heading to insert and to "keep the structure in a data
file (JSON/YAML)", wrote five invented sentences in the site's own language,
and answered "switch to Loki so I can develop it there with either chat or
terminal" with the same advice a third time. The owner's sign-in lived only
behind "Watch". Once signed in, Review + Stop watching pushed ✕ off the
right edge of the screen.

- widget/continue.ts + src/lib/widget/continue.ts: the thread as one
  message (newest kept, ≤1800 chars) and where it lands in Loki.
- GET /api/widget/continue: signs the person in if needed, checks
  getProjectAccess on the widget's project, resolves the project key and
  redirects into /loki?project=&q= or /terminal?project=&view=terminal;
  a stranger goes back to the site with #loki-owner-denied.
- widget/conversation.ts: "Continue in Loki · Chat → · Terminal →" under
  the composer for the owner; one sign-in link for anyone else after their
  first message; "This is my site — sign in with Loki →" under Loki's
  greeting, on the first screen. The owner pass travels with each question.
- /api/widget/advise + advisor.ts: the pass is verified as ingest verifies
  it; with it the advisor knows the person OWNS the site and Build this
  builds. For everyone, four hands-off rules: never explain how to edit the
  site, never write its content, a build request becomes the one change to
  tap, and "take this into Loki" is answered with where that control is.
- widget/theme.ts: the header's text column shrinks before the actions do;
  Stop watching stays on one line; the continue row wraps on a phone.
- widget/main.ts: the owner is not offered to hide their own tool.
- scripts/test/widget-continue.ts (new), widget-advise.ts: pinned.
- docs/architecture/feedback-widget.md: the row and the route.

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

* feat(widget): the loop closes on the site — Your changes, a live announcement, an honest Follow link

"On it — Loki tells you when" was the end of the widget's story, and on the
site Loki never told anyone: the telling went to push and Telegram, the page
the owner came back to said nothing, and "Follow the build" toured the
unchanged page with "let me show you what changed".

- widget/changes.ts: "Your changes" above the thread for the owner — the
  project's recent changes with one word each (Building · On its way · Live ·
  Needs you …), See it → once live, Open in Loki → when something needs them,
  asked for on arrival and every 30 s while something moves. A change this
  browser saw building that is now live is announced once: in the thread when
  the panel is open, beside the launcher (bubble + unread) when it is not.
- POST /api/widget/owner/changes: the one read with the owner pass. Same
  attachFeedbackWork the inbox uses, then src/lib/feedback/owner-view.ts
  writes the owner's words; the work view never leaves the server. No valid
  pass → no rows.
- /feedback/<id>/watch-fix lands on the inbox row while the change is still
  being built; the walkthrough only once it is live.
- The owner's repeated note keeps its follow link.
- widget/continue-row.ts, widget/greeting.ts: split out of createConversation
  (the lint rule caps it at 510 lines; CI caught it at 543).
- scripts/test/widget-changes.ts (new); widget-continue.ts updated.
- docs/architecture/feedback-widget.md.

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

* fix(widget): the owner's door is not an .act — the embed test counts those

widget-embed-browser asserts exactly one "as written" link (.act) under the
visitor's last message; the sign-in door under the greeting shared the class
and made it two. Its own class, same look.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 04:12:00 -07:00
CatoandClaude Opus 5.5 17e63d1396 feat(widget): one designed piece — the launcher is the status, Loki stops crying wolf, the panel fits (#1106)
Found by using the live widget on loki.orangecat.ch as owner, not by tests:

- The composer overflowed in every real browser: with a mic present, Record +
  Screenshots + Send as feedback pushed Ask Loki out of the 372px panel (the
  test browser has no mic, so nothing caught it). Tools are icons at rest, the
  row wraps; widget-embed-browser now fakes a mic and fails at 1200/390/320 if
  the panel scrolls sideways or any button sits outside it (proven against the
  #1099 CSS: 6 failures).
- The top bar covered the site's own navigation. For the owner the LAUNCHER is
  now the status: "Loki · watching", an unread count of what Loki said while
  the panel was closed, the newest remark in a bubble beside it. The bar is the
  fallback, shown only when neither launcher nor panel can be seen.
- Loki cried wolf on Loki's own page: "15 links have no name" (innerText is ""
  under content-visibility:auto, and ?? never fell back) and "25 tap targets
  too small" (WCAG 2.5.8's spacing exception ignored). Now 0 and 1 (a really
  crowded 154x16 link); examples name a link's address instead of "a". Pinned
  by fixtures that fail with the old code.
- A remark arriving mid-tap moved the button away (it happened live): the
  thread follows new messages only if you were at the bottom or acted
  yourself; opening the panel lands on the newest message.
- "On it" was a dead end: owner builds now return followUrl (Loki's Watch the
  fix page for that item) and the receipt says "Follow the build →".

widget/README.md now opens with the design model and the rules that resolve
its trade-offs.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 10:17:56 -07:00
CatoandClaude Opus 5.5 54364444d7 fix(monitor): a dead API key pages within the hour — and a muted link can page again (#1103)
orangecat's GROQ_API_KEY was revoked for days (2026-10-08): voice input
failed, the Cat's chat quietly answered from other vendors, and nothing paged.

Why the existing watch missed it: ai-provider-check.sh set a failing link
'bad' and never 'ok', and alert_transition pages only on a flip — so
groq/openai/gpt-oss-20b, bad since 2026-09-14 (rate limits), was muted for
good when the key died. Links below the threshold in a readable window now
recover (an unreadable journal still recovers nothing), and a 401/403 is
reported as 'API KEY REJECTED' with what to do, not a bare count.

New api-key-check.sh asks the vendors directly, hourly, with no traffic and no
tokens: every DISTINCT key in every app's env file — /opt/*/shared/.env AND
/opt/*/app/.env, the layout orangecat uses and a shared/-only rollout missed.
401/403 = dead (page once, naming the apps and a working key of the vendor);
anything else = no verdict. OpenRouter is asked on /key (its /models says 200
for a dead key). Keys are fingerprinted, never printed or put in a URL. Its
first real run found a SECOND dead key (evig), since replaced.

Tests: 26 + 18, both mutation-proved; wired into test:ops. Alerts documented.


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

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 10:05:17 -07:00
CatoandClaude Opus 5.5 6f63fd2516 fix(calendar): a booking that keeps failing stops and says so (#1102)
One approved event had its date only in the action's description. The
date rescue never read the description, and a failed booking went
straight back into a queue the drain polls every 15 s: 38,851 failures
between 2026-09-21 and 2026-10-08, a model call on every pass against
the shared free tier, and no word to the operator that it was never
booked.

- The rescue now receives the row's description (drain + in-process
  executor), so a date written there books.
- After MAX_BOOKING_ATTEMPTS (3) failures the row goes approved ->
  expired and the operator gets ONE Telegram "⚠️ Not booked" with the
  details and the reason (registered in telegram-notifications.md).
- scripts/test/booking-attempts.ts pins both halves (mutation-checked).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 10:03:40 -07:00
CatoandClaude Opus 5.5 1d2523625c feat(widget): feedback back in front; Loki speaks up when something is wrong; Stop watching is one tap (#1099)
After #1092 feedback was hidden (Send to builder only appeared after asking
Loki), the page / whole site / element choice had become a toggle chip,
stopping Watch was only "Pause" on the top bar, and Loki only counted what
it saw.

- About: This page / Whole site / An element is one segmented control again,
  and the composer has Send as feedback (straight to the confirmation, no AI)
  beside Ask Loki.
- Watch speaks up: every notice (failed request, slow answer, the site's
  console error, slow load, a freeze after a tap, content jumping), every
  automatic fix, and the page checks after each page settles become a "Loki
  noticed" message in the conversation, in plain words naming the tap that
  led there, with Fix this (the request written out) and Why does it matter
  (asks the advisor with the session). Rule-based (explainNotice /
  explainChecks) - no background model call - and said once per visit.
- The bar says what Loki noticed, with Show (open the conversation) and
  Stop watching / Watch again; the header has Review + Stop watching, or
  Watch again. Stopped, nothing is recorded and nothing is said.

Tests: widget-watch 12 cases (explainers), widget-thread (noticed restore),
widget-watch-browser 50/50 (remark in words + Fix this, no repeat after
reload, header Stop watching records and says nothing - fails with the
guard removed), widget-embed-browser 47/47 (element feedback straight to
the builder, no AI call).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 09:35:00 -07:00
CatoandClaude Opus 5.5 6be6045295 feat(widget): one conversation with Loki; Watch in the header (#1092)
* feat(widget): one conversation with Loki; Watch is in the header for anyone who owns the site

The panel was three tools sharing a box: Request a change (a form), Ask Loki
(an advisor) and Chat, behind tabs and scope chips, each with a history that
vanished on close - and Watch could only be switched on by arriving through
one link on the project page in Loki, so an owner simply visiting their site
never saw it.

Now:
- One thread (widget/conversation.ts). Type, speak, paste a screenshot or
  point at an element; Loki answers about this page (one tap: whole site).
  Every suggested change, and your own message as written, has Send to
  builder / Build this, which opens a confirmation card in the thread; the
  receipt (building / track link) lands in the thread.
- The thread is kept per tab (widget/thread.ts, validated on restore), so it
  survives the site's own page loads.
- Watch in the header: Review for the owner; for anyone else an explainer
  with "This is my site - sign in with Loki", via GET /api/widget/owner,
  which checks ownership of the widget's project and returns to the same
  page with a pass. The return URL must be on the project's own site
  (ownerReturnUrl), so the route cannot hand a pass to someone else's page;
  a non-owner lands back with a plain explanation.
- data-fc-modes now only picks who answers: advisor (default), the studio
  concierge (chat), or none (report). The owner always gets the advisor.
- widget/loki-api.ts holds the two calls; advise.ts and chat.ts are gone.

Tests: widget-thread (new), owner-note-builds (return-URL guard),
widget-embed-browser 41/41, widget-watch-browser 40/40,
widget-host-avoid-browser 24/24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(widget): style guard follows the panel's real controls; comment no longer reads as an import

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 08:02:54 -07:00
CatoandClaude Opus 5.5 f6b9dd701f fix(hetzner): a sleeping app naps cleanly; ivy-health checks what Loki runs (#1087)
* fix(hetzner): a sleeping app naps cleanly; ivy-health checks what Loki runs

Sleep-when-idle stops the app with SIGTERM when its proxy idles out, and
Node exits 143. Without SuccessExitStatus systemd recorded that as
Result=exit-code, so every nap read as `failed` and paged Telegram as
"DOWN" quoting the boot banner, then "RECOVERED" on the next visit — ~10
sites flapping all day, burying real alerts. The generated app unit now
counts 143/SIGTERM as a clean stop; the test pins it (mutation-checked).

ivy-health.sh was box-only and still checked fleetcrown-app/-bridge and
the retired OpenClaw gateway, paging "DEGRADED (restart failed)" every 4h
for units that no longer exist. Versioned here, now heals postgres and the
loki-* units and probes loki-app /api/health; installed on the box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(telegram): register ivy-health.sh as a sender

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(hetzner): ivy-health history without the retired name

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 07:14:22 -07:00
CatoandClaude Opus 5.5 edb1249552 feat(watch): Review: Loki judges what you just did on your site (#1081)
* feat(watch): Review — Loki judges what you just did on your site and suggests what to improve

Watch mode only acted when something broke. It now also notices what a
demanding reviewer would (4xx, slow requests, console errors, slow loads,
main-thread freezes, layout shift, pauses between steps) plus measured page
checks (unnamed controls, unlabeled fields, tiny tap targets, missing alt,
broken images, sideways scroll, h1/lang). The pill counts them; Review sends
the session to Ask, which judges it through errors, design, engineering,
process and product - every point cited from the session - and each change
is one tap from a request that carries the watched steps. The trail now
survives page loads within a tab, so a multi-page site reads as one visit.

No model runs until Review is pressed. The report POST is now one helper
(widget/send-report.ts) shared by Send and the automatic fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(watch): Review never blames the site for Loki's own work; plain-text answers

Found by looking at the 390px render, not by the tests:
- opening Loki's own Review panel scored a 0.27 layout shift against the
  site (Chrome reports shadow-DOM sources with a null node) - only shifts
  pinned on a site node count now;
- the widget's own boot registered as 'the page froze 369ms' - a freeze now
  counts only when it overlaps the second after a tap on the site;
- the review asked for **bold** lenses and the widget shows text, so clients
  saw literal asterisks - plain-text rubric + plainAnswer() on every reply;
- '404 in 0.0s' - duration only when slow.

The browser test now proves the detectors fire on real jank (a Load more
that freezes and pushes content down) AND stay quiet for Loki's own panel.
The 'typed values never leave the page' checks were vacuous (fill() never
taps the field) - they tap the filled field now and fail under mutation.
Docs: the architecture table described Watch as 'still a seam'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:46:34 -07:00
CatoandClaude 6bf6142b63 feat: live-fix messages open "Watch the fix"; late at night Control says go to sleep, autopilot has it (#1078)
Fix walkthroughs:
- New /feedback/<id>/watch-fix mints a fresh owner tour ticket on every
  open and lands on the live page's walkthrough (inbox when there is no
  live page or no access). A ticket lasts a day; a Telegram message lasts
  forever, so messages carry this address, not a ticket.
- notifyFixShipped: push, Telegram and the in-app alert for a live fix now
  link the walkthrough ("▶ Watch the fix") instead of the bare page.
- getFeedbackWithProject returns the project's liveUrl.

Late night:
- lib/late-night: 23:00–05:00 local, one "night" key per evening, copy.
- LateNightAutopilot on Control: autopilot off → "Hand it to autopilot and
  go to sleep" with one tap to turn it on; on → "Autopilot is on — go to
  sleep". "Not tonight" hides it until the next evening.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 11:40:54 -07:00
CatoandClaude Fable 5.1 fb25ac6734 feat: say who you're talking to, and whether the change is live (#1067)
* fix(terminal): name the conversation after the agent in the session; "Loki" is the supervisor only

The view switch read "Loki | Terminal" (#1041). That named the coding agent's
own conversation after a different AI: Loki runs on whichever model is first
in its chain, and the thing in the session is Claude Code today, Codex
tomorrow. The operator reported the result on 2026-10-07: "there can be one
model powering the chat, and another model is open in the terminal".

- TerminalViewSwitch takes the running agent's label: "Claude | Terminal",
  "Codex | Terminal", "Chat | Terminal" when unnamed.
- "Loki" goes back to the supervisor panel: the desktop pane button and the
  session-sheet section, whose row now says it answers on Loki's own model.

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

* feat(projects): the Build strip ends on the outcome — live at skif.ch, or waiting on you

The project page knew whether an agent was working, how the last run was
graded, and (in the run's fix ledger) whether the change had merged and
deployed. It read the first two and said "work reached the repo" — true, and
not what the person who asked for the change wanted to know.

- lib/project-state-sentence: one sentence per project (headline, detail,
  tone, waitingOnYou), from the build status plus the shipping ledger. Ends on
  the outcome ("Live at skif.ch", "In review — goes live by itself", "Merged,
  but not live"), never on the mechanism; no PR numbers, CI or auto-merge in
  the words. `waitingOnYou` is true only when nothing moves until the
  operator acts — a change in review is not waiting on anyone.
- LastAttempt carries `shipping` (normalized payload.fix), and `landed`
  honours a deployed ledger, so a timed-out run that shipped is not "nothing".
- ProjectBuildStatus renders the sentence; its kicker follows the tone, and a
  link to the live site or the change sits in the text — the action slot
  stays the one button that starts work.

Control's card already shows the ledger line; Today lists only flagged
projects. Both unchanged here.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 07:12:11 -07:00
CatoandClaude Opus 5.5 c9044a8151 feat(sites): sites that are not live yet sleep when idle (#1066)
* wip(sites): sleep-when-idle building blocks (not wired in yet)

Adds the status list and idle time (_box-env.sh) and the pure generators
(lib.sh: sleeps_when_idle, wake_inner_port, sleep_app_unit, wake_socket_unit,
wake_proxy_unit). Nothing calls them yet: sync-infra.sh is unchanged, so no
site's units change. Wiring them in waits on the owner's go-ahead.

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

* feat(sites): sites that are not live yet sleep when idle

Every site ran around the clock with up to 1 GB, which capped the 16 GB box at
roughly 50 sites however rarely they were visited. A site whose register status
is prospect, demo, validating or unverified now sleeps: systemd listens on its
port, the first request starts it (a second or two), and it stops after 15
idle minutes. Live sites (clients, products, evig, the 4001-4004 services) are
untouched; a row that becomes live is switched back to always on on its next
sync.

- sync-infra.sh: for a sleeping row, the app listens on port+20000 and is bound
  to <name>-wake.service (systemd-socket-proxyd --exit-idle-time) behind
  <name>-wake.socket on the public port. Caddy and deploy.sh keep talking to
  127.0.0.1:$PORT, so neither changes; a deploy's restart pulls the proxy up.
  Falls back to always on, out loud, if the box's proxyd lacks idle exit.
- install-watchdog.sh: a sleeping site is checked by its socket, not by a
  request every 5 minutes (which would keep it awake forever).
- uptime-sweep.sh: sleeping sites are health-probed on the first sweep of
  00/06/12/18 UTC instead of every 15 minutes, so botsmann's kind of outage
  is still caught within hours; certificates are still checked daily.
- Sync sites workflow: re-applies sync-infra.sh to named sites and checks each
  one answers — the rollout for sites already on the box.

Tests: test-sleep-when-idle.sh runs sync-infra and the watchdog installer end
to end against a recording ssh; test-uptime-sweep.sh covers the 6-hourly probe.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 07:01:59 -07:00
CatoandClaude Opus 5.5 5aa521e08d feat(sites): give a site its own domain — evig.orangecat.ch → evig.ch (#1065)
* feat(sites): give a site its own domain — evig.orangecat.ch → evig.ch

A site starts on <slug>.orangecat.ch. When its owner buys a domain, Loki can
now make that domain the site's address: the domain (and www. when it points
here) is served, the free address answers with a 308 to it, and the project's
live URL, production URL and widget origin list follow. Nothing the visitor
sees says where the site is hosted, and the site stays one repo, one Loki
project, on the same box.

- lib.sh caddy_vhost: the one rule for what a row's domains field means. A
  row mixing an own domain with its free host serves the own domain and 308s
  the free one. sync-infra now calls it; every existing row's vhost is
  byte-identical (pinned against the real register in test-custom-domain.sh).
- attach-domain.sh <slug> <domain> | --detach: checks DNS first (A to the box,
  no stray AAAA) and refuses with the exact records when it is not set —
  Caddy would otherwise retry a failing certificate for hours while the free
  address already redirects there. Edits the row, publishes it to main via
  the shared publish_register_row (moved out of register-site.sh), syncs,
  waits for HTTPS. Refuses the handcrafted 4001-4004 services (evig among
  them) whose Caddy blocks are hand-written.
- GET/POST/DELETE /api/projects/[id]/domain + an "Own domain" panel next to
  the live link: type the domain, see the records and whether they are set,
  connect, or go back to the free address. Studio-box gating is the same as
  site registration; everyone else gets the command.

Docs: docs/infrastructure/custom-domains.md, including why sites are not
hosted inside OrangeCat (removed 2026-08-27) and the two things a site's own
code may still need after a move (metadataBase, OrangeCat OAuth redirect URIs).

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

* fix(env): document LOKI_SITES_IP / LOKI_SITES_IPV6 in .env.example

env-example-covers-src requires every variable src/ reads to be named there.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 05:53:32 -07:00
CatoandClaude 1138940bc2 fix(terminal): Chat in the switch, prompts that fit the screen, nav off the keyboard; questions stay questions (#1040)
From a phone report on /terminal and /loki (2026-10-05):

- The input switch ended in a "Loki" chip that opened the same panel as the
  header's Loki button; tapping it was expected to show the session as a
  conversation. Chat is now the switch's first position (Chat · Type ·
  Prompt · Voice) on phone and desktop, the chat view carries the same switch
  back, and the duplicate header chat icon and desktop "Conversation" button
  are gone. Picking an input mode also shows the terminal.
- The Prompt box offers up to three prompts read off the screen
  (lib/terminal-suggestions.ts): the PR whose CI is pending or red, an error
  on screen, a y/n question, "continue" after Completed. A tap fills, never
  sends.
- With the soft keyboard up the bottom nav floated over the Prompt box and the
  terminal was squeezed out. The nav now hides while the keyboard is up
  (fc-keyboard-open, every page), and in Prompt the key deck folds away until
  the keyboard closes.
- "Are you able to work on improving Loki in this field." was queued as agent
  work: no question word the resolver knew, no question mark, and " on " hit
  the last-resort task rule. Auxiliary-led yes/no questions are now chat, and
  the no-LLM fallback keeps questions as chat too.
- The queued-offline reply named the builder and then said "starts when a
  builder is online (cloud or this computer)". It now names only that builder.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 05:49:55 -07:00
CatoandClaude Opus 5.5 77ad544875 feat(terminal): attach from a phone, swipe to scroll, one bar, no dead ends (#1042)
* feat(terminal): attach from a phone, swipe to scroll, and a full screen that is full

Attaching. The paperclip on a phone opened a chooser of capture apps (Camera,
Camera, Recorder, "Photos & Videos") with no way to the screenshot: one file
input with a mixed accept. The composer is chatkit's, so the fix is there
(bitbaum/chatkit: Camera / Photos / Files sheet, one input per source) and
this bumps the pin. Control's own paperclip (attachment-strip) now renders
chatkit's AttachMenu instead of its own mixed input, and a picked PDF gets a
sentence instead of being read as text.

Attaching in the conversation view. It had attach={false}. A message with a
screenshot is folded by the same lib/composer-attachments every dispatch
uses (new /api/control/fold-attachments: the fold and nothing else) and
pasted into the session like any message. sendKey is now one serialized
chain, so Enter can never overtake a long chunked paste.

Scrolling. xterm 6 scrolls on the wheel only, so on a phone a swipe moved
nothing. lib/terminal-touch-scroll.ts turns a vertical swipe into
scrollLines, carries sub-row movement, glides after a flick, and leaves taps
alone. Verified with real xterm in Chromium under touch emulation: 0 lines
before, ~1 line per row of finger travel after. A "Live" button returns to
the newest output while scrolled back.

Full screen. Expanded kept the whole dock (two key rows, mode chips,
composer: more than half the phone), so it bought a few rows and read as
four toolbars stacked under the session. Expanded now collapses the dock to
one bar: Keys and Write open their panel on demand, Esc and Enter stay on
the bar. The phone switch drops Voice (the composer's mic dictates) and its
Loki chip (the header's Loki button is the one entry point).

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

* feat(ux): one composer per screen, one bar on the phone, no dead ends

Verified on the real app (production build, local Postgres, demo tenant,
a stubbed live session) at 320/390/768/1440: responsive audit green on
every page; screenshots of each changed surface.

Terminal, phone. Both layouts are now one bar (Keys / Write; Esc / Enter
while watching) with one panel open. The normal page opens on Write, full
screen on nothing. The stacked dock (two key rows + chips + composer) is
gone from both.

Conversation view. A builder that never sends the transcript used to show
"The conversation isn't coming through … Fleet Runner 0.8.38" — now the
surface shows the terminal for that session and drops the toggle, without
touching the saved preference.

Loki panel. A working run said it three times ("Working · 2 min" /
"Agent is working" / "Agent is generating. Inject to steer…");
railStatusLines prints only lines that add something. In the conversation
view the panel is Ask-only, so the page never shows two composers for one
session. Plain empty copy; the "Full chat" text link is an icon button.

Sheets. On a phone a bottom panel is a real sheet on the bottom edge — it
floated ~90px up, clearing a bottom nav that is hidden while it is open.

Floating clutter. The Ask Loki bubble is gone from /terminal (it sat on
the Loki panel's Send); on phones the feedback launcher hides behind the
bottom nav and "Report a problem" lives in the account menu.

Dead ends. An offline/gated terminal offers "Use this computer" and "Get
Fleet Runner" as buttons. Control's never-connected banner is one
sentence and one button: the duplicate "Start a new project" card goes,
and the five CLI installers — which queued commands no builder would pick
up — only show where a builder can act on them.

Also: no-op input-mode chips hidden in the conversation view; memory
descriptions wrap instead of a hover-only ellipsis; the responsive audit
honours CHROMIUM_PATH. Tests: phone-chrome.ts, railStatusLines cases.

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

* fix(shell): Report a problem falls back through the router, not location.assign

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

* chore(deps): pin chatkit to the merged commit of bitbaum/chatkit#7

Same tree as the branch head it replaces (5c2cdd6), which was deleted
after the squash-merge; pinning main's commit keeps the install
fetchable.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 05:27:53 -07:00
CatoandClaude Opus 5.5 4abd1664c0 feat(terminal): one Loki | Terminal switch, drawn in both views at every width (#1041)
* feat(terminal): the dock's Loki switch shows the session as a conversation

Beside Type / Prompt / Voice, "Loki" read as a fourth way of working and then
opened a side panel about the session instead. It now switches the screen to
the session as a conversation — the chat-app view (ClaudeChatView) that was
only reachable through an unlabeled icon in the header. Where the agent writes
no conversation log (not Claude), the chip still opens the Loki panel; the
header's Loki button keeps opening the panel everywhere.

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

* feat(terminal): one Loki | Terminal switch, drawn in both views at every width

The terminal screen named two different things "Loki" and hid a third behind
an icon: a speech-bubble icon in the phone header (the conversation view), a
"Loki" header button (the run summary panel), and since the last commit a
"Loki" chip in the dock that disappeared with the dock the moment you used it.
On desktop the conversation view had no way back at all — its only entry was
a "Conversation" button inside the terminal pane.

- TerminalViewSwitch: one labelled Loki | Terminal control, current view
  marked, in the phone header and the desktop session bar.
- "Loki" now names only the conversation view. The run summary panel moves to
  the session sheet on phones and is "Summary" on the desktop pane.
- Input modes (Type / Prompt / Voice) show only in the terminal view, where
  they do something.
- Under 375px the switch drops its icons so the session name keeps its width.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 04:55:48 -07:00
CatoandClaude Fable 5.1 d856ce2b83 feat(studio): every request reaches a person; the chat stops narrating its rules (#1002)
* feat(studio): every request reaches a person; the chat stops narrating its rules

- A studio brief, a partner application and every guest action on one now
  announce themselves like feedback does (push, Telegram, an alert pointing
  at /feedback/studio). #995 persisted them and told nobody — the opposite of
  "a person will reply". Replays stay silent; a notify hiccup never fails the
  ingest.
- Widget chat: a fallback model answered a bitbaum visitor with "Stage used:
  beta. / No URLs written. / Loki first because building leads" under the
  real answer. stripMeta drops such lines before the reply is shown, and the
  prompt says the answer is only what the visitor reads. Tests pin the leak
  and the sentences that must survive.
- A paused widget token cannot transcribe voice either.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs(telegram): register the studio notifier

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* refactor(studio): the routes announce; the query layer only says what happened

Announcing from inside createStudioRequest/mutateStudioPortal wrote an alert
row for the e2e's test tenant while the test was deleting it, and the FK
blocked the teardown (CI: studio-portal-e2e). The queries now return what
happened — the created row, or the applied action and its row — and the two
routes fire the notification, the way /api/feedback does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-01 08:30:26 -07:00
CatoandClaude Opus 5.5 74e0eeef5c fix(changelog): complete, current changelog and roadmap; /releases is Fleet Runner releases (#1001)
* fix(changelog): render every entry whole — bullets, sub-headings, prose, all of history

The /changelog parser kept only the first line of each bullet, dropped ###
sub-headings and bullet-less entries, cut entries at 700 characters and kept
the newest 40. The page now renders the whole record, grouped by month, with
PR numbers linked. A test reads Loki's own CHANGELOG.md and checks the parsed
record against an independent reading of the source (mutation-checked: the
old parser, a no-op continuation join and a dropped sub-heading each fail it).

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

* fix(releases): /releases is Fleet Runner releases; the stale platform list goes

Titled "Changelog" with an H1 of "Loki", the page carried a hand-kept
Platform section whose newest entry (2026-07-31) was still badged Latest.
CHANGELOG.md is the canonical product record; its two entries move there and
the page links /changelog instead.

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

* docs(changelog): fill September, the Aug 15 – Sep 21 gap, and mark #955 superseded

Adds the user-visible changes that never reached CHANGELOG.md (MCP, Watch it
work, OrangeCat sign-up, change a site from its URL, MIT relicense, Solon
founding, Telegram approvals, site retirement, and more), each checked
against its PR, in plain words with the PR number. Replaces the one-paragraph
summary of five weeks with dated entries and moves the two platform entries
from the old /releases list in.

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

* docs(roadmap): Shipped section, retired vocabulary out, Now holds only moving work

Finished items move to Shipped and nine shipped-but-unlisted ones join them;
headless CLI install and BYOK chat are ticked; Beacon, Mission checkpoints and
the autonomy ladder give way to the on/off autopilot and approvals; sign-in is
OrangeCat-first. The roadmap framing stops claiming local models are
first-class (open-weight models run the chat today; local is the direction)
and stops pointing at internal documents.

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

* docs(changelog): say the rename without the retired name

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 05:06:57 -07:00
CatoandCursor 64b1c4bd7f refactor(thoughts): read essays through bip-kit's collection reader (#988)
listThoughts uses readCollection from bip-kit/node (0.5) instead of its own
readdir + parseFrontmatter loop; the whitepaper page drops its private copy
of the frontmatter parser. Same 69 essays, fields and blocks. Five essays
without readingTimeMin showed a made-up 6 min; they now get the computed
time. The content-publishing SSOT records who reads through bip-kit 0.5.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 11:03:24 -07:00
CatoandClaude 75980bac76 feat(auth): sign-up goes through OrangeCat; one click links an existing account (#977)
Step D7 of orangecat ADR-0009 ("One account for every door").

- The sign-up page's OrangeCat button now opens OrangeCat's own
  create-account screen (OIDC prompt=create, advertised in its discovery
  document) and says so: "Create an account with OrangeCat". The Loki
  password form is kept for people who want one, but waits behind a single
  line ("Prefer a password just for Loki?") instead of being the default.
  lib/auth/orangecat-sign-in.ts holds both facts, pure and tested, so the
  sign-in and sign-up buttons cannot drift apart.
- A signed-in person whose Loki account is not yet an OrangeCat account
  sees one calm banner with one button, "Connect OrangeCat" — the same
  round-trip Settings → Account offers, from any page, dismissable for good.
  From then on every OrangeCat sign-in (code, Google, passkey) is Loki's too.
- The "routes where a banner may not take the viewport" list is now one
  config (config/banners.ts) shared by both shell banners.

Loki sessions stay Loki's own; what OrangeCat governs is the link, and a
refused refresh already marks it broken. Lint/tsc could not run in the
sandbox (the chatkit/listkit GitHub tarballs are blocked there); the new
unit test passes and CI is the gate.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-29 03:14:19 -07:00
CatoandClaude Opus 5.5 a1cc13053c feat(mcp): message Loki from any AI app; the Telegram agent reads screenshots and videos (#965)
* feat(openclaw): the Telegram agent reads screenshots, photos and videos

The Telegram agent is OpenClaw on bitbaum, and OpenClaw already describes
inbound media before the chat model reads the turn — but on defaults that
cut every description at 500 characters and read one attachment per
message. A screenshot lost most of its text; an album was read as its
first picture; video had a one-line "Describe the video." prompt.

- scripts/openclaw/media-understanding.json: versioned tools.media.image
  and tools.media.video blocks (Gemini; screenshots transcribed verbatim,
  albums read whole; videos returned as transcript + visuals + claims +
  authenticity signs so the agent can argue about whether a clip holds up).
  tools.media.audio is deliberately untouched — voice notes already work.
- scripts/openclaw/install-media-understanding.sh: the only way it reaches
  the box. Refuses without a Gemini key, writes through OpenClaw's own
  schema-validating `config set`, restarts the gateway, then proves an
  image (and, where ffmpeg exists, a video) is actually described.
- scripts/test/openclaw-media-config.ts: pins the limits and the audio
  hands-off rule.

Validated against openclaw@2026.4.23's schema locally. Not yet applied to
the box.

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

* refactor(actions): share the decision and the enqueue report; let a turn be read-only

Groundwork for the MCP server, so it calls the same code the chat seams do
instead of a copy of it:

- lib/actions/decide-action.ts: approve/reject one draft, lifted out of
  POST /api/actions/[id]/decision (which now calls it; wire shape unchanged).
- lib/actions/enqueue-report.ts: what an enqueue outcome may truthfully be
  called (auto-approved / awaiting-approval / deduped), lifted out of
  POST /api/actions/propose (wire shape unchanged).
- config/orangecat.ts: the OrangeCat origin and OAuth issuer in a DB-free
  module; Auth.js and the identity bridge read the issuer from here instead
  of each re-deriving it.
- askLoki / runLokiTurn take `readOnly`: the tool loop drops its propose
  tools and the OpenClaw gateway fallback is skipped, so a caller granted
  conversation but not action cannot get Loki to act by asking.

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

* feat(mcp): a remote MCP server so AI apps can message Loki and have it act

POST /api/mcp speaks MCP Streamable HTTP (stateless JSON-RPC 2.0; protocol
2025-11-25 / 2025-06-18 / 2025-03-26). claude.ai and ChatGPT connectors,
Claude Code and Cursor can ask Loki, list the approval queue and projects,
dispatch work, book appointments and decide queued actions.

Auth: a ck_* agent token (both scopes), or an OrangeCat RS256 access token
verified with node:crypto against the issuer's JWKS — iss, aud (must be the
Loki resource URL, never a client id), exp. `sub` maps to the Loki user via
orangecatActorId; an unlinked actor gets the sign-in step, not a 500. A
missing or bad token is a 401 whose WWW-Authenticate points at the RFC 9728
metadata served at /.well-known/oauth-protected-resource(/api/mcp).

Scopes loki.chat / loki.act and the tool map are SSOT in src/config/mcp.ts.
Act tools go through injectPrompt, enqueueAction and decideAction — the
functions the Telegram skill's routes call — so the approval queue gates
them exactly as it does there. Both paths are excluded from the session
middleware (proxy.ts, with the reason), registered in api-route-auth and
the demo sandbox. Docs: docs/development/mcp.md.

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

* fix(openclaw): match the installer's smoke output with a here-string, not a pipe

printf | grep -q can report a miss on a match under pipefail (grep exits,
the writer takes SIGPIPE). no-grep-q-in-a-pipe caught it.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 14:49:20 -07:00
CatoandClaude 839f35ef6c fix(feedback): one inbox surface, project links by id, a render harness (#961)
Landing from Implement on /feedback?project=<id> printed "Nothing waiting
on you for 5936f8fb-…": the inbox filtered by project NAME and showed the
reader the id, on a page whose chips, stat cards and section heads were
each drawn in a different style. Every check was green; nobody had
rendered it.

- The ?project= filter resolves a name or an id against the data; an
  unknown value filters nothing instead of printing itself.
- A project-scoped view names its subject ("Showing petvity · 1 open ·
  All projects"), scrolls the active chip into view, and drops the
  per-row project chip. An empty project view says what is shipped and
  offers "Show all projects" / "Open <project>".
- One chip primitive (ui-inbox-project) for project and source filters;
  sections use the ui-inbox primitives; the three stat cards are one line
  (metricsLine, pure).
- A failed row has one primary button: the provider switch (or Retry);
  Watch steps down to secondary.
- Any refused feedback run gets one automatic second attempt; only
  commands the runner could not read, dead credentials and a missing
  workspace still stop. Test updated.
- scripts/preview/build-feedback-preview.mjs renders the real inbox with
  fixture rows in headless Chromium at 390 and 1280, dark and light, for
  every ?project= shape, failing on overflow or a console error. REVIEW.md
  records the definition of done this adds; responsive-design.md documents
  the harness.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 07:09:06 -07:00
CatoandClaude Fable 5.1 6fbafe88a5 feat(records): ROADMAP.md and CHANGELOG.md in each repo are the canonical roadmap and changelog (#952)
* feat(feedback): "Watch the fix" walkthrough; failed runs say why

What the owner hit on 2026-09-28, testing the loop from a phone:

- A shipped Farmhouse fix showed a green "Live · confirm" chip that was
  itself a link to the site. It read as "watch it live" and landed on the
  homepage with no idea where to look.
- A failed Petvity run printed the bare word "Retry" above a Retry button,
  with the reason hidden.

Now:

- The badge is a status, never a link, and says "Shipped · confirm".
- "Check live" becomes "Watch the fix" (plus "What changed" -> the PR). It
  opens the live page with a signed, 24h tour token in the fragment. The
  widget, which already runs on every fleet site, reads an outline of the
  page and plays a walkthrough from /api/widget/tour: a cursor glides to each
  element, a caption says why, in-page controls are really clicked (anything
  that navigates or submits is only pointed at). The script comes from the
  model on the owner's AI budget, with a word-overlap fallback so it never
  depends on a vendor.
- A step the tour cannot show says so ("Oops — ... flagged, it will be
  investigated") and is filed as an AI-review item on the project, so a fix
  that is not really live comes back into the loop.
- Failed rows get one plain sentence from the run error (quota, repository
  access, timeout, no session, crash...) instead of "Retry".

Verified in headless Chromium at 390px against live farmhouse.orangecat.ch
with this bundle: scroll to the footer link, click it (page returns to top),
a missing step reports back, no horizontal overflow.

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

* feat(records): ROADMAP.md and CHANGELOG.md in each repo are the canonical roadmap and changelog

The fleet map (/api/fleet/map) is what every site's /roadmap and /changelog
render through bip-kit, and its only producers were Loki's goals table and
dev_log column. Read in production today: 19 of 34 projects had goals, nearly
all of them one machine-seeded placeholder ("Make <x> development and
verification public", 0 of 3 steps done); the changelogs were run notes.
Meanwhile Loki, OrangeCat, Heidi and evig kept local roadmap copies the SSOT
forbids, and Solon and Petvity had no pages at all.

Now:

- src/lib/register/repo-records.ts parses ROADMAP.md (## buckets → status,
  ### items, - [x] milestones, Target:) and CHANGELOG.md (Keep-a-Changelog
  dialect) from each project's public GitHub repository, fetched in parallel
  and cached ten minutes in-process. A missing or private file yields nothing.
- The map prefers the file where it exists and keeps goals / dev_log where it
  does not; every entry says which producer it came from (`records`) and
  links the file (`source`), and repo items carry the author's one-liner.
- Loki's own ROADMAP.md holds the product roadmap that used to live in
  marketing-content (the buckets went stale twice) plus the scale plan:
  tenancy on the box, one box → a pool, BYOK + metering, the partner track,
  Loki as a GitHub App, own inference, the academy, with "Capacity you can
  read" as the trigger metrics. CHANGELOG.md is brought up to date from
  2026-08-15.
- /roadmap renders the record (grouped Now / Next / Later / Shipped);
  /changelog renders it instead of forwarding to /releases, which stays the
  Fleet Runner release history. Footer and account menu link both.
- docs/architecture/building-in-public-records.md is the file contract, the
  audit, and who complies; the SSOT doc points at it.

Tests: scripts/test/repo-records.ts (parser, precedence, provenance,
fetch/cache/failure); fleet-map suites unchanged and green.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 04:22:26 -07:00
CatoandClaude Opus 5.5 63d8f84d33 feat(widget): Ask Loki for a second opinion; hiding is visible and reversible (#950)
* feat(widget): Ask Loki for a second opinion; hiding is visible and reversible

Tested the embed in a real browser and found three install/hide defects:
- a `type="module"` tag rendered nothing (document.currentScript is null);
- two copies of the tag rendered two launchers;
- hiding lived only behind a long-press/right-click and was one-way: after a
  reload nothing, not even the host's own Loki.report(), brought it back.

Fixes: find the tag by its attribute when currentScript is null; a boot-in-
flight guard keeps one widget per page; "Hide this button on this site" sits
at the foot of the panel with an Undo toast, and #loki, Loki.show(),
report() and ask() all restore it.

New Ask Loki mode (on by default next to "Request a change"): the person the
site was built for asks whether an element, the page or the whole site should
change and why it is the way it is. The widget builds a text outline in the
visitor's browser (a few same-origin pages for "Whole site") and POSTs it to
/api/widget/advise — same token, origin allowlist, rate limits and owner AI
budget as widget chat. The answer may say "leave it"; each recommended change
has "Request this", which prefills Report so advice becomes ordinary
Implement work. data-fc-modes="report" opts a site out.

Tests: scripts/test/widget-embed-browser.ts (real Chromium; fails on the old
bundle) and scripts/test/widget-advise.ts.

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

* refactor(widget): move panel pieces out of main.ts to meet the function-length ratchet

CI lint failed: the main IIFE grew to 597 lines (max-lines-per-function 510).
The success views, scope chips, mode tabs and hide toast move to
widget/panel-views.ts; the counter/Send sync is one helper. No behaviour
change — widget-embed-browser (31) and widget-host-avoid-browser (17) pass.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 00:11:04 -07:00
CatoandClaude Opus 5.5 3af2fec589 fix: what the Farmhouse end-to-end test broke — Live link, stuck Claude dialog, owner wording (#938)
* fix(sites): a site that goes live after registration is recorded, and its owner told

Registration wrote the live URL only if the site answered at that moment.
Farmhouse's first deploy failed, a later one succeeded, and nothing looked
again: no live URL, a Live link that opened the OrangeCat listing, and no word
to the owner. An hourly check (and the owner opening the project page) now
asks the same question registration asks and, the first time the answer is
yes, sends the owner their link that readies the widget.

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

* docs(telemetry): six crons run hourly now that check-site-live does

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

* fix(runner): a Claude session showing a dialog is cleared before a prompt is sent into it

Farmhouse's parked session sat on Claude Code's "Teach auto mode about your
environment?" dialog. The owner's widget note was injected into the dialog,
nothing ran, and the run was NACKed 33s later while the widget said "On it".
Claude reports this itself ({status: waiting, waitingFor: "dialog open"}); the
runner now presses Escape and, if the dialog stays, starts a fresh session.

Also: on the box every live-session lookup used the dispatch's laptop path,
which no session has, so the generation check fell back to guessing from
screen activity. They now use the folder the agent really runs in, and the
reader accepts current CLIs' updatedAt.

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

* feat(widget): owner mode reads as the owner's, and the agent is told the owner asked

The widget no longer asks the owner for a name/email and says what happens
("Your site: what you say here gets built and goes live"). The agent's brief
now opens with "The owner of <project> asked for this change" instead of
"Fix this visitor feedback" — still fenced as text from a browser.

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

* chore(desktop): 0.8.35 — ships the dialog-clearing runner fix to Fleet Runner too

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

* docs(changelog): Fleet Runner 0.8.35

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 04:27:44 -07:00
CatoandClaude Opus 5.5 2105d3e358 fix(widget): the launcher finds a free slot on every host page, with a host contract for the rest (#918)
The launcher knew its corner, an offset, a global data-fc-bottom and one
foreign fixed launcher. Everything else it could miss: any layer wider than
90% of the viewport was ignored, so on substrata /atlas at 390px it parked on
the country bottom sheet; and it re-measured only on load, resize, window
scroll and URL change, so a sheet mounted later was never seen.

One engine now, for every width and obstacle:
- placement.slotOrder: preferred corner up its near band, the mirrored
  corner, then the rest of each edge (pure, unit-tested).
- host-scan: hit-tests each slot (launcher + 12px gap) with
  elementsFromPoint and judges free / surface / layer / blocked. Controls
  (incl. [tabindex], iframes, cursor:pointer) block; fixed/sticky bars and
  inner scroll panels are layers; a control >=25% of the viewport (a
  pannable map) is a surface.
- placement.chooseSlot: first free, else least-bad, else HIDE - never sit
  on a control.
- Re-measures on DOM mutation (throttled 1/s) and on inner-panel scroll.
- Host contract: data-fc-avoid (never overlap), data-fc-place=
  left|right|hidden on <html> or a page region. Documented in
  widget/README.md.

Also fixes a latent bug the browser test caught: clearing inline edges to ""
let the shadow stylesheet's right:16px survive a move to a LEFT corner, so
"Move to other corner" stretched the launcher across the page.

Tests: widget-placement.ts (pure) and widget-host-avoid-browser.ts (real
Chromium, 9 fixtures). Against the pre-fix bundle 7 assertions fail; each
new rule (layer, surface) fails its fixture when mutated out. CI installs
chromium-headless-shell so the browser test runs rather than skips.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 09:11:52 -07:00
CatoandCursor f2f6206bcf fix(projects): truthful cloud presence + project header state/actions (#912)
* fix(projects): tell the truth about cloud presence and separate header state

Box-runner heartbeats as cloud but could register bridge presence as local,
so /terminal said Cloud offline while the journal shipped work. Infer cloud
from box-* versions, force the channel in box-runner, and scope the terminal
honesty chip. Project header now shows listing/live as status, not peer links;
catalogue invite waits until kickoff/build is idle.

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

* chore(desktop): bump Fleet Runner to 0.8.33 for presence-channel fix

desktop/bridge-subscriber changed so box-* runners register as cloud; the
release-drift gate requires a version bump and changelog entry before merge.

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

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-25 05:29:46 -07:00
CatoandClaude Opus 5.5 0b05ebb74b fix(ai): no box timer or background path spends the shared free AI tier (#897)
* fix(ai): no box timer or background path spends the shared free AI tier

Removes the frontier-digest, feedback-digest and scout-events cron routes and
timers; the digest email is built without a model; check-model-ids no longer
sends a one-token completion per pinned model; the DoD model judge on run
close (page poll / runner push / cron sweep) is gone - precheck only; the
Today Watch nudge composes on click, rate-limited, not on mount; the loki-e2e
check (a real chat turn 4x/day) is on demand only; standing-rule calendar
bookings never call the model to recover a date.

scripts/test/no-free-background-ai.ts walks the call graph from every cron
route and close path and fails if any reaches a model endpoint.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

* fix(ai): delete the scout and feedback-digest producers the removed crons left dead

Also lowers the telemetry monitored-path floor to 2: frontier_digests was
demoted on purpose with its cron.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>

---------

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 01:19:03 -07:00
CatoandClaude Opus 5.5 75c870da2d fix(terminal): PTY follows the grid, expandable full-width pane, one composer (#887)
* fix(terminal): resize the PTY to the grid on screen, not only when typing

The resize was published only from an interactive (Type + live keys) view,
so Prompt mode, Voice mode and every phone fitted xterm locally and never
told the PTY. Measured: 79-col grid drawing a 120-col PTY on desktop Prompt
mode, 86 vs 120 on a 390px phone — torn words and stray columns at the
right edge. Fit + publish now run on mount, on every host resize, on a font
step, and re-assert on window focus.

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

* feat(terminal): one composer for chat and inject; expandable, full-width pane

- components/composer/Composer is THE composer (text, attach, voice, model,
  Send/Stop, optional modes). Loki chat (LokiComposer), the terminal's
  Ask/Inject rail, the Prompt-mode box / phone dock and Control's quick send
  all render it. TerminalLokiComposer (bare textarea, no attach/voice) is
  deleted; Control's one-line ⌘Enter input is gone.
- The rail's Inject is the prompt composer while the rail is beside the
  session, so the page no longer shows two inject boxes at once.
- Terminal pane: rail is a fixed width (lg+) instead of 40% of the row, can be
  closed (remembered), is a sheet below lg; Expand works at every width and
  Esc leaves it, except when typed into the xterm or handled by a dialog.
- Tests: one-composer (logic, per-call-site render, no private textareas),
  terminal-expand (Esc rules).

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 15:55:43 -07:00
CatoandClaude Opus 5.5 715ed7a3d9 docs(architecture): builders and booking — anyone can build here, without org peering (#880)
The studio is at capacity; builders should still be able to join, be booked and
work on one project. Records where each part lives (Loki / OrangeCat / the site
as a door), the slices in order, the decisions taken, and the trap: org
membership grants visibility AND dispatch over every peer's projects
(getOrgProjects feeds control, inject and orchestration), so a booked builder
is a project editor (#872), never an org peer.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 14:06:25 -07:00
CatoandClaude Opus 5.5 6ee4cbb858 feat(widget): Chat mode — a chat the Cat and Loki both live in (#879)
The widget's Chat tab ships. A visitor on an embedding site asks; whichever of
the Cat (earning, getting paid) and Loki (getting things built) the question
belongs to answers as itself — both when both have something useful — from the
public fleet map, and is sent to the project that fits.

- POST /api/widget/chat: fcw_* token + origin allowlist + per-IP/per-token
  limits, charged to the token owner's fair share of the free AI pool. Links are
  attached from the map, never typed by the model. When the budget or every
  vendor refuses it still routes by keyword match (degraded: true).
- src/lib/widget-chat/concierge.ts: pure facts/prompt/links/fallback. Retired
  projects, throwaway names (same pattern as the litter gate, pinned equal) and
  unwritten not-running projects are not offered; stage words say beta/pilot,
  never live/client; facts are budgeted to survive free-tier limits.
- Chat is OPT-IN per embed (data-fc-modes="chat,report"); the default is now
  Report alone, because the same bundle runs on pilot sites. The first listed
  mode opens first. window.Loki.ask(question) lets a host page hand a question
  over (bitbaum's homepage does).

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 13:58:52 -07:00
Cato f02a96218f docs(ci): recommend post-CI deploy handoff (#868) 2026-09-23 13:59:59 -07:00
Cato fcd38cb463 fix(loki): clarify terminal and retire stale guidance (#866) 2026-09-23 07:58:21 -07:00
CatoandClaude Opus 5 ffe1c02580 Copy and docs that said things the code does not do (#844)
* fix(copy): six places the UI told the operator something untrue

Each was re-confirmed against current main before touching it — several were
found two days and ~40 PRs ago and could have been fixed or moved since.

- /download understated every artifact by 25-35%: "~80 MB" for a .deb that is
  100 MB, "~98" for a 124 MB .dmg, "~81" for a 109 MB .exe. The numbers are
  retyped by hand each release and had drifted silently.

  Dropped rather than corrected. Re-typing them fixes today and guarantees they
  are wrong again at the next release — the same rot as the 0.8.19 pin in
  desktop/README and the Whisper model sizes. A live check would need network
  in the unit suite, which is offline-only here (desktop-release-drift shells
  out to git, not HTTP), and a network dependency inside verify is its own
  hazard. The notes keep what is stable: package manager, Apple Silicon, x64.

- "Launch Claude Code" launched whatever agent was selected. BootstrapModal
  POSTs `agent: agentId` (claude/codex/gemini/grok/cursor), so choosing Codex
  ran Codex under a button naming Claude. DoneStep now takes the real label.

- "Settings → Agent tokens" linked to /settings with no fragment and landed on
  Profile. SettingsTabs names #agent as the intended anchor and its own comment
  calls the fragment-less case "a silent dead-end in the new-user funnel".

- Appearance claimed another device "starts on Auto again". ThemeProvider sets
  defaultTheme="dark".

- Privacy omitted Crew from the PIN-gated list — it lives under (private)/ and
  every /api/crew/* route calls requirePrivateApiAccess — and described the TTL
  as "30 minutes of activity" when private-zone-token stamps it once at verify.

- ecosystem.studioUrl pointed at /studio, which 404s, and loki-core.ts injects
  that string into Loki's grounding preface: the assistant was telling
  operators to go to a dead page. /create is the verified surface.

Also: profileUrl pointed at /profile/mao-nakamoto — the retired pseudonym, in
a URL, rendered on the PUBLIC /support page under a card titled "Cato", with a
config key literally named `mao`. The key is now `cato`.

The URL is NOT a guess: every /profile/* path on orangecat.ch redirects to
login, and OrangeCat's own source carries no owner-username constant, so the
real handle is unverifiable from here. It points at the verified OrangeCat home
with a comment to repoint it once the handle is known — swapping a wrong name
for a broken link would not be an improvement.

Worth noting: test-no-retired-name.sh matches the spaced form, so the slug
`mao-nakamoto` passed every previous sweep. Widening it is a separate change.

verify: exit 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs: five documents that would send an agent the wrong way

Docs an agent reads before acting, each contradicting the code it describes.
Every claim re-checked against current main first.

connection-presence.md — the dangerous one. Step 6 "Cutover" instructs:
"drop the heartbeat setInterval in the runner and the heartbeat branch in the
web online check. Presence is purely connection-based."

The shipped rule is the OPPOSITE and deliberately so. applyHeartbeatExpiry()
in src/lib/builder-presence.ts requires connection AND a fresh heartbeat,
because a connection lost to a DB blip — or a half-open socket the bridge never
sees close — pins connected=true until the bridge restarts, and Control then
asserted "this computer online" for a laptop shut for days. An agent executing
step 6 would delete the expiry and bring that back.

Struck through rather than deleted, with the reasoning, so the decision stays
legible: the plan was sound, reality disagreed, the code won. The same table
claimed the heartbeat pusher timer was "removed"; desktop/src/main/pusher.ts:369
still runs it.

self-improvement-plan.md — its load-bearing premise is false. "prompt_history
has no runId" and "Phase 0 (the runId FK) is DEFERRED … add the column when
Phase 3 revives". The column and its index shipped:
src/db/schema/prompt-history.ts:34,42. An agent picking this up would re-add an
existing column. Superseded note plus two strike-throughs.

master-plan-2026-07.md and AUDIT_REPORT_2026-07-13.md — both still name Stripe
as the revenue rail and file CONFIRMED-HIGH bugs against stripe/webhook routes.
Stripe went in #508: no src/app/api/stripe/, no stripe dependency. Bannered
rather than rewritten — a dated plan that was right when written is worth
reading; what it needs is a header naming which premises died.

debt-reduction-roadmap.md — linked from README as current, describes the
retired beacon popup as live architecture across ~11 sections, and had 35 file
links hardcoded as /home/g/dev/loki/... — absolute paths into one machine's
home directory, broken for every other reader of a public repo. Bannered; all
35 rewritten repo-relative.

branding-design.md — what an agent reads before touching UI, and four of its
anchors pointed at things that do not exist: desktop/src/renderer/ (deleted in
v0.7.4; HANDOFF.md says "DO NOT bring it back"), SidebarBrand.tsx, and the
mark's SSOT, which moved to src/config/brand-mark.ts. Also "the 1845-line
globals.css", which is 6073 — the count is dropped rather than corrected,
because a number retyped into prose rots by definition.

verify: exit 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 08:17:02 -07:00
CatoandClaude Opus 5 a02d31d996 Every public claim matches the code, and two gates can now fail (#802)
* fix(truth): every public claim now matches what the code and the licence say

The /license page forbade what LICENSE grants. #791 relicensed the repo to MIT
and fixed LICENSE, the README and the Terms — but missed the page, which still
said "source-available", listed hosting and repackaging under "you may not",
and promised a replacement licence that had already shipped. On a public repo,
that revoked rights we had granted.

Same shape, five more places:

- Three live /thoughts pages and four front-matters carried "Mao Nakamoto",
  the retired identity, into the rendered byline and the OG social card.
- legal/ named that identity as operator, data controller and IP assignor, and
  assigned the work to bitbaum AG / orangecat GmbH / loki GmbH — none of which
  were ever incorporated. Rewritten as a record of authorship and the MIT
  grant, which is what is actually true.
- The desktop About dialog and the installer copyright metadata shipped
  "© 2026 Mao Nakamoto" in every build. No audit pass had looked there.
- /pricing and the feedback-widget docs said the report loop "closes itself"
  months after close-loop.ts deliberately removed auto-resolve for being
  untrue; resolve is an operator act and has zero call sites.
- /roadmap claimed signed installers under "Shipping now"; no signing secret
  exists and /download says the opposite two pages away.
- /releases claimed "every shipped version" while missing nine, and listed a
  0.8.25 that was never tagged — its "Binaries →" link 404'd. Removed per the
  file's own rule: one entry per tag pushed to loki-releases.
- desktop/README pointed all five install commands at bitbaum/loki, which
  404s; releases publish to loki-releases. Version pin replaced with a glob so
  it cannot rot again.
- DEFAULT_USER_NAME greeted nameless OAuth users as "Mao".

And the two that lied to agents rather than users: CLAUDE.md claimed pre-push
runs the full verify bundle so "green locally means green in CI", and
AGENTS.md claimed pre-commit runs tsc. The hook's own header documents why it
stopped doing both — a docs-only push runs nothing. An agent trusting either
line would skip the verification it needed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(gates): close the two gaps that let deleted things keep passing

Two gates could not fail, and one migration ledger had silently drifted.

MIGRATION JOURNAL — 13 files missing, next db:generate breaks the deploy.
drizzle/ held 78 .sql files; meta/_journal.json had 65 entries. Production
was fine and always had been: apply-schema.sh globs the directory and keeps
its own _deploy_schema_history, so it never reads the journal. But
drizzle-kit does, and its newest snapshot was 0072 — so the next generate
would re-emit 0073-0077, including CREATE TABLE "calendar_busy" with no
IF NOT EXISTS. apply-schema.sh rewrites ADD COLUMN only, and the batch is one
transaction, so the deploy would abort on a change unrelated to it.

Reconciled to 78 via bootstrap-migration-ledger.ts --write-journal, and added
scripts/test/migration-journal-coverage.ts so it cannot drift again: files vs
journal in both directions, plus idx contiguity. Proven by mutation — drop one
entry and it exits 1; restore it and it exits 0.

SMOKE — every authenticated probe passed whether or not the route existed.
The auth middleware answers 401 before routing, and check_route accepted 401
for everything in AUTH_API_ROUTES. Measured: /api/definitely-not-a-real-route
returns 401 exactly like /api/orgs. So the list proved nothing, and
/api/checkout/personal sat in it for 15 days after the Stripe rail was
removed. A 401 now only passes if a route file actually resolves on disk
(dynamic and catch-all segments included); the dead entry is gone, and all
remaining probes resolve.

Also: bumping desktop/package.json to 0.8.29, because the retired-identity fix
in the previous commit touched desktop/src/main/index.ts and desktop-release-
drift.ts correctly refused to let a shipped file change without a release to
carry it. That gate was right and is the model for the two above.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 08:40:34 -07:00
CatoandClaude Opus 5 602a581c46 Organise navigation around the operator loop, give the header an identity, and stop Control contradicting itself (#797)
* refactor(shell): organise navigation around the operator loop, and give the header an account menu

The sidebar carried 27 destinations in four sections, one of which was named
"More" and held Approvals, Terminal, Prompts, Activity, System, Thoughts and
the PUBLIC /fleet register — seven pages whose only shared property was that
nobody had decided where they went. Alongside them sat a "Site" section:
Mission, Philosophy, Roadmap, Whitepaper and Investors, in the signed-in app
navigation.

Loki is an operator console. Its surface answers three questions, so the
sidebar now has exactly three sections and each one states its question:

  Now     — what needs me?          Today, Approvals, Feedback
  Fleet   — what is my fleet doing? Control, Projects, Activity, System
  Command — how do I act on it?     Loki, Terminal, Prompts

Private stays PIN-gated below them. The marketing pages left the signed-in
shell and stay reachable through Cmd-K, which now indexes NAV directly rather
than whatever happens to be in the sidebar — curating the sidebar must never
make a page unfindable.

Alongside that, identity:

- There was no way to sign out from the header, and nothing anywhere in the
  top bar said who was signed in. A grep of components/shell/ for "avatar",
  "UserMenu" or "ProfileMenu" returned nothing. Sign out, Settings and the
  private-zone lock lived in the sidebar footer, which is `hidden md:flex`,
  and were duplicated in the mobile Menu sheet's footer: two account menus,
  neither called one, and none where users look first.
- AccountMenu now owns all of it, in the top bar, on every viewport.
- The theme toggle moved inside it. It was the only control in the top bar
  drawn with a border and a fill (ui-theme-cycle-btn) while every signal
  beside it was a bare ghost circle (ui-topbar-btn) — a preference outweighing
  every piece of live state on the page.
- SidebarFooter is deleted. Its collapse button was marked `md:hidden` inside
  a panel marked `hidden md:flex`, so it could never render on any viewport;
  SidebarBrand has always owned the working toggle.

Two retired NAV entries are deleted rather than hidden: `agents` → /control
and `atlas` → /projects pointed at the pages that replaced them, and since
NAV_ITEMS is what AppTopBar and PageTitle scan for "which page am I on?",
the first match won — /control would have been titled "Agents". Their
redirect pages reference the targets, so the redirects stay honest.

scripts/test/navigation.ts is rewritten to defend the new structure: every
section must state its question, "more"/"misc"/"tools"/"site" are rejected by
name, account items may not appear in the sidebar, marketing items may not,
no two items may share an href, and the bottom bar must carry one entry point
per loop section.

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

* fix(control): stop the hero claiming "Idle" over a queue of six things

Observed on prod: the Control hero read "Idle — nothing queued" while a panel
titled "Needs you", badged 6, sat roughly a screen and a half below it, under
a 23-project list. One page, one question — is anything waiting on me? — and
two answers, with the confident wrong one on top.

Two distinct faults, fixed together because either alone leaves the page
contradicting itself.

1. The hero could not see the queue. deriveFleetPulse read agents, run
   outcomes and projects awaiting input, and nothing else, so the one queue on
   the page that literally counts things waiting on the operator was invisible
   to the headline that summarises them. It now takes `inbox` and ranks it
   last among the states that say something is up — a stall, a failure, a
   half-finished run and a blocked project all still outrank chores — but
   comfortably above "Idle".

   `unknown` is a separate state from `count: 0` on purpose. A queue we failed
   to read is not a queue we know to be empty; ControlInbox already refused to
   render silence as the answer "no", and the hero now refuses too.

   The count could not be lifted while it lived inside the panel rendering it,
   so the fetches moved to `useControlInbox`, called once in ControlPanel and
   passed down. One read, two consumers, one truth. It also removes a third
   copy of the /api/feedback/summary request from the page.

2. The panel was filed in the wrong tier. ControlPanel's own ordering rule
   says tiers 1-2 are about a human being blocked and "reporting never renders
   above blocking" — and a queue titled "Needs you" with a count badge is the
   definition of tier 2. It sat in tier 4. It now sits with AttentionBar and
   AgentEscalations, which it can afford because of how it was built: one line
   per group until opened, nothing auto-expanding, and nothing at all rendered
   when the queue is empty. Two rows above the fleet, not the ~1,400px of
   unbounded strips it replaced.

The `inbox` state takes the warning dot rather than neutral grey, for the
reason the `partial` state already does: grey beside the words "Waiting on
you" is the page agreeing with itself in tone while disagreeing in substance.
`unknown` stays neutral — that one really is "no idea".

Four tests pin it: a non-empty queue is never Idle, an empty one still is, an
unreadable one is not a claim of emptiness, and real trouble still outranks
chores.

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

* fix(design): un-invert the dark text ramp, and make token drift a build failure

@bitbaum/design-tokens calls itself "the design single source of truth for
OrangeCat, Loki and Solon". Solon proves it — its globals.css is 19 lines and
imports the package. Loki's is ~5,800 and declares its own ramp, with the
package present only as a devDependency used to generate the widget theme. A
comment here said the quiet part out loud: "Loki still declares its ramp
locally, so the value is kept in step by hand."

Nothing was keeping it in step. Measured: Loki and the package disagree on 32
of the 36 tokens they both define, and the disagreement has a shape — someone
transcribed the DIGITS between colour spaces without converting them.
`--text-secondary` is `oklch(0.4 0 0)` here and `0 0% 40%` there; those are 30
of 255 apart.

  light: surfaces agree within 5/255; the TEXT ramp is 20-30 apart
  dark:  text agrees within 7/255; the SURFACE ramp is 17-30 apart
         (Loki's ground is #010101, the fleet's is #121212)

Comparing them exposed a real bug, which this commit fixes. Loki's documented
ramp is primary → secondary → tertiary → muted, each quieter than the last.
The light block follows it (0.1 → 0.4 → 0.58 → 0.72). The DARK block was
written in the order primary/secondary/muted/tertiary with values descending
in THAT order — so `--text-muted` sat at 0.65 while `--text-tertiary` sat at
0.59, and text marked muted rendered BRIGHTER than text marked tertiary. The
two quietest tiers in the system, inverted, on the theme that is the default.
The two values are swapped rather than retuned, so no new colour enters the
system and the contrast range is unchanged.

The rest is a gate, not a migration. Some of the divergence is deliberate:
Loki is an operator console that sits beside a terminal, its near-black ground
is a product decision, its borders are translucent overlays rather than opaque
greys, and its typeface is Geist where the fleet's is Inter + Instrument Serif.
Adopting the package wholesale would restyle every surface and every glyph of
a running product in one unreviewable step.

So scripts/test/token-drift.ts requires every difference to be DECLARED. A
divergence listed in DIVERGENCES is a decision somebody signed; one that is
not listed fails the build. Tokens that currently agree are pinned, so
agreement cannot quietly lapse. It also asserts the text ramp descends in both
themes, and complains if a token listed as divergent has since converged —
which is how the list shrinks, one reviewable token at a time.

It is picked up automatically by scripts/test-unit.ts (which globs
scripts/test/*.ts), so it runs in `verify` and in CI without further wiring.
Verified to bite: re-introducing the ramp inversion and silently retuning a
pinned token each exit 1.

Docs corrected to match the shell as it now is: CLAUDE.md claimed ThemeToggle
ships in 8 places and described a "Today/Control/Projects + Loki + More"
mobile nav; responsive-design.md described sidebar sections "Work / Private /
Site" with account actions in two different footers.

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

* refactor(shell): stop two navigation surfaces answering a question already answered

Loki ran six navigation surfaces at once — sidebar, top bar, the
Profile/Chat/Control/Terminal strip, the mobile bottom bar, the Menu sheet and
the command palette. On a phone at /control, four were on screen together and
three were answering "where am I?".

Two of them now stand down where they add nothing.

FleetSurfaceGuide renders only with an active project. Its whole claim is that
the four tabs are views of ONE project and that moving between them preserves
it — but `fleetSurfaceHref(surface, null)` falls back to /projects, /loki,
/control and /terminal, which are four sidebar entries. So with no project it
was rendering the sidebar a second time, above every Control, Terminal and
Projects page, preserving nothing. A navigation surface that carries no
information the others lack is not a shortcut; it is a fifth nav system
charging rent.

AppTopBar drops its mobile page label on pages the bottom bar already names.
Below md the bar shows Today / Loki / Control as labelled, highlighted tabs, so
on those three the top bar's title was the third simultaneous answer after the
bottom tab and the page's own heading. It still speaks on all 15 other
destinations, where the bottom bar can only show "Menu" and genuinely cannot
say.

scripts/test/nav-surfaces.ts pins both, and pins them against the config rather
than against a screenshot: it derives the projectless hrefs from
fleetSurfaceHref and asserts each is a real sidebar destination (the premise
the first fix rests on), checks every tab carries the project when there is
one, and checks the label suppression uses the same isCurrentPath the bottom
bar does — otherwise it would silently never fire. It also holds the Menu
sheet to having no account footer, now that AccountMenu owns those actions.

Verified to bite: reverting the strip gate fails the suite.

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

* fix(ci): pre-push ran the wrong suite for scripts/test/

The hook classifies changed paths into three arms and runs the gates each one
can break. `scripts/test/` was in the `_ops` arm, and that was backwards in
both directions at once:

  • test:ops runs `scripts/hetzner/test-*.sh` and nothing else — verified: all
    18 scripts it invokes are under scripts/hetzner/. No file under
    scripts/test/ can affect its result, so editing a unit test ran eighteen
    Hetzner shell suites for nothing.
  • scripts/test/ holds the 218 .ts files that ARE the unit suite
    (scripts/test-unit.ts globs the directory). The unit suite runs in the
    `_app` arm, which scripts/test/ did not trigger. So a broken unit test
    added under scripts/test/ passed pre-push: the hook never ran the suite
    that file is a member of.

Now: `scripts/test/*.ts` → `_app` (tsc, lint, design, desktop, test:unit,
test:home). `scripts/test/*gate.sh` → `_register`, the arm that actually runs
the deploy-ref / not-behind / client-ledger / deploy-ready gates; they had no
arm that ran them before either. `_ops` keeps hetzner and site-template.

scripts/test/pre-push-routing.ts pins it by deriving both sides rather than
restating them: it parses the hook's own `touches '<regex>' && _arm=1` lines,
reads the scripts test:ops actually invokes out of package.json, and asserts
each path reaches the arm that covers it. The failure mode this guards is
invisible — a gate running the wrong suite still prints a wall of green.

Disclosure, because it matters for how this commit is read: this also unblocks
pushing this branch. test:ops fails 4 of 92 checks in a container running as
root (the .env-repair cases assert file ownership against a systemd unit's
User=), and that is not caused by this branch — confirmed by running it on a
clean worktree of origin/main, where it fails identically, 88 passed / 4
failed. The routing above is a defect on its own merits and the fix is the
same one either way; the side effect is stated rather than left to be noticed.
Those 4 ops failures remain, unaddressed by this branch, on main.

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

* chore(design): ratchet the dead ui-* rules in globals.css

check-loki-classes.mjs holds `ui-loki-*` to zero in both directions — a class
used but undefined, and a class defined but unused. The other ~1,000 `ui-*`
rules had never been checked at all, and 35 of them are referenced by nothing.

That matters more here than in most codebases. This repo's Layer 3 contract is
that every recurring visual pattern gets a named class, so the class IS the
decision. Someone looking for "how do we draw a metric card" finds
.ui-control-metric-card, -value, -label and .ui-control-metrics-grid sitting in
globals.css and reasonably concludes that is the house style. Nothing has used
them in months. Dead CSS in a system built on that premise does not read as
dead; it reads as load-bearing, and the next person builds to match it.

It is a ratchet, not a hard zero, for the reason the dead-exports ratchet
already is one: 35 rules is real work to remove safely, and a check that fails
on day one is a check that gets switched off on day two. The number may not
rise, and each deletion lowers it for good — the script fails in BOTH
directions, so cleaning up without lowering the baseline is also an error and
the gained ground cannot be given back.

Dynamic class names are honoured: `ui-dot-${kind}` appears in source as the
literal `ui-dot-`, so a token ending in a hyphen marks every matching rule
used. Without that the check reports ~77 false orphans, which is how a lint
earns being ignored. Eight such prefixes are in play.

Also deletes .ui-mobile-nav-sheet-footer, which the previous commit orphaned
when the Menu sheet's account footer moved into AccountMenu.

Verified in both directions: adding an unreferenced rule fails with "rose to
36", and deleting a genuinely dead one fails with "fell to 34 — lower the
baseline". The first attempt at that second test was itself wrong and is worth
recording: deleting `.ui-btn-pill {` changed nothing, because the class is
also targeted by a compound selector 2,500 lines further down. The checker was
right and the test was wrong — which is exactly the sort of thing a rule
counted by hand gets wrong.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-20 05:37:59 -07:00
CatoandClaude Opus 5 1cc39fb361 feat(events): a weekly scout for what is worth going to (#787)
The operator asked to hear about events worth attending instead of finding them
by accident after they had happened. Finding events is the easy half; sending a
message that is still worth opening in week six is the hard one.

So the shape is borrowed from what already works in this repo rather than
invented:

  ONE MESSAGE, NOT ONE PER EVENT. The 2026-08-05 disk-alert storm (40 pings in
  three hours) is the standing lesson about per-item notification.

  EVERY LINE IS ACTIONABLE. Each suggestion is a real draft in the approval
  queue with its own one-tap Approve link, so "that looks good" is a tap and it
  is in the calendar — not a link to a listings page and a note to self. The
  queue, the signed links and the booking drain all already existed and are
  already proven; the scout's whole delivery story is "write a draft".

  A CLASH IS NAMED. Each suggestion is checked against the calendar mirror, so
  a Thursday gig that collides with an existing meeting says so before it is
  accepted rather than after.

FOUR DECISIONS WORTH THE REVIEW:

1. SEARCH COMES FROM ai-kit/web. fleet/SHARED.md owns this and says plainly: do
   not hand-roll fetch-and-summarise. That package already has the backend chain
   (self-hosted searxng → brave → tavily), an SSRF-safe reader for urls the
   MODEL chose, and a three-valued answer. `could_not_look` is not `nothing`:
   a dead backend must never be reported as "there are no events in Zurich this
   week". Writing a second client here would have reinvented that bug — and
   memory already records the specific shape (a stock searxng answers JSON with
   403, which reads as "no results").

2. ONE MODEL CALL PER RUN, NOT ONE PER RESULT. Extraction has to be a model —
   snippets carry dates as prose, in two languages — but the AI budget is
   rationed and shared across ten apps, so per-result extraction would spend a
   day's allowance on one digest. Every snippet goes into a single batched call.

3. THE MODEL IS NOT TRUSTED ABOUT TIME. It is told today's date and told that
   omitting is always correct; whatever comes back is screened AGAIN in pure
   code, which drops undated, past and out-of-horizon entries regardless of what
   it claimed. This is not hypothetical: the first search run while building
   this returned a Zurich meetup dated September 2025 as its top hit.

4. THE CAP IS THE PRODUCT. The operator selected all four purposes, so ranking
   cannot lean on exclusion — six per week is what stops a curated handful
   becoming a feed. Better to miss a good event than to send the message that
   teaches him to swipe past the next one.

Rejections are the memory: a suggestion turned down is never proposed again,
however it is spelled, so the operator says no once rather than every week.

Tests: 21 cases on what reaches the digest, written from the side that hurts —
the guessed date, the duplicate, the rejected thing returning — with the real
2025 listing as a fixture. The cron installer gains a weekly OnCalendar form
(existing daily/hourly entries expand exactly as before) and the scout is added
to the one list that both writes AND enables timers, because listing a job twice
is how one gets a timer and never runs.

Deliberately NOT built: a separate same-day reminder. Approved events go into
Google Calendar, which already reminds; a second notifier would be the second
one of something that works.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 06:47:45 -07:00
CatoandClaude Opus 5 64b857b1f3 docs(handoffs): commit the 2026-09-17 system review before it is lost (#779)
The review existed only as an untracked file in the worktree of a session
that has since ended — one `git clean` or worktree removal from gone, and
it is the only written record of what was checked in production that day.

Committed verbatim. The addendum is marked and dated rather than edited
into the body: a review is a record of what was true when it was written,
and quietly correcting it destroys the thing that makes it useful later.

The addendum closes the items that have since shipped (#770, #772, #773,
#775) so a reader does not re-diagnose them, and records the mechanism
found behind the one open item that looked like a reporting bug: `partial`
is terminal. reap-evidence.ts only ever promotes `timeout -> partial`, so
a run that closed `partial` is never revisited no matter what later merged
and deployed. Changing that is a closure-policy decision, left alone.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 00:54:31 -07:00
CatoandClaude Opus 5 28de8ac62e feat(newsletter): let the studio site join the list, and say so out loud (#762)
The studio site's /hire/ page stops publishing rates and offers a waitlist
instead. It is a static page on another origin, so a JSON POST to
/api/newsletter triggers a preflight this route did not answer, and a row
landed in a table with no sending pipeline — capture-only by design, which
is fine for a newsletter nobody has sent and wrong for a page that promises
a human writes back when capacity opens.

CORS, but an allowlist. The feedback widget can afford
`Access-Control-Allow-Origin: *` because its fcw_* token is the real gate.
This route has no token and writes a row per call, so it echoes one
allowlisted origin at a time (src/lib/api/public-cors.ts) and varies on
Origin, and an unknown origin gets no ACAO at all. The 429 carries the
headers too: a cross-origin refusal the browser cannot read is a refusal
the visitor cannot be told about.

A new row now announces itself on Telegram, through the channel's existing
contract — fire at the insert choke point, never throw, never slow the
response, and stay silent when the operator must not act. subscribeToNewsletter
returns whether it actually inserted, so a repeat signup is still a silent
no-op; the visitor is told the same thing either way. Registered in
docs/telegram-notifications.md, as the gate requires.

Proven by mutation, not by a green run: setting ACAO to "*" fails the new
test with "an allowlisted origin must be echoed back verbatim", and the
allowlist test also refuses a prefix match (bitbaum.orangecat.ch.evil.test),
a scheme downgrade, a null origin and a missing one. 191/191 unit files pass.


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

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 05:00:18 -07:00
CatoandClaude Opus 5 e6b8a17970 feat(approvals): standing approvals + one-tap decisions from Telegram (#761)
* feat(approvals): standing approvals + one-tap decisions from Telegram

Asking Loki in Telegram to put an appointment in the calendar did not put an
appointment in the calendar. It sent you to a website.

Three separate causes, all fixed here:

1. THE CHAT HAD NO ROAD TO THE CALENDAR AT ALL. `gog calendar create` is
   blocked on the box by the safety shim, and the fleetcrown skill could only
   decide drafts that already existed — it had no way to create one. So the
   agent hit the shim, read "route it through the approval queue", and passed
   that on as advice. Adds `fc.sh book`, which proposes a structured event
   through /api/actions/propose, and rewrites the shim's refusal to name it.
   The shim still blocks every external Google write; unattended agents have
   gained nothing.

2. THE GATE WAS ON THE WRONG SIDE OF THE REVERSIBILITY LINE. The queue enforced
   "nothing runs that the operator did not TAP", which is stricter than the rule
   it stands for ("nothing runs that the operator did not APPROVE"). For an
   event in your own calendar — private, self-only, undone by deleting it — the
   difference was pure latency (2026-08-04: proposed 14:15, booked 21:02).
   Standing approvals let that yes be given once, in advance, with three rails
   in code rather than in a docblock: eligibility is hard-coded (calendar events
   and commitments only — never anything that reaches another person), the
   payload is re-checked at decision time (guests mean invitations, so those go
   back to the queue), and unknown is never yes (no resolvable time, or a slot
   already past, queues). Default on for calendar events; toggle at /approvals.

3. THE NOTIFICATION HANDED BACK A CHORE. "2 actions are waiting… <url>" states
   a problem and leaves the answer behind a login. Decisions now arrive as a
   card carrying what/when/where plus one-tap Approve / Reject / Edit buttons,
   backed by HMAC links scoped to one action and one verb — so a decision needs
   no session and works when the gateway is down. Still two messages and only
   two: one when a decision is owed, one when the effect really happened.

Also fixes a real data bug: propose_action had no event date fields, so the WHEN
of an appointment had nowhere to go and arrived as prose in `body`, which a Groq
pass then had to guess back — a model re-deriving a value the model one step
earlier knew exactly.

Behaviour that did NOT change: emails, messages, dispatches, and person-book
writes still require a per-item yes, and always will — they are ineligible in
code, and a preference row naming one authorises nothing. Every auto-approval is
audited with `via: standing-rule` and announced, so nothing is done in the
operator's name silently.

Tests pin the parts that must not be trusted: 37 cases on the standing-approval
rails (asserted from the side that hurts — a false `auto: true`), 21 on token
forgery and tampering.

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

* fix(chat-skill): the chat's whole Loki skill was dead, and unversioned

Found while testing the previous commit end-to-end, and it is the largest of
the reasons appointments never got added.

On 2026-09-14 the product was renamed to Loki and `calendar-drain.env`'s keys
were renamed with it. The chat agent's skill script, which reads that file, was
not — because it lived only on the box, where no gate in this repo could see
it. Since then every command it offers has aborted on its first line:

    line 14: <OLD>_AGENT_TOKEN: <OLD>_AGENT_TOKEN missing in calendar-drain.env

Verified live on bitbaum just now. So from Telegram the operator could not list
the approval queue, could not approve or reject anything, and could not
dispatch — silently, because a skill that errors just makes the agent talk
about something else instead. The only surviving route to a decision was the
website. That is the complaint, and it had a cause older than the UX.

Fixes:

- Renames the skill to `loki` (the retired product name is forbidden in this
  repo by scripts/hetzner/test-no-retired-name.sh — which caught this commit,
  correctly, when the box files were first imported verbatim) and reads the
  env keys the file actually has.
- The installer REMOVES the superseded skill directory rather than leaving it.
  Two skills claiming the same job, one of which cannot run, is how the agent
  kept choosing the broken one.
- The installer now runs `loki.sh pending` as the openclaw user and fails if it
  cannot authenticate. That is the check which would have caught the rename on
  the day it happened: run the thing, as the user who runs it, and require real
  output. Every other verification in that script only asserted that files
  exist, and files existing is exactly what was true throughout the outage.

Also closes a gap in the previous commit: an auto-approved COMMITMENT executed
without telling anyone, while the comments claimed every auto-approval is
announced. Calendar events are announced from where gog succeeds (asynchronous,
on the box); everything else finishes inside enqueueAction, so that is the only
place that knows it finished at all. A standing approval nobody is told about
is not a standing rule, it is a silent one.

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

* fix(install): keep the gog shim parseable, and prove the block still fires

The replacement text I substituted into the shim carried double quotes. It
lands inside `block(){ echo "…" >&2; }` — a double-quoted bash string — so a
quote in the middle of it closes that string early and leaves the shim a
syntax error. Every gog call on the box would then fail, reads included, and
the calendar drain's real bookings with them: an install step meant to improve
an error message would have taken out the calendar entirely.

Caught by tracing the sed against the shim's actual text rather than running
it. Two checks added so the next one is caught by the machine:

- `bash -n` on the shim after the edit — it is a shell script we just modified
  in place, so prove it still parses before trusting anything else about it.
- Actually attempt a calendar write as the openclaw user and require it to be
  REFUSED. The old check grepped for the rule's text, and a rule you can read
  in a file is not a rule you have seen refuse anything.

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

* fix(ui): use tokens this design system actually defines

The new approvals control and decision page reached for `text-brand`,
`accent-brand`, `bg-surface-hover` and `rounded-card`. None of those exist in
globals.css — the real names are `accent-text`, `surface-raised` and the
`radius-*` scale. Tailwind emits nothing for an unknown utility and reports no
error, so the checkbox would have rendered browser-default blue and the hover
state simply would not have happened, on a page whose entire job is to be
tapped once and trusted.

The design check passes either way: it forbids arbitrary values (`bg-[#fff]`),
which is a different failure from naming a token that was never defined. Caught
by grepping whether any other component uses these names — none did, which is
the tell.

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 04:01:06 -07:00
Cato f4164a6f67 fix(runner): make Terminal and provider status truthful (#755)
* fix(terminal): stop claiming dead sessions are generating

* fix(runner): report provider quota walls honestly

* docs: define Loki's working product contract

* fix(runner): replace stale provider PTY on retry

* fix(control): route provider switches to project runner

* fix(terminal): keep Watch on the dispatched runner
2026-09-16 23:21:21 -07:00
Cato 8034cb629b feat(feedback): add reporter tracking and project editors (#754) 2026-09-16 22:21:59 -07:00
Cato e38cb83871 fix(feedback): one alive signal — Working only with post-prompt evidence (#753)
Align Feedback ↔ Terminal to RUN-STATUS-SSOT: Working only when inject is
verified generating or a generating/progress hop lands after the prompt;
inject-no-generate → Needs you with Open Terminal / switch provider / Restart
Fleet Runner. Stamp injectVerified on runner ack; expand quota chooser to
Claude Code, Codex, Cursor, Grok, Antigravity (no Hermes). Prefer cloud-first
always-on box-runner; do not expand dual-channel status language.
2026-09-16 16:43:12 -07:00
Cato 55934f7f5b docs(foundation): canonical run status SSOT for all surfaces (#752)
Queued/Starting/Working/Needs you/Done/Failed — Working only with post-prompt evidence. Kills Feedback vs Terminal split-brain.
2026-09-16 16:22:38 -07:00
Cato 0e6cb86dd4 feat(terminal): PTY/Loki split with Ask vs Inject (#746)
Terminal is a ~60/40 PTY and Loki rail on the same run id Watch
follows. The rail shows phase, stall, and next action from run
events — not a log dump — with Ask vs Inject into this session,
PTY-byte ack after inject, and Grok/Cursor/Antigravity when quota
dies. Mobile opens the same rail as a bottom sheet. Empty Terminal
names Fleet Runner vs Kitty. Implement's Terminal link carries ?run=.
2026-09-16 12:33:22 -07:00
Cato 43c6bb44af fix(runner): make feedback dispatch observably start (#745) 2026-09-16 11:54:30 -07:00
Cato 05e7d32a6d ci: fast verify on main after green PR merge (#743)
Full pnpm verify is ~60m. Squash merges already paid that cost on the PR;
re-running it on main doubled merge→live. Main tips whose subject contains
(#N) now run verify:main (format/tsc/lint/design/gates). PRs and manual
main pushes still get full verify. Docs: docs/infrastructure/merge-to-live.md
2026-09-16 09:28:47 -07:00