Sessions started by an argument-less slash command produce no title metadata in the transcript
Claude Code 2.1.267, Ubuntu 24.04, both headless (claude -p) and interactive sessions.
Summary
When a session is started by a slash command, the session JSONL records a usable prompt string only if the command had arguments. A bare command such as /morning-briefing produces a last-prompt event with the lastPrompt field omitted entirely, and no ai-title event is ever generated for slash-command sessions. The result is a transcript with no title metadata of any kind, so any consumer reading the file, including tooling that lists or resumes sessions, has nothing to name it with.
This is an inconsistency rather than a crash: the identical event type carries the text for /memory-digest --daily and omits it for /morning-briefing.
Evidence
With arguments:
{"type":"last-prompt","lastPrompt":"/skill-curator --improve","leafUuid":"2ff2237a-…"}
Without arguments:
{"type":"last-prompt","leafUuid":"48e7819b-…"}
The command name is not lost, it just never reaches a title field. It is in the first user message the whole time:
<command-message>morning-briefing</command-message>
<command-name>/morning-briefing</command-name>
Reproduction
claude -p "/some-command"where the command takes no arguments. Inspect the resulting~/.claude/projects/<project>/<session>.jsonl: everylast-promptevent lackslastPrompt, and noai-titleevent exists.claude -p "/some-command --with-args". Thelast-promptevents carrylastPromptwith the full command string.
Reproduces identically in an interactive session, so it is not specific to --print/headless.
Why it matters
Anything reading the transcript to name a session gets nothing for exactly the sessions a human never typed by hand, i.e. scheduled and automated runs.
Suggested resolution
Either would resolve it:
- Write
lastPromptfor argument-less slash commands too, with the command name as its value, matching the behaviour when arguments are present. - Or generate an
ai-titlefor slash-command sessions as is already done for prose prompts.