Skip to content

Read custom-title entries from session JSONL so Claude Code /rename is reflected in the sidebar #747

@felipemeres

Description

@felipemeres

Summary

Sessions renamed in Claude Code (via the /rename command) are not reflected in the CloudCLI sidebar. The Claude session synchronizer builds its name map only from ~/.claude/history.jsonl (which holds first-prompt-per-session entries), but /rename writes the new title into the session's own JSONL transcript instead. The rename is durable on disk, but invisible to CloudCLI — so a user juggling several parallel sessions has no way to surface their per-session labels in the UI.

Reproduce

  • CloudCLI UI v1.31.5 (npm install)
  • Claude Code v2.1.131
  • Node v24.14.1, Ubuntu 24.04
  1. Start a session in claude, send a message, then run /rename Foo.

  2. grep custom-title ~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl shows the rename was persisted:

    {"type":"custom-title","customTitle":"Foo","sessionId":""}
    {"type":"agent-name","agentName":"Foo","sessionId":""}
  3. grep "Foo" ~/.claude/history.jsonl returns nothing — /rename does not append to history.jsonl.

  4. Open CloudCLI — the session shows either the first user prompt or Untitled Claude Session. Never Foo.

Root cause

server/modules/providers/list/claude/claude-session-synchronizer.provider.ts:31:

const nameMap = await buildLookupMap(
  path.join(this.claudeHome, 'history.jsonl'),
  'sessionId',
  'display',
);

history.jsonl is a per-prompt log written by the CLI as the user types. /rename does not touch it. The actual rename lives in the session JSONL as a {"type":"custom-title", "customTitle":"…"} entry (and a redundant agent-name entry).

This is the same architectural seam called out in #731 — the synchronizer is built around history.jsonl as the only name source, and gaps appear whenever Claude Code persists a name through some other path.

Suggested fix

processSessionFile() already iterates the session JSONL. It can pick up the custom-title entry (preferring the latest one if multiple exist, since users can rename more than once) and prefer it over the history.jsonl-derived first-prompt fallback.

Suggested precedence for the displayed session name:

  1. CloudCLI UI rename (sessions.custom_name in CloudCLI's SQLite) — already wins, unchanged
  2. NEW: Claude Code /rename → most-recent customTitle from session JSONL
  3. First user prompt from history.jsonl — current default
  4. Untitled Claude Session

Why this matters

The renaming-many-tabs workflow is exactly what brings users to a session-management UI like CloudCLI in the first place — they have lots of parallel Claude Code sessions and they label them so they don't get lost. Today CloudCLI shows the same generic title for all of them regardless of how thoroughly the user has renamed in the CLI.

Happy to send a PR if useful.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions