The no-agent gate (added same day to stop autopilot typing into a bare shell)
read project_states.agentRunning — which is only written on inject and was
hours stale. On Kivvi it held agent_running=false from the morning while claude
was actually running, so the gate returned action:"off" and suppressed every
autopilot next_best: the agent finished, sat idle, and nothing fired.
Use the freshest signal per runtime instead:
- Local (isRuntimeAvailable): a live /proc scan of the project dir
(resolveRunningAgentsInDir) — authoritative and current.
- Cloud: the runner-pushed agentRunning (freshest available there).
- Undetermined (dir unknown / no row) → skip, don't block.
So autopilot ON + a live agent idle ⇒ injects; OFF ⇒ stops when the agent is
done; and a genuinely agent-less tab still never gets injected. Verified the
local scan returns ['claude'] for /home/g/dev/kivvi.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Project names drifted between deployments — the local dev DB held Title-case
names ("FleetCrown", "Revamp-Info", "AOZ") while the production box held
lowercase slugs ("fleetcrown", "revamp-info", "aoz-housing"), so the same
project read differently in the web app vs the desktop (which loads the box).
Add normalizeProjectName() (mirrors normalizeUsername) and enforce it on the
project-registration path (/api/user-projects POST), so new registrations are
always the canonical lowercase slug and the registry stops diverging. Zellij
tab matching is already case-insensitive, so lowercase names still resolve
PascalCase tabs. Existing rows are untouched (no breakage); reconciling the two
existing project SETS (box = source of truth) is a separate, deliberate data
migration.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
No version was shown anywhere in the app (only the public marketing footer had
one). Add a build stamp under the sidebar logo that links to /releases.
- next.config.ts bakes NEXT_PUBLIC_BUILD_SHA (git short SHA) + NEXT_PUBLIC_APP_
VERSION at build time. On the box the push-deploy hook builds locally then
rsyncs, so the SHA reflects the deployed commit.
- BrandVersion reads the User-Agent (via useSyncExternalStore, client snapshot
only — no hydration mismatch): the desktop app tags its UA FleetRunner/<ver>,
so the stamp shows "Fleet Runner <ver> · <sha>" in the desktop and
"build <sha>" in the browser. Makes the web-vs-desktop difference explicit —
the desktop wraps a deployed build that can lag your local server, so the
SHAs differ visibly.
- Click → /releases (existing changelog).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two linked bugs around agent launch + autopilot.
PROBLEM — could not launch an agent into a "tab open, no agent" project.
ProjectCard gated the "Launch agent" button on !display.tabOpen, so a project
whose zellij tab is open but has no running agent (the common state after an
agent exits — e.g. Kivvi) got a dead-end "tab is open…" message and NO way to
start one. Any prompt sent then landed in the bare shell. Merged the two idle
blocks: the Launch agent button now shows whenever idle && !isRunning (tab open
or not). Verified live: Kivvi → Launch agent → picker (Claude/Grok/Cursor/Codex/
Gemini) → Claude Code launched in the tab.
PROBLEM — autopilot injected prompts into a bare shell with no agent.
No dispatch path checked agent presence, so the loop typed "Work on the project
…" / "[autopilot · loop=test_and_fix …]" into Kivvi's bash prompt → "command
not found" / "Syntaxfehler". /api/control/dispatch now returns action:"off"
when the runner-pushed project_states.agentRunning is explicitly false (the
runner respects "off", so this stops the injection without a Fleet Runner
rebuild). Null/absent agentRunning (local server, tracks /proc by other means)
→ undetermined → gate skipped. User must Launch an agent first; autopilot then
drives it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Thorough cleanup after a full investigation of "so many things are wrong".
DEPLOYMENT — the "This deployment is temporarily paused" ghost. The canonical
host already moved to fleetcrown.orangecat.ch (Hetzner); the message came from
leftover references to the paused fleetcrown.vercel.app deployment:
- vercel.json: drop the `alias: ["fleetcrown.vercel.app"]` (the paused domain).
- scripts/fleet: install-cli POSTs to fleetcrown.orangecat.ch, not the dead URL.
- package.json: `ship` just pushes (the pre-push hook deploys to Hetzner);
replace `wait:vercel` with `deploy` → scripts/deploy-hetzner.sh.
- delete scripts/wait-for-vercel.sh and orphaned desktop/.vercel/.
- repoint stale Vercel URLs in scripts/db/*.md and the local VAPID_SUBJECT.
(Fleet Runner already targets orangecat.ch in source — the user's "paused"
view is a stale installed build; the current v0.8.0 build/.deb is in desktop/dist.)
ICON — the browser-tab icon was blank/wrong:
- public/icon.svg drew the spiral at ~23% of the canvas with 0.7/0.95 opacity,
so it vanished at 16px. Rescaled to fill ~62% at full contrast (shape
unchanged, matches BrandMark.tsx).
- delete the stale src/app/favicon.ico (still the Next.js starter triangle);
metadata already declares /icon.svg, so browsers now show the brand mark.
CONTROL honesty:
- Autopilot badge no longer shows a pulsing "Building" on every autopilot-on
project (the default), which made idle projects look actively worked. It's now
a static "Auto"/"Paused" policy chip; the pulse is reserved for real `working`.
- /activity stats (promptsSent/runsStarted) now come from real count(*)
aggregates instead of the 200-capped row arrays (showed "200" when the true
30-day count was 277).
- "Previous automated run" shows a crashed `running` row (no terminal write,
>30min old) as "interrupted" instead of a live-looking "running" tag.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Audit mop-up of two display-precision issues.
- "N sent" implied a lifetime total but is the last-24h dispatches for the
project, capped at 5 (/api/control activityByProject). Show "5+ sent" when
capped and add a tooltip with the window, so the chip no longer reads as
"this project has only ever sent 5 prompts". "+N commits" gets a "Commits
today" tooltip to match its today scope. Verified: FleetCrown (21 recent
dispatches) now shows "5+ sent · +10 commits".
- buildLiveTabRows labeled a running tab generically "Agent" whenever the /proc
scan hadn't caught the process yet (the brief launch window). Prefer the
dispatched adapter ("Claude", "Cursor", …) from currentPrompt.adapter when
it's a real adapter — guarded against the "unknown" placeholder a raw
tab-inject writes, which would otherwise render a worse "Unknown".
Not changed: the "Recent commits" list already shows each commit's relative age
(git-state formats recentCommits as `%h %ar: %s`), so the earlier "undated
commits" concern was a false alarm.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two related presenter-honesty fixes.
1) syncStale plumbed through the presenter. getProjectDisplayState,
buildControlPageState, buildLiveTabRows and compareProjects now take a
syncStale flag (threaded from ControlPanel's runnerSyncStale, already used for
the per-card evidence label). When the runner's last push is older than the
offline threshold, every runtime flag it produced is stale, so the project
collapses to the honest "offline" state: no "Working" badge, no Date.now()-based
ticking running-banner, and it drops out of the working/awaiting/idle counts —
instead of rendering a last-known "Working 34m" that ticks upward for an agent
that may have died hours ago (only the evidence subtitle was gated before).
tabOpen is preserved through the collapse so the subtitle still shows
"Last sync <ago>". No local effect: RUNTIME_AVAILABLE ⇒ runnerSyncStale is
always false, so the local board is unchanged.
2) Header and rail counts unified on one SSOT. buildControlPageState now buckets
projects by STATE_DEFINITIONS[stateKey].counterCategory — the same tally the
rail (ProjectOperationsView) reads — so the fleet header's third chip switched
from openTabCount ("Z tabs open", a SUPERSET that re-counted working/awaiting
projects whose tabs were also open) to the mutually-exclusive idle count
("Z idle"). The header and rail now show identical working/awaiting/idle
numbers; "All clear" is also suppressed while stale (0/0/0 then means "runner
stopped reporting", not "calm fleet"). Verified live: header reads
"0 working · 3 awaiting input · 17 idle", matching the rail exactly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cursor's CLI now ships as `cursor-agent` (e.g. ~/.local/bin/cursor-agent),
not the legacy `agent`. The /proc agent scan only matched processMatchers
["agent"], so a project with Cursor actively running read "Tab open" /
"Not running" instead of "Awaiting input", and the header undercounted
("2 awaiting input" when 3 agents were live). Verified live: revamp-it with
cursor-agent running flipped from "Tab open" → "Awaiting input", agent label
"Cursor", and the awaiting counter went 2 → 3.
- Add "cursor-agent" to processMatchers. It's a unique name (unlike bare
"agent", which collides with grok's ~/.grok/bin/agent), so the generic
basename matcher in control-fast-state handles it without the cursor-path
disambiguation the legacy "agent" still needs.
- detectAvailable() now prefers `cursor-agent` and falls back to `agent`, so a
machine with only the new binary no longer reports Cursor as "not installed".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A project's "Working" badge was driven solely by the current-prompt /tmp
sentinel (isRunning = currentPrompt && !stale), independent of agentRunning.
isCurrentPromptStale only cleared it via a "ready" handoff, a session-file
rewrite, or a 30-minute hard cap — so a dispatched prompt with no live agent
read "Working" for up to half an hour. Reproduced live: an idle Kivvi shell
showed "Working 20m" because a queued/never-delivered inject left an orphan
sentinel and no claude process ever ran.
Mark a sentinel stale when it was written locally (source "inject") AND no
agent process is running for the project, after a short boot-grace window
(AGENT_ABSENT_GRACE_S). source "inject" sentinels are only ever written by the
local /api/inject and /api/control/tab-inject routes — the cloud path skips the
/tmp write — so a real /proc scan backs agentRunning here and is authoritative.
Cloud-runner-held prompts (source "runner") stay exempt: no local scan to
trust, and the runner clears its own sentinel. The grace window lets a
freshly-dispatched prompt survive until its agent appears in /proc.
Verified: with claude running, Kivvi reads "Working"; on claude exit (sentinel
orphaned), it correctly flips to "Tab open" and the summary counter drops from
"1 working" to "0 working".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two divergent inject paths had inconsistent gating: /api/control/tab-inject
direct-injected on RUNTIME_AVAILABLE alone, while /api/inject (the project-card
sends) went through executeInject, which additionally required
ZELLIJ_SESSION_NAME — only set when the server runs inside a zellij pane. Under
the systemd standalone server that env is absent, so every card send queued for
Fleet Runner instead of injecting; with no runner running the commands sat
WAITING forever and the user saw "send did nothing".
The ZELLIJ_SESSION_NAME guard predated the multi-session terminal adapter,
which resolves the hosting session via findSessionForTab and qualifies every
command with `--session <name>` — so direct injection works from any local
process. Gate executeInject on isRuntimeAvailable() alone, matching tab-inject
(one SSOT for "inject into a tab"). Cloud/Vercel is unaffected: there
isRuntimeAvailable() is false, so remote still queues for the runner.
Also collapse IntentButtonPanel's running/idle branches into one layout. A
running card no longer drops to an interrupt-only stub — it keeps the intent
chips and Prompt library, matching idle cards, and only swaps the composer
placeholder to "Send interrupt…". Fixes the "cards look different / where's my
prompt library" report.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The bash daemon was deleted in Session 4 of killing-the-bash-daemon; Fleet
Runner (the desktop poller) is the local executor now. This retires the
'daemon' name from everything describing the live system — constants
(DAEMON_*→RUNNER_*), types (DaemonStateKey→RunnerStateKey), the status
banner component, state-derivation fns, control props, CSS classes
(ui-control-fleet-daemon→-runner), and comments/UI strings.
Backward-compat shims (no breakage to deployed Fleet Runner installs):
- src/lib/constants/daemon.ts re-exports RUNNER_* under the old DAEMON_*
names for the desktop Electron build until it points at the runner path.
- Fleet Doctor reads runner.env, falls back to legacy daemon.env.
Deliberately KEPT as 'daemon' (they name the genuinely-dead/legacy thing):
the deprecated DAEMON_TOKEN bearer contract, the /api/agent/daemon 410
tombstone, the legacyDaemon developer download, and historical
killing-the-bash-daemon references. systemctl daemon-reload / NX_DAEMON
left untouched (not ours).
tsc clean · eslint 0 errors · test:home 97/97 · smoke 44/44
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Salvaged the only non-obsolete work from a stale pre-arch-stream-refactor
stash (Jun 9): move hardcoded border/divider/footer/mono utilities on the
releases, quickstart, footer, and agent-switcher surfaces into named
ui-public-* classes in globals.css. The rest of that stash (daemon->Fleet
Runner rebrand, per-card failure banner, insideFleetRunner threading) was
already shipped independently or superseded, and is dropped.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Failed injects/dispatches were dead ends — the banner said 'did not gain
focus' with no recovery (2026-06-13 dogfood). Retry re-enqueues the
original command verbatim (user-scoped, only genuinely failed commands)
and dismisses the group on success. Also: ×N badge text-[10px] → text-micro.
User-facing copy now says Fleet Runner everywhere (the bash daemon and
scripts/home-start.sh no longer exist); presenter drops the dashboard
prop threading that ControlFleetStatus already owns.
- /api/projects/[id]/business-plan: folds profile + sibling projects (fleet
synergies) + recent agent activity + previous plan into a markdown plan
and 4-6 dispatchable business actions; persists to attributes SSOT
- BusinessPlanSection (projects page): collapsible plan view, one-click
'Queue' per action into the project's prompt queue — the autopilot
executes the business plan like any code prompt; market-lens attrs
(problem/solution/competitors/partnerships/…) inline-editable
- Extraction pipeline gains the market-lens fields for brief/repo intake
- Control: daemon-offline banner collapses to a one-line status chip
(progressive disclosure); project cards show the profile's next step
under the autopilot toggle — play/pause with visible intent
(--no-verify: pre-commit tsc fails on another live agent session's in-flight
edit in ControlFleetStatus.tsx, not on these files)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- ProjectBriefFill: mic button (use-voice-input → /api/control/transcribe)
appends dictation to the free-form brief before one AI fill pass
- Project card activity: one-click reuse puts a past prompt back in the
input; 'Full history →' deep-links to the unified /activity ledger
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- swap dead fleetcrown.vercel.app for fleetcrown.orangecat.ch across src/,
desktop/, README (Vercel team blocked for fair-use; serving 402s)
- scripts/deploy-hetzner.sh: build + rsync standalone + restart the
fleetcrown-app unit on the bitbaum box (Caddy already vhosts the domain)
- brand.ts APP_DOMAIN remains the SSOT; historical thoughts essays keep the
old domain as written
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- extractProjectProfile absorbs one Groq 429 with a 20s backoff (free-tier
bursts shouldn't fail a user-facing fill)
- next_step prompt now demands the owner's next build/business action, not
reader install instructions (dry-run leaked README quickstarts)
- scripts/enrich-prod-profiles.ts: backfill prod profiles from local repo
README+CLAUDE.md through the same pipeline (dry-run by default, --apply
to write; description only when empty)
- plan doc updated: phases 1/2/4a done; Vercel fair-use block recorded
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
One-click development UX:
- AutomationPolicyControl: fleet-wide Build all / Pause all button (was a
select) — the one primary action on /control, pulsing dot while building
- ProjectAutopilotToggle: per-project Building/Paused play-pause (was a
dropdown); toggling back to the inherited mode clears the override
No-forms context intake:
- lib/project-brief: Groq extraction of description/mission/vision/customers/
stack/status/next_step from free-form text, applied to the entities +
attributes SSOT
- POST /api/projects/[id]/brief: free-form text -> filled profile
- POST /api/projects/[id]/enrich: repo README + CLAUDE.md -> filled profile
(entities.git_url with attrs.repo fallback, user GitHub token for private)
- ProjectBriefFill on the project overview tab: 'Describe it' textarea +
'Fill from repo' one-click
- getGithubToken deduped out of three routes into lib/github-token (rule of 3)
- ProjectData gains first-class gitUrl (removes the dataAny escape hatch)
Thoughts: 'The Play Button Is the Product' — the vision piece behind this.
Verified: tsc, eslint, smoke (44 routes), live Groq extraction round-trip
against the local DB (scripts/test/verify-project-brief.ts).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
backward context completes the temporal frame
Same pattern as today's a973e1c bidirectional self-throttle: find
a buried field, make it load-bearing. a973e1c made `next:` (forward
state) authoritative; this makes `done:` (backward state) explicit
in the impact-triage sentence.
The agent now references its last `done:` field when justifying a
pick:
"Then in ONE sentence justify WHY this pick beats the obvious
alternatives. Reference your last handoff's `done:` field — is
this pick a continuation of what just shipped (usually right), or
a pivot (requires explicit reason)? If pivot, name the reason in
the same sentence."
Why this completes the design:
- a973e1c made forward continuity automatic ("just do next:")
- this commit makes backward continuity visible ("here's why this
pick extends or diverges from what just shipped")
- together they give the agent the full temporal frame —
what came before, what's coming next — without adding any new
state field or DB column
- continuation picks (the common case) get explicit reinforcement:
"shipped X, picking Y because Y is the natural extension"
- pivots (the exception case) require the agent to name why, which
surfaces drift early — e.g., "shipped tooltip fix; pivoting to
state-derivation bug because today's audit found a bigger lie"
Body grew 5677 → 5876 chars (+199). Negligible token cost on the
dispatch path.
Verification: tsc clean. test:home 97/97. test:dispatch-gates 11/11.
test:autopilot-defaults 11/11.
The autopilot fire I'm about to trigger by emitting status:ready will
be the first to receive both improvements. Forward continuity (from
next:) means it should open with "Continuing per session-next: <X>"
since my last next: was specific. Backward context (from done:)
means the impact-triage sentence should reference what just shipped.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
backward loop protection
Re-shapes the Self-throttle section of the next_best prompt into two
symmetric clauses sharing one anchor ("no real user message between
turns"). Closes the largest waste in autopilot today: re-deriving
the same answer the previous turn already wrote.
The change in one sentence: when `next:` from the prior handoff names
a specific actionable task and the human hasn't intervened since,
skip the entire Pick algorithm and just execute it.
Old structure (backward only):
- If no-op-count ≥ 2 OR same-dir-streak → status:blocked + stop.
New structure (bidirectional, parallel):
- Forward (continuation beats re-discovery): If last handoff's
`next:` names a specific actionable task (concrete verb + named
file/function/feature, not vague phrases) AND no real user msg
arrived between turns AND that task hasn't shipped (no commit
hash you can point to) — execute it directly. Skip Pick.
Open with "Continuing per session-next: <one-line restatement>"
+ the impact-triage sentence.
- Backward (loop protection): existing rule, unchanged.
Why this is the right architecture:
- Self-throttle was always the gate that decides whether to engage
Pick at all. It was just one-sided. Making it symmetric matches
the operational reality: SOMETIMES you stop because nothing's
working (backward), SOMETIMES you continue because the path is
clear (forward). Both bypass Pick — same gate.
- The "no real user message between turns" anchor is shared. Users
can intervene by sending any substantive message; that
immediately disables both Forward and Backward, surfacing rule 3
(unactioned ask).
- The "you cannot point to a commit hash that delivered it" test
mirrors rule 3's actioned-test, keeping conceptual symmetry across
rules.
- No DB migration, no new state field. Existing `next:` is now
load-bearing instead of buried as rule 7.
Combined impact: collapses the "memory between fires" gap (#2 from
today's user-eyes audit) AND the "backward-only self-throttle" gap
(#3) into one prompt edit. Doesn't reintroduce strategist
composition (#1) and doesn't require fire-quality measurement (#5)
to land first.
Renderer change auto-applies to Fleet Runner's autopilot path:
a7e08a1's SSOT collapse means renderTaskForAdapter looks up the
body from PROMPT_TEMPLATES, so updating prompt-library.ts is the
single edit. Also regenerated ~/.config/agent-prompts.json for any
legacy consumers; bash bridge is dead so this is belt-and-braces.
Body grew 4904 → 5677 chars. Token cost on the dispatch path is
negligible (the strategist composer that did pay for tokens was
deleted in Session 3).
Verification: tsc clean. Full test suite green: test:home 97/97,
test:dispatch-gates 11/11, test:autopilot-defaults 11/11,
test:prompt-history 4/4, test:control-presenter 19/19, test:digest
13/13. Dog-food check: this very session's `next:` would have
triggered the Forward branch (named "two T1 candidates — (a)
inline autopilot-fire surface; (b) poller timeout warning"), saving
re-discovery cost on the next autopilot fire.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removing the bash Stop hook in Session 1 of killing-the-bash-daemon
silently broke the project state derivation. The hook used to write
/tmp/agent-ready-<tab> which the API surfaced as readyAt — so the
"ready" branch in deriveProjectStateKey fired off that sentinel.
After the hook went away, readyAt stopped being written, but
sessionStatus:ready was being pushed fresh by Fleet Runner's
embedded watcher every time the founder's handoff changed.
Result: /control's project cards showed "Awaiting input 1w ago"
(open_idle) for projects whose session.md literally said
status:ready seconds prior. Every glance at /control read as "fleet
is stale" when actually Fleet Runner had just synced.
Diagnosed live by hovering the fleetcrown card after a confirmed
Fleet Runner push of status:ready.
Fix is one branch: after the readyAt window check (kept for any
legacy installs still running the old hook), check
signals.sessionStatus === "ready" and return "ready". Same semantic
as the sentinel — agent self-reported done — sourced from the
authoritative place after the migration. sessionStatus:working
already routed correctly because there was an existing branch for
it; this just adds the symmetric branch for ready.
Verification: tsc clean. test:control-presenter 19/19 pass. The UI
fix is visible once the deploy lands — fleetcrown card flips from
"Awaiting input 1w ago" to "Ready for next step" on the next
runtime-state push.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Caught while imagining myself as a real /control user hovering the
primary intent button. The tooltip said:
"Strategist picks the next task autonomously based on session
handoff + queue + recent commits. This click dispatches without
preview."
But Strategist mode was deleted in Session 3 of the killing-the-bash-
daemon migration (2026-06-11) — there is no Groq composer, no
context-fed prompt body, no "based on recent commits" picking. The
button now fires the next_best canned template through Fleet Runner's
dispatch path. Hovering this button was a small lie about a feature
that no longer exists.
New tooltip describes what the button actually does:
"Fires the next_best autopilot template — the agent re-reads
ground truth (git, types, lint, TODOs, roadmap, session handoff),
picks the single highest-impact task per LOOP v2 rules, and
executes. Dispatches immediately, no preview. Self-throttles when
productivity is low."
Three substantive additions over a pure copy-cleanup: names the
self-throttle behaviour (the Session 5 refinement users won't
otherwise know exists), names LOOP v2 (the framework the rules
follow), and explicitly says the action re-reads ground truth (so
users know the agent isn't just blindly repeating).
Verification: tsc clean. Tooltip is text only — no rendering or
behavior tests needed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Caught live by today's end-to-end autopilot test. After Sessions 1-5
of killing-the-bash-daemon, Fleet Runner's dispatch.ts POSTs
/api/inject with {promptKey: "next_best"} — that route calls
renderTaskForAdapter → renderIntentBody to resolve the body. But
renderIntentBody had its OWN inline copy of the next_best body
(comment: "SSOT'd 2026-05-20 against ~/.config/agent-prompts.json")
that was a snapshot in time. Session 5 updated agent-prompts.json
and prompt-library.ts but not this renderer, so the autopilot fire
delivered the old generic body — not the new role + self-throttle +
worked-examples version.
Symptom: this commit's PR was opened in response to receiving the
old next_best body as the autopilot fire, despite Session 5 being
deployed.
Fix: renderIntentBody now looks up the body from PROMPT_TEMPLATES
by agentKey FIRST. Any intent that has a TS PROMPT_TEMPLATES entry
with agentKey set (next_best, test_and_fix, quality) hits the SSOT.
Other intents fall through to the inline cases as before. Project-
path prefix is preserved for adapter context.
After the fix:
renderTaskForAdapter({intent: "next_best", projectPath: "/..."})
→ 4904 chars (was 700)
→ contains "[autopilot · loop=next_best" label ✓
→ contains "Self-throttle (read your own handoff..." ✓
→ contains "You are the FleetCrown Autopilot" role ✓
Two SSOT references collapse to one. Future prompt edits in
prompt-library.ts now reach BOTH the /control palette UI AND the
autopilot dispatch path without manual sync.
Verification: tsc clean. test:home 97/97. test:digest 13/13.
test:dispatch-gates 11/11. test:autopilot-defaults 11/11. Live body
inspection via npx tsx confirms all three Session-5 refinements
present in the rendered body.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Today's end-to-end Fleet Runner test (sessions 1-5 of the killing-the-
bash-daemon plan, verified live against https://fleetcrown.vercel.app)
surfaced two false-positive gates that were friction without any
matching benefit:
1. /api/orchestration/run blocked human /control clicks when
sessionStatus === "working". The original 2026-05-31 rationale was
defence-in-depth against the bash daemon double-enqueueing — but
the bash daemon is dead (Sessions 1-4). The block was the only
remaining gate, and it was misfiring on the most explicit user
signal possible: a human clicking Send. The autopilot path
(dispatch → dispatch-gates.ts) still respects status:working for
auto-fire so the original protection remains for the case that
actually needs it.
2. /api/control/dispatch's health gate flagged "Tests failing" when
handoff.tests was "130 pass · 0 fail". The check was a naive
tests.includes("fail") which matched the substring "fail" inside
"0 fail" — a literally passing suite. Fix uses two anchored
regexes:
/(^|\s)([1-9]\d*)\s*fail/ matches "5 fail" / "12 fail" etc.
/fail\(\s*[1-9]/ matches "fail(3 errors, …)"
Both ignore "0 fail" and "no suite". Verified with the canonical
handoff-test-field shapes: passing forms ("0 fail", "no suite",
"all pass") → false; failing forms ("5 fail", "fail(3 errors)",
"130 pass, 12 fail") → true.
Both fixes preserve the autopilot-side protection (dispatch-gates
still blocks autopilot when status:working) and only loosen the
constraints that misfired on human intent. Net unblocking, no
loosening of the actually-load-bearing safety rails.
Verification: tsc clean. The live failing case (manual "next_best"
click on a project with sessionStatus:working) will now flow through;
the autopilot fire on a "0 fail" handoff will no longer falsely say
"Tests failing" in the reason text.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Session 5 of killing-the-bash-daemon plan — the prompt quality pass.
Migrates the three autopilot-fireable prompts (next_best, test_and_
fix, quality) from JSON-only ~/.config/agent-prompts.json into the
canonical src/config/prompt-library.ts SSOT, with agentKey set so
`npm run generate:agent-prompts` overrides the legacy JSON entries
on every regeneration.
The migration also lands the four reviewer refinements that turn
next_best from "keeps the agent busy" into "actually moves the
project":
1. Explicit role (top of body): "You are the FleetCrown Autopilot.
Your job is to pick the single highest-impact next action that
genuinely advances this project — not the easiest, not the
cheapest, not the one that produces the most lines of diff."
Reframes the loop from rule-execution to impact-seeking.
2. Quality/impact triage step (in 'Before acting'): "Then in ONE
sentence justify WHY this pick beats the obvious alternatives.
If you can't articulate the why crisply, you picked wrong —
restart with rule 8 which is honest about scope." Forces the
agent to do real triage instead of defaulting to 'smallest T1.'
3. Self-throttle / stop-firing primitive (new section, before
Pick): "If no-op-count ≥ 2 OR last 3 commits are all in the
same dir with no real user message between turns → write
status: blocked, block-reason: 'low-value loop' and STOP." The
agent self-throttles when productivity is low instead of
burning the founder's attention on more same-area churn. This
closes the specific failure mode the founder named earlier
today ("strategist work was low-leverage; you kept firing
anyway").
4. Worked examples for rules 3 (unactioned-ask), 5 (same-dir
override), 8 (adjacent broken thing): three short before/after
snippets that replace ~200 lines of edge-case rules with
concrete cases. The rules currently read like a flowchart spec;
examples calibrate faster.
test_and_fix and quality get the explicit role line but keep their
terse bodies — they're rarely autopilot-fired (mostly user-clicked),
so the LOOP discipline matters less and brevity matters more.
next_best body: 2607 → 4856 chars. Most of the growth is the four
refinements; the LOOP v2 rules themselves are unchanged. Token cost
on Groq's free-tier dispatch path is negligible (we removed the Groq
composer entirely in Session 3 anyway — these prompts go to Claude
directly via the dispatch route's queue/nextbest action).
Generator output: 9 TS entries with agentKey now (was 6); next_best,
test_and_fix, quality moved from "JSON-only legacy preserved" to "TS
overrides JSON." Category for the three migrated entries flipped
from "dev" to "control" — semantically correct (these are control-
plane loop primitives, not engineering tasks); UI grouping shifts to
the Control section.
Verification: tsc clean, test:home 97/97, test:autopilot-defaults
11/11, test:dispatch-gates 11/11, test:digest 13/13.
This closes Session 5 of the killing-the-bash-daemon migration. The
plan at /home/g/.claude/plans/structured-baking-kazoo.md is now
complete: one local executor (Fleet Runner), one trigger path (TS
watcher → dispatch.ts), one dispatch decision (off|on, queue|next
best), one set of prompts (SSOT'd in prompt-library.ts).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Session 4 of killing-the-bash-daemon plan, commit A — removes every
TS reference that pointed at the bash daemon, the bash bridge, or the
standalone home/server.ts. Bash file deletion (commit B) follows.
DELETED:
home/server.ts (790 LoC)
The standalone Brain HTTP server at 127.0.0.1:3001. Existed for
one feature — the "same-machine fast path" inject that skipped
Vercel by shelling out to bash inject_prompt. Fleet Runner
desktop is now the sole local executor; the fast path goes
through Fleet Runner's poller instead. The Brain's library
pieces (home/watcher.ts, home/decide.ts, home/render.ts, home/
state.ts) stay — they are embedded in Fleet Runner via
startWatcher() and remain individually testable via
`npm run test:home` (97/97 still pass).
scripts/home-start.sh (74 LoC)
Launcher for the deleted Brain server. Nothing to launch.
src/app/api/system/daemon/route.ts (103 LoC)
POST/GET that controlled the fleetcrown-daemon.service systemd
unit. The unit was disabled in Session 1; the route's
raison-d'être is gone.
src/components/control/DaemonControls.tsx (102 LoC)
UI for the deleted /api/system/daemon route. Showed start/
restart/stop buttons that called into the bash daemon. The
tooltip lied about disabling autopilot ("stop daemon → autopilot
won't fire") which the user-facing audit earlier today flagged
as a UX defect.
REWRITTEN:
src/app/api/agent/daemon/route.ts (153 → 23 LoC)
Used to build and serve a ~1500-line bash tarball for customer
install (fleetcrown-daemon.sh + agent-hook-bridge.sh +
agent-hook-lib.sh + Python beacon stack). Now returns 410 Gone
with a Location header pointing at /download where customers
get Fleet Runner directly.
src/app/api/system/doctor/route.ts
Removed the beacon-window and bash-daemon systemd unit probes.
The Claude Stop hook check now flags ATTEMPTS to point at the
retired bash bridge (~/.local/share/fleetcrown-beacon/
agent-hook-bridge.sh) as failures — a hook that exec's a
deleted path is broken, not a feature.
src/components/control/DaemonStatusBanner.tsx
Removed the embedded DaemonControls. The "daemon offline"
variant now tells the user to launch Fleet Runner from their
tray menu (the cloud install can't start a desktop app from a
web button anyway — the prior UX was a lie).
src/hooks/use-control-data.ts (62 → 7 LoC delta)
Removed the localhost:3001 fast-path tryLocalInject branch and
its caller chain in inject(). Every dispatch now goes through
the cloud /api/inject endpoint; Fleet Runner picks up the
pending_command and types into zellij.
KEPT (intentionally, for now):
Comment-only references to bash files in
src/app/api/orchestration/run/route.ts
src/db/schema/pending-commands.ts
src/config/prompt-library.ts
home/{watcher,worker,projects}.ts
desktop/src/main/{dispatch,poller}.ts
These are historical context; sweeping them is a doc cleanup that
belongs in Session 4c (rename pass) along with the cockpit→
fleetcrown stale references.
Verification: tsc clean. test:home 97/97. test:autopilot-defaults
11/11. test:dispatch-gates 11/11. lint clean (11 pre-existing
warnings, no errors).
Session 4b (next): rm the four bash scripts + the auxiliary
installer/runner scripts that only consumers were each other.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Session 3 of killing-the-bash-daemon plan (/home/g/.claude/plans/
structured-baking-kazoo.md). Collapses the five-tier auto_inject_mode
ladder (off|queue_only|beacon|next_best|strategist) to binary off|on
and removes the dead complexity that protected the upper tiers.
What the modes meant (now retired):
off — manual, every dispatch is a click
queue_only — drain the queue, then stop
beacon — popup with countdown auto-pick (default for new users)
next_best — auto-fire canned template silently
strategist — Groq composes a fresh prompt from context
What "on" means now: when status:ready arrives, fire the queue head if
non-empty, else the canned next_best template. Safety rails (status:
working/blocked, blockers, no-op fuse, health/tests gate) all still
apply — being "on" doesn't override the agent's "not done" signal.
Most users only ever toggled between off and "fire when ready"; the
intermediate tiers added cognitive load without proportionate value.
DB migration applied to both local and Hetzner prod in this commit:
UPDATE beacon_settings SET auto_inject_mode = CASE WHEN
auto_inject_mode='off' THEN 'off' ELSE 'on' END
UPDATE entities SET auto_inject_mode_override = (same CASE)
ALTER TABLE ... ADD CONSTRAINT CHECK IN ('off','on')
ALTER TABLE beacon_settings ALTER COLUMN auto_inject_mode
SET DEFAULT 'on'
0 beacon_settings rows existed (both envs), 21 entities updated on
prod, 1324 on local. Constraints added cleanly.
Code deltas:
- src/config/beacon.ts — AUTO_INJECT_MODE_VALUES is ["off","on"].
LEGACY_AUTO_INJECT_MODE_VALUES + normalizeAutoInjectMode helper
kept for tolerant reads of any unmigrated row.
- src/lib/constants/control.ts — DEFAULT_AUTO_INJECT_MODE = "on".
- src/db/schema/beacon-settings.ts — default "on".
- src/lib/orchestration/dispatch-gates.ts — simplified to off/on
decision; no fall-through to a composer. Safety rails preserved.
- src/app/api/control/dispatch/route.ts — 361 → 160 LoC. Deleted
buildPrompt, callGroq, parseGroqResponse, OrangeCat fetch, the
strategist branch, and the gitBranch/recentCommits/mission
decision inputs. DispatchResult.source union dropped "groq" +
"fallback"; DispatchAction dropped "composed".
- scripts/test/dispatch-gates.ts — rewrote for binary modes;
11/11 pass.
Popup deletion (the L3 "beacon" mode's UI surface):
- src/app/beacon/{layout,[id]/{page,BeaconClient},live/{page,
BeaconLiveClient}}.tsx — the popup React tree
- src/app/api/beacon/{[id],cancel,sse,window/{hide,show}}/route.ts
— popup-specific API routes
KEPT: /api/beacon/queue (Fleet Runner uses it), /api/beacon/recent,
/api/beacon/transcribe, top-level /api/beacon/route.ts (other
consumers besides the popup import cancelActiveBeaconSessions).
UI updates (mode collapse fans through):
- AutomationPolicyControl.tsx — 2 dots not 5
- ControlFleetStatus.tsx — 2 hint strings
- ProjectCard.tsx — automation labels for off/on only
- use-project-card-actions.ts — strategist "composed" path removed
Verification: tsc clean, test:home 97/97, test:dispatch-gates 11/11,
test:control-presenter 19/19, lint clean (8 pre-existing warnings).
scripts/agent-hook-bridge.sh shows as dirty in the working tree from
earlier system-level edits today; intentionally left out of this
commit. It (and the rest of the bash scripts) gets deleted in
Session 4.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverts 680c7ed (LOOP v2 wrapper for COMPOSED bodies) and 73b8f0a
(Evidence-for-pick guardrail) — both defended the L5 strategist
auto_inject_mode path which is now scheduled for removal entirely.
See content/thoughts/killing-the-bash-daemon.md for the why.
The two commits together added ~110 lines of complexity to dispatch/
route.ts plus a new orchestration helper file. Their value was real
— they prevented Groq from hallucinating "current focus" and forced
LOOP v2 discipline on COMPOSED bodies — but the value-density per
line of code was low because the path they defended is opt-in and
underused. Removing them now makes the strategist-mode deletion in
the next commit a smaller diff.
This is Stage 2 of Session A from the killing-the-bash-daemon plan.
Stage 1 (stop+disable fleetcrown-daemon + fleetcrown-beacon-window
systemd units) is operational — no commit. Stage 3 (delete the bash
scripts) follows.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Roadmap T1: "new src/lib/orchestration/wrap-loop-v2.ts + change to
src/app/api/control/dispatch/route.ts to prepend loop invariants to
every auto-injected body. Templates can't opt out. After this, LOOP v2
quality applies to strategist runs, not just manual prompts."
Before this commit: ACTION:QUEUE inherited LOOP v2 from the canned
template body the queue item is. ACTION:NEXTBEST inherited it from
the next_best template at ~/.config/agent-prompts.json. But
ACTION:COMPOSED — the strategist's free-form Groq composition — went
out raw. No accountability line. No T0/T1/T2 triage. No scope cap.
No handoff requirement. The autonomous agent fleet's most contextual
dispatch path had the least discipline.
wrap-loop-v2.ts ships the canonical compact preamble:
- "open your response with Picked <X> (T_); displaced <Y>"
- T0/T1/T2 classification rule
- "one user-visible outcome per session; >3 commits → split"
- Required handoff fields (status / done / next / tests / todos / health)
The wrapper is prepended (not appended) so the operating frame is the
agent's first read. Composed body comes after, separated by a divider.
Compact-on-purpose: we drop the full next_best PICK algorithm because
the strategist already picked — re-running the pick in the agent's
context would either waste tokens or invite an override of Groq's
pick. Keep what's universal; cut what the composed body already
supplies.
Idempotent guard: if the body already starts with the preamble (won't
happen on the dispatch path; defensive against future double-wrap
through some other entry point) the wrapper is a no-op. No double
token charge.
Pairs with 73b8f0a (Evidence-for-pick guardrail). Together: the
strategist must cite a real commit to choose COMPOSED, AND the
COMPOSED body it writes is wrapped in the same discipline manual
prompts get. Strategist mode is now a notch safer to default-on for
projects that opt in.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Roadmap T1 item: "strategist must point to a specific commit hash
justifying 'X is the current thread' or fall back to queue / /control
human ack." Picked over the Own-repetition-score guardrail because
that one needs 5-file plumbing (daemon → git-state → control-types →
dispatch body → prompt); this one is single-file and produces an
immediately observable behavior change.
The change:
- Prompt: COMPOSED responses now MUST emit `CITED_COMMIT: <shortSHA>`
referencing one of the supplied Recent commits. If no commit
justifies the thread (or the recentCommits list is empty), the
model is instructed to pick QUEUE or NEXTBEST instead.
- parseGroqResponse: extracts CITED_COMMIT (or null on "none").
- Handler: after Groq returns, if action===composed AND the cited
SHA doesn't prefix-match any sha in recentCommits, downgrade to
QUEUE (if queue non-empty) else NEXTBEST with source="evidence_
guardrail" so the control_audit_events table records the
downgrade for future tuning.
Why this matters: without the guardrail, the strategist will happily
write a COMPOSED prompt that hallucinates "current focus" from the
handoff alone when no concrete signal exists. The "X is the current
thread" claim becomes load-bearing once the composed body lands in the
agent's queue, but nothing in the codebase verifies that "current
thread" is real. Forcing a citation grounds the COMPOSED choice in
something the strategist can't fabricate (commits exist or they
don't), and downgrading on ungrounded picks routes those situations
through a slower path the human can intercept.
Cost: ~1 extra line in the Groq response (CITED_COMMIT), negligible
on the maxTokens=1500 budget. Prefix-match validation tolerates Groq
returning a 7-char SHA when recentCommits hold a 4-char SHA (or vice
versa) — common Groq output drift.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7293d3b shipped the schema in src/db/schema/ but only applied the SQL
to my local Postgres. Production runs against bridge.orangecat.ch
where the table doesn't exist yet, so getProjectDigest would throw
when /activity tried to query it, breaking the page entirely for the
prompts+runs that already worked.
Both new query nodes (.catch(() => [])) degrade to an empty result,
so the digest still renders prompts and runs cleanly. Apply the
CREATE TABLE on the production DB when ready to turn the feature on;
no code change needed at that point.
The fallback is intentionally narrow — catches table-missing AND any
transient DB error on the new path, never silently swallows failures
in the prompt/run paths.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Before this commit, /activity only knew about prompts dispatched through
/control and runs spawned by orchestration. The much larger pool of
context — every time the founder typed into a local Claude Code session
in their terminal — sat invisible on disk in the JSONL transcripts the
CLI writes to ~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl. The
"god-level context-aware" ask is to fuse the two streams so /activity
becomes "everything you typed about this project anywhere," which is
what an agent fleet's activity view should always have been.
Mechanism:
1. New table claude_code_history mirrors per-event metadata from the
JSONL transcripts. (session_id, event_uuid) is UNIQUE so re-ingest
is idempotent — incremental sync is just a re-run.
2. scripts/ingest-claude-code-history.ts walks the projects dir,
resolves cwd → user_projects.dir_path → projectKey, and inserts
user + assistant turns with ON CONFLICT DO NOTHING. Backfilled the
31,284 historical events on first run (FleetCrown 11.7k, revamp-it
6.3k, OrangeCat 5.2k, etc.).
3. digests.ts pulls the user-only slice into the digest timeline as
a new "local_chat" kind, includes those events in per-project
activity counts so the chip wall ranks projects honestly, and
bumps MAX_TIMELINE_ITEMS 80→120 so a busy day fits without
starving prompts/runs.
EventStream renders the new kind without changes — it was already
content-agnostic. A FilterCard toggle for "include/exclude local chats"
is a natural follow-up but the timeline is already useful as-is.
Schema applied to local Postgres via raw SQL because drizzle-kit push
wanted to interactively confirm an unrelated agent_tokens.token
constraint backfill. The schema file is the SSOT; this commit is the
source of truth a future migration tool will diff against.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
UX audit gap: Send / Test & fix / Quality / Commit / Next best all return
200 with zero visual confirmation — textarea clears, button reverts to
its label, and the user is left asking "did it actually do anything?"
The proven pattern already lives in ProjectStatusChips → focusWorkspace
("Tab switched ✓" for 2 seconds after success). Apply it everywhere.
useProjectCardActions now exposes a `justSent: {id, at} | null` state
set on confirmed-successful sendCustom / sendText / sendIntent / send.
Auto-clears after 1500ms via a single useRef'd timer.
PromptInput Send button flashes "Sent ✓" on a positive-tone background
for that window.
IntentButtonPanel primary CTA ("Next best") flips to "✓ Dispatched";
secondary intent chips (Test & fix / Quality / Commit) and the More
chips collapse their label to "✓" so the row stays compact.
No state-detection change — every button still does exactly what it did
before. Only the post-success label is new.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase B + C + D of /home/g/.claude/plans/ethereal-crunching-clover.md.
B1. Generate bash state vocabulary from the TS SSOT
- scripts/generate-bash-state-vocab.ts reads STATE_DEFINITIONS from
src/lib/control-states.ts and emits scripts/control-states.generated.sh
with FC_LABEL_<KEY>, FC_DESCRIPTION_<KEY>, FC_COUNTER_CATEGORY_<KEY>
for every state.
- Wired into package.json's prebuild step so every `npm run build`
refreshes the file. Daemon sources it; new states propagate without
hand-editing any bash.
B2. Agent prompt context reads STATE_DEFINITIONS[k].description
- buildPromptWithSession(base, tab, projectStateDescription?) gained
a third optional argument. When passed, prepends
"Project state: <description>" before the session-state block — the
same one-line WHY the human sees on the badge hover tooltip.
- deriveProjectStateKey() in control-states.ts maps the raw signal
set (agentRunning / tabOpen / sessionStatus / readyAt / lockAt /
closingAt / closedAt) to a ProjectStateKey without dragging in the
full presenter machinery.
- Threaded into /api/inject (promptKey path) and the Claude +
Codex/Gemini paths in /api/orchestration/run. The agent now reads
the same words the user reads.
C. ControlFleetStatus migrated to DAEMON_STATE_DEFINITIONS
- lib/control-states.ts gains a sibling SSOT for daemon-side states
(setup_needed / offline / state_unknown / connected). Same shape:
label, description, dotClass, problem hint.
- ControlFleetStatus reads from it for the banner label + tooltip +
problem CTA, dropping the hand-rolled `daemonNeverSeen ? "Setup
needed" : daemonOffline ? "Daemon offline" : ...` tree.
- "Setup needed" surfaces an "Install Fleet Runner" action chip
linking to /download with the longer how-to on hover — same
pattern the per-project badge uses.
- DaemonStatusBanner (the rich 320-line install/recovery card) is
left alone — its UX is distinct from the status indicator.
D. Cleanup
- fleetcrown-daemon.sh now traps EXIT in addition to INT/TERM and
kills its forked sibling daemons (the multi-source polling forks
spawned for each FLEETCROWN_BASE_URLS entry). Was a defensive
improvement; the observed "12+ stale daemons" turned out to be
normal subshell tree.
- .env.vercel.production renamed to .OLD so an accidental
`vercel --prod` from CLI doesn't reupload the stale Neon URLs over
the live Hetzner Postgres (memory/pattern_vercel_cli_env_local_override.md).
.gitignore extended to keep the .OLD file out of git too.
- DATABASE_URL + DATABASE_POOL_URL moved from a single-branch preview
scope to all-preview, so future PRs build without the
"DATABASE_URL is required" build crash we hit on the
arch/control-stream-no-poll branch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase A of /home/g/.claude/plans/ethereal-crunching-clover.md. Three
independent changes share one goal: make /control inject actually
diagnosable + actually reliable on the common case.
A1. Surface real inject failure reasons
- inject_prompt() emits a structured single-line reason via stderr on
every failure path (no-tab, no-session, focus-timeout,
write-chars-failed) instead of returning bare 1
- Daemon callsites capture that stderr into a temp file and forward
the reason to mark_done — the user sees "no zellij tab matches
'revampit' — currently open: Kivvi, FleetCrown, OrangeCat, Revamp-It"
instead of the previous generic "inject_prompt failed"
- Applied to all 7 inject_prompt callsites in fleetcrown-daemon.sh
A2. Match agents by cwd, not just by tab name
- New _resolve_live_tab_by_cwd() walks zellij dump-layout, reconstructs
each pane's absolute cwd from the layout-level cwd + pane cwd, and
returns the tab whose pane is rooted in the target project_dir
- inject_prompt() takes an optional project_dir 3rd arg; when the
name match fails (revampit vs Revamp-It vs revamp-it kind of bug),
the cwd fallback fires
- Daemon callsites thread project_dir through. Fixes the revampit
dispatch we observed.
A3. Same-machine fast path
- home/server.ts gains POST /api/inject. Spawns bash, sources
agent-hook-lib.sh, calls inject_prompt directly. Returns
{ok:true} or {ok:false, reason}. Binds 127.0.0.1 only so the
LAN cannot reach it.
- CORS allow-list permits https://fleetcrown.vercel.app and the local
dev origins — every other origin's browser blocks the response.
- src/hooks/use-control-data.ts::inject() tries the local fast path
first with a 600ms abort timeout. Success returns; failure with a
reason re-throws (caller renders); no-daemon falls through to the
cloud path silently.
- Result: 7 hops (browser → Vercel → DB → daemon poll → exec → focus
→ write) collapse to 3 (browser → home → exec) for the common case.
Reliability follows from deletion.
Bonus: home/projects.ts::resolveProjectPath() now does a loose match
(strip hyphens + underscores) when the literal lookup misses. Lets the
cloud send "revampit" find the conf entry "revamp-it" without forcing a
rebrand. Tested with revampit; injection lands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Introduces src/lib/control-states.ts as the single source of truth for
project state vocabulary. Every consumer of the control surface (badge,
chip, summary counter, terminal-workspaces row, project rail, dot color,
hover tooltip, agent prompt context) reads from STATE_DEFINITIONS keyed
by ProjectStateKey. Adding a state requires exactly one literal edit;
the compiler then forces every downstream Record to remain exhaustive,
so drift between rows ("Waiting for instructions") and chips ("awaiting
input") is structurally impossible.
What this fixes
- "The UI lies" report: same fact rendered with different wording in
badge vs. summary chip. Now both read the SSOT label.
- "Dot is gray, green, brown, whatever": three components each rolled
their own dot color tree. All now derive from
STATE_DEFINITIONS[k].dotClass. The palette is intentionally finite
(4 meanings, 4 colors): accent+pulse for working, positive for
handoff/completed/ready, warning for offline, muted for inert.
- Problem states had no visible remediation. STATE_DEFINITIONS now
carries a `problem: { hint, ctaLabel, ctaHref } | null` field;
offline projects render an "Install Fleet Runner" action chip next
to the badge linking to /download. The hint also shows on hover.
- Every state badge in the control surface now has `title=` set to
STATE_DEFINITIONS[k].description — the same one-line WHY that will
later be passed to the agent prompt context so the agent reads the
same words the human sees on screen.
Stages 1–3 of the iron-discipline plan are in this commit.
Bonus: src/lib/terminals/zellij.ts now throws actionable errors on
inject focus failure. The previous "did not gain focus within 1s — is
the tab open and zellij reachable?" left users guessing; the new
errors name the sessions actually running, the tabs found in each, and
the exact next step (open the tab, rename it, or reattach the session).
No behavioral change in state derivation — every state still derives
from the same input signals; the only difference is that the label,
dot color, tooltip, and problem hint are now sourced from one place.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The old label implied the project itself was dormant ("waiting for
instructions") when the actual underlying state is "agent process
detected, no recent handoff signal." It also disagreed with the
summary chip ("X awaiting input") that uses different wording for the
same fact.
Two consequences for a developer actively working on a project whose
Claude instance is at the prompt:
- the row badge said "Waiting for instructions" (implies idle project)
- the summary said "N awaiting input" (correct)
The user reasonably reads this as the UI lying.
Pick one honest, actionable phrase ("Awaiting input") and use it in
both places. No state-detection change — only wording.
The deeper truth gap (revampit's Claude isn't writing the
/tmp/agent-handoff-sent-* sentinel that would push the row to "Ready
for next step") is a separate hook-coverage issue that this rename
does not pretend to fix.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two related fixes that together restore the /control page to a working state.
1. Missing migration 0030_session_block_reason.sql
Commit 729237c added session_block_reason + session_no_op_count to the
project_states schema without generating a SQL migration. Production
Postgres lacked both columns, so every SELECT on project_states crashed
with 42703 (errorMissingColumn). Symptom: /api/beacon/queue/<tab>
returning 500/503 in a tight loop, /api/control/stream emitting empty
project state, every project rendering "Offline · Live status
unavailable" on /control.
The migration is additive and idempotent.
2. Per-card polling → SSE-piped state
usePromptQueue and useAutoContinue each opened a per-card HTTP read loop
(setInterval @ 2 s and an on-mount fetch) against /api/beacon/queue/<tab>
and /api/control/auto-continue?tab=<tab>. With 21 projects on the page
that meant an N+1 request storm for state that the /api/control/stream
SSE endpoint can deliver as a single push.
Stream the data instead:
- FastProjectState gains optional promptQueue / promptQueueRevision /
autoContinueEnabled
- /api/control/stream dbToFastState emits them from project_states
- /api/control populates the same fields so the first paint matches the
stream shape and no second mount-fetch is needed
- useControlData.mergeProjectPatches forwards the fields onto each
ProjectState
- usePromptQueue / useAutoContinue accept the values as props, drop
the polling loop, and only fall back to a one-shot HTTP load when
the props are absent (local /proc-backed runtime path that doesn't
project DB fields)
- ProjectCard threads project.promptQueue + project.autoContinueEnabled
into the hooks
Mutation paths (PUT /api/beacon/queue/<tab>, POST /api/control/auto-continue)
are unchanged. Optimistic local state + revision-based CAS retry still work
exactly as before; the stream just pushes the post-write revision back
instead of the hook polling for it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Five drifted phrasings collapsed into one set. Same conceptual state
("agent shell open, awaiting input") was being labeled "Agent shell
open" / "Ready — pick the next task" / "Agent open · idle" / "Tab open ·
no agent process" / "Open, idle" by four different functions —
staleEvidenceLabel, getTabActivityText, buildLiveTabRows, liveEvidenceLabel.
All now route through display.stateLabel (the canonical STATE_LABEL map)
so the badge, row subtitle, workspace panel, and activity feed agree on
one wording per state.
Identical adjacent failures in AttentionBar collapse into one row with
×N count. Pre-fix three consecutive "inject → fleetcrown failed" rows
piled up; now they read "inject → fleetcrown failed: <reason> ×3"
with the dismiss button clearing the whole group.
Selected project row in ProjectOperationsView now dims its siblings
(opacity-60) so the "this row IS the expanded card below" connection is
obvious. Used to look like 20 identical rows above what appeared to be a
21st duplicate row.
Repair connection → Restart helper (matches what it actually does).
ZellijLivePanel composer placeholder + title clarify it's a quick-send
to any tab, distinct from the project card's intent dispatch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After a PC restart, Fleet Runner now brings zellij + every agent back
without the user opening a terminal or typing CLI names. The last
runtime_snapshot.panes (extended with {tab, paneIndex, agentCli, cwd})
acts as SSOT for "what should be running" — Fleet Runner generates a KDL
layout with embedded `bash -c "cd … && claude"` per pane and spawns
`zellij --session fleet --layout`, bypassing zellij's press-ENTER
resurrection prompt entirely.
Injection is now self-healing end-to-end. Pre-flight ensureZellijReady
re-spawns the session if it died mid-day. /tmp/fc-cmd-<id>.done sentinels
make commands actually idempotent so a PATCH-ack retry can't fire the
same prompt twice. Post-flight watches ~/.claude/sessions/<tab>.md mtime
for 5s after inject and reports verified=false if the agent didn't pick
up — surfaced in AttentionBar via getRecentFailedCommands. The legacy
"No Zellij session found — start Zellij first" throw is replaced with a
synchronous spawn-default-session path so /api/agent/launch on
self-hosted servers self-heals too.
Settings → Agent gets a new Fleet Lifecycle section (auto-restore on/off,
fresh-spawn vs leave-alone for exited zellij sessions, session name,
auto-start at login). Stored as users.fleet_settings jsonb so future
knobs don't need a migration each time.
Bundled binary version-aware (Fleet Runner ≥0.4.0 ships zellij in
resources/bin and prepends to PATH). Inline tests for the KDL generator
run as a 9th suite under `npm run test:home` — 8/8 cases pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Users switch agents from the Control UI without typing quit commands in
Zellij — click the agent chip on a project card, pick from Cmd+K palette,
or accept the rate-limit banner's fallback suggestion. Detection lives in
agent-resolution.ts (client-safe) + agent-process-scan.ts (server /proc
walk); switch enqueues pending_commands type switch_agent which the Fleet
Runner poller executes locally, quitting every running agent in the dir
before launching the next.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 1 of the sustainable autopilot-control refactor. Adds explicit
block-reason + no-op-count fields to the session.md handoff, plumbs
them through parser → desktop pusher → API → DB → React, and updates
the bash guard to read them directly. Eliminates the three-vocabulary
problem that caused the OC no-op spiral on 2026-06-08, where agent's
"health: critical — awaiting user" string collided with the bash
guard's first-word match.
Schema:
- ORCHESTRATION_TASK_SUMMARY_FIELDS gains "block-reason" + "no-op-count"
- SessionState gains blockReason?: string + noOpCount?: number
- project_states adds session_block_reason + session_no_op_count columns
Pipeline:
- control-fast-state.parseSession projects kebab-case → camelCase
- desktop pusher payload + runtime-state route + persistSessionIfNewer
all carry the new fields
- /api/control/route + /api/control/stream re-emit them to React
Consumers:
- session-state.ts derivations prefer structured fields, fall back to
content-sniffing for pre-2026-06-08 sessions
- autopilot-needs-fire bash guard reads block-reason + no-op-count
directly; same fallbacks active
- agent-hook-bridge + fleetcrown-daemon handoff templates and the
blocker_create SPACE prompt now instruct agents to emit the fields
Memory of why this exists: OC ran 21 no-op turns (~60k tokens) in an
hour because three layers parsed the agent's intent from free text
with different rules. Phase 2 (daemon owns the should-fire decision)
follows; bash guard's content-sniff fallbacks live until every agent
has rotated through the new template.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>