Feature request: Programmatic API for session title + locale-aware AI title generation
Feature request: Programmatic API for session title + locale-aware AI title generation
Repository: https://github.com/anthropics/claude-code
Summary
Two related gaps in the current Claude Code VS Code extension that, together, prevent automating chat session titles in the user's preferred language:
- No programmatic way to update a session title — neither via
vscode.commands.executeCommand, an exposed extension API, nor an external CLI hook. - AI-generated titles are always in English — even when the entire conversation (and
CLAUDE.md) is in another language (Korean, in my case), and there is no user-level setting to override the language.
There's also no user-visible UI to manually rename a chat tab (✏️-style click does not enter an edit state in v2.1.140), which compounds the issue.
Current behavior (v2.1.140)
- Session titles are auto-generated via a
generate_session_titleAPI call. Output is consistently in English. - The title is stored in the session JSONL as an
ai-titleevent. - Editing the JSONL directly (appending a new
ai-titleevent) does NOT update the chat header until a full window reload — the extension does not watch the JSONL withfs.watch/createFileSystemWatcher. - The
rename_session,rename_tab,update_session_statemessage handlers exist internally but are only reachable from the webview <-> extension IPC, not fromvscode.commands.executeCommandor any other external entry point. - Attempted Chrome DevTools Protocol (
--remote-debugging-port) attach: VS Code's production Electron build does not expose the webview frame for HTTP CDP, so externalRuntime.evaluateto callacquireVsCodeApi().postMessage({type: "rename_session", ...})is not possible.
Why this matters / use case
I run Claude Code in Korean. My CLAUDE.md explicitly instructs Korean responses, and every user message is Korean. Despite this, every new chat tab gets an English title like "Check Notion connection status", which makes the tab list hard to scan in a Korean workflow.
I tried building a Stop hook that calls claude -p --model sonnet to summarize the recent messages into a short Korean title, then appends it to the JSONL. The hook works (Sonnet produces good Korean titles), but the chat header never reflects them because:
- The extension does not watch the JSONL file.
- There is no
vscode.commands.executeCommandentry point to programmatically triggerrename_session. - CDP webview attach is blocked by the production build.
Proposed solutions (any of these would resolve it)
Option A — Locale-aware title generation
A user setting like claudeCode.titleLanguage (or just respect CLAUDE.md-level language directives in the title-generation prompt). Lowest user-side friction.
Option B — Public command for renaming
Register a command such as:
"claude-vscode.renameSession": { "sessionId": "...", "title": "..." }
so that external tooling and Stop hooks can call it via vscode.commands.executeCommand (or via the standard vscode:// URL handler).
Option C — JSONL file watcher
Have the extension watch the active session JSONL with vscode.workspace.createFileSystemWatcher, so external ai-title event appends are reflected without a window reload.
Option D — User-facing rename UI
A click-to-edit on the chat tab header (the small ✏️ icon already shown in the header would be a natural target).
Environment
- Claude Code extension:
anthropic.claude-code-2.1.140(win32-x64) - VS Code: 1.119.1 (WSL Remote)
- OS: Windows 11 + WSL2 (Ubuntu)
- Workflow: 100% Korean
Happy to provide more details / test patches.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗