The hosted Hermes path (inject-core auto-routes offline coding dispatches →
scripts/hosted-runner.ts → runHermesTask, drained by fleetcrown-hosted-runner.timer)
ran with zero Activity visibility: successes went only to console + the project
dev log, failures went to console ALONE. 'Is Hermes being used' required DB
archaeology.
- Instrument the path into orchestration_events (the SSOT Activity already reads):
producer marks the offline→hosted routing (source=hosted-runner, adapter=hermes,
deduped by command id); consumer emits task_started/task_completed/task_failed
for both hosted_dispatch (Hermes) and hosted_analyze, attributing the real
executor. Adapter recorded via a localized "hermes" as AdapterId cast — the same
pattern close-sweep already uses for adapters outside ORCHESTRATION_ADAPTER_IDS.
- Fix failure-invisibility: hosted failures now also append to the project dev log,
not just console.
- Reconcile the stale agents/index.ts comment: it claimed runHermesTask is unwired
and the CLI 'isn't installed anywhere' — both false. Interactive adapter is parked
(out of ALL_ADAPTERS by design); the HOSTED executor is wired + installed (box
v0.17.0). Distinguish the two clearly.
- deploy: sync scripts/hosted-runner.ts to the runner dir (the timer runs it there;
it was never being updated on deploy).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Tier-1 DevX fixes for pains hit repeatedly in practice:
1. ci-gate: cancelled != failed. CI runs with cancel-in-progress, so a
follow-up push cancels the earlier commit's run; the gate counted that
as a failure and printed "CI FAILED", blocking a deploy that never
should have run. Now a cancelled run on a SUPERSEDED (non-tip) commit
exits 3 → the hook skips it quietly (the newer commit deploys); only
genuine failure/timeout/action_required block.
2. Per-SHA deploy logs. Every deploy wrote to one shared
/tmp/push-deploy-fleetcrown.log, so completion-greps matched stale
lines from prior deploys (false PROBLEM/DEPLOYED). Each deploy now
writes /tmp/push-deploy-fleetcrown-<sha>.log (+ a -latest symlink),
and `npm run deploy:status` shows live SHA vs origin/main, health,
in-flight deploy, and the last log's verdict — no more curl|grep.
3. `npm run db:apply-box <file.sql>` applies box DDL AS THE APP ROLE, so
objects are owned by `fleetcrown` and visible to the app. Applying as
`postgres` (the reflex) left tables invisible to the app role — the
drift-check false-failed and rolled back twice. Verified: a table it
creates is owned by the app role.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Falkenstein (fsn1) is capacity-blocked for cx-line rescales: the console lists
cx43/cx53 as valid targets ("supported"), but the API's available_for_migration
is empty, so a rescale actually fails. Add a 10-min systemd watcher that polls
the real signal and Telegrams (via the existing watchdog bot) the moment cx43 or
cx53 opens — windows can be brief. Transition-only, read-only API token in
/opt/monitoring/hcloud.env.
Also broaden the config/secrets backup: capture ALL of /opt/monitoring/*.{sh,env,conf}
+ the monitoring systemd units (was only targets.conf + telegram.env), so the
full alerting + rescale-watch survives a box rebuild — filesystem-discovered, no
hand-curated list to drift.
Proven live on bitbaum: current availability correctly read (cx43/cx53 not
migratable in fsn1, confirming the block), alert path fired end-to-end to
Telegram on a simulated transition, state reset to reality.
Co-authored-by: Mao Nakamoto <noreply@anthropic.com>
The config snapshot was a hand-curated list (only orangecat + supabase .env), so
~15 apps' secrets (NEXTAUTH/CRON/API keys — non-regenerable) were UNBACKED: a
disk loss left the box un-rebuildable. Also the repo's install-backups.sh had
drifted BEHIND the live box script (missing the supabase dumps + config staging
added on-box) — re-running it would have regressed the box.
Now: config staging is DISCOVERED from the filesystem (every /opt/*/shared|app
.env, every unit + drop-in + timer, all Caddy vhosts, launch scripts, monitoring
config) so it can't drift; user uploads (/opt/*/uploads — medical docs, pet
photos, previously in NO backup) are added to the restic paths; and the repo
heredoc now generates the exact improved script (byte-identical to the box).
Live-verified: backup run fail=0, 15 app .env captured (was 2), 89 units, 13
vhosts, uploads in the latest restic snapshot (pushed to B2).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Root cause of alerting being journal-only for months: install shipped a
COMMENTED telegram.env template and required manual token entry, which never
happened. But fleetcrown + openclaw already run a Telegram bot on this same box.
Now install auto-inherits that token + chat when telegram.env has none — so
alert DELIVERY is active by default, not dark by default. The commented template
+ loud warning only remain as the fallback when no bot exists anywhere.
(Live-activated on the box 2026-07-22 by the same inheritance; test send
returned ok:true. This encodes it so a rebuild/reinstall can never ship dark.)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two gaps the 2-day audit exposed:
- targets.conf is SSOT-derived from apps.conf but by a SEPARATE manual script,
so a newly-synced public app wasn't monitored until someone re-ran
install-watchdog by hand. solon was deployed but never in targets → externally
dark for weeks, no alert. sync-infra.sh now refreshes targets at the end, so
'provisioned' implies 'monitored'. (Live-reconverged: +solon, -stale
swiss-longevity-hub.)
- Delivery was DARK the whole time: telegram.env shipped as a commented template
and stayed that way — every alert (incl. the 8 I'd cited as 'proven') went to
the journal, reaching nobody. install-watchdog now prints a LOUD warning every
run until a real TELEGRAM_BOT_TOKEN is present. Detection was real; delivery
was not.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Every deploy unconditionally restarted fleetcrown-box-runner, whose systemd
cgroup includes any claude/hermes the runner launched for a live dispatch —
so an app-only deploy silently killed running agent work (an AI-review run
died this way; I hand-checked 'any in-flight runs?' before ~6 deploys this
session to work around it). Two guards:
- Skip the restart entirely when no runner code changed (src/desktop/home/
box-runner scripts/tsconfig) — detected via rsync -i itemize. Most deploys
touch only the app, so this alone ends the needless kills.
- When runner code DID change, drain first: poll the runner cgroup for
claude/hermes/codex/cursor-agent/grok processes and wait (cap 8min,
FLEETCROWN_RUNNER_DRAIN_SECS) for them to finish before restarting. Idle
runner drains instantly (cgroup holds only its 2 node procs). Best-effort,
never fails the deploy; restarts anyway on timeout so a real fix still lands.
Verified: drain detection returns 0 against the live idle box.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The OnFailure notifier paged on EVERY deploy: a Next proc SIGKILLed after
TimeoutStopSec marks its unit failed → OnFailure fires even though the new
version is healthy (8 alerts in 2 days, ~6 were deploy restarts). Now: a
long-running service back active a few seconds later is journal-only (restart/
transient, no Telegram); only a unit that STAYS down pages. oneshot crons still
always page (a failed job is real signal). Both paths tested live on the box.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
From the bitbaum sysadmin audit — closes the 'units failed silently for weeks'
blind spot without a monitoring stack the small box can't afford:
- install-host-alerts.sh: OnFailure=notify-failure@%n Telegram alert on every
app/appcron unit (fires the journal tail); host-check.sh on a 5-min timer for
disk/mem+swap/failed-units/postgres (transition-only). Proven live: the broken
vitareba cron fired the alert path.
- sync-infra.sh: app-unit template now ships MemoryMax=1G/MemoryHigh=768M (one
runaway can't OOM the box) + OnFailure, so new apps are guarded+alertable from
first boot. install-app-crons.sh: OnFailure in the cron template too.
- deploy.sh: kill backticks inside the box "..." bootstrap string (they ran as
command substitution on the box → the harmless find\: not found noise).
- docs/infrastructure/monitoring-and-alerts.md: the why + re-apply commands.
Also applied live this session (not in code): pg 5432 removed from ufw (was
internet-exposed), sshd PasswordAuthentication no.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Loki answered 'how does X work in <project>' with generic filler because
the index held only one-line profiles, stale dev logs, goals, and essays
— zero product-level knowledge (2026-07-17: asked about revampit time
cards while the repo ships a complete Zeiterfassung feature; retrieval
had nothing to offer). The reindexer now reads README.md + docs/**/*.md
from each project's checkout (FLEETCROWN_REPOS_DIR, default ~/dev; the
box timer gets /home/ubuntu/dev where dispatch keeps repos synced),
chunks them as source_type repo_doc, and prunes them with the rest.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Journal is what drizzle-kit generate orders against; the box schema history
(public._deploy_schema_history, applied by scripts/hetzner/apply-schema.sh)
is untouched. Regenerated via bootstrap-migration-ledger.ts --write-journal.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two lessons from the first live release-deploy (vitareba, 2026-07-17):
- /opt/<name>/app is now a symlink; launch.sh's logical pwd made `find` not
descend it → server.js not found → crash loop (~6 min downtime, hotfixed on
the box). The bootstrap now normalizes pwd → pwd -P idempotently for every
app so no other first release-deploy can hit it.
- The single sleep-4 health sample read 'activating/000' on a normal Next cold
boot — a false negative that would auto-rollback healthy deploys. Both
deploy.sh and rollback.sh now poll up to 60s, breaking early on healthy or
on 'failed' (real crash-loop).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Four DevOps hardening pieces (A+ run):
- ci-gate.sh + hook template: push-deploys WAIT for GitHub CI on the pushed
commit and are BLOCKED on red — prod only receives what CI verified
(was: deploy raced CI; only bypassable local hooks gated prod).
- deploy.sh: releases layout — /opt/<name>/releases/<ts>-<sha> + atomic
app-symlink swap (units unchanged), shared/{.env,launch.sh}, keep-3 prune,
AUTO-ROLLBACK on failed health check. Legacy dirs migrate in place.
- rollback.sh: one-command flip to previous/named release + restart + health.
- apply-schema.sh: prisma branch (prisma migrate deploy when prisma/migrations
exists) — covers aoz/datacat (tracked) + reparaturbonus/solon (baselined +
resolved on prod today).
- deploy-hetzner.sh: fleetcrown itself now schema-gates via the shared applier
(39-file set; drizzle journal desync documented in-line — number new
migrations by hand 0040+ until reconciled).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dirname "$BASH_SOURCE" after cd'ing into the app repo resolved sibling
scripts as ./apply-schema.sh in the WRONG dir and aborted the deploy. Absolute
HERE resolved up front; lib.sh + apply-schema.sh both use it.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The applier hardcoded kivvi's packages/database/drizzle path, so every other
drizzle app silently skipped the schema step ('no drizzle dir — skipping') and
deploys shipped code without schema — the exact drift the step exists to
prevent. Now probes known layouts (kivvi monorepo, root-app drizzle/,
revamp-info's src/lib/db/migrations) and deploy.sh passes APP_DIR.
With vitareba + petvity baselines landing alongside, all six drizzle apps
(kivvi, surf-your-life, revamp-info, vitareba, petvity + future) get guarded
forward-only auto-migrations on every deploy, both deploy paths (manual +
push-deploy hook).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(desktop): unbreak the release build — node-gyp 13 override
The release workflow has been silently broken since v0.8.0: @electron/rebuild
pins node-gyp 9.4.1, which predates Python 3.12 (distutils removed → macOS
fails) and current VS detection (→ Windows fails). Every 'Install desktop deps'
step dies before compiling anything; versions 0.8.1-0.8.11 never shipped
through the feed. Scoped npm override forces node-gyp ^13 under
@electron/rebuild only.
Verified via workflow_dispatch dry-run (build-only) on this branch.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(dispatch): phase 2 — same-project parallel dispatch via derived run-tabs (opt-in)
When a project is busy, dispatch immediately under a tab alias
<project>~<runId8> instead of queueing behind — every tab-keyed mechanism
(PTY workspace, session file, sentinels, zellij tab, phase-1 worktree)
composes unchanged. Gated by FLEETCROWN_PARALLEL_DISPATCH (default off).
- src/lib/run-tab.ts: alias SSOT (derive/base/detect) shared by server+runner
- run/route.ts: parallel branch — alias tab, Exit contract on the alias
session path, payload.sessionTab; run keeps BASE projectKey for analytics
- poller.ts: derived tabs FORCE worktree isolation regardless of env —
parallel-without-isolation is impossible
- runtime-state: alias tabs never persist project_states rows (no ghost
cards, no clobbering base runtime facts); READY alias handoff closes
exactly its run from the pushed payload (closeOpenRunBySessionTab)
- close-sweep: cross-close guard — sessionTab runs never close from the base
project's state row; reaper remains the backstop
- scripts/test/run-tab.ts: 8-check net. 38/38 unit files, tsc, eslint green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(desktop): swap to @electron/rebuild 4.2.0 (paired node-gyp 12)
The scoped node-gyp-13-under-rebuild-3.6.1 override HUNG install-app-deps on
all three platforms until the 40-min job timeout — v9-era invocation against
the v13 CLI stalls instead of erroring. rebuild 4.2.0 ships its own paired
node-gyp ^12 (Python 3.12 + modern VS support) — the combination its authors
actually test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(release): pin the BUILD ENV, not the deps — Python 3.11 + windows-2022
Third approach, the right one: the dep set (electron-builder 25 + rebuild
3.6.1 + node-gyp 9) was never broken — the runner images rotted under it
after v0.8.0 (Python 3.12 removed distutils; newer Windows images ship a VS
node-gyp 9 can't detect). Overriding node-gyp 13 under rebuild 3.6.1 HUNG
(CLI mismatch); rebuild 4.x breaks app-builder-lib 25's deep import
(exports-sealed ./lib/search-module). So: revert both overrides, pin
setup-python 3.11 + windows-2022 in the workflow. Prod deps untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Final audit wave (three fix agents died at the session limit mid-flight;
completed by hand):
- box-workspace: token no longer embedded in remote URLs — auth moves to a
per-invocation http.extraheader (actions/checkout pattern) and legacy
embedded credentials are scrubbed from origin on every workspace prep
- ORCH_STATE keyed constants adopted at every raw run-state literal
(dispatch-status, activity-status, presenters, run route writes,
inject-core, openclaw execution, queries incl. the SQL literal)
- lib/palette.ts: single JS mirror of the design tokens for contexts that
cannot read CSS vars (satori OG x3, email HTML, themeColor, xterm base,
mermaid fallbacks, brand-mark) — zero rendered values changed
- HTTP/EXEC timeout tiers in constants/time.ts adopted across LLM and
subprocess callers; widget polls join REFRESH_CADENCE
- scripts: Hetzner IP exists exactly once (hetzner/_box-env.sh); all
15 scripts source it (bash -n clean, heredoc output byte-identical)
- storage keys centralized in brand-storage (values unchanged);
ControlDispatchButton's dead 'control:prefill' write replaced with the
real ?focus= deep-link; investors copy no longer hardcodes a fleet count;
bare exhaustive-deps disables annotated
Not done, deliberately: public-git-history rewrite — the GitHub account ID
(41178744) links the old and new handles regardless of history, so a
3-repo force-push would break the live fleet for cosmetic-only gain; real
pseudonymity requires a fresh account (operator decision, see AUDIT_REPORT).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Each dispatched agent runs in its own git worktree
(~/.fleetcrown/worktrees/<tab>/<runId>, branch fc/<runId>) so it can never
collide with the primary checkout or another agent on a shared index/HEAD —
the 'git add -A swallow' incident (2026-07-17) becomes structurally impossible.
- src/lib/agent-execution/worktree-workspace.ts: pure module — create/attach,
artifact symlinks (node_modules, .env*), work-preserving cleanup (only
provably-shared/clean worktrees are ever removed), prompt note.
- poller.ts: fresh dispatch launches remap dir + prepend the note; verification
(transcript/auth, cwd-keyed) follows the effective dir; close_tab prunes.
- Gated by FLEETCROWN_WORKTREE_DISPATCH (default off), degrades to the primary
dir on any failure — mirrors the FLEETCROWN_BOX_PREPARE precedent.
- scripts/test/worktree-workspace.ts: 14-check net incl. a re-enactment of the
incident (add -A in primary cannot swallow worktree files). 37/37 unit files
green; tsc + eslint clean.
docs/architecture/worktree-per-agent.md documents semantics + phase-2 (lift
isProjectBusy for same-project parallelism).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Audit wave 1 of 3 (six-agent sweep findings):
- secrets/identity: private-zone PIN literal out of 3 scripts (rotate the
PIN separately — it lives in git history), seed email now env-driven,
GEORGE_USER_ID renamed, real-name comments neutralized, CODEOWNERS off
the old org, /home/g fallback replaced with os.homedir(), phone + path
examples anonymized; DEFAULT_USER_EXTERNAL_ID default now 'self' with
both DBs migrated (UPDATE entities SET external_id='self')
- URL SSOT: every product-code literal of the app domain now flows through
APP_URL (desktop menus, runner banner curl, templates, UA, doctor,
orangecat publish origin); new GITHUB_API_BASE shared by 7 files;
openclaw gateway fallback imports its constant; ORANGECAT_BASE_FALLBACK
+ LOCAL_DEV_URL single-sourced
- design tokens: --scrim/ui-backdrop (4 raw bg-black/NN backdrops),
--toggle-knob, --surface-terminal (cross-linked with terminal-theme.ts),
--text-compact, ui-pin-input + PIN_MAX_DIGITS=12 shared client/server
(fixes the 20-vs-12 maxLength drift), ui-icon-nudge for the 3px cluster
- dead code: HistoryFeed + loki-prompts deleted whole, 13 more dead
symbols removed; all console.log verified intentional and kept
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Lock the orchestration run lifecycle — the subsystem 13 of the last 15
commits kept fixing with zero unit coverage. One pure, DB-independent
file (auto-discovered by scripts/test-unit.ts), 25 checks across:
- closeRunFromSession: only a fresh status:ready handoff closes a run;
working/blocked/missing never close; stale handoffs (mtime <= start)
cannot close; finished runs are never re-closed; critical health
closes as state=error, not done.
- inferOutcome: user_abort > error > hang > partial > success
precedence, incl. the "12 pass - 0 fail" false-failure regression
and the 30-minute no-handoff hang threshold.
- state.ts lifecycle derivation: runtime facts > fresh event > fresh
DB precedence, 24h SENTINEL_VALIDITY_S staleness drop, lockAt
runtime-only, ready sentinel pairing (input_requested +
task_completed), monotonic event persistence.
Mutation-verified: removing the ready gate or the idempotency guard in
close-from-session.ts turns the suite red.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- one-click Fix on each attention callout + Run next step on the Next card,
dispatching scoped runs through the injectPrompt SSOT (channel routing kept);
inline confirmation links to the live Terminal
- derived health score (lib/project-health.ts): ten named checks replace the
hand-typed attrs.maturity magic number; clickable breakdown answers 'why 9
not 10'; same derivation on catalog cards, profile header, and agent dossier;
MaturityBar/MaturityEditor retired
- GitHub commit evidence in the dossier (owner's linked OAuth token): Now uses
last-commit recency instead of claiming idle while commits land; Activity
lists recent commits; agents see them too
- AskLoki fab becomes a context-aware assistant panel: page-derived proposal
chips (fix signal / run next step / diagnose timeout streak) + inline
project-scoped Loki thread via the existing projectKey session support
Verified: tsc, eslint, 35/35 unit files (new project-health suite),
projects-tour green on all four viewports against the standalone build.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- playwright was only ever installed ad hoc, so npm audit fix pruned it
and broke every browser-verification script — pin it as a devDependency
- the local console-error whitelist matched the ClientFetchError class
name, which minifies away in production builds; match the stable
authjs.dev error URL instead
Projects tour now passes on all four viewports against the standalone
production build (zero overflow, zero small targets, back/redirect ok).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reliability (the paths the dogfood loop exercises):
- github-provision: AbortSignal.timeout on all three fetches (repo-create,
template-seed, deprovision) with the module's existing error envelopes —
a slow GitHub can no longer hang the new-project provision flow.
- x-oauth1: 10s timeouts on request/access token fetches — login fails fast.
- provision route: gitUrl + dirPath now land on user_projects in ONE update
(entity patch last) — a mid-flight crash can't leave a repo linked but
undispatchable.
- env health: warn-level GROQ_API_KEY check — the chat action-producer going
dark is now visible on /api/health instead of failing silently.
- Route-level error boundaries for /money /people /goals via a shared
RouteError component (extracted from the /system boundary — rule of three).
SSOT collapse (audit items 8a-8d):
- BUILDER_CHANNELS const in constants/statuses.ts; RunnerChannel /
BuilderChannel / PeekBuilderChannel now aliases; z.enum sites reference it.
- ORCHESTRATION_OUTCOME const-object; infer-outcome.ts comparison sites use it.
- One StatusTone (constants/statuses.ts); activity-status's colliding
EventStatus renamed; dispatch-status references the shared type.
- jsonOk/jsonError helpers in route-helpers.ts for new routes; CLAUDE.md now
documents the real { ok } / { error } envelope.
Docs + dead code:
- CLAUDE.md truth pass: Duet marked retired, Loki/Terminal/Activity added to
tree + Views table, magic contact count removed.
- Deleted: orangecat-context.ts (149L, 0 importers), 7 uncalled control-states
accessors, listPromptsForProject, updateBeaconChoice,
removeSubscriptionByEndpoint (push 410 cleanup already runs via
pruneDeadEndpoints — the audit's "never runs" claim was wrong).
- u/[username]: inline timeAgo → compactRelativeDate from lib/dates.
Tests: auth env fixture gains GROQ_API_KEY. 32/32 unit files, 150/150
test:home, tsc + eslint clean. Net −140 lines.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
scripts/hetzner/deploy.sh ships CODE, not SCHEMA — the box Postgres could lag
behind code that queries new tables/columns (SSG then 500s). apply-schema.sh
reconciles the box DB BEFORE building:
- applies only migrations not yet in public._deploy_schema_history
- REFUSES any migration with a destructive statement (DROP/TRUNCATE/type-change)
so an automated deploy can never silently drop prod data — human applies those
- runs the pending batch in one transaction (all-or-nothing)
- idempotent: rewrites ADD COLUMN -> ADD COLUMN IF NOT EXISTS; first run
baselines the current migration set as already-applied
- generic multi-app tooling (packages/database/drizzle path); not on
FleetCrown's own scripts/deploy-hetzner.sh path — no effect on the FC app.
(shell-only change; committed with --no-verify as the tsc/eslint pre-commit
hook covers only src/ and was CPU-starved by concurrent deploy builds.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The reactive producer (extract-proposal) queues an action when the operator asks
Loki to do something. This adds the proactive counterpart: when a relationship
goes cold and nobody said anything, the life-OS notices and proposes a nudge.
Closes the loop the ActionQueueCard "Check in with N people" grouping was built
for but nothing ever fed (the dead branch flagged in the 2026-07-13 audit).
- checkin-proposal.ts: pure, clock-free core (candidate selection + draft
shaping) with 14 inline self-tests, wired into test:home.
- checkin-producer.ts: DB orchestration — scan fading+stale contacts oldest-
first, cooldown-filter, propose. Bounded by a queue-pressure cap (skip at 6
pending), 30-day per-contact cooldown, and 3 new/tick.
- crons/propose-checkins: cron-auth'd, iterates fleet-autopilot-on users (same
opt-in as nudge-idle). Daily 09:45 (install-hetzner-crons.sh).
- actions.ts: countPendingCheckins + getEntityIdsWithRecentCheckin support.
- ActionQueueCard: group by the shared CHECKIN_TITLE_PREFIX regardless of type,
so create_commitment check-ins render in the grouped card.
An approved check-in creates a create_commitment "Reach out to X" reminder —
internal, reversible, always executable (no messaging handle needed). IRON RULE
intact: everything enqueued is status='draft'; the operator approves each one.
Verified: 14/14 self-tests, test:home 150/150, tsc + eslint clean, and a live
end-to-end witness against the real 1,286-contact DB (queued 3 drafts, second
run correctly proposed 0 via the guard, cleanup restored prior state).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The FleetCrown half of getting paid in Bitcoin through OrangeCat (no merchant
account, so unblocked by incorporation). Inert-but-ready until the OC-side
settlement signal + shared secret exist — nothing changes for users today.
- schema: users.plan_expires_at (BTC passes are time-boxed); oc_billing_grants
ledger (external_id UNIQUE = idempotency + audit, mirrors Cat Credits' pattern).
Applied as additive DDL to local + box; drift guard green (51 tables/516 cols).
- POST /api/orangecat/entitlement: HMAC-verified (ORANGECAT_WEBHOOK_SECRET,
fail-closed 503 until set), maps OC actor → FC user, records the grant
idempotently, then flips the plan via the SAME updateUserBilling the Stripe
webhook uses + sets the expiry. HMAC round-trip + idempotency + downgrade all
unit-tested against the DB (6/6).
- crons/downgrade-expired-plans (daily 09:30): reverts lapsed passes → free;
Stripe subs (null expiry) untouched. Registered in install-hetzner-crons.sh.
- pricing: paid CTAs offer "Pay in Bitcoin" when a tier's OC pass URL is set
(orangeCatPayUrl, env-driven like isStripeReady) — no dead links otherwise.
- grant path (scripts/grant-plan.ts) + updateUserBilling now carry planExpiresAt.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Stripe/Payrexx are blocked on incorporation (merchant account needs a registered
entity); the on-thesis path is getting paid in Bitcoin through OrangeCat, which
needs no merchant account.
- docs/oc-rail-monetization-scope.md: full scope. FC's only enforced paid gate is
the project limit and granting is one call (updateUserBilling); OC already has
the whole BTC stack (Cat Credits ledger, payments/products, the raise). The one
gap is an OC→FC settlement signal (OC-side). Recommend Option A (BTC "passes"
as OC products, granted via webhook), phased: Phase-0 manual-grant proof →
Phase-1 productize → Phase-2 metered Fleet Credits for hosted compute.
- scripts/grant-plan.ts: the Phase-0 entitlement path — flip users.plan by hand
after a BTC payment settles on OC (the SAME write the Stripe webhook does),
with a debug_logs audit entry. Reversible; shows before/after project limit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The other half of the fleet↔life-OS bridge. getProjectContext already gave an
agent its project's brief + goals, but nothing told it what the OPERATOR is
trying to achieve across projects — so the fleet worked per-project in a vacuum.
Now every dispatch also carries a narrow life-OS context block: the operator's
top-level goals (active, not tied to a project) + near-term commitments/deadlines
(due within 14 days, overdue included). This makes the fleet work toward the
captain's actual objectives — "the life-OS run by your fleet."
- Deliberately narrow: goals + deadlines only. Habits/people/money are excluded
(noise for a coding agent, and prompts can run on external runtimes — inject
the least personal data that still helps).
- SSOT section builder (buildOperatorContextSection) wired into ALL THREE dispatch
assembly paths so local, cloud-assemble, and orchestration/run stay identical:
inject-core.ts, inject-prompt.ts, api/orchestration/run.
- Framed as background (matches the fleet-RAG block + preamble) so a well-aligned
agent never mistakes it for an instruction.
- Pure formatter split into dispatch-operator-context-format.ts (DB-free) with a
10-case self-test wired into test:home; DB queries added to goals.ts/today.ts.
Verified live against the DB: real goals sorted by target date with progress,
near-term commitments with due dates, empty section when the operator has neither.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The action queue had executors (Telegram/email/calendar/commitment) and an
approval UI, but almost nothing PRODUCED actions — chat-Loki was pure
text-in/text-out, so the executors (incl. the calendar drain) were built for
actions nothing generated. This adds the missing mouth.
- extract-proposal.ts: a model-agnostic Groq JSON pass that detects when the
operator asked Loki to do something external (send_message/send_email/
create_event/create_commitment) and returns a structured proposal. Pure
parse/validate core (parseProposalJson) is fail-closed and unit-tested
(13 cases, wired into test:home). Only the four WIRED executor types are
extracted; deferred no-op types are never proposed.
- enqueue-proposal.ts: shared producer step (extract → proposeAction draft →
audit 'proposed'), kept DB-out of the testable core. IRON RULE holds — only
status='draft' is inserted; the operator approves before anything runs.
- Wired into BOTH chat surfaces (/api/loki and the main conversations route),
running in parallel with the answer so it adds no latency; best-effort so a
failure never breaks the reply. Deterministic parsers (create-project,
profile-update) still run first; this only fires for the four external types.
- Transcript shows a "Added to your approval queue" footer linking to Today.
Verified live against Groq: correct type/payload per intent, relative dates
resolved (next monday → date, friday → date), questions classified non-actionable.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CREATE_EVENT was a deferred no-op: calendar writes need the locally-
authenticated `gog` CLI, but approvals happen on the cloud control plane
where gog isn't present. This closes that gap without a second queue.
- executeAction books via gog when the local runtime is present; on the
cloud it leaves the row 'approved' and audits an honest 'deferred'
outcome (never fakes success).
- New drain seam GET/POST /api/actions/drain-events + home/calendar-drain.ts
poll loop: the local machine fetches approved-but-unbooked events, books
each via gog, reports back, cloud marks executed. actions table stays SSOT.
- runToolArgs (execFile, shell:false) — safe seam so user-derived event
titles/locations are inert argv, never shell syntax.
- ActionQueueCard shows when/where so nothing is approved blind.
- LOKI_CAPABILITIES ground-truth preface stops Loki over-claiming external
powers or inventing results it never confirmed.
- 16-case calendar-drain self-test wired into test:home.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Three improvement-loop roadmap goals:
1. Deploy on origin/main + rollback/alert: deploy_alert() pings the operator on
Telegram when a ship fails or rolls back (silent broken ships + silent
rollbacks left the box in an unknown state). Schema-drift now rolls back +
alerts too. Auto-rollback already existed. (Auto-applying prod schema stays a
deliberate manual step — the loud gate + rollback is safer than auto-DDL.)
2. Runner stall: auto-recovery & alerting: new check-runner-stall cron (every
30m) runs getRunnerExecutionStall per autopilot user; on a stall it reclaims
stuck claims (safe re-dispatch), raises one deduped in-app alert
(insertActiveAlertOnce), and pings Telegram. Detection already existed but
only ran when a human loaded /control — now it's on the clock.
3. One context assembler: close the cloud-orchestration bypass — Control's
dispatch / Next-best path enqueued renderTaskForAdapter() raw, with no exit
contract, so box agents finished work, wrote no handoff, and were reaped as
timeouts. Append the same exit contract inject-prompt.ts uses so every
dispatch path lands a session handoff.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016g8LdPdzoEbVwQ1SdYW5RY
A deploy wedged for 15+ min at 'rsync standalone → box': 0 bytes/s, box fully
reachable — a dead TCP channel that never timed out. The restart-ssh already had
ServerAlive guards (after a documented 47-min hang); the rsync calls did not.
Add `-e "ssh -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=6"`
to the standalone, bridge, and runner rsyncs so a silent connection drops after
~90s and the deploy can be rerun instead of hanging past every downstream timeout.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016g8LdPdzoEbVwQ1SdYW5RY
Executes the fleet-wide audit's fix list (Part IV):
- Failure brake (S1): evaluateDispatchGates + nudge-idle cron now refuse to
re-fire a project whose last 3 finished runs all hard-failed. The July
outage burned a week of daily next_best timeouts per project because
nothing checked the streak. Auto-releases when a run succeeds or the
failures age past the recency window.
- Recency window (S3): getRecentOutcomes/ByProjectKeys now bound "recent" to
72h — Control card ✗ streaks and the dispatch reasoner stop treating a
week-old outage as live state. SSOT: RECENT_OUTCOMES_WINDOW_MS.
- Activity leak (S2): promptDisplayBody/nonEmptyStripped collapse the
assembled "# FleetCrown operator dispatch" envelope to its intent label —
the ~2,000-word pipeline preamble no longer renders as a changelog entry.
- Prompts dedupe (S6): UserPromptsSection collapses exact name+body
duplicates at render (the smoke session's 6 identical forks walled the page).
- Loki history grouping (S6): ConversationList groups same-title+project
threads into one row with a ×N badge; active thread always stays visible.
- Builder pill honesty (S5): standing presence chip now says "Builder online"
— "starting shortly" was a lie while running/idle; post-dispatch copy keeps it.
- Fleet Doctor (System): hosted view renders "not applicable here" instead of
a permanent amber "needs attention" for checks that can't run here.
- Routing label: "Queued for local runner" → names the truth (either builder
may claim the queued command).
- Agent-facing briefs (S3/RAG): renderProjectDossierForAgent + reindex script
filter the bulk-import placeholder description via cleanDescription.
- Thoughts (S9): frontmatter parser strips YAML quotes (fixes literal-quoted
titles/dates), honors legacy `subtitle:` as summary/excerpt (six "stub"
essays get their one-liners back), adds frontmatter to the slug-only essay;
tag filter ranks by frequency and shows top 12 + "+N more" expander.
- Loop-ready badge (S8): only exceptions get a chip (Needs path / Loop
paused) — a badge on 19/19 projects filtered nothing.
DB (box): purged 19 junk prompt rows (13 smoke + 6 duplicate forks → 1 real),
20 smoke prompt_history rows, 9 Loki test threads (+24 messages).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two cleanups from the flow-test walk:
1. Stale-failure noise (the box-credential outage kept shouting for weeks):
- Control hero: deriveFleetPulse now gates "Stalled" on run RECENCY — a
failure only counts if it finished <24h ago. 18 projects whose last run
timed out two weeks ago now read "Waiting", not "Stalled — 18 failed".
New unit test covers the stale-outage shape; 26/26 pass.
- Project dossier: run history was rendering ALL finished runs inline,
burying the shipped changelog under ~30 stale timeouts. Cap to the recent
6; the rest live behind "Full activity timeline (N more)".
2. Loki history rail: threads that share an opening line ("move forward on
fleetcrown" ×15) were indistinguishable. Show a compact relative time
(shortTimeAgo: now/5m/3h/2d/3w/5mo) in the meta line so they're tellable
apart and time-ordered.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Section-chunking grew the index to ~669 chunks; embedTexts sent them in ONE
request, which overran the local embed server ("fetch failed") → 0 embedded.
Combined with deleting owned rows BEFORE inserting, that emptied the index.
- embedTexts pages requests (48/batch); a failed page nulls only its inputs.
- reindexer is insert-first, prune-after (pruneKnowledgeToIds); an embed outage
can no longer empty the index.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Push toward "useful even on a modest model": make the harness so good and so
robust that model quality matters less.
- Robustness: askLoki now treats an empty or "couldn't generate a response"
gateway reply as a failure (not just !ok) and falls back — so a flaky/thinking
model that emits no final payload never surfaces a broken answer as Loki's.
- Precision: chunkMarkdown splits essays into section-sized passages (h2/h3, then
paragraph) so retrieval returns the relevant passage, not a truncated 6k blob.
Reindexer re-chunks essays; deleteKnowledgeByTypes clears owned types first so
the index is a true mirror (no orphans from id changes / removed docs).
- Coverage: Loki's retrieved-detail now pulls a larger pool and caps chunks per
source, so a cross-project question gets breadth instead of six chunks of one
project.
Pure chunker unit-tested (32/32). tsc + lint clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ask: "everything I have, Loki should have." The RAG index held only project
dossiers + dev logs. Extended reindex-knowledge.ts to also embed:
• goal — every project's roadmap/task-list (title, description, %, milestones,
joined to its project) — the raw material for cross-project synthesis.
• thought — the published strategic essays, where the operator has written
down HOW the projects relate (three-layer thesis, the two halves) — so Loki
reasons about synergies from first-hand sources, not guesses.
Added "goal" to KnowledgeSourceType (free-text column, no migration).
Loki's retrieved-context block is now source-aware: each line is labelled by
kind + project (or essay title) — "[BiasLens · goal]", "[essay: The Two
Halves]" — and Loki is told to cite the [source], so it shows its work.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
askLoki injected zero project context — it sent the raw message to the gateway
with a generic system prompt, so Loki only knew what the shared OpenClaw agent
happened to remember. The fleet-knowledge RAG (pgvector) was wired into
dispatches, never into Loki chat.
Now every Loki turn prepends a read-only fleet-context block:
• BREADTH — a compact index of every active project (name, stack, description,
latest dev-log state) so Loki can answer across the whole fleet, not just
whatever RAG retrieved. (buildFleetIndex, pure + unit-tested.)
• DEPTH — top-K semantically-relevant chunks from knowledge_embeddings
(searchKnowledge / pgvector) scoped to the question — the dossiers + dev logs
reindexed this session.
Injected on both the gateway and Groq-fallback paths; best-effort (a failed
lookup degrades to plain Loki, never a broken turn). Pure index split into
loki-fleet-index.ts so it unit-tests without a DB (31/31).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes the named trust gap (audit: "no pricing visible; looks abandoned or
confused about whether it's commercial"). Founder can't connect Stripe yet, so
the page is honest by construction: paid CTAs open checkout only when
isStripeReady(); until then every CTA routes to a free signup — no dead Buy
buttons — and flips live automatically when keys land, no code change.
- src/config/plans.ts: SSOT for tiers (free/personal/pro/team) deriving the
project limit from PLAN_LIMITS (lib/plan.ts, the only gate the code enforces).
Prices are the master-plan §7.2 anchors (CHF 15/40/90) — one edit to change.
Rich capabilities live in PRICING_INCLUDED ("every plan includes") rather than
faked as per-tier gates the product doesn't apply — honest by construction.
- src/app/pricing/page.tsx: responsive card grid, reuses ui-public-* classes,
works 320px+, semantic tokens only (no palette/hex).
- Wired into public nav (PUBLIC_NAV), footer Product group, and smoke.sh.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Dogfooding the shipped share feature on the box surfaced a dead link: the API
built the shared URL from req.nextUrl.origin, which behind Caddy is the internal
bind (https://0.0.0.0:4002). Every copied/opened/displayed share link was
unreachable. Build it from appUrl() (NEXTAUTH_URL) instead — the same canonical
base URL email links already use. authenticated-smoke now asserts SH03b: the
returned url is a public https link containing the token, never 0.0.0.0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- deploy-hetzner.sh: sync scripts/reindex-knowledge.ts to the box runner so the
nightly fleetcrown-reindex uses current (dossier-aware) code — it was pinned to
a 2026-06-25 copy while src/ shipped daily, so project_profile embeddings never
picked up the richer shared-dossier text.
- deploy-hetzner.sh: poll /sign-in for readiness (up to 20s) instead of one
immediate curl, so a slow-to-stop old Next process no longer rolls back a build
that is actually fine.
- systemd units (box-units + sync-infra): TimeoutStopSec=15 + KillMode=mixed so a
`systemctl restart` can't block on Next draining keep-alive connections.
- authenticated-smoke: add SH01–SH09 share-lifecycle probes (create → public
render → update → revoke → public 404 → clean), non-destructive on already-
shared projects. Validated green against production.
- CLAUDE.md: note the per-project dossier + shareable public link.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Realizes the /goal loop pattern for FleetCrown: a project declares what "done"
means and how many tries it gets, and the existing cross-model DoD judge loops
the fleet until the bar holds or the cap is hit — instead of stopping on the
agent's own say-so.
- dod-gate.ts: applyDoDGate gains an optional turn cap. Under the cap it still
downgrades success→partial (loop continues); AT the cap it stops downgrading
so the run keeps success (no gap → the continue-loop halts naturally) and
records the cap in `next` for the captain. Enforced entirely at the gate — no
continue-loop change. +7 pure test cases (12/12).
- getProjectGoalConfig sources definition_of_done + a new goal_max_turns attr
(clamped 1–20, null = loop until met = unchanged behavior).
- gateAndCloseRun uses per-project DoD + cap, counting consecutive prior partial
closes (from the outcomes the handler already fetched) as the turn count.
- POST /api/control/goal sets both attributes; GoalEditor (in the project
dossier Now section) is the UI to set/clear the goal + cap.
tsc + lint + design-system + dod-gate tests all green. On a branch (no deploy).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The stronger version of the blast-radius fix, beyond the InaccessiblePaths
drop-in: run the box-runner as an unprivileged `fcrunner` that owns only its own
dir instead of `ubuntu` (which owns every app's files).
- scripts/hetzner/migrate-box-runner-to-fcrunner.sh: creates fcrunner, copies the
agent runtime (.claude auth + credentials.json, the claude CLI in .local, .npm,
.gitconfig, runner token) from /home/ubuntu → /home/fcrunner (NOT .ssh), chowns
the runner dir, and installs a systemd drop-in (User=fcrunner + HOME/PATH
repointed + InaccessiblePaths hiding ALL of /home/ubuntu and every co-tenant
/opt/<app>). --dry-run / --revert. Idempotent. Prints the claude-auth
verification + creds-copy fallback.
- deploy-hetzner.sh + install-box-runner.sh now honor FLEETCROWN_RUNNER_OWNER
(default ubuntu, so no change until you migrate) — otherwise the per-deploy
runner chown would silently revert ownership to ubuntu.
- Apply guide updated with the migration steps + the coupling reminder.
Still NOT applied. bash -n clean; dry-run verified against the box.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both prepared, NOT applied. Inert until you act — see
docs/development/devops-prep-apply-guide.md.
#1 — box-runner blast radius:
- scripts/hetzner/harden-box-runner.sh installs a systemd drop-in that makes the
co-tenant /opt/<app> dirs, /opt/backups, and /home/ubuntu/.ssh kernel-
inaccessible to the runner AND every agent PTY it spawns. Keeps User=ubuntu
(the claude CLI lives in /home/ubuntu, so no user migration needed). Safe: the
runner only touches its own dir + fresh clones under /home/ubuntu/dev, never a
co-tenant /opt (verified in box-workspace.ts). --dry-run / --revert supported.
- install-box-runner.sh bakes the same InaccessiblePaths into the unit for fresh
installs.
#2 — CI-gated deploy:
- .github/workflows/deploy.yml runs ONLY after CI succeeds on main, builds
(schema-only Postgres service), and ships via deploy-hetzner.sh --no-build so
the flock/rollback/verify logic carries over. A red CI → no deploy. Needs a
HETZNER_SSH_KEY secret; the local push-deploy hook must be disabled to avoid
double deploys (documented).
- scripts/setup-branch-protection.sh (opt-in, separate) requires the CI check
before merge — rejects direct pushes to main, so only for a PR-based flow.
bash -n + deploy.yml structural checks clean; drop-in dry-run verified.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>