Skip to content

Evolving session titles via Claude Code hook injection #16

@amahpour

Description

@amahpour

Problem

Session titles are currently set once from the git branch name or first user message. They don't evolve as the session progresses, so a session that starts as "Fix Auth Bug" but pivots to refactoring the middleware still shows the original title.

The LLM-based approaches explored in #8 didn't work out:

  • claude -p --model haiku subprocess: 30+ second startup time, too slow
  • Anthropic API direct: not acceptable (external API cost)

Ideas to explore

Option A: Hook-based prompt injection

Inject a system prompt or tool hint via Claude Code hooks that asks the assistant to periodically emit a special token with a session title. For example:

[SESSION_TITLE: Refactor Auth Middleware]

The watcher would parse this token out of assistant messages and update display_name. The token would be stripped from the transcript display.

Option B: User-triggered rename via special syntax

User types something like /title Fix Auth Middleware in the Claude Code session. The watcher detects this pattern in user messages, updates the title, and optionally hides the command from the transcript.

Option C: Periodic re-derivation from transcript

Every N user messages, gather the last 5 user messages + git branch and re-run the heuristic title generator with more context. No LLM needed, just smarter keyword extraction.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions