Name sessions from their first prompt via haiku #131

Closed
opened 2026-09-02 17:42:33 +01:00 by naps62-yolo · 0 comments
Collaborator

Sessions are named by a random handle picked in the spawn form. Replace that with a name derived from the session's first prompt.

Behind a cargo feature haiku-autoname, on by default:

# maestro-daemon
default = ["haiku-autoname"]
haiku-autoname = []
# maestro (umbrella) — `?` keeps the daemon out of a cli-only build
haiku-autoname = ["maestro-daemon?/haiku-autoname"]

Naming moves server-side. The spawn form's name field starts empty in both clients; the /api/names prefetch and reroll go away (web/src/spawnForm.ts:271, maestro-tui/src/draft.rs). CreateSessionRequest.name becomes optional, and create() generates the handle itself via maestro_names.

metadata.name_source: generated | haiku | user. A typed name is user and is never overwritten. PATCH rename always sets user, so renaming pins a name. generated renders dimmed in both sidebars — provisional. A session that never sends a prompt stays dimmed indefinitely; that is accurate, no timer. Update docs/SIDEBAR.md line 1, and add a source accessor next to display::custom_name.

The signal is agent-agnostic. New POST /api/sessions/:id/prompt taking {prompt}. Claude Code feeds it from a UserPromptSubmit hook (add to HOOK_EVENTS, gated with the feature so a build without it installs no dead hook); other agents get their own installers writing to the same route. The hook posts its payload verbatim (curl -d @-) and lets the daemon parse the JSON — prompts contain quotes and newlines.

Naming runs claude -p --model haiku as a subprocess, whatever agent sent the prompt. No API key, no outbound HTTP from the daemon. Prompt goes in on stdin, never argv, and is never logged. Hard timeout ~10s; on failure or a missing binary, keep the generated handle silently. Only fires when name_source == "generated", once per session. On success, manager.rename() — existing sidecar write and SessionUpdated broadcast, no client changes.

Wire types and the route constant in maestro-protocol stay ungated.

Sessions are named by a random handle picked in the spawn form. Replace that with a name derived from the session's first prompt. Behind a cargo feature `haiku-autoname`, on by default: ```toml # maestro-daemon default = ["haiku-autoname"] haiku-autoname = [] # maestro (umbrella) — `?` keeps the daemon out of a cli-only build haiku-autoname = ["maestro-daemon?/haiku-autoname"] ``` **Naming moves server-side.** The spawn form's name field starts empty in both clients; the `/api/names` prefetch and reroll go away (`web/src/spawnForm.ts:271`, `maestro-tui/src/draft.rs`). `CreateSessionRequest.name` becomes optional, and `create()` generates the handle itself via `maestro_names`. **`metadata.name_source`: `generated | haiku | user`.** A typed name is `user` and is never overwritten. PATCH rename always sets `user`, so renaming pins a name. `generated` renders dimmed in both sidebars — provisional. A session that never sends a prompt stays dimmed indefinitely; that is accurate, no timer. Update `docs/SIDEBAR.md` line 1, and add a source accessor next to `display::custom_name`. **The signal is agent-agnostic.** New `POST /api/sessions/:id/prompt` taking `{prompt}`. Claude Code feeds it from a `UserPromptSubmit` hook (add to `HOOK_EVENTS`, gated with the feature so a build without it installs no dead hook); other agents get their own installers writing to the same route. The hook posts its payload verbatim (`curl -d @-`) and lets the daemon parse the JSON — prompts contain quotes and newlines. **Naming runs `claude -p --model haiku`** as a subprocess, whatever agent sent the prompt. No API key, no outbound HTTP from the daemon. Prompt goes in on stdin, never argv, and is never logged. Hard timeout ~10s; on failure or a missing binary, keep the generated handle silently. Only fires when `name_source == "generated"`, once per session. On success, `manager.rename()` — existing sidecar write and `SessionUpdated` broadcast, no client changes. Wire types and the route constant in `maestro-protocol` stay ungated.
naps62-yolo self-assigned this 2026-09-02 17:43:58 +01:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: naps62/maestro#131