From c563009adcd90e0d9d4e49c956a13087b8ed8313 Mon Sep 17 00:00:00 2001 From: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Date: Thu, 13 Aug 2026 17:57:58 +0200 Subject: [PATCH] chore(claude): retire dead fleet-user-prompt.sh capture hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The June-era UserPromptSubmit hook posted every typed prompt to localhost:3000, where nothing listens on a normal setup — silently dropped for ~2 months. Replaced by fleetcrown-capture.sh, which Fleet Runner (>=0.8.12, fleetcrown PR #230) generates and rewrites on startup: machine output, so gitignored rather than tracked. settings.json now registers the new hook; capture verified end-to-end into the prod activity ledger before this commit. Co-Authored-By: Claude Fable 5 --- .claude/hooks/fleet-user-prompt.sh | 68 ------------------------------ .claude/settings.json | 6 +-- .gitignore | 1 + 3 files changed, 4 insertions(+), 71 deletions(-) delete mode 100755 .claude/hooks/fleet-user-prompt.sh diff --git a/.claude/hooks/fleet-user-prompt.sh b/.claude/hooks/fleet-user-prompt.sh deleted file mode 100755 index 5ad8292..0000000 --- a/.claude/hooks/fleet-user-prompt.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -# Claude Code UserPromptSubmit hook for FleetCrown. -# -# Captures every prompt typed into a Claude terminal and POSTs it to the -# fleet server so the Activity page sees terminal work, not just dispatches -# routed through /api/inject. Always exits 0 — never blocks the user. -# -# Claude sends the hook event on stdin as JSON with at least: -# { "prompt": "...", "cwd": "...", "session_id": "..." } -# -# Auth: Bearer FLEETCROWN_DAEMON_TOKEN (mirrored via daemon.env). - -set +e # never fail the user's prompt because logging is broken - -# Load token from daemon env. Skip silently if not present. -for f in "${HOME}/.config/fleetcrown/daemon.env" "${HOME}/.config/cockpit/daemon.env"; do - [ -f "$f" ] || continue - set -a - # shellcheck disable=SC1090 - . "$f" - set +a -done - -TOKEN="${FLEETCROWN_DAEMON_TOKEN:-${COCKPIT_DAEMON_TOKEN:-}}" -# Prefer the local systemd server when it's up — writes land in the same -# shared DB the Vercel deployment reads, and the local one always has the -# newest endpoints. Override with FLEET_CAPTURE_URL for headless / remote use. -BASE="${FLEET_CAPTURE_URL:-http://localhost:3000}" - -if [ -z "$TOKEN" ]; then - exit 0 -fi - -# Slurp Claude's JSON payload from stdin BEFORE backgrounding (background can't -# read the parent's stdin reliably). Pass through env to the worker so the -# heredoc-vs-stdin collision doesn't happen. -PAYLOAD="$(cat)" - -# Fire-and-forget worker. Exits within 1.5s on the inner urlopen timeout, but -# we don't wait — the user's prompt must submit instantly. -FLEET_PAYLOAD="$PAYLOAD" FLEET_BASE="$BASE" FLEET_TOKEN="$TOKEN" nohup python3 -c ' -import json, os, sys, urllib.request -base = os.environ["FLEET_BASE"] -token = os.environ["FLEET_TOKEN"] -try: - payload = json.loads(os.environ["FLEET_PAYLOAD"]) -except Exception: - sys.exit(0) -prompt = (payload.get("prompt") or "").strip() -cwd = payload.get("cwd") or os.getcwd() -session_id = payload.get("session_id") or "" -if not prompt: - sys.exit(0) -body = json.dumps({"prompt": prompt, "cwd": cwd, "sessionId": session_id}).encode("utf-8") -req = urllib.request.Request( - f"{base}/api/activity/capture", - data=body, - method="POST", - headers={"Content-Type": "application/json", "Authorization": f"Bearer {token}"}, -) -try: - urllib.request.urlopen(req, timeout=1.5).read() -except Exception: - pass -' /dev/null 2>&1 & - -disown -exit 0 diff --git a/.claude/settings.json b/.claude/settings.json index c7506fc..f8824b7 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -19,7 +19,6 @@ "TodoWrite" ] }, - "model": "claude-fable-5[1m]", "hooks": { "Notification": [ { @@ -81,7 +80,7 @@ }, { "type": "command", - "command": "/home/g/.claude/hooks/fleet-user-prompt.sh" + "command": "/home/g/.claude/hooks/fleetcrown-capture.sh" } ] } @@ -91,5 +90,6 @@ "tui": "fullscreen", "editorMode": "vim", "agentPushNotifEnabled": true, - "voiceEnabled": true + "voiceEnabled": true, + "model": "claude-fable-5[1m]" } diff --git a/.gitignore b/.gitignore index 31d5b05..b636136 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__/ *.pyc .claude/hooks/dangerous-commands.log +.claude/hooks/fleetcrown-capture.sh