33 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 634402bace feat(hooks): every session starts knowing what is merged-not-shipped (#88)
fleet drift.sh answers "is the same commit on the laptop, GitHub, Gitea and
the box?", but nothing ran it, so it changed nothing. It takes a minute, too
slow for SessionStart, so an hourly user timer (fleet-drift.timer) runs
scripts/fleet-drift-cache.sh into ~/.cache/fleet-drift.txt and the hook
only reads it, next to the agent list. A missing or stale (>3 h) cache is
said, never hidden. tests/session-start.test.sh (4 cases, mutation-checked)
runs in CI.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 15:35:38 +01:00
CatoandClaude Opus 5.5 d9911fb2a6 feat(hooks): Stop blocks "done" while the repo's verify is red (#86)
stop.sh had been a no-op since 2026-06-11. It now runs `<pm> run verify` when
the repo has a verify script and holds work not yet on the default branch
(dirty tree or unmerged HEAD), and exits 2 with the failing tail so the agent
fixes it before calling itself done.

Brakes, each tested: 130s timeout (under the 150s hook limit) lets the stop
through; at most 3 blocks per session; no node_modules / exit 127 = cannot
verify, not red; CLAUDE_STOP_VERIFY=0 or .claude/no-stop-verify opts out.
Passes are cached by tree fingerprint, so repeated stops verify once.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 10:37:25 +01:00
CatoandClaude Opus 5.5 035aee1533 chore(ci): one check per change — remove the merge sweep, check on PRs only (#85)
Removes the fleet auto-merge sweep caller (and wake chain where present);
checks run on pull requests only, not again after merging; a deploy that
waited for CI on main now deploys on push. The forge merge check
(forge/verify) verifies each PR on its merge result and merges it.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:31:44 +01:00
CatoandClaude Opus 5.5 9594eb1682 feat(hooks): auto-approve EnterWorktree into a sibling repo's worktree (#76)
EnterWorktree(path=~/dev/<repo>/.claude/worktrees/<name>) from a session at ~
raises a 'permission-root relocation' prompt that the EnterWorktree allow rule
does not silence. A PermissionRequest hook approves exactly that shape (resolved
with realpath, so .. and symlinks cannot escape) and falls through to the
normal prompt for anything else. Tested in both directions, wired into CI.

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 00:13:41 -07:00
CatoandClaude Opus 5.5 20022ed6bc docs(claude): chats — reuse the reference, never write one from scratch (#74)
* docs(claude): chats — reuse the reference, never write one from scratch

13 chats in 10 repos, each written fresh and each missing something another had
fixed (usually the mic); George had to find every gap himself. Global rule: open
loki /loki first, meet fleet SHARED.md 'Chat — the standard', behaviour may not
differ between apps, done = 390px screenshot + one sentence through the mic.

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

* docs(claude): shorten the chat rule to a pointer; raise the budget 291 -> 302 for it

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 22:27:34 -07:00
CatoandClaude Opus 5 1b883ff10c fix(hooks): commit the hook that was running from one disk, drop the renamed twins (#72)
settings.json is this repo's SSOT for what runs, and it disagreed with
.claude/hooks/ in both directions at once.

Registered but never committed: session-start.sh. It prints the "AGENTS
RUNNING" banner at the top of every session — the thing that makes
scripts/fleet-status.sh unavoidable rather than something a session has to
remember. It was written on 2026-09-10 and has been running here ever since,
while existing on exactly one disk. A new machine would not have had it, and
nothing would have said so.

Committed nothing runs — or rather, registered after it was superseded:
fleetcrown-capture.sh and fleetcrown-session-end.sh survived the FleetCrown ->
Loki rename as byte-for-byte twins of loki-capture.sh / loki-session-end.sh,
differing only in token path and host. Both ~/.config/fleetcrown and
~/.config/loki still hold a token, and both fleetcrown.orangecat.ch and
loki.orangecat.ch still answer, so since the rename every prompt typed on this
machine has been posted TWICE, to two different products. Their registrations
are removed here; the scripts are deleted from the box in the same change.

settings.json also gains the SessionStart block and modelSettings, which lived
only in the working copy. The file is otherwise the live one unchanged.

A registration with no file and a file nothing runs are the same bug seen from
opposite ends, so the new test asserts both ends, and is itself asserted to
fail in both directions rather than merely to pass today.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 07:16:54 -07:00
CatoandClaude Opus 5 f939d38a2b fix(hooks): stop a leading cd re-homing every background session (#71)
On 2026-09-20 a session sitting in ~/ ran `cd ~/.claude/hooks` (a symlink
into this repo) in the same second the background daemon was spawned. The
daemon recorded the shell's live cwd as its spawner's location:

  daemon run --spawned-by {"cwd":"/home/g/dev/dotfiles/.claude/hooks",...}

Every background session minted afterwards inherited that directory. They
reported themselves as "dotfiles" in the UI, wrote their transcripts to
projects/-home-g-dev-dotfiles--claude-hooks/, and — the part that costs real
work — would read and write their memory from the wrong silo.

The leading `cd` bought nothing in the first place: the Bash tool resets the
working directory to the session's own after every call, so it never
persisted. It was pure footgun, and only the spawn race made it visible.

So block it, at the one place this repo already gates every tool call. The
guard inspects only the first line and only an unparenthesised `cd`/`pushd`:
a subshell `(cd ...)` or `$(cd ...)` cannot escape itself, a heredoc body
belongs to another interpreter, and `ssh host "cd /opt/app && ..."` is a
remote directory — blocking any of those would stall 5-20 live sessions.
Both directions are asserted by a test, wired into CI, because a hook this
load-bearing must not regress in either.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 06:52:18 -07:00
CatoandClaude Fable 5.1 1fa68c293c fix(ci): auto-merge caller declared secrets twice, so the workflow never parsed (#69)
The caller declared `secrets:` twice under `jobs.sweep` — one block passing `GITHUB_TOKEN`, a second passing `FLEET_PAT`. A YAML mapping cannot hold the same key twice, so GitHub refused the whole file: the Actions tab lists the workflow by its PATH instead of its `name:`, and every run since at least 2026-09-13 is a zero-job `failure`. This repo has had no auto-merge at all in that time, and nothing said so — a sweep that fails to start looks exactly like a sweep with nothing to merge.

Keep the `FLEET_PAT` block (the reusable workflow falls back to `github.token` when it is empty), drop the `GITHUB_TOKEN` one. Verified with a strict duplicate-key YAML load and actionlint 1.7.12.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 22:49:11 -07:00
CatoandClaude Fable 5.1 71becc5253 chore: rename FleetCrown to Loki (#67)
The product was renamed on 2026-09-14: bitbaum/loki, loki.orangecat.ch,
LOKI_* env keys, loki-* units. This repo referenced the old name in
11 files changed, 22 insertions(+), 22 deletions(-).
Email addresses at the old sending domain stay until the new domain is
verified in Resend.


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

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:23:08 -07:00
Cato 5d5e857c79 Adopt fix-scans.sh from lifeops, and write down three rules earned today (#66)
* feat(scripts): adopt fix-scans.sh, and say that scripts/ exists

Batch-repairs date and GPS metadata on scanned film frames: scanners stamp
the scan time, not the shot time, so a 1994 roll sorts into last Tuesday in
any photo app. Dry-run by default, --apply writes through exiftool.

It came from bitbaum/lifeops, a repo created by an agent on 2026-08-13 that
never went anywhere. The idea (personal non-code tasks made repo-shaped so
FleetCrown can dispatch them) is worth keeping as an idea; a repo is not the
place to keep an idea. This is the one file in it that does real work, and
it is environment-shaped, so it belongs beside fleet-status.sh.

The architecture block never mentioned scripts/ even though fleet-status.sh
has lived there for months. A directory the file does not list is one the
next person puts the wrong thing in.

* docs(claude): three rules earned the hard way today

Written after a session that created litter, then nearly deleted live code
while cleaning it up. Each is a fact an agent cannot derive:

- Clean up the experiment when the experiment is over. Six dogfood sites
  from 10-11 September were still live days later, two reading as real
  Zurich businesses that do not exist, on George's own domain. Includes the
  deletion ORDER: the FleetCrown project first, or box-prepare re-clones the
  site within two minutes.

- Never create a GitHub repository on your own initiative. Agents commit
  under George's own identity, so an agent-made repo is indistinguishable
  from his. 27 of 48 repos had an agent-authored first commit, and he did
  not recognise several of them.

- Answer "what do we have?" from a register, never a grep. ~/dev is a
  partial copy of the org. A grep for @bitbaum/<name> missed every consumer
  of packages that install under a bare name, and "nothing depends on these"
  nearly deleted bip-kit (8 adopters), limitkit (3) and threadkit (3).
  fleet/registers/*.json had the right answer the whole time.

* docs(claude): three rules earned today, and the budget to hold them

Each records an incident from 2026-09-12 and is a fact an agent cannot
derive on its own:

- Clean up the experiment when the experiment is over. Six dogfood sites
  from 10-11 September were still live days later, two reading as real
  Zurich businesses that do not exist, on George's own domain. Carries the
  deletion ORDER, because the FleetCrown project row is invisible from the
  box and box-prepare re-cloned three of the six within two minutes.

- Never create a GitHub repository on your own initiative. Agents commit
  under George's own identity, so an agent-made repo is indistinguishable
  from his. 27 of 48 repos had an agent-authored first commit and he
  recognised few of them.

- Answer "what do we have?" from a register, never a grep. A grep for
  @bitbaum/<name> missed every consumer of packages that install under a
  bare name; "nothing depends on these" nearly deleted bip-kit (8
  adopters), limitkit (3) and threadkit (3). fleet/registers/*.json had
  the answer the whole time.

The first draft of these ran 75 lines and the budget gate caught it, which
is the gate working: they are 49 now. BUDGET rises 242 -> 291, set to the
exact count so the ratchet keeps no slack, with the reason in the diff.
2026-09-12 12:30:11 -07:00
CatoandClaude Opus 5 8c9c70f31b ci(claude): hold the global file at 242 lines, and stop forbidding cross-repo work (#64)
Two follow-ups to #63.

**The ratchet.** #63 cut the global CLAUDE.md from 718 to 242 lines, but nothing
stopped it refilling — accretion is how it got to 718 in the first place, one
reasonable-looking section at a time. CI now fails if it exceeds 242. The count
may fall or hold, never rise: adding a section means cutting another or raising
BUDGET in the same commit, so the decision lands in a diff a human reads instead
of being inherited silently. Verified in all three directions before shipping —
red at 247, green at 242, green at 200 with a note to lock the win in.

**The rule that forbade today's work.** Project isolation said "never write code
to or read files from a project directory other than the one cwd is in". Read
literally it prohibits every cross-repo change: the fleet brief, a shared
package, a fix in the repo that actually owns the bug. Its real target is prompt
drift — the continuation template naming a project you are not in — so it now
says that instead. An explicit request in the conversation, and cross-repo work,
are legitimate; drifting on the strength of stale template text is not.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 12:41:24 -07:00
CatoandClaude Opus 5 de7f0cc44a ci(auto-merge): hand the sweep a PAT so workflow PRs stop stalling (#61)
GITHUB_TOKEN cannot merge a PR that touches .github/workflows. The sweep tries,
the merge API refuses, it logs "leaving for the next sweep", and repeats — while
still exiting 0. So the failure is invisible: every run reports success and the
PR simply never merges.

That is not hypothetical. ai-kit #11 (bump actions/checkout) sat green, CLEAN
and MERGEABLE for nine days; aoz-housing #122 (bump actions/upload-artifact)
for nine more. Both had to be merged by hand today. Every Dependabot
`github_actions` bump in the fleet is in this class, permanently.

A PAT fixes a second thing that costs more: THROUGHPUT. A dispatch made with
GITHUB_TOKEN emits no workflow_run, so after each merge nothing wakes the sweep
to take the next PR — it waits for the cron, and GitHub throttles scheduled
workflows to roughly hourly regardless of what the cron says. Observed in
fleetcrown: sweeps ~50-65 minutes apart against a */10 schedule. A PAT-created
dispatch does emit workflow_run, so the queue drains at CI speed instead.

The reusable workflow has always supported this — GH_TOKEN is
`secrets.token || github.token`. This just passes it.

SAFE BEFORE THE SECRET EXISTS: an undefined secret resolves to empty, and the
fallback picks github.token. So this changes nothing until FLEET_PAT is created
as an organisation secret, and needs no second pass afterwards.


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

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 17:22:04 +00:00
GandClaude Opus 5 1a0169710d chore: remove the forwarded sweep — every caller has migrated (#58)
The shim was a migration aid: it kept sixteen repos working unchanged while
they repointed from bitbaum/dotfiles to bitbaum/fleet. All sixteen have
migrated, so it now forwards nothing.

Verified before deleting, across all 38 org repos: 156 workflow files read,
0 unreadable, 0 remaining `uses:` references to dotfiles. "No hits" from a scan
that skipped files is not an answer, so the unread count is part of the check.

Removing it matters beyond tidiness. A shim that forwards nothing is a second
place the sweep appears to live, and the whole reason this policy is shared is
that copies drift — twenty-two of them once drifted into eight versions here.
This repo is the development environment again: shell, editor, tool config.


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

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 12:01:53 +00:00
91802e9d93 chore: fleet automation moves to bitbaum/fleet; this repo is the environment again (#56)
A repo holding a .bashrc was the wrong place for the machinery gating thirty
other repos: three sessions and the owner collided here in one week, and every
fleet change looked like an environment change. The audits, templates,
registry and sweep now live in bitbaum/fleet (layout unchanged, all six test
suites green there, secrets set, CI green).

Nothing breaks for callers:
- auto-merge-sweep.yml stays as a FORWARDING SHIM — the 16 repos calling it
  as a reusable workflow keep working; the shim maps the historic ref
  'master' to fleet's 'main' and holds no logic.
- SHARED.md stays as a pointer, because a decade of docs and habits say to
  check it here. The registry is maintained only in fleet.
- This repo's own auto-merge now calls fleet's sweep like every other repo.

CI slims to what this repo now is: shell syntax plus an install.sh
dangling-symlink check. CLAUDE.md and README describe the environment repo;
the global standards' pointers now name fleet/SHARED.md and
fleet/templates/ci.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 08:14:38 +00:00
Mao Nakamoto 3f648900a7 chore(ci): GitHub owner maonakamoto -> catomean 2026-08-27 19:18:28 +02:00
Mao Nakamoto a59f9480a4 chore(ci): GitHub owner maonakamoto -> catomean 2026-08-27 19:14:40 +02:00
GandClaude Opus 5 7821247b24 refactor(ci): adopt ai-kit, the package ai-ration became (#45)
`ai-ration` is now `ai-kit`, because the name described one of its five modules
and hid the rest — and the person deciding whether to install it could not tell
what it did. That is an adoption cost paid at every install decision, and this
is the package with ONE adopter whose absence took five repos down together on
2026-08-26.

The audit here was its second adopter, so it moves first. `AI_RATION_FROM` still
works and the old paths stay in the resolver list: a rename must not turn a
working daily audit into a silent exit 2 on the first machine that has not
caught up.

Installed from GitHub rather than npm because ai-kit v0.3.0 is tagged, built and
verified but not on the registry — the repo has no NPM_TOKEN, which needs an
account nobody here holds. Switch to `npm i ai-kit` once it does.

SHARED.md records WHY the merge stopped where it did: ai-kit absorbed ai-ration
and re-exports ai-forms, because to an app "which model do we call", "AI chat"
and "AI form fill" are one feature. threadkit and limitkit stay out — neither is
about AI, and an app throttling its login form should not install a model
catalogue to do it. Merge by what a consumer needs together, never by "these are
all shared utilities".

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 14:36:34 +02:00
GandClaude Opus 5 01aec5eff7 feat(ci): ask the vendor, daily, whether our model ids still exist (#43)
AOZ reported "KI-Assistent nicht konfiguriert. Bitte GROQ_API_KEY setzen" on a
deployment whose key was valid. Groq had retired the whole llama-3.x family and
the pinned id answered 404. Production had been failing exactly as long as the
demo and nobody knew, because "not configured" is the only thing the app can
say.

Six pins across five repos were dead the same morning — botsmann, evig, kivvi,
orangecat, truthseeker — three of them serving live traffic. None of it was
visible from inside a repo: every gate was green, because the code is correct
and the vendor changed underneath it. No lint rule, type check or unit test can
see this, which is exactly the gap the central audits exist to cover.

So this asks the only authority that knows. One GET /models per vendor, ZERO
tokens, which is what makes it schedulable — and "somebody is supposed to
remember" is the mechanism that already failed for eight days in ai-ration's
own consumer.

It calls ai-ration's checkCatalog rather than growing a second vendor query
here; the package takes the chain as an argument, so it generalised to
arbitrary ids with no change. That makes dotfiles its second adopter, which is
the medicine this file prescribes to everyone else.

Three findings survive as tests because the first live runs produced them:

  - xAI's `grok-3-mini` was filed under Groq — one letter apart, and xAI's URL
    sat 6 lines from the pin while Groq's sat 18. Attribution now follows the
    marker ABOVE the pin, since that is the branch that owns it, and vendors we
    cannot query still own their ids so they report UNCHECKED instead of being
    absorbed by the nearest vendor we can.
  - fleetcrown's computed `${link.provider.id}/${link.model}` was reported
    retired. An interpolated id is the absence of a pin.
  - botsmann's pin lives in lib/constants.ts, which no AI-shaped filename
    filter opens. Candidates are now two-tiered and ranked, and truncation is
    REPORTED — a bounded sweep that stays quiet about what it skipped reads
    exactly like one that found nothing.

An unreadable catalogue reports UNCHECKED, never GONE. Treating "I could not
look" as "nothing is there" would mark every pin retired and invent a
fleet-wide outage somebody then acts on.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 12:05:14 +00:00
GandClaude Opus 5 b03e5eca34 feat(fleet): reclaim the checkouts whose work already shipped (#42)
The fleet creates a git worktree per agent session and removes none of them.
On 2026-08-26 there were 24, holding 5.2 GB, and every single one belonged to a
PR that had already merged — 23 were byte-for-byte clean. That is a recurring
manual sweep, so it becomes a script rather than something re-derived from
scratch each time the disk gets tight.

stranded-work.sh and this are the two halves of one question. That one asks "is
any work trapped on this disk?"; this asks "is any checkout still here after its
work shipped?" They turn on the same distinction, too: an upstream that is
configured but no longer resolves means the branch was pushed and its remote
branch deleted. Reading that backwards is what made stranded-work report 24
merged PRs as stranded yesterday.

Because this one deletes checkouts, the entire design is the refusal list. A
worktree is removable only if it was PUSHED, is CLEAN, is UNUSED, and GitHub
says MERGED — and each of those is a case where removing it would have
destroyed the only copy of something:

  no upstream    the branch exists on exactly one disk
  any dirt       a worktree is where the unfinished edit lives
  live session   someone is working in it right now
  not MERGED     CLOSED is abandoned, not gone; empty is gh failing, not consent

The predicate is pure so all nine tests run without a repo, a network call or a
session, including "no argument means dry-run" — if that ever inverts, the first
person to run it bare loses every checkout.

Verified on the real fleet: 23 removed, 5.2 GB freed, the four it refused being
one never-pushed branch, one live session, one dirty tree, and one superseded
local branch.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 08:46:54 +00:00
GandClaude Opus 5 4c0e923789 feat(fleet): find work that is stranded, not work that is merely dirty (#39)
* chore(zellij): drop the hardcoded project-tab layout

Every login ran `zellij -l projects`, which loaded a hand-maintained
layout naming nine project tabs. That list is a copy of state that
already lives in ~/dev, so it drifted: two of its nine tabs pointed at
directories that no longer exist (openclaw, cockpit), and none pointed
at the repos actually being worked on. Startup reliably produced tabs
nobody wanted.

The layout's only other content was a default_tab_template that is
byte-for-byte zellij's compiled-in default (tab-bar / pane / status-bar,
verified via `zellij setup --dump-layout default`). So the file
contributed nothing but the stale list, and deleting it is the whole
fix — a bare `zellij` yields one tab whose cwd is inherited from the
launching terminal rather than hardcoded anywhere.

Fixes the class, not the instance: there is no longer a project list to
go stale. Open project tabs on demand instead.

* feat(fleet): flag work that has aged, not work that is merely dirty

This repo already had a fleet health check. It did not prevent the thing it
looks like it prevents: on 2026-08-24 orangecat held 118 uncommitted files
and fleetcrown 88, both untouched for ten days — a finished EntityType rename
and a finished publishing workstream, each existing on exactly one disk.
`git-health` had been reporting them accurately that entire time.

The design error is worth naming, because it is easy to repeat: DIRTY IS NOT
A DEFECT. Every tree is dirty while someone works in it, so a count that is
equally true at minute five and at day ten carries no signal. It gets read as
noise, and then it stops being read. Age is what separates work in progress
from work that is going nowhere.

So stranded-work.sh reports only what has aged past a threshold (default 3d)
and prints NOTHING when the fleet is healthy. The silence is the mechanism,
not manners: a check that speaks on every shell gets muted, and a muted check
is an absent one. It covers both uncommitted files and commits that were made
but never pushed — the second is how four of fleetcrown's commits hid, since
a tree can be clean and still be holding everything back.

It cannot run in CI: the work it looks for has never left the machine, so
GitHub cannot see it by construction. It runs from .bashrc instead, printing
the last scan from cache and refreshing in the background, so it never costs
a prompt. `fleet-stranded` runs it on demand.

The deciding half takes TSV on stdin and touches no git, no filesystem and no
clock, so the tests drive the shipped rule rather than a restatement of it —
the drift the existing ratchet test comments already worry about. Both
failure modes are tested, because either one kills it: it must go red on aged
work, and it must stay silent on a fresh tree.

Writing the tests first paid immediately — the rename case failed, because
the porcelain prefix was being stripped after the "old -> new" arrow was
resolved, which ate three characters of every renamed path. orangecat's
rename touched 18 deletions and a rename; the guard would have misread it.

17 tests, wired into CI.

* chore: ignore per-session agent worktrees

_claude_autoworktree_enter creates .claude/worktrees/<name> per session, so
every concurrent session leaves a permanently-untracked directory behind. That
is scratch, not source, and it makes `git status` read dirty forever — the
noise that let 206 genuinely stranded files hide across this fleet for ten
days.

Scoped to worktrees/ rather than all of .claude/, so tracked settings and
CLAUDE.md are unaffected. Matches what threadkit already does.

* chore(git): ignore agent browser scratch globally, not in 18 repos

`.playwright-mcp/` is written by the Playwright MCP server whenever an agent
drives a browser. It had appeared in 9 repos and left 2 permanently dirty.

The first fix was a .gitignore line in all 18 — 18 diffs, 18 reviews, and a
19th repo that gets missed next month. But no contributor without this setup
ever sees the path, so it was never the project's business. One line in the
global ignore covers every repo, including ones not created yet.

Matters because a permanently dirty tree is the noise that lets genuinely
stranded work hide — the thing scripts/fleet/stranded-work.sh exists to catch.

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

* fix(fleet): the stranded-work guard could not see worktrees

Shipped this morning to find work that never leaves the machine. It scanned
$FLEET_ROOT/*/ only — so it missed the place this fleet does most of its work.

Every agent session runs in a `git worktree` under .claude/worktrees/, and
those hold real branches. Measured tonight, hours after the guard went in:

    26 unpushed commits across 25 locations, oldest 25 days

...while `fleet-stranded` reported two dirty files in dotfiles and nothing
else. fleetcrown alone held 9 branches, none of them pushed to origin. The
guard was not merely incomplete; it was certifying a fleet that had almost a
month of work sitting on one disk.

That is the failure mode named in this file's own header — a check that gets
read as "all clear" when it means "I did not look there" — and I built it into
the fix for it. A blind spot shaped like the dominant workflow is worse than no
guard at all.

Worktrees now report as `repo/worktree-dir` with their OWN branch, and the main
checkout is not double-counted as one of its own worktrees. Three tests pin it,
including that last one; all three go red with the scan removed.

Found while auditing fleetcrown for code debt — the audit's biggest finding
turned out to be in the auditor.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 20:24:44 +00:00
GandClaude Opus 5 b2f3817b6d feat(ci): absorb the deploy reconciler, unblocking the last two repos (#31)
fleetcrown and orangecat were the only repos excluded from the auto-merge
rollout, because their variants carried something the canonical did not: a
reconciler that actually SHIPS the base branch. Converting them without it would
have let merges land and never deploy — the exact failure the reconciler exists
to prevent.

Deployment is a RECONCILER, not a chain. A push made with GITHUB_TOKEN emits no
workflow_run event, and — one level deeper than anyone expects — neither does a
run that GITHUB_TOKEN itself dispatched, so nothing downstream ever wakes on an
automated merge. Observed on fleetcrown 2026-08-05: three PRs merged, main
green, ZERO Deploy runs created. Invisible, because CI itself ran and went green.

So instead of trusting a trigger, compare desired state (the base's tip) against
actual state (the last successful deploy) and close the gap. Self-healing by
construction: a deploy that never fired, or fired and failed, is retried by the
next sweep instead of leaving a commit merged-but-not-live.

OFF BY DEFAULT. DEPLOY_WORKFLOW is empty unless a repo sets it, so the twelve
repos already on the canonical behave exactly as they do today. Adopting a
reconciler must never start firing deploys in repos that never asked for one.

THE GREEN GUARD IS THE WHOLE DIFFICULTY, and it is not in the original. The
variant this came from EXITED on a red base, so reaching the reconciler there
proved the tip was green. This script deliberately does NOT exit on red — it
lets a PR that repairs the base through — so the same lines pasted here would
ship a tip whose CI is failing. Same code, different surrounding control flow,
opposite meaning. Hence `-z "${base_red_jobs}"`.

Five new tests, and the red-base one is mutation-proven: removing that single
condition turns it red and leaves the other ten green, so the guard is
load-bearing rather than decoration. The others pin that the reconciler is inert
when unset, ships a drifted green tip, does NOT re-deploy a tip already live
(otherwise it would redeploy the same commit every ten minutes, forever), and
does not stack a dispatch on top of one already in flight.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 18:50:11 +00:00
GandClaude Opus 5 ef95a78eb7 ci: give the weekly audit more than ten minutes to finish (#29)
The audit's timeout was set when it read one file per repo. It now reads
package.json, the git tree (to count test files), the workflow listing and every
workflow body — roughly 150-200 API calls across the fleet. Local runs take
10-15 minutes; the job was capped at 10.

A timeout that kills the sweep mid-flight produces NO report, on a weekly
schedule, for a check whose entire purpose is finding gates that quietly stopped
checking. It would have become an instance of the thing it audits.

30 minutes. The job runs once a week, so the ceiling costs nothing — it is a
backstop against a hang, not a performance target.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 16:40:34 +00:00
G b5eca684d0 test(ci): the sweep gets tests — rescued from the repo losing its copy (#27)
evig was the ONLY repo in the fleet with tests for auto-merge-sweep.sh, and
centralising its copy of the script would have deleted them. That is the worst
possible trade: consolidating the code while throwing away the only evidence it
behaves. The tests are as much a shared asset as the script, so they moved here
with it — ported from Jest to bash, since this repo has no JS toolchain.

They execute the REAL script against a fake gh on PATH, so they test shipped
control flow rather than a description of it. A stubbed re-implementation of the
guard would pass happily while the real script deadlocked, which is exactly what
happened on 2026-08-07: an Actions incident left main 'failure' with no failed
job, and the sweep refused every merge for ~14h while exiting 0 and looking
healthy.

Six cases, covering both directions — it must re-run a cancelled or infra-failed
base run, and must NOT re-run a genuine failure (retrying a real failure is how
a broken base gets merged onto anyway), must stop at the attempt cap, and must
still reach the PR loop when the base is green. A guard that never lets anything
through is an outage with better manners.

PROVEN TO GO RED: mutation-tested by disabling the re-run in a throwaway copy —
the two cases that depend on it failed, the other four held. A suite that has
only ever passed is indistinguishable from one that asserts nothing, which is
the exact failure this repo's other checks exist to prevent.

One bug found in the porting, worth naming because it is silent: `grep -c`
PRINTS 0 and also EXITS 1 when there is no match, so the obvious `|| echo 0`
appends a second zero and every numeric comparison dies with 'integer
expected'.
2026-08-16 15:51:44 +00:00
G 7c27770055 fix(ci): the re-arm list is SPACE-separated, and the doc said comma (#22)
The sweep does `for wf in $REARM_WORKFLOWS` — unquoted, so the value is
word-split. The reusable workflow's input documented it as comma-separated,
which would turn "ci.yml,deploy.yml" into ONE token, fail every dispatch, and
produce exactly one symptom: nothing deploys.

That is the worst shape a bug can take here. A push made with GITHUB_TOKEN
triggers no workflows, so the re-arm is the only thing that ships a merge — and
when it fails the sweep still exits 0, reports a successful merge, and looks
completely healthy. Merges land forever and never reach production.

Caught while piloting the first adopter (aslan-tattoo), whose existing workflow
passes 'ci.yml deploy.yml' — space-separated, as the script requires and as the
doc did not say.
2026-08-16 13:55:40 +00:00
GandClaude Opus 5 66cfcd7048 feat(ci): one canonical auto-merge sweep, callable instead of copyable (#21)
auto-merge-sweep.sh was copied into 22 repos and drifted into EIGHT distinct
versions, 245 to 404 lines. Three of them independently grew different fixes for
real outages, and each fix reached only the repo that wrote it:

  evig, revampit   infra-failure detection + re-run. An Actions incident left
                   main `failure` with no failed job at all (one cancelled, the
                   rest green); it stranded 11 PRs for ~14 hours.
  fleetcrown       DEADLOCK naming — a red base with the repairing PR sitting in
                   the queue was indistinguishable from "nothing to merge".
  the other 19     neither.

That is the whole argument for central code: the second repo to hit an Actions
incident had already been given the answer by the first, and never received it.
This is also the script that decides what ships, so the drift is not cosmetic.

WHAT THIS SHIPS

  scripts/ci/auto-merge-sweep.sh          the union of the three
  .github/workflows/auto-merge-sweep.yml  reusable (workflow_call), so a repo
                                          adopts ~10 lines instead of ~400

"TAKE THE BIGGEST FILE" IS NOT A MERGE STRATEGY, and I nearly shipped that. The
first attempt replaced this file with the 404-line variant, which looked like a
superset and is not: it is missing the GITHUB_STEP_SUMMARY reporting, the
stale-PR warning and the conflict warning that the 296-line version has. Ten
repos run that version. Picking by size would have silently deleted working
behaviour from all of them.

So the base here is the variant those ten repos already run, with the two
outage fixes spliced in. The diff is 106 insertions and ZERO deletions — no
repo can lose anything by adopting it, and 20 repos gain fixes written for
outages they have not hit yet.

Every repo-specific value is already an env var (GH_REPO, BASE_BRANCH,
CI_WORKFLOW, REARM_WORKFLOWS, MAX_RUN_ATTEMPTS), so there is nothing left to
fork over. The reusable workflow checks out THIS repo rather than the caller —
the sweep talks to the caller entirely through the API, so a repo's own contents
can never influence how its PRs get merged.

Verified: `bash -n`, YAML parses, and the merged script was run end to end
against a live repo with nothing to merge (maonakamoto/ai-ration) — it parsed
its config, resolved the base, listed PRs and exited 0.

NOT DONE HERE, deliberately: the other 21 repos still carry their copies. This
PR changes only this repo's sweep, additively. Rollout is mechanical once this
is proven in place, and doing 22 repos' merge automation in one step is how you
find out your merge automation is broken in 22 repos at once.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 13:51:05 +00:00
GandClaude Opus 5 fbfd6686a7 feat(shared): a registry, a generated inventory, and a duplication ratchet (#20)
The fleet does not have a knowledge problem about duplication. It has an
enforcement problem, and there is evidence for exactly that:

  orangecat/docs/architecture/adr/ADR-0002-rate-limiting-unification.md, dated
  2026-01-18, is still Status: Proposed. It names TWO rate limiters. There are
  now FOUR — the duplication grew AFTER the decision to unify was written down.

  templates/ci/README.md says "deliberately ONE central script, not a copy per
  repo". auto-merge-sweep.sh exists in 22 repos in 8 distinct versions, spanning
  11,787 to 19,344 bytes. A fix landed in one reaches at most 9 of them. This is
  the script that decides what ships.

Both were documented. Documenting is what failed. So this ships three things,
none of which is a document that can rot unnoticed:

1. SHARED.md — the registry. What exists (ai-forms, ai-ration), what is worth
   extracting next with counts, and — stated as explicitly as the rest — what
   must NOT be centralized: auth, DB schemas, and chat/form MARKUP. "Share
   everything" is its own failure mode; each app has to keep looking like
   itself, which is why ai-forms is headless and ai-ration ships no HTTP client.

2. shared-inventory.sh — the measurement, generated rather than maintained.
   Reads each repo's REMOTE default branch via the trees API, because local
   checkouts drift and have already produced a redundant PR and a nearly-dropped
   gate in this fleet.

3. The ratchet. `--check` fails when any count RISES. Nobody has to fix 87
   duplicated files today; the only requirement is to stop adding. A count that
   falls gets locked in with `--update`, and raising the baseline stays allowed
   — it just has to happen in a PR where someone sees it, rather than by
   accident.

Two decisions that keep the number trustworthy, both learned the hard way today:

  FORKS ARE EXCLUDED. `openclaw` is a fork of openclaw/openclaw — 1.5 GB of
  upstream. Counting it contributed 46 provider files, 7 loggers and 7 date
  utils that nobody here wrote and nobody here can unify. A metric dominated by
  somebody else's codebase measures nothing and gets ignored.

  A TRUNCATED TREE REFUSES TO JUDGE. The trees API truncates on huge repos, and
  an undercount would read as progress. --check exits 2 rather than certify a
  decrease that did not happen.

The ratchet's deciding half is pure text and is tested against fixtures with no
network (7 cases, wired into this repo's CI): it must go red on a rise and on a
new unmeasured concern, and must stay quiet on a hold, a decrease, and a concern
removed from the script. A ratchet that silently passes while duplication rises
would certify the thing it exists to stop.

The global CLAUDE.md now points at SHARED.md, so the check happens before the
code is written rather than in review afterwards.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 13:38:05 +00:00
GandClaude Opus 5 e27771b2bf feat(ci): audit the two UI defects only a rendered page can show (#19)
Both were reported by the operator in plain language, after every gate in
the repo was green: "i dont see it" (a link at 3.13:1 that was the only
route to a feedback report's screenshots) and "this area looks bad. not
aligned" (four stacked rows starting at three different x, 369/383/385,
with a wrapped line snapping back to 369).

Neither is visible to a unit test, a type check or a lint rule, because
nothing is wrong until the page is painted. So: one central auditor that
renders every fleet site, same doctrine as verify-floor-audit.sh — never
a check copied into each repo, because a copied check drifts.

  1. INVISIBLE ACTIONS — interactive labels below their WCAG AA floor.
  2. RAGGED STACKS — sibling rows at different x, and wrapped lines that
     do not align with the line above. Both come from one habit: an icon
     placed INLINE at the head of a line, shoving that line sideways by
     its own width and leaving a wrapped paragraph no hanging indent.

The site list is DISCOVERED from fleetcrown's public footer, which is the
fleet's own SSOT for "sites we run". A new site is audited the day it is
linked; a retired one stops being audited. Nobody edits a list.

Three measurement traps this had to get past, each of which produces a
confident wrong answer rather than an error:

- A single canvas paint composites a translucent colour against whatever
  is already there, turning the chips' oklch(1 0 0 / 0.04) overlay into
  SOLID WHITE and inventing failures on readable text. Colours are
  resolved to straight RGBA by painting twice and solving for alpha, then
  every translucent layer down to the first opaque ancestor is
  composited.
- getBoundingClientRect().left includes padding, so an element given
  padding-left to align it reads as unmoved. Positions come from a Range
  over the text node — which also yields one rect per rendered line, and
  that is how a missing hanging indent becomes measurable at all.
- An aria-hidden marker is explicitly NOT content, so it must not define
  where content starts. Without skipping those subtrees the audit
  measures the bullet instead of the label, every row reads the same x,
  and the misalignment the bullet CAUSES becomes invisible.

The first draft reported 88 defects across 14 sites and most of the
alignment ones were correct markup: a heading followed by consistently
indented items. A rule that fires on everything is as useless as one that
fires on nothing and costs more, because someone has to read it. The
signature of an ACCIDENTAL indent is a RETURN — the column goes out and
comes back (369 → 383 → 369) — where deliberate structure goes out and
stays (197 → 210 → 210). Plus a 4px floor, below which it is glyph
metrics, not layout. That took it to 50 real findings across 13 sites.

test-ui-defect-audit.mjs pins BOTH sides on inline fixtures: the real
fleetcrown bug is still caught, the fixed version is silent, deliberate
indentation is not flagged, and translucent chips are not called white.
The workflow runs it BEFORE the sweep — a detector that has quietly
stopped detecting reports a clean fleet, which is an absent check that
produces a ✓.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 13:29:47 +00:00
GandClaude Opus 5 772e51cc41 refactor(ci): one fleet audit, not two — fold the wiring rules into it (#18)
#16 added check-verify-contract.sh without noticing that verify-floor-audit.sh
already existed and already swept the fleet weekly. Shipping a second fleet
conformance checker is the exact duplication this repo's own README warns about
("deliberately ONE central script"), so the new rules move into the existing
audit and the duplicate is deleted.

The two were not redundant, which is why the rules survive the merge. The audit
asked what `verify` CONTAINS; the new rules ask whether anything RUNS it:

  ⊗ UNCALLED   the repo defines `verify` and no workflow invokes it
  ⊙ SOFTENED   the invocation carries --if-present, or `verify` disarms itself

botsmann is the case that proves they are different questions. Its `verify` was
perfect — format:check + lint + test + build — so the content audit correctly
reported it AT FLOOR while its CI hand-copied the same four steps with
--if-present on each.

The rules live in verify-predicates.sh rather than inline so they are testable
at all: the audit is remote-only by design, and a rule that can only be exercised
by a live API call is a rule nobody re-tests after editing its regex.
test-verify-predicates.sh (14 cases, run by this repo's CI) proves each rule
bites AND that conforming shapes are not flagged — a checker that cries wolf gets
ignored, which is the same end state as no checker.

AUDIT REMOTES, NEVER LOCAL CHECKOUTS. The deleted script swept working trees
under ~/dev, and that design was wrong in a way that cost real work: two of its
four findings had already been fixed on the repos' default branches and only
looked broken because the local clones were stale. It produced one redundant PR
(botsmann#134, closed — botsmann#133 had already landed the same fix) and one
that would have silently dropped `&& npm run check:tenant`, added to
sbb-lost-found's verify after that checkout was taken. The default branch is the
only ground truth about what actually defends a repo.

Run live against all 26 repos: reports 14 below the floor, including three
UNCALLED (aoz-housing, ai-ration, openclaw) that no previous check could see.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 11:50:57 +00:00
GandClaude Opus 5 9822958df6 feat(ci): enforce the verify contract, instead of only stating it (#16)
templates/ci/README.md has said it for a while: "verified" is defined ONCE, in
package.json `verify`, and CI runs it verbatim. Nothing checked that. The last
fleet audit checked whether repos DECLARED a verify script and found 21 of 21
did — which reads like success and is not, because a repo can declare a perfect
`verify` that CI never calls, or call it in a way that cannot go red.

Running the contract end to end across ~/dev found four real violations:

  botsmann         CI hand-copied verify's four steps AND put `--if-present` on
                   each, so renaming a script would have turned its gate into a
                   silent pass
  surf-your-life   CI linted with `--max-warnings 0` while the `lint` script did
                   not — `verify` on a laptop was WEAKER than the gate that
                   blocks the merge
  sbb-lost-found   `verify` softened itself from the inside with `--if-present`
  ai-ration        no CI at all

check-verify-contract.sh asserts all five links: `verify` exists, CI invokes it,
no `--if-present` on that invocation, no `continue-on-error` on that step, and no
`|| true` inside `verify` itself.

It is deliberately narrow. It does NOT flag `|| true` elsewhere in CI: that is
usually legitimate (cleanup, optional copies, jq parses with a fallback) and
flagging it produced nine false alarms out of nine here. A checker that cries
wolf gets ignored, which is the same failure mode it exists to prevent. The
first version also rejected `pnpm verify` — pnpm's idiomatic implicit-run — and
reported a conforming repo as broken; fixed, and now covered by a test.

The checker ships with negative tests wired into this repo's CI. Seven prove each
rule bites against a violating fixture; four prove conforming shapes are NOT
flagged. This is the point: the checker's first clean run said "all 21 repos
conform", and a gate that has never gone red is indistinguishable from one that
cannot.

The fixtures are plain directories containing an empty `.git` dir rather than
real repos — the checker only tests for `-d .git`, and running git inside a
throwaway tree has already destroyed a repository in this fleet once.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 11:10:02 +00:00
GandClaude Opus 5 a587cccee5 ci: audit the verify floor the templates already promised (#12)
templates/ci/README.md has defined "verified" since it was written: one
script, identical everywhere, verify = lint && typecheck && test, called
verbatim by CI. Nothing checked it, so it drifted. Running the audit for
the first time: of 24 JS repos, 12 are at the floor and 12 are not.

The split that matters is between two kinds of "not":

  FIXABLE (3)   the repo has the script, verify just skips it — one line
                sbb-lost-found (lint, test), datacat (test), evig (test)

  REAL WORK (9) no such script exists; ai-forms has no lint, truthseeker
                and reparaturbonus-zh have no tests at all, ivy-portal and
                printcraft neither typecheck nor test, design-tokens and
                prime-tower have no verify script

Adding a no-op "test" script would satisfy a naive floor, so the audit
refuses to conflate the two: a gate that does not exist is reported as
work, not as a lint error.

Deliberately ONE central script rather than a copy per repo.
auto-merge-sweep.sh was copied into 17 repos and now has at least 5 live
variants, so a fix landed in one reaches none of the others. Reading the
fleet remotely cannot drift.

Detection notes, all three learned by getting them wrong first:
  - a gate counts if verify CALLS a script named for it. That is what lets
    kivvi's "turbo lint" and datacat's "cd frontend && npm run lint" count
    without this script having to see through them; matching only tool
    names flagged 24 of 24 repos as failing.
  - it also counts if verify runs the tool inline, since fleetcrown calls
    tsc --noEmit directly and orangecat's script is spelled type-check.
  - repos are read on their OWN default branch: ?ref=main 404s on a master
    repo, and that means wrong ref, not missing file.

A fourth, found by the audit reporting every repo as broken: under set -u,
"local cmd=$1 out=$cmd" reads cmd before the same statement assigns it, so
the expansion helper aborted and returned empty — which reads as "no gate
found". Each local now gets its own line.

Scope, stated because it is easy to over-read: this audits the CONTRACT,
not whether each gate works. sbb-lost-found's lint script exists and has
never run — next lint prompts interactively against its flat config.

Runs weekly into the job summary. GITHUB_TOKEN reaches the 31 public
repos; the 3 private ones need a FLEET_READ_TOKEN secret to be included.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 14:00:05 +00:00
G 05fa0bd819 fix(ci): keep checks/statuses scopes when copying auto-merge to a private repo (#6)
This workflow is the copy source for ~20 repos. It omitted checks:read and
statuses:read, which a public repo does not need to answer the sweep's
statusCheckRollup query — so it worked everywhere it was tried, and every
place it was tried was public.

ivy-portal, the first private repo to run it, failed on every sweep with
'Resource not accessible by integration' and merged nothing, ever.
2026-08-07 06:52:24 +00:00
G 26492e606d ci: green PRs merge and deploy themselves (#4)
* ci: add the auto-merge sweep policy

* ci: green PRs merge and deploy themselves
2026-08-05 19:16:31 +02:00
GandClaude Fable 5 8b6c7ab90f ci: defend the template repo, and stop it handing out stale action versions (#2)
dotfiles defines what "a defended branch" means for ~26 repos and had no
.github/ directory at all — the source of truth for every gate was the one
branch with no gate. It had also drifted: it still handed out
actions/checkout@v4 and setup-node@v4 sixteen days after fleetcrown and
orangecat moved to v7, so every fresh copy re-introduced the old versions.

Templates bumped to v7 to match what the fleet actually runs (verified against
fleetcrown and orangecat, not guessed).

The new workflow checks the four things that make this repo trustworthy:
- every .sh parses (install.sh is what lands on a new machine; a syntax error
  there surfaces at the worst possible moment)
- every CI template is valid YAML (a broken template fails far from here,
  inside whichever repo copied it)
- both templates still call `npm run verify` — the template's entire premise
  is that "verified" is defined once in package.json and CI calls it verbatim;
  if that quietly stops being true the premise is gone
- no template pins actions/checkout or setup-node below v7 — the exact drift
  this commit is fixing, now impossible to reintroduce silently

Each gate prints a positive count of what it scanned, so "0 scanned" can never
again look like "0 problems" — the failure mode that let fleetcrown's design
gate pass for its entire life while scanning nothing.

All four verified locally before pushing: 9 shell scripts parse, both
templates parse, verify SSOT present in both, no stale pins.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 20:03:11 +02:00