Commit Graph
207 Commits
Author SHA1 Message Date
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
Cato 0bfc4a7d99 docs(foundation): lock Implement→Watch/Terminal/Chat Loki-only loop bar (#742) 2026-09-16 08:41:52 -07:00
Cato 36fbb2ba75 docs: Loki foundation redesign (harness, AI, Robots, chrome) (#739)
* docs: Loki foundation redesign (harness, AI, Robots, chrome)

SSOT for Cato’s 2026-09-16 program: honest run states, AI providers tab,
Robots foundation, OrangeCat-class chrome. Public name Cato only.

* docs: loop-first implement order (FleetCrown must work before polish)

Cato: P0 Implement honesty + visible Watch/Terminal + live Cloud provider before AI/Robots/chrome.

* docs: use Loki not retired FleetCrown name in foundation order
2026-09-16 07:16:19 -07:00
Cato f1d35e5d93 feat(fleet): expose canonical public development profiles (#737) 2026-09-15 16:28:14 -07:00
Cato 13243a6bf6 feat(feedback): Watch progress, honest offline Queued, widget Loki modes seam (#734)
Captain Feedback no longer parks Substrata (and peers) under “moving on its
own” while the cloud builder is offline. Builder offline → Needs you with a
dig-in reason + Telegram path; one auto-retry cold-start before escalate.

Watch on the row shows a short run-ledger step (not a PTY wall), with dig-in
event trail and Terminal (source=cloud) once a session exists.

Widget panel is Loki-on-the-site: Report/Chat/Watch mode strip
(widget/surface-modes.ts). Report ships; Chat/Watch are progressive seams
via data-fc-modes.
2026-09-15 14:43:01 -07:00
CatoandClaude Opus 5 baa8e2e6fb chore(aoz): follow bitbaum/aoz-housing -> bitbaum/aoz-begleitung (#732)
The repo was renamed today. It was the last place the product was still called
Housing: the name row in fleet's registers/retired.json retired "AOZ Housing" as
the PRODUCT name on 2026-09-10, but the repo kept it, and the repo is public.

The deploy name `aoz-wohnen` is deliberately NOT renamed with it. It is an
infrastructure identifier — systemd unit, /opt path, database — nothing on the
box keys on the repo name, and moving it would touch a live site for no visible
gain. apps.conf's comment block already said as much and still does.

The load-bearing change is apps.conf's fourth field. repo-metadata-audit.mjs
keys the register on that path's BASENAME, so while it read /home/g/dev/
aoz-housing the join against GitHub missed and every metadata check for this
repo was silently skipped — the audit went green by not looking at it. The local
checkout was moved to match and its three worktrees repaired (`git worktree
repair`), not pruned: they hold branches.

Two test failures worth keeping, because both were the rename telling the truth:

  - project-mention asserted that "the AOZ housing rebuild" resolves to the
    project. With the slug renamed it does not, and should not. The case exists
    to prove "a slug with a hyphen, typed with a space" matches, so the INPUT
    moved to the current name rather than the expectation being loosened.
  - tab-match asserted a terminal tab literally named "AOZ Housing" matches the
    slug. Same thing: the fixture now uses the name the tab would actually have.

Consequence worth naming: someone who types "aoz housing" at Loki will no longer
be understood. There is an alias mechanism for exactly this shape
(register/build.ts maps the deploy name to the repo), but wiring the retired
name into mention-matching is a product decision, not a rename chore.

Left alone on purpose: scripts/db/retire-stale-projects.ts, whose data row
records the project names the database actually held when that migration ran;
and content/thoughts/*.md, published essays — one of which quotes a filesystem
path observed during a debugging session, so rewriting it would falsify the
anecdote.

The production user_projects row was updated too (name and git_url), because the
database is a second copy of the repo identity and a past rename left 21 rows
pointing at a dead account. New URL proven to resolve: 431bae7.

Tests green: fleet-register 44, project-mention 28, tab-match 10, fleet-map 7,
loki-project-ranking all.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 12:17:25 -07:00
CatoandClaude Fable 5.1 f7c4e35fdc feat(builder): a project can pin its work to the hosted runner — no Claude credential needed (#718)
builder_pref gains a third value, 'hosted'. A project pinned to it never
touches a runner PTY: the dispatch goes straight to the hosted runner
(Hermes in its own clone on the box, on the providers the box already holds
keys for — Copilot, Gemini, Groq), and the hosted runner closes the tracked
run with the pull request as evidence, so the outcome reaches the thread
that asked, like any other run.

Why now: the box's Claude Code credential died silently and every
self-dispatch hung, while Hermes on the same box answered fine. The
unattended path should not depend on a person's Claude subscription at all.

- statuses.ts: HOSTED_BUILDER_PREF / BUILDER_PREFS (channels stay what they
  were — nothing claims 'hosted' from a queue); API enum widened.
- inject-core: hosted branch before the channel pin; run id travels in the
  hosted_dispatch payload.
- hosted-runner: closeHostedRun() through updateOrchestrationRun (outcome
  turn, ledger, escalation bookkeeping all fire); delivered stamp at claim.
- Control → project profile → Runs on: third choice with its explanation.
- docs/development/cloud-local-workflows.md: the tier in the SSOT table.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 22:43:29 -07:00
CatoandClaude Fable 5.1 a22b6d4ae7 fix(security): one secret-scanning message per repo, skip forks, dry-run first tick (#711)
The per-repo read (#710) fixed a blind org endpoint and immediately sent 100
Telegram messages: the openclaw FORK carries ~100 open alerts for upstream's
own test fixtures, and the loop paged each one. Now: forks are not read at
all, N new alerts in one repo are ONE line counting by type, and the tick an
install runs right after writing the check is journal-only so a change of
data source never pages the whole baseline as "new". The test plants a fork
with 100 alerts and asserts zero messages, and three alerts in one repo →
one message.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 05:20:17 -07:00
CatoandClaude Fable 5.1 efeabdec64 test(e2e): does Loki work as intended — asked of the live site, on a clock (#712)
Three testable meanings, one script, no browser and no mocks
(scripts/test/loki-loop-e2e.ts, run as the signed-in operator through the
same API the /loki page uses):

1. knows the fleet — a fleet-shaped question is answered from the studio map
   (all three pillars named, fleet_map among the retrieved sources) and the
   reply is an answer, not the model's plan for one;
2. publishes the map — /api/fleet/map is public with the pillars live, and
   bitbaum's map.json is the same map, recently generated;
3. closes the loop (--dispatch) — a request typed into a thread comes back
   into that thread as an outcome turn. A run that never returns is aborted
   with a [loki-e2e] marker so no test leaves the operator's queue hanging.

Proven against production before commit: 3/3 without dispatch; with dispatch
and the builder unauthenticated, the loop failed honestly inside two minutes
with the runner's own diagnosis delivered into the thread.

Scheduled on the box every six hours (install-loki-e2e-watch.sh ->
loki-e2e-check.sh, alert on flip; the dispatch leg only when the builder-auth
probe last said ok). pnpm run test:e2e:loki runs it from a laptop.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 05:17:40 -07:00
CatoandClaude Fable 5.1 df113dc811 feat(security): threat detection for the box, the GitHub org and the laptop (#708)
A 2026-09-14 posture audit found the box well guarded (default-deny ufw,
keys-only SSH, fail2ban, unattended upgrades, offsite restic) but blind: no
intrusion or integrity detection at all, and the GitHub org with secret
scanning off on all 48 repos and every marketplace action allowed with the
box's root SSH key in an org secret. This adds the detection layer on the
existing alert channel, so a break-in becomes one Telegram message within
five minutes instead of a discovery months later.

- install-security-watch.sh: security-check.sh (5-min timer) alerts on
  CHANGE only — guards down, sshd drift, edits to the files an intruder
  touches (sshd/sudoers/authorized_keys/cron/PAM/ld.so.preload/Caddy/ufw/
  monitoring/units), new internet-facing ports, new privileged accounts,
  SSH logins from never-seen IPs that are not GitHub runners, processes
  from /tmp or miners, new setuid binaries, new containers, stale offsite
  backup, week-old pending reboot. Baselines seed silently; one grouped
  message per tick; every message ends with what to do.
- github-security-check.sh (daily): new secret-scanning alert, new critical
  dependency alert, repo turning public, new member/collaborator/deploy
  key, Actions allowlist loosened. Every API call guarded: a failed call
  skips its check and keeps the baseline (the first version paged an error
  body as a policy change, and a wiped baseline would flood "new" next day).
- Caddy JSON access log on every vhost (snippet + sync-infra template) and
  a fail2ban caddy-scan jail: 8 probes for /.env, /.git, wp-login, cgi-bin
  … in 10 min = 24h ban. Proven by scanning orangecat.ch from the laptop
  (tenth request refused); a real scanner was banned within minutes.
- sshd drop-in: 3 tries, no X11, dead-peer detection, AllowUsers root ubuntu.
- scripts/local/laptop-security-check (user timer, 30 min): new network
  listener, sshd running, screen lock off, upgrades off, ~/.ssh changes,
  new login account, gh identity change, week-old reboot; delivered through
  the box's lib-alert over SSH, desktop notification as fallback.
- test-security-check.sh (test:ops): 39 assertions extracting the shipped
  heredocs; the property under test is "speaks once on change, never when
  nothing changed".
- docs/telegram-notifications.md: every new message registered.

Applied outside the repo in the same session: secret scanning + push
protection on 41/44 active repos (3 private repos are not eligible on the
plan) and as org defaults; Dependabot alerts + automated security fixes on
all 44; org Actions policy = GitHub-owned + verified + an explicit allowlist
of the 11 third-party actions the fleet uses.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 04:29:11 -07:00
Cato 15fb484a50 fix(feedback): Implement gets a real builder, Working means a PTY, Telegram when Needs you (#705)
Phone evidence: Heidi sat Queued / fake Working / Stalled with cloud builder
offline and no session on Cloud. Boss-mode:

- Implement prefers the cloud box-runner, falls back to hosted Hermes when
  offline, and refuses with one next action instead of queueing into the void.
- Working only when a runner heartbeat proves a real agent PTY; delivered
  with no output is Starting, then Not running — never fake Working.
- Feedback/Control stay short (badge + next action; dig-in for why);
  Telegram pings when stalled or Check live waits (check-feedback-needs-you).
2026-09-13 22:29:59 -07:00
CatoandClaude Fable 5.1 275d162f44 feat(ops): hourly probe that the box builder's Claude Code token still works (#699)
The box-runner's CLAUDE_CODE_OAUTH_TOKEN belongs to the Claude account that
minted it. When the operator moved accounts (2026-09-14) the box kept the old
token; every dispatch printed "Your organization has disabled Claude
subscription access for Claude Code" into a PTY nobody reads, went silent,
and was reaped an hour later as "timeout". The product's whole promise was
off and nothing said so.

builder-auth-check.sh asks the builder one question with the runner's own
environment and alerts on the state flip (ok / disabled / down), naming the
fix. Installed hourly by install-builder-auth-watch.sh; tested against the
verbatim line; the token never appears in output.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 18:20:17 -07:00
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
Cato 3ccf63588b feat(ops): watch the provider the fallback chain is hiding (#685)
A fallback chain hides the thing it protects against. Groq answered 400
json_validate_failed to EVERY structured Cat call — prompt suggestions,
the offer engine, both writing engines, the intent router — for days.
Users got answers, the health route stayed green, and the only trace was
a warn line in a journal nobody reads. It was found by hand.

link-health.ts already makes a dead link cheaper (a 60s in-process
breaker) but deliberately forgets, and forgetting is the problem: a
provider can be down forever and the symptom is a slightly slower reply.

ai-provider-check.sh reads the app journals over 24h, counts failures per
provider/model, names the kind (json_validate_failed, rate_limit, 429),
and alerts through the existing lib-alert plumbing — alert_transition, so
it fires on a state flip rather than nagging daily.

Three things it deliberately does NOT do:

- It does not claim a success RATE. Failures are logged, successes are
  not, so this is a floor and says so. A monitor that implies more than
  it knows is how the registry audit came to report "zero adopters" for
  a package with eight.
- It does not treat an empty journal as health. No lines is COULD NOT
  LOOK, and it alerts on that too. A monitor that cannot go red is worse
  than no monitor.
- It never disables a provider. Which link to drop is a product decision
  with cost and quality on both sides; an automated answer would be
  wrong in the direction nobody notices.

The test fixtures are verbatim lines from the incident, and they earned
their keep immediately: they caught a trailing quote that counted one
link as two, and kind-matching that silently excluded every fallback
line — which is exactly where `reason` lives.

Against the live journal it now reports groq at 2 failures in 24h, down
from 11 before this morning's fix, so at the default threshold it stays
silent. That is the fix confirming itself.
2026-09-13 05:50:49 -07:00
CatoandClaude Opus 5 f637036f17 feat(feedback): say WHY the agent is quiet, not just that it is (#679)
* feat(feedback): say WHY the agent is quiet, not just that it is

George dispatched a fix at 15:45:29. The first output arrived at 15:58:43 —
thirteen minutes later, and only because he opened a terminal by hand and
found the agent sitting at a Claude sign-in. The row said "the agent never
reported any output". True, useless, and the reason was ten seconds away.

Silence has two meanings and the operator can only act on one. "Thinking" is
nobody's problem; "waiting for a human" is theirs, right now. The runner could
already tell them apart — detectAuthFailure reads the transcript for a 401 or a
/login notice — but it only ever asked ONCE, inside an 8-second window at
inject time. That run passed the check and then went quiet, and nothing looked
again.

The heartbeat is the thing that watches the terminal for the whole run, so it
is where the question belongs. After 90 seconds of no output the runner asks,
and the answer rides the next beat; the route stamps payload.blocked and emits
one `blocked` event per stretch; the row reads "Needs you to sign in" with
Watch opening the terminal where you answer it. 90 s is chosen so the reason is
ready BEFORE the ten-minute mark forces the row to say something.

One subtlety worth the test that pins it: a blocked agent prints nothing, so
the "no output, no beat" rule would have suppressed exactly the beat carrying
the reason. Silence WITH a reason is now the message — still one beat per
window.

detectAuthFailure moved to desktop/src/main/agent-auth.ts: the poller starts the
heartbeat, so importing it back would have been a cycle.

163/163 unit files, lint, check:desktop, prettier green.

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

* chore(desktop): 0.8.23 — the runner says why a quiet agent is quiet

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 10:53:41 -07:00
Cato 69b5926ff4 chore(register): delete the six experiment sites, and gate what let them linger (#678)
* chore(register): delete the six experiment sites, and gate what let them linger

Six sites from dogfood and site-factory runs on 10-11 September were still
live today, five with GitHub repositories behind them. Two of them read as
real Zurich businesses that do not exist — "Velokiosk — Bike Repair at
Zürich HB" and "Kaffeeklappe – Kaffee to go in Zürich Wiedikon" — on the
founder's own domain. Nobody decided to keep them. They were never removed
once the thing they proved was proved.

All six are gone from the box (service, vhost, /opt, checkout, port, row,
workflows, and this box's deploy key revoked from each repo first), and the
five repositories are deleted. This removes their rows here, which had
drifted from the box copy.

The gate is the point. check-no-experiment-litter.sh fails the build when a
generated throwaway name reaches the committed register — a dated suffix
(-sep11-0040) or a throwaway prefix (dogfood-, factory-, probe-, e2e-). No
grace period: spinning one up for an hour leaves no trace here, so
committing its row IS the moment a test becomes permanent.

It matches names, not kinds. A first version judged kind=demo and flagged
sbb-fundbuero and camille-boulangerie, which are real work that happens to
sit at demo status — exactly the false positive that gets a gate widened
until it catches nothing. No product is ever called factory-sep11-0040.

* docs(retire): delete the project first, or the box puts the site back

Deleting the six sites in the obvious order looked like it worked — units
stopped, vhosts gone, directories removed. Two minutes later:

  [box-prepare] cloning velokiosk-sep10 <- github.com/bitbaum/velokiosk-sep10

and three of the six checkouts were back. A FleetCrown project row that
still names a dirPath is a standing instruction to restore the site, and
it is invisible from the box, so the box cannot know the site was retired
on purpose. The order is now part of the documented cleanup.
2026-09-12 10:39:22 -07:00
Cato ac8c25597c fix(teardown): stop offering a repo deletion no token can perform (#670)
* fix(teardown): stop offering a repo deletion no token can perform

Deleting a project with ?deprovision=delete-repo returned

    502 {"error":"GitHub delete failed (403)",
         "detail":"Must have admin rights to Repository."}

found by running the whole create-and-reverse path against production.
The cause is not a permissions mistake: GitHub requires the delete_repo
scope, and neither credential this product holds asks for it — the org
token has gist/read:org/repo/workflow, the user OAuth grant has
read:user/user:email/repo/workflow. So no FleetCrown token can ever
delete a repository, and the button offering it could only ever fail.

That is the right security posture, so keep it and make the product
honest about it instead:

- the teardown UI drops the delete option and links to the repository's
  own Settings page on GitHub, where the owner has rights we never borrow
- a delete attempted through the API reads GitHub's x-oauth-scopes header
  (sent on every response, errors included), and when delete_repo is
  genuinely absent says so, lists what the token does have, and gives the
  URL — rather than echoing a 403 nobody can act on. A token that DOES
  hold the scope and still gets 403 keeps the real message.
- retire-site.sh --repo delete refuses up front, before the service,
  vhost and files are gone, instead of failing at the last step

Verified against production: repo creation 200, archive 200, publish to
OrangeCat then take it down (public page 200 -> 404), project delete 200.
scripts/test/repo-delete-capability.ts pins both halves of the contract
and fails if either comes back.

* fix(retire): warn while it is a plan, refuse only when told to go

CI runs a GitHub token without delete_repo, so the new preflight aborted
the DRY RUN and took the whole retire-site suite with it. A plan that
cannot run is still worth reading: it now says the scope is missing, and
only --go refuses outright, before anything is torn down.

The test stubs both answers from gh rather than inheriting whichever
token the machine happens to hold — CI has no delete_repo, a laptop may.
2026-09-12 03:30:46 -07:00
CatoandClaude Opus 5 3a8f152cf4 fix(feedback): the auto-merge safety guard was decoration — an audit, and what it found (#669)
* fix(feedback): the safety guard was decoration, and four siblings of it

A first-principles audit of the loop, written as if the auto-merge had already
gone wrong. Five defects, none of them stylistic.

1. THE OWNERSHIP GUARD DID NOT EXIST. decideAutoShip takes fromOurDispatch and
   refuses when it is false; the single call site passed a hardcoded true. The
   pull request is resolved from PROSE the agent wrote, so a handoff that merely
   mentions a number ("same approach as PR #42") would have handed #42 to the
   merge call — and #42 can be a person's unrelated work. It is now established
   from GitHub's created_at: a run row exists before any agent touches the repo,
   so its pull request is always newer than the run. One minute of slack for
   clock skew; anything older belongs to a previous attempt or to someone else.

2. THE CACHE FOUGHT THE THING THAT FILLS IT. The refresher resolved the pull
   request preferring the reaper's evidence; the cache-validity check read only
   the handoff. A run whose evidence and handoff named different pull requests
   could never satisfy the check, so every inbox request re-fetched GitHub for
   that row, forever. resolveFixPrRef is now the one answer both ask for.

3. A PAUSE NOBODY COULD LIFT. One failed deploy pauses a project's automatic
   shipping. The scan counted resolved and archived rows, and a deploy_failed
   ledger is terminal — so the pause never ended and nothing in the product
   could end it. Only open rows count now: resolving IS the operator saying
   they handled it.

4. STARVATION DRESSED AS A RATE LIMIT. The inbox refreshes at most 8 ledgers
   per request and took them in list order — newest first. Everything past the
   eighth was never looked at again. Oldest-first makes the cap a rate limit;
   the count is logged rather than silently dropped.

5. THE SAME ROW BEHAVED DIFFERENTLY IN TWO PLACES. runnable was only on the
   cross-project inbox, so the project page offered Implement on a project with
   nowhere to work and answered with a 422 toast instead of "Connect a
   repository". Both lists carry it now.

And the gap the audit was really for: NOBODY WAS TOLD WHEN A FIX WENT LIVE, OR
WHEN A MERGED FIX FAILED TO DEPLOY. The loop announced a visitor filing and an
agent's run closing — and a run closes at a pull request, which is the exact
claim the ledger exists to stop making. That was survivable while a human
pressed merge. It is not survivable now that FleetCrown merges and deploys onto
a live site unattended: a failed deploy after an automatic merge is the worst
state this system can produce, and it was silent. notify-shipped.ts announces
both, on a ledger TRANSITION so each fix speaks once, naming whether FleetCrown
merged it.

Every rule that used to live in a loop is now a pure exported function with
tests — projectsPausedByBrokenDeploy, prOpenedByRun, fixCheckedAtMs,
resolveFixPrRef, shipAnnouncementFor — because today's lesson was that testing
the rule while the wiring goes untested is how a feature ships inert.

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

* docs(telegram): register the fix-shipped notifier

Every path that can reach the operator's phone owes a row saying what arrives,
when, and from where. The gate is right to refuse without it.

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

* fix(feedback): meet the alert gate where it looks, and stop two labels overstating

CI caught what I had not run: scripts/test/alert-registry.ts reads the alert
types a file raises by scanning it, and FAILS on a file it cannot read rather
than skipping one. A ternary at the call site made this file unreadable to it.
That is the right kind of gate — it refuses to pass vacuously — so the types
are literal `type:` fields now, and the branch reads better anyway because the
severity differs with the type.

Two labels also claimed more than they measured, the same class this whole
audit is about:

  "Report → fix" is stamped when the operator presses Confirm, so the number is
  dominated by how long they took to look, not by how fast the loop shipped. It
  says "Report → confirmed" now.

  FeedbackInbox's own docstring still described "Needs you / In progress /
  Shipped" grouped by DB status — the arrangement replaced precisely because
  status cannot answer the page's one question.

160/160 unit files, lint, prettier, tsc, design and both registry gates green.

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

* test(feedback): pin the ownership guard to the real merge and the real mistake

The best pin available for prOpenedByRun is production. On
dogfood-site-sep10-1201, run 1ff0be72 started 16:13:25 and its pull request #3
was opened at 16:15:37 — two minutes in, and it merged for real. The pull
request the parser wrongly named, #1, was opened at 10:21:48, six hours
earlier.

So the guard admits the merge that legitimately happened and rejects the exact
pull request that yesterday's bug resolved. It is a second, independent line of
defence against that failure: prose said #1, but #1 predates the run.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-12 03:00:37 -07:00
CatoandClaude Opus 5 8cd138bd1a feat(feedback): ship fixes automatically, per project, opt in (#656)
An agent's job ends at a pull request, so until somebody merges it the
visitor's report is not fixed. This adds the switch that decides who presses
merge — per project, off by default, in the Feedback section beside the
widget's Pause.

NOT an auto-merge.yml in the customer's repo. That would be a commit in
someone else's repository, would need back-filling into repos FleetCrown
never provisioned (annushka's was made by hand), would need another commit to
turn off, and — the real objection — it merges ANY green pull request,
including one a person opened for something unrelated. FleetCrown already
watches the exact PR its own dispatch produced (the fix ledger), so it merges
that one and nothing else: the setting applies to PRs already open, and
leaves no trace in the repo when it goes back off.

auto_ship is nullable on purpose. NULL = never chosen, and the project shows
an invitation rather than a switch sitting in the off position looking like
somebody's decision. FALSE = chosen off; stop offering. Off is the effective
default either way, which is what keeps client sites safe: FleetCrown cannot
tell a client site from its own — that ledger lives in apps.conf on the box,
not in this database.

Conditions, pure and pinned in scripts/test/feedback-auto-ship.ts:
  - only a PR from FleetCrown's own dispatch;
  - never on an "unverified" ledger — that is the agent's claim, and it is
    the exact shape the org-restriction 403 produces;
  - not a draft, and GitHub must say mergeable (null means it is still
    computing, which is not permission);
  - every check passed, and NO CHECKS AT ALL IS A HOLD. The dogfood site's
    first agent PR had zero checks; absence of red is not evidence of green;
  - one failed deploy pauses the project, so a broken fix cannot have the
    next one land on top of it.

When it holds, the row says what it is waiting for — an operator who turned
the switch on should never have to wonder whether the feature works.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 08:35:34 -07:00
ebeeb8101d feat(loki): retrieve before answering — Loki could not see the fleet it is named for (#647)
George filed two reports through FleetCrown's own feedback widget, watched
nothing happen, and asked Loki "what was the most recent feedback sent".

  Not in your data.

Both rows were in site_feedback, filed minutes earlier. Four runs spawned from
them sat in `waiting`. Twenty-four runs had errored in three days. The answer
was nevertheless honest: Loki had been handed no records, so the sentence was
true of what it could see — which is worse than an error, because a truthful
negative reads as a checked one.

Three independent causes, each sufficient alone.

1. NO SOURCE READ THE TABLE. `grep -rn feedback src/lib/agent/` returned
   nothing. Nor did runs, agent sessions, alerts, or notes. Loki could see the
   "life" half of the product (people, projects, goals) and nothing of the
   fleet half the product is named after.

2. THE PROMPT BUDGET WAS ARITHMETICALLY IMPOSSIBLE. One module constant —
   Groq's 12000-token minute window x 0.8 / 3 rounds = 3200 — applied to every
   vendor. Groq has since cut the window to 8000, and the prompt's own fixed
   cost measures 2946 tokens (system prompt 1264 + native tool schema 977 +
   catalog), leaving ~254 tokens: one fact. With the operator's message it goes
   negative, the fit correctly returns zero, and production logged
   `[loki] round 1: 40 facts exceed the call budget — sending 0` on every turn
   and sent it anyway with an empty Records block.

3. THE RICHER SEED WAS ON THE FALLBACK PATH ONLY. buildGroundedTurn (approvals,
   knowledge, economy, cues) ran only inside askLokiViaGateway. The primary
   loop seeded people + projects. So the approval queue seeded in #262
   *specifically to survive losing the tool loop* was, on the path that
   normally ran, reachable only by the tool call the loop could not afford.

WHAT CHANGED

Retrieve first, then reason. A pure keyword planner (src/lib/agent/plan.ts)
reads the question and fetches the relevant sources in parallel BEFORE the
model is called; tools become depth, not basic retrieval. A tool loop needs a
healthy model and a fitting prompt before it can ask its first question, which
is exactly what is missing when this class fires. A regex is dumber than a
model and never rate-limited. This is how OrangeCat's Cat has always worked.

Eleven new fact adapters: feedback, runs, live agent sessions, alerts, notes,
plus a computed fleet pulse (runner state, runs waiting/errored, unread
feedback, pending approvals, today's AI budget) and a buildFleetBrief of
SQL-computed answers the model may only phrase. Six new tools over them.

Budgets follow the vendor: linkPromptBudgetTokens() sizes Groq from its minute
window and large-context vendors by usefulness; the prompt is sized against the
largest usable link and the walker SKIPS links it does not fit (a preflight,
not a refused round-trip). Env-tunable without a deploy. When overhead busts
every budget the loop now throws instead of sending an empty Records block.

Conversation history reaches the primary path, so continuity no longer appears
and disappears depending on which brain served the turn.

Provenance is rendered: model, what was read per source, tools used, elapsed
time, and the grounding verdict. The verdict was always computed and always
returned; the route dropped it on persist and the assistant never read it, so a
flagged answer looked exactly like a clean one — the failure the harness exists
to prevent, reintroduced at the last inch.

THE GATE (this is the third time this class has fired)

Every read tool's data must ALSO be reachable from the seed. Seed =
survivability, tool = depth, one adapter called by both.
scripts/test/loki-retrieval-plan.ts fails the build on a read tool with no seed
source, and on a seed source no question can reach. It caught a real orphan on
its first run: the OrangeCat economy feed, fetchable but unreachable.

Also fixed while here: propose_action reported a failed DB write as a
successfully queued draft; the repair pass accepted a repair that invented a
NEW unsupported claim if it had fewer total; assignee matching used a bare
substring (the dr-UZH-nikov pattern on the write side); pageContext over 2000
chars 400'd the whole request instead of being clamped; the native tool schema
repeated each full description, paying for the same prose twice.

Docs: docs/architecture/loki-answering.md.
Tests: 4 files, 63 checks, all env-independent.


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

Co-authored-by: Cato <georgy.butaev@revamp-it.ch>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 06:31:48 -07:00
CatoandClaude Opus 5 81d86a2869 feat(feedback): a fix ledger, and a page grouped by who is blocked (#639)
* feat(feedback): a fix ledger — where the change actually is, instead of a Check live that lies

"Check live" appeared the moment a run closed with success, and it opened
whatever URL the visitor had reported. Both halves were wrong.

The agent's job ends at a pull request (SHIP_INSTRUCTION says so). At close
the change is a PR nobody merged, on a site nobody redeployed — so "check
live" showed the unchanged page. And the reported URL is where the visitor
happened to be: a preview host, a stale domain, or in one of my own test
rows a .example fixture that resolves to nothing.

The fix ledger (src/lib/feedback/fix-shipping.ts) answers one question —
where is this change on its way to the live product? It reads the PR the
agent named in its handoff (or the reaper's evidence), asks GitHub with the
user's own token, and caches the answer on the run (payload.fix), refreshing
at most once a minute while the state can still change and never once it is
terminal. States: nothing shipped · pushed, no PR · PR #N open · closed ·
merged · deploying · deploy failed · Live.

The row now says which of those it is, shows the agent's own one-line
account, and offers the button that matches: Review PR while it is open,
Check live only once a deploy-like workflow succeeded on the merge commit,
Retry when nothing shipped. Check live opens the PROJECT's live URL plus the
reported path, never the visitor's host. Confirm resolves; the undo arrow
reopens it as "not fixed".

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

* refactor(feedback): group by who is blocked, and open with the loop's numbers

The page asks one question — is anything waiting on me? — and answered it
with DB status, which cannot. `dispatched` covers an agent mid-run AND a fix
that merged and deployed an hour ago, so the row that needed a person sat
under "In progress" next to the one that didn't, and "Stalled" (a person's
problem, Retry) was filed as progress.

work.waitingOn is now the SSOT: you / machine / nobody, derived in ONE place
from the phase and the fix ledger, so a new phase cannot land in the wrong
column. Sections become Needs you / Under way ("moving on its own — nothing
to do") / Shipped, and the poll runs while anything is machine-side, which
now includes a PR waiting to auto-merge.

The page also opened with a blank column above three rows. It is the
ironing-out loop, so it now leads with the loop: reports, shipped, median
report→fix — the metrics the inbox route already computed and only ever
showed as a footnote on one section heading. Fifth caller of StatRow/StatCard;
no new CSS.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 05:00:30 -07:00
CatoandClaude Opus 5 2df4978e47 docs(handoff): the loop closes without a human up to the merge, and what still blocks the deploy (#636)
Records the 'do it all' round: what shipped for each open item, the evidence
on kaffeeklappe-sep11 (agent PR merged by the site's own sweep, run closing
itself, the change live), and the one chain break it exposed — a
token-merged commit starts no Deploy, which #635 fixes.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 04:37:18 -07:00
CatoandClaude Fable 5.1 b7b26df120 feat(feedback): the row shows the work happening — runner heartbeat, Working · N min, Watch into the terminal (#632)
* feat(feedback): the row shows the work happening — runner heartbeat, Working · N min, Watch into the terminal

Between 'submitted' and 'closed' a run wrote nothing anywhere, so Feedback
read a busy agent as Queued and, from minute ten, as Not running. The box
runner owns the agent's PTY and sees every byte; it now beats
PATCH /api/control/runs/:id/progress (at most every 45 s, only when the PTY
printed) and the cloud stamps payload.lastProgressAt + a 'progress' event.

deriveFeedbackWork reads the heartbeat: fresh = 'Working · 47 min' for as
long as the run takes; gone quiet = 'Stalled' with how long it worked and
how long it has been silent; never any = 'Not running' after 10 min measured
from delivery. Every delivered phase is watchable, so the row's button is
'Watch' into /terminal?project=… whenever a PTY exists, and 'Open on
Control' only while Queued.

A project with no repository and no folder gets 'Connect a repository'
instead of Implement, and the dispatch route refuses the same case with a
422 that says what to do — the Annushka failure class, closed at the source.

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

* fix(control): Watch follows the same watchable rule as the Feedback row

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

* chore(desktop): 0.8.21 — Fleet Runner reports run progress while the agent prints

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

* docs(changelog): Fleet Runner 0.8.21 — run progress heartbeat

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 03:12:09 -07:00
CatoandClaude Fable 5.1 6e6ca0bc7a docs(cloud-primary): nothing left that describes the old substrate — docs, marketing, comments, focus_tab (#631)
* docs(cloud-primary): nothing left that describes the old substrate — docs, marketing, comments, focus_tab

The cloud-primary series (#615 routing, #618 OrangeCat auto-kickoff, #624
Fleet Runner 0.8.19, #630 web PTY-only) changed what the product IS. This
sweep makes every surface that describes it say so, so neither an agent
reading the repo nor a person reading the site is told about zellij tabs,
presence-based routing, a cold-start restore, or a handoff that "starts
nothing".

Inventory-driven (≈105 doc lines, ≈30 user-facing strings, ≈22 code
comments, 2 repo-level items), not a grep-and-replace:

User-facing
- /download prerequisites: the "Zellij — bundled" card is gone; copy says
  each agent runs in a terminal Fleet Runner owns.
- Quickstart, license page, executor copy (cloud is the default; "This
  computer" is a per-project choice under Runs on), marketing pillars,
  whitepaper (owned-PTY design, "where a project runs is a decision, not a
  guess", ZSH typing-guard section deleted), Control terminal panel strings
  (components renamed LiveTerminalPanel / LiveTerminalRows), peek drawer
  copy, GitHub release notes for 0.8.19, repo description + topics.

Agent-facing
- README, CLAUDE.md, AGENTS-adjacent SSOTs: cloud-local-workflows.md now
  states the stored routing rule; priority plan closes B6; multitenancy plan
  routes by builder_pref; HANDOFF.md staleness table + terminals section;
  the 2026-09-10 cold-start handoff gets a dated "superseded" section; the
  two shipped proposals (fleet-runner-pty-ownership, desktop-app) carry a
  status banner; home/README describes the eight modules that exist;
  desktop/README describes 0.8.19; roadmap seed marks the migration done;
  box-runner unit and log drop FLEETCROWN_RUNNER_PTY; 22 code comments.

Code (one coherent retirement)
- focus_tab is removed from the pending-command contract, the desktop
  validator and poller, enqueueTabCommand's type, the validator test and the
  failure classifier (START_SESSION | RETRY). The runner had rejected it
  since 0.8.19; now it cannot be enqueued at all.

Verified: tsc, eslint, 148/148 unit files, 130/130 home self-tests,
check:desktop (typecheck + build).

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

* chore(desktop): 0.8.20 — the focus_tab retirement touches desktop/, so it ships as a release

The release-drift gate is right: a desktop change without a bump goes red on
main once the next tag is minted. 0.8.19's changelog date is corrected to the
release's real publishedAt.

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 02:41:20 -07:00
CatoandClaude Fable 5.1 d6ac2544d4 feat(orangecat): "Build it with FleetCrown" builds — the intent lands on a running kickoff (#618)
The button on an OrangeCat profile promised a build and delivered a form. The
handoff page consumed the signed intent, created a project, and stopped:
"Nothing starts running." Everything that turns a brief into a repo, a deploy
and an agent — planKickoff's four steps behind "Make it happen" — waited for a
second click on a page the person had not asked to visit.

Now arrival is the click. `decideHandoffMode` (pure, tested) says what the
page does: build by default, review when asked (`?review=1`), review when a
same-named project exists (only a person can say whether "Bitbaum" and
"Bitbaum" are one thing), open when the entity is already connected. In build
mode the page consumes the intent on mount, creates the project, and redirects
to it with `?kickoff=auto`; the project page hands that to ProjectKickoff,
which runs the very same run() the button runs — no second orchestrator. A
brief too thin to extract from stays put with the same hint the button shows;
a failed auto-create degrades to the picker with the error visible.

Linking an EXISTING project never auto-starts: linking is not consent to start
work on it. Funding events still never dispatch.

Page copy tells the truth in both modes; the fund-to-build architecture doc
no longer lists automatic dispatch as roadmap.

Verified: pnpm run verify green (tsc, lint, design, desktop, 145/145 unit
files incl. the new scripts/test/orangecat-handoff-mode.ts, ops).


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 00:35:32 -07:00
CatoandClaude Fable 5.1 14cf80ec57 docs(handoff): the cold start walked through the real UI, with the widget (#608)
kaffeeklappe-sep11 from Projects → Add → Make it happen → live site → widget
report → Implement → Resolve, in a real browser. Records the UI-only findings.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 23:57:37 -07:00
CatoandClaude Fable 5.1 02cc30429f docs(handoff): cold start walked on production — evidence, what needed a hand, what is still open (#599)
velokiosk-sep10: brief → repo → live site → feedback → Implement → live
change → Resolve, on 2026-09-10/11, with the register path completing from
inside the product on 5c27d775. Records the two operator clicks left on the
path, the run-record discrepancy for an Implement injected into an open PTY,
and the ranked open list for the next owner.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 17:26:13 -07:00
CatoandClaude Fable 5.1 71762e4649 fix(cold-start): register lands deploy.yml; scaffold installs/builds/serves (#585)
* fix(register): a site registered from the box gets its shim, its port, and its builder

Walked the cold start on production after #569 (velokiosk-sep10). The repo
was seeded; then four defects on the register-and-run path:

- The OAuth grant had no workflow scope, so GitHub refused to write
  .github/workflows/deploy.yml and register-site.sh carried on saying the
  remote may already have it. The grant now requests workflow; the script
  falls back to the host's own gh login for the shim and fails when the file
  is not on the remote.
- box() named no SSH identity; ubuntu's only key is the CI deploy key, so the
  box refused itself. box() passes DEPLOY_KEY_PATH when readable.
- The durable register was behind main and handed out a port main had already
  given away. Ports and conflicts are read from both registers, the durable
  checkout is fast-forwarded when all its rows are on main, and every new row
  goes to main as a PR.
- A dirPath under the box clone root was routed to the operator's laptop
  because it was present; that runner cannot clone on demand and reported
  "inject did not stick". projectChannelLock returns cloud for box-rooted
  workspaces.

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

* fix(scaffold): a new site that actually installs, builds and serves

Diplodoctor was scaffolded on 2026-09-10, provisioned completely — repo,
systemd unit, Caddy vhost, register entry — and served 502. Its session
diagnosed it and fixed it IN THE DIPLODOCTOR REPOSITORY. The template was left
exactly as it was, so the next site would have rediscovered the same three
faults from scratch. This is that fix moved to where it belongs.

The template was never internally consistent about its package manager. It
shipped no lockfile at all, yet its CI ran `npm ci`, which REQUIRES
package-lock.json — so a freshly scaffolded site's CI could not pass on its
first commit, or any commit. Meanwhile the box deploys with `pnpm run build`.
Two managers, one repo, and the half that ran in production was not the half CI
described. Everything here converges on pnpm, which is what actually ships.

  pnpm-workspace.yaml   NEW. `allowBuilds: sharp, unrs-resolver`. pnpm 11
                        refuses to run a dependency's build script unless it is
                        approved and EXITS NON-ZERO when one is not, so without
                        this a fresh clone cannot install and the deploy dies
                        before the build. It must not go in package.json's
                        `pnpm` field: pnpm 11 no longer reads that field and
                        ignores it with a warning, which makes the setting look
                        present while doing nothing.
  .nvmrc                20 -> 22. pnpm 11 imports node:sqlite, absent before
                        Node 22.13. Harmless while CI used npm; fatal the moment
                        it uses pnpm.
  ci.yml                npm -> pnpm throughout, and the Next cache key now
                        hashes pnpm-lock.yaml instead of package-lock.json — a
                        file that never existed here, and hashFiles() returns
                        an empty string for a missing path, so the key was
                        constant and the cache could never invalidate.
  package.json          `verify` uses pnpm; `packageManager` pins pnpm@11.25.0
                        so a stray `npm i` cannot mint a second lockfile.

Two things this also fixes that were not in diplodoctor's repair.

**The scaffold now resolves a lockfile into the first commit.** Without one the
repository is born unbuildable in two places at once: CI's
`pnpm install --frozen-lockfile` refuses to invent a lockfile, and the box
resolves versions afresh on every release, so the site that was verified is not
the site that ships. `--lockfile-only` keeps this to a few seconds and unpacks
no node_modules.

**next 16.2.4 -> 16.3.4.** The template was minting every new site with a
CRITICAL unauthenticated RCE — GHSA-2xp9-vwfh-vxw4, the Next image-optimization
hole, patched at >=16.3.3. orangecat was patched for this today; the scaffold
would have kept issuing fresh vulnerable sites afterwards.

**And the port race, which nearly shipped an hour ago.** Ports are allocated
from `apps.conf` in a LOCAL checkout, and this studio runs five to ten agent
sessions at once, each in its own worktree. A stale copy reports a stale highest
port. A dry run in one such checkout offered 4024 for a new site while origin
already had diplodoctor on 4024 and heidi on 4025 — two sites, one port, caught
by hand one command before it would have shipped. The script now fetches and
REFUSES when its register differs from origin/main, naming the pull that fixes
it, rather than guessing a number another session already took.

Verified: `bash -n` clean; a dry run against an up-to-date register allocates
4026 and the staleness guard passes.

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

* chore(register): causius on 4026 — the first site the fixed scaffold built

causius.orangecat.ch is live: systemd active, HTTP 200, its own certificate, on
the first deploy. Diplodoctor needed two follow-up pull requests to reach that
same state yesterday; this one needed none, because the template was repaired
before it was used rather than after.

Registered as `product` / `validating` — ours, and not yet claiming to be a
live client engagement, so the client-ledger gate is satisfied without inventing
terms for something that has no customer.

Port 4026 came from a register that the new staleness guard had just verified
against origin. The stale local copy this was first attempted from offered 4024,
which diplodoctor already holds.

Deliberately NOT bought: causius.com and causius.ch are unregistered and stay
that way for now, by George's call. The site therefore lives at its free
orangecat.ch address, which is exactly the ladder /domains sells — start free,
move to your own domain later, keep every link alive. Dogfooding it means the
first customer of that offer is us.

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

* fix(scaffold): site-template CI floor test expects pnpm

The scaffold now installs with `pnpm install --frozen-lockfile` (#583 onto
main). The floor test still demanded `npm ci`, so verify would fail every
run after the template switch even though the template itself is correct.

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 15:00:27 -07:00