diff --git a/hosts/FredOS-Mediaserver.nix b/hosts/FredOS-Mediaserver.nix index 4459f23..b75dbea 100644 --- a/hosts/FredOS-Mediaserver.nix +++ b/hosts/FredOS-Mediaserver.nix @@ -119,6 +119,13 @@ # time-to-first-text 2657ms -> 1122ms, wall clock 5.7s -> 2.4s, same # answer. A one-line lookup has nothing to reason about. # + # --name is not cosmetic: without it Claude Code fires a second, + # concurrent `source=generate_session_title` request to invent a title + # for a session --no-session-persistence then throws away. It costs no + # wall time (both requests dispatch ~1ms apart), but it spent 507 input + # tokens against 153 for the real question. Naming the session up front + # removes it: one request instead of two, 660 input tokens -> 153. + # # For the record, two things that are NOT the bottleneck, both measured: # process startup (0.12s boot + 28ms to fire the request, so keeping a # warm process saves nothing) and prompt size (184 input tokens). @@ -132,6 +139,7 @@ --permission-mode dontAsk \ --output-format text \ --model claude-haiku-4-5 \ + --name qs-ask \ --system-prompt 'Answer the question in one or two short sentences, under 240 characters. Lead with the specific fact asked for, including units. No preamble, no caveats, no markdown, no follow-up offers. If you do not know, or the answer depends on live data you do not have, reply with exactly: UNKNOWN' \ 2>/dev/null) \ || { echo "qs-ask: claude exited non-zero (auth expired? run 'claude' once to log in)" >&2; exit 0; }