Desktop sidebar ignores UserPromptSubmit hook `sessionTitle` output
Summary
The documented hookSpecificOutput.sessionTitle from UserPromptSubmit hooks (added in v2.1.94) is honored by the CLI but not by the desktop app's sidebar. The desktop displays its own auto-generated title and ignores the hook output.
Environment
- Claude Code 2.1.121 (desktop)
- macOS 14.x
Repro
- Add a
UserPromptSubmithook in~/.claude/settings.json:
``json``
{
"hooks": {
"UserPromptSubmit": [
{ "hooks": [ { "type": "command", "command": "/path/to/hook.sh" } ] }
]
}
}
- Have the hook return:
``json``
{
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"sessionTitle": "[ProjectA] Test Title"
}
}
- Submit a first prompt in a desktop session.
Expected
Sidebar entry shows [ProjectA] Test Title.
Actual
~/.claude/sessions/<pid>.json→.name = \"[ProjectA] Test Title\"✅- Session
.jsonltranscript →custom-titlerecords contain\"[ProjectA] Test Title\"✅ ~/Library/Application Support/Claude/claude-code-sessions/.../local_*.json→title = \"<auto-generated summary>\",titleSource = \"auto\"❌
The desktop sidebar reads from the local_*.json file. The hook output never reaches it.
Manual /rename works because it sets titleSource: \"user\", so the field is honored when set through the UI's own path.
Workaround attempted (and why it's not viable)
Patching local_*.json directly to titleSource: \"user\" works briefly but the desktop overwrites it on session-close/app-close — disk state at next app start is what wins, and the in-memory state is what writes last. So patches don't survive a close/reopen reliably without a constantly-running watcher daemon.
Ask
Have the desktop sidebar honor hookSpecificOutput.sessionTitle from UserPromptSubmit hooks — same effect as /rename (i.e. set titleSource: \"user\" in local_*.json and invalidate the in-memory cache).
Use case
Auto-formatting session titles per-project (e.g. [ProjectA] …, [ProjectB] …) for users who work across multiple repos and view sessions in date-sorted mode rather than project mode.
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗