renderTaskForAdapter built prompts without the session file content.
buildPromptWithSession was already imported but unused in the claude path.
Wrapping the rendered prompt with session context means next_best, quality,
test_and_fix, etc. now see done/next/health from the last run before choosing work.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1. beacon popup countdown is now display-only (Cockpit is sole auto-injector)
– shows "Cockpit continues in Xs · click to choose" so user knows what's happening
– no independent auto-inject; web popup just closes when control panel fires
2. dismissed resets per cycle so ReadyBanner fires once per agent run
– prevAgentRunning ref tracks false→true transition; setDismissed(false) on new run
3. orchestration/run cancels open beacon sessions (same as /api/inject)
– missing cancel caused lock file to persist, blocking every subsequent stop hook
UX: replace MicOff (mute icon) with square stop icon + waveform bars in
control panel prompt input, matching beacon popup style
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
**Pause bug fix:**
- /api/beacon/cancel endpoint cancels active beacon sessions for a project
- Clicking pause in the control panel now calls this endpoint so the beacon
popup's independent 30s countdown can't fire after the user pauses
**Prompt queue:**
- usePromptQueue hook (localStorage-backed) for per-project queued prompts
- Queue button (ListPlus) in the prompt input + Alt+Enter keyboard shortcut
- QueueList shows numbered items with × removal in running and idle states
- ReadyBanner auto-inject drains the queue first, falls back to next_best
- ReadyBanner shows "Queue N" tag when items are waiting
**Session summary restored:**
- SessionSummary (up next / done) is now visible while agent is running
- RunningBanner clearly labels the active task; session.next below it shows
what comes after — no more confusion between current and upcoming work
**SSOT / DRY:**
- lib/session-content.ts: shared parseSessionText() for session file parsing
- beacon popup page, beacon [id] API route both use the shared parser
- useWhisperMic extended: exposes waveformBars + recordingSeconds
- beacon popup replaced ~150 lines of custom mic code with useWhisperMic hook
- ReadyBanner uses stable refs for onSend/onAutoInject to prevent re-injection
from unstable parent function references on every SSE render
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- RunningBanner: add "RUNNING" kicker, show "Custom prompt" title with prompt text as subtitle
so users see exactly what the agent is executing, not a truncated prose fragment
- Hide SessionSummary (session.next arrow) while agent is running to eliminate confusion
between "what's being done now" vs "what comes next"
- Pause/play toggle button added beside interrupt input in running state for auto-continue control
- Prompt input upgraded from single-line <input> to auto-expanding <textarea> (fieldSizing:content)
with Shift+Enter for newlines and Enter to send
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bug Five: the SSE stream resolved each project's canonical tab name to its
live Zellij casing once when the EventSource connected. If a new Claude
session opened (adding a suffix like " Claude") or a tab was renamed, the
stream continued reading /tmp sentinel files under the stale name. The
project appeared frozen in the control panel until the connection dropped
and reconnected.
Fix: maintain a zellijTabCache variable and fire getZellijTabs() in the
background when the cache is older than 10s. Each tick re-runs
resolveEffectiveTab against the freshest known tab list before reading the
/tmp files. Max staleness is now ~12s (10s TTL + up to 2s tick).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
use-speech-recognition.ts is now unreferenced — AskIvyModal was the
last consumer and was migrated to useWhisperMic in the previous commit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
useSpeechRecognition (Google's cloud STT, unreliable on Linux) swapped
out for useWhisperMic (local Whisper via /api/beacon/transcribe).
Mic button now has three explicit states: recording (pulsing red MicOff),
processing (spinner, disabled), and idle (Mic). Input ring and placeholder
update to match. Error message renders below the input on permission or
hardware failure. Mic is always shown — no 'supported' guard needed since
Whisper runs locally without browser API detection.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Part 1 — atomic bash lock: replace TOCTOU check-then-write on
agent-stop-active-<tab> with POSIX noclobber `( set -C; : > lock ) 2>/dev/null`.
Concurrent stop hooks that both used to pass the test-before-write now
race atomically; only one wins. Stale locks (>90s) are overwritten.
Part 2 — cancel open beacons on panel inject: cancelActiveBeaconSessions()
scans /tmp/cockpit-beacon/*.json for active sessions matching the tab and
sets choice="" — the empty-string sentinel that causes beacon.py's polling
loop to return "" and bash to `exit 0` cleanly.
/api/inject calls this immediately after injectIntoTab() succeeds.
Part 3 — beacon popup auto-closes on cancellation: polls GET /api/beacon/:id
every 2 s; calls window.close() as soon as choice !== null (set by Part 2).
Clears on unmount or when the user submits their own choice first.
Together these three parts prevent the popup and the control panel from
both injecting prompts into the same Zellij tab.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
go-to-tab-name is fire-and-forget — it returns before Zellij has switched
the visible tab. Under load the 0.3s sleep was too short, causing write-chars
to type the prompt into whichever pane happened to be focused at that moment.
Both inject paths now poll zellij action dump-layout after go-to-tab-name and
wait until the focused tab matches the target (up to 1s, 50ms intervals).
In the common case the switch completes in <50ms, so typical injection is
faster than before; the edge case where it was silently misfiring is fixed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Parser: new 'image' block () and 'code' block (fenced backtick blocks)
Paragraph accumulator breaks on backtick fences and ![ so neither leaks into prose
- MermaidDiagram client component: dynamic mermaid import, dark theme matching
Cockpit surface colors; SVG inline; falls back to raw text on render error
- Page: Next.js Image for image blocks with figcaption; MermaidDiagram for mermaid
fenced blocks; pre/code for all other lang tags
- Images convention: /public/thoughts/{slug}/, referenced as /thoughts/{slug}/file
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: beacon.py called _cockpit_ready() using /api/control (slow DB+git
endpoint, 4+ seconds cold) with a 2s timeout. When OrangeCat fired rapid
consecutive stop hooks, this check failed even with Cockpit running, so
_start_cockpit() spawned extra npm run dev processes that inherited the bash
command substitution pipe (stdout). Their startup output flooded the captured
`choice`, jq parsing failed, and the script exited silently with no injection.
Fix 1: Add /api/health endpoint (instant response) — beacon.py now uses this
instead of /api/control for all liveness checks; also fixes the curl check
in agent-hook-bridge.sh.
Fix 2: Redirect _start_cockpit() subprocess stdout/stderr to DEVNULL — like
_open_browser() already does. Prevents npm run dev from inheriting the pipe
and polluting the captured choice.
Fix 3: Add concurrent stop guard at top of handle_stop — skips the popup if
another stop is already active for the same tab (within 90s). Prevents
beacon storms from rapid turn completions.
Also increased _poll_choice timeout from 3s to 8s to tolerate cold route
compilation without dropping choices.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
If the claude process crashes before the stop hook fires, the currentPrompt
/tmp file is never cleaned up. With the new !currentPrompt guard for isReady,
this left projects stuck on "Running: <stale task>" indefinitely.
Fix: in the display layer, treat currentPrompt as null whenever agentRunning
is false — if there's no process, there's no active turn, regardless of what
the file says. Uses agentRunning (now accurate after the argv0-basename fix)
as the authority on whether a process is alive.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The DB currentPromptKey was used as a fallback when the /tmp file was absent.
After a system reboot, /tmp files are gone but DB still has the old value →
every project with a prior injection showed "Running: <stale task>" indefinitely.
currentPrompt is transient turn state — the stop hook always clears the /tmp file
when a turn ends, so the file's presence is the only reliable signal. The DB column
is still written by the inject route (for lifecycle event timing via currentPromptStartedAt)
but is no longer read back into the UI state.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- getAgentCwds: match argv[0] basename only, not full cmdline — prevents
bash shell-snapshot processes (/home/g/.claude/shell-snapshots/...) from
matching the 'claude' processMatcher and permanently setting agentRunning
- isReady: replace !agentRunning guard with !currentPrompt — the claude
binary stays alive between turns, so agentRunning is always true while
a session is open; currentPrompt is the reliable turn-tracking sentinel
- isOrchestrationReady: same !currentPrompt guard
- showRunningBanner: no longer requires isRunning — fires on currentPrompt
alone so the banner appears even before the process shows up in /proc
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three fixes for the wrong-monitor popup problem:
- beacon.py: fallback uses primary screen instead of cursor position —
cursor can be on any screen but the terminal is usually on primary
- agent-hook-bridge.sh: writes claude-screen-<PANE_ID> from xrandr at
stop hook time if missing (context-limit continuations bypass the
claude() bash wrapper which normally writes it at launch)
- ProjectCard.tsx: auto-continue defaults OFF — require explicit opt-in
to prevent the Cockpit UI from auto-injecting a second prompt while
the user is already typing their own message in the same terminal tab
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When an agent is running but no currentPrompt sentinel exists (e.g. agent
was running before Cockpit opened, or prompt wasn't injected via the UI),
the banner now shows session.next as a "Next:" hint — or session.done as
"Last:" if next is empty. Also aligns padding and font-weight with
RunningBanner for visual consistency across all active-agent states.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 2-second SSE tick was reading /tmp/agent-ready-<conf_name> but bash writes
/tmp/agent-ready-<zellij_exact_name>. On case mismatch the stream never saw
state updates and the Control panel lagged by the 30s polling fallback.
Fix: resolve each project's tab name to its exact zellij casing once at stream
startup (same getZellijTabs + resolveEffectiveTab that the main GET route uses).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: resolveEffectiveTab returned conf-file casing ('OrangeCat') while
zellij may store the tab as 'orangecat'. go-to-tab-name is case-sensitive —
navigation silently failed and write-chars landed on whichever tab was focused.
Fixes:
- resolveEffectiveTab now always returns the exact casing from activeTabs
(zellij's ground truth), never from the conf file
- injectIntoTab uses shellEscape() for the tab name argument so spaces and
quotes in tab names no longer break the shell command
These two bugs together explain the "prompts go to the wrong tab" report from
the Control panel UX.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the bare check-mark + "Running…" with a confirmation card that shows:
- The exact action that was dispatched (prompt icon + label, or custom text)
- Which project the agent is now running on
- A prompt to watch progress in the Control panel
- An "Open Control panel" button as an escape hatch
The window still auto-closes after 400ms; the screen is just visible during
the brief moment before it disappears.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Explicitly request audio/webm;codecs=opus from MediaRecorder (prevents Chrome
from picking video/webm even on audio-only streams)
- Use recorder.mimeType on the assembled Blob so the MIME label matches actual codec
- Bail client-side when blob < 100 bytes (tap-and-immediately-release)
- Expose execFile stderr in the error response instead of the generic
"Command failed: python3 ..." so the UI shows the actual Python traceback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Expose the prefer_browser_ready_ui flag (read by agent-hook-bridge.sh to
decide between native PyQt popup and the web beacon) as a checkbox in the
Settings → Beacon section. GET returns the current value, PATCH persists it
to ~/.config/agent-dashboard-settings.json alongside countdown/model.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove hardcoded .dark wrapper from beacon layout — root ThemeProvider
already manages the class on <html> via next-themes + localStorage, so
the beacon now inherits the user's theme preference like any other route.
Add ThemeToggle (compact) to the beacon header so the user can switch
modes directly from the popup. Upgrade 11px hint text from text-text-muted
to text-text-tertiary for WCAG AA legibility at small sizes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously the only way to change countdown_seconds or whisper_model was
to hand-edit ~/.config/agent-dashboard-settings.json.
- /api/beacon-settings GET+PATCH: reads/writes the settings JSON file,
validates countdown (5–300s) and model (tiny/base/small/medium/large)
- BeaconSettings component: self-loading client component matching the
existing ProfileSettings/ProjectsSettings pattern
- Settings page: BeaconSettings placed between Profile and Projects
Verified round-trip: GET returns {countdown_seconds:12, whisper_model:"base"},
PATCH updates the file and subsequent GET reflects the change.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both were SSOT violations — PyQt respected ~/.config/agent-dashboard-settings.json
but the web beacon hardcoded its own values.
- beacon.py _web_stop: reads countdown_seconds from settings, passes as
?countdown=N query param when opening the Chrome app URL
- beacon page: reads ?countdown from window.location.search on load
(lazy useState initializer, SSR-safe via typeof window guard)
- /api/beacon/transcribe: reads whisper_model from settings file before
invoking transcribe.py, falls back to "base" if missing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each beacon completion already writes a DevLogEntry to userProjects.dev_log.
That history was only shown in the Control panel's project profile sidebar.
- /api/projects/[id] now joins userProjects by name and returns devLog (20
most recent entries, newest first) alongside the entity data
- ProjectData type gains devLog: DevLogEntry[]
- Projects overview tab shows a collapsible "Session Log (N)" section using
the same entry cards as Control
- Extracted shared DevLogList component so both views stay in sync without
copy-pasting the rendering logic
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace Web Speech API (cloud, silent failures) with MediaRecorder →
POST audio blob → Python Whisper (local, no internet) pipeline. Adds
real-time waveform visualisation, recording timer, and a clear
idle/recording/processing state machine with never-silent error display.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Mic: interimResults=true shows live text as you speak (italic overlay
in the input field while result is still forming)
- Mic: pulsing ring animation on the button while recording
- Mic: "Recording…" status line + word·char count once text is entered
- Mic: aborted error is now silent (user stopped it, not a failure)
- Add "Cockpit" button in header — opens /control in a new tab so you
can see the full project/process panel without losing the beacon
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Countdown bug root cause: cancelCountdown set pausedRef=false, so the
next interval tick saw c=0≤1 and called submit. Fix: set both
pausedRef=true and cancelledRef=true — two independent guards.
Three-layer defence matching PyQt _tick/_choose pattern:
1. pausedRef.current check at interval entry
2. cancelledRef.current check inside setCountdown callback (race-safe)
3. Live input value check (mirrors PyQt: if custom text → cancel)
Additional: onFocus on input cancels countdown on click, not just on
first keystroke. handleCustomChange cancels on any change (not just
non-empty). Mic: explicit error messages for permission-denied, network,
no-speech; try/catch around rec.start(); continuous=false explicit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove min-h-screen so the page doesn't expand to fill fixed height
- On load: resizeTo(520, scrollHeight) + moveTo to keep bottom-right
anchor (reads screenLeft/screenTop before resize to reposition)
- Reduce initial Chrome window from 820→640px so less blank area before
JS fires; loading/submitted states use compact fixed heights
- Sync _terminal_screen_position default height to match
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Web Speech API mic button appends transcript to custom input
- Pause/Play button halts the 30s countdown; Space key toggles
- Number keys 1–9 pick slots directly from keyboard (Esc closes)
- Typing in custom input cancels auto-countdown
- Inline style in layout prevents white FOUC before hydration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- beacon.py: main() now calls _web_stop (Cockpit web page) instead of PyQt6 for stop
mode — eliminates WA_TranslucentBackground transparency bug on Linux compositors
- _cursor_screen_position(): calculates bottom-right of cursor's screen via PyQt and
passes --window-position to Chrome so the app window opens in the right place
- user_projects: add devLog JSONB column (array of DevLogEntry: date/done/next/tests/
todos/health); schema pushed to DB
- beacon PATCH API: appends a DevLogEntry to the matched project when a choice is set —
fire-and-forget so it never blocks the beacon response
- GET /api/user-projects/[id]: new endpoint so ProjectProfile can fetch devLog
- ProjectProfile: new DevLogSection (collapsed by default) shows last 12 entries with
date, health badge, done summary, and next step — auto-populated from beacon sessions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Header was hidden when profileOpen=true, making the profile impossible to close.
Always render ProjectCardHeader; toggle profile vs content below it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- beacon.py stop mode now opens localhost:3000/beacon/<id> (Chrome --app mode)
instead of a PyQt6 window; PyQt6 confirm popup stays for sync blocking
- /api/beacon + /api/beacon/[id] routes create/poll/submit sessions via /tmp files
- /beacon/[id] page uses the same ui-btn-primary, ui-panel, ui-kicker components as
the rest of Cockpit — fonts, tokens, and layout are literally the same code
- Per-project agent+model prefs: modelPref column added to user_projects (pushed);
ProjectState now carries id/agentPref/modelPref; launch modal pre-fills saved
prefs and saves choice back after every launch; ProjectProfile agent selector
persists to DB immediately
- Default agent changed from codex to claude in agent-preferences + hook fallback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously beacon used ~/.config/agent-prompts.json and Cockpit used
dimension-prompts.ts (two separate files with overlapping, duplicated content).
Now agent-prompts.json is the single source of truth for all prompts:
- Added dimensionId field to every entry to group them in Cockpit's UI
- Added 16 new dimension-specific prompts (refactor, security, user flows, etc.)
- New /api/prompts/agent route reads the file and serves it to the browser
- ProjectProfile.tsx now fetches from the API instead of importing from a TS file
- Removed dimension-prompts.ts entirely
Beacon reads agent-prompts.json directly (no change).
Cockpit reads it via API on demand.
To add/edit/remove prompts: edit ~/.config/agent-prompts.json once.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bootstrap/route.ts was calling /api/user-projects via relative HTTP fetch
which doesn't work server-side — replaced with direct createUserProject() call.
Modal gets max-h-[calc(100vh-2rem)] overflow-y-auto so tall review forms scroll.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wraps session summary in a QScrollArea (max 55% screen height) so content
never overflows the screen. DONE toggle now scrolls to reveal items instead
of resizing the window. Also bumps ai-brief timeout to 90s with user-visible
"~30s" hint so the CLI invocation no longer times out.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ThemeProvider was set to defaultTheme="system" + enableSystem=true, causing
the UI to render in light mode on machines with a light OS theme. CLAUDE.md
mandates dark-first; switching to defaultTheme="dark" + enableSystem=false
enforces this regardless of system preference.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New /api/project/ai-brief — calls claude --json-schema to parse free-form startup idea into structured brief (name, tagline, features, stack, etc.)
- New /api/project/bootstrap — creates local dir, GitHub repo, Neon DB, registers in Cockpit; returns YC-style launchPrompt for Claude Code
- New BootstrapModal 4-step wizard: describe → review/edit → creating → launch (wired to "New" button in ControlPanel)
- beacon.py: progressive disclosure in session summary — first item always visible, "Show N more ↓" expands rest per section (UP NEXT / IN PROGRESS / DONE)
- beacon.py: card widened to 600px, summary card border-radius 12px, expand hover uses accent color
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Default view shows only the first 'Up next' item with a 'Show all ↓' button.
Expanded view shows all next/done bullets with section labels and '↑ Collapse'.
Uses ui-card-section and ui-kicker from the design system SSOT. Single-item
sessions with no done text show inline with no toggle (nothing to expand).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bump item text to text-base (16px) with leading-relaxed, increase inter-item
gap to space-y-3 and section gap to space-y-5, use bold uppercase labels with
explicit tracking. Makes the two sections visually distinct and each item
legible without squinting.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Increase vertical spacing (space-y-2 per item, space-y-4 between sections),
bump outer padding to py-4, widen gap between arrow and text, use leading-relaxed
so items don't feel crammed when multiple bullets appear.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Splits next and done text on '; ' to render each semicolon-delimited item as
its own labeled bullet row. Adds 'Up next' (accent) and 'Done' (muted) section
headers so the two groups are immediately distinguishable. Each item is still
fully copyable (select-text).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Running projects without a currentPrompt showed no activity indicator in the
card body — just a pulsing dot in the header. Now shows a compact accent-tinted
row with a spinner, 'Agent active' label, and today's commit count as evidence
of progress. Matches the RunningBanner style but doesn't require prompt tracking.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SessionBadge now extracts only the first segment (before '—' or ',') so agents
writing "LINT CLEAN, BUILD CLEAN, 0 TS ERRORS, 674 TESTS PASSING" render as
"LINT CLEAN" with the full text in a tooltip. LAST RUN orchestration panel is
suppressed while the agent is active — it's context-before-action noise during runs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces equal-weight chip grid with state-driven layout: next_best gets a
full-width accent-tinted primary button with pause/play adjacent; action intents
(test_fix, quality, commit) become a compact secondary chip row; More toggle
inline at end of secondary row; expanded section uses border-t separator.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>