Auto-generate and apply a concise thread name after the first prompt
What variant of Codex are you using?
Codex with the existing thread rename capability (/rename / RENAME flow).
What feature would you like to see?
Codex now has a way to manually rename the current thread, but I would like the initial naming flow to be automatic:
- I start a new thread and enter the first real prompt.
- Codex derives a short, human-readable thread name from that prompt.
- Codex automatically applies that name to the current thread by reusing the existing rename path.
For example, if the first prompt is:
Investigate why the app-server schema generation test fails after adding the new config endpoint.
Codex could name the thread something like:
App-server schema test failure
Expected behavior
- After the first user prompt, Codex generates a concise title for the current thread.
- The generated title is applied automatically through the same persistence path used by manual rename.
- The title is short enough to scan in thread history/sidebar/resume lists.
- Codex should not overwrite a title that the user has already manually set.
- If the prompt is too vague, Codex can either keep the current default title or wait until there is enough context.
Why this matters
Manual rename is useful, but it adds friction to every new thread. In practice, thread history becomes hard to scan when titles are long, generic, or just copied from the first prompt. Since Codex already has rename plumbing, automatic first-prompt naming would make the default experience much better without requiring the user to remember to run RENAME manually.
Related issues
This is related to, but slightly different from:
- openai/codex#15444: assistant-invokable rename when the user explicitly asks for it
- openai/codex#14482: setting an initial name manually with
codex --name - openai/codex#24060: auto-updating the title later as the conversation changes
This request is specifically about automatically naming a fresh thread shortly after the first prompt, using the existing rename mechanism.
7 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I tried a local workaround for this in the CLI/TUI flow.
Current workaround:
Stophook runs at low frequency.codex exec --ephemeral --disable hooksto generate a concise title from the current transcript.thread_namerecord to~/.codex/session_index.jsonl./rename <title>to the clipboard so the current TUI can be refreshed manually if needed.This works for persisted history/resume, but it does not update the active TUI statusline unless
/renameis executed interactively. So it is only a workaround, not a real solution.A few guardrails were needed to make it usable:
The missing official capability seems to be one of:
I also added local structured logging around the workaround to track skip reasons, rename success, cooldown behavior, latency, and errors. That helps tune the heuristic, but the core limitation is still that hooks cannot currently update the active TUI title.
Adding another data point in support of this.
Environment:
thread-titleObserved behavior:
019f1eac-3bd3-7501-a3bb-85de8f25e2de.state_5.sqlite.threads.titleis populated, but it is just the full first user prompt:“so i am using codex cli and i wonder if codex will auto set a title...”
/titleonly configures which title fields appear in the terminal title; it does not rename or summarize the thread.Desired behavior:
Codex CLI Terminal Thread Titles.codex resume./rename <title>orcodex rename <session> <title>would also help, but the ideal default is automatic concise naming.+1
Codex should do this by default. Thread naming is too manual right now for something that has a big impact on everyday usability.
There is already rename plumbing, so this feels like a missing product behavior more than a missing capability. The obvious implementation, if it fits the current architecture, would be to route
/renamewith no explicit title through a very small model that generates a short thread name, then persist it through the existing rename path. If that is not the exact internal shape, the product behavior should still be the same.The current behavior creates unnecessary friction. Once you build up a real session history, weak titles or manual cleanup make resume/history navigation noticeably worse. This is a small UX issue that compounds quickly.
I would treat this as baseline behavior, not a nice-to-have. Other related features are useful, but secondary:
codex --nameat startup.The main win is simpler than all of those: a new thread should usually get a good title automatically, by default, without the user having to think about it.
Confirmed with
codex-cli 0.144.5in the VS Code integrated terminal.My terminal title includes
thread-title, but after the first prompt completes it continues to display the thread UUID until I explicitly run/rename. Manual rename updates the terminal title correctly.Automatically generating a concise title after the first meaningful prompt—while preserving manually assigned titles—would make multiple Codex terminal sessions substantially easier to identify.
Confirmed on
codex-cli 0.146.0on macOS with the VS Code integrated terminal.Configuration:
Observed behavior:
state_5.sqlitealready contains a human-readable value inthreads.title.thread_name, so the configuredthread-titlesegment continues to display the thread UUID./rename <name>updates the terminal title immediately, confirming that terminal-title rendering itself is working.thread/name/setcall can persist a name, but it does not reliably refresh an already-running TUI owned by another app-server process.The 0.146.0 TUI source reflects this distinction:
StatusLineItem::ThreadTitlereadsthread_nameand explicitly falls back tothread_idwhen the name is absent:https://github.com/openai/codex/blob/rust-v0.146.0/codex-rs/tui/src/chatwidget/status_surfaces.rs#L739-L750
This means the generated/persisted thread title and the user-facing thread name are separate values, and the generated title is not promoted into the name path used by
thread-title.Expected behavior: after the first meaningful prompt, Codex should apply the generated concise title through the normal thread-name persistence and notification path, unless the user has already assigned a name manually. This should update both the active TUI terminal title and future resume/history surfaces.
Current
mainhas changed the timing constraint discussed in this thread in a way that may simplify an implementation.initial_user_message: None, sendsthread/name/set, and verifies the persisted name throughthread/read(source atc6058cc).This means the ordering failure in #31158 accurately describes
0.142.5, but waiting for the first turn is no longer required on currentmainmerely to make name persistence possible.turn/completedcould still be a useful scheduling boundary to keep title generation off the primary turn's critical path and avoid competing for provider capacity.There are two remaining race/UI concerns in the current interfaces:
ThreadSetNameParamscontains onlythreadIdandname, andThreadNameUpdatedNotificationcarries no source or generation token (protocol, notification). A late title-generation result could therefore overwrite a manual/renameunless the apply step is conditional or the persisted metadata records provenance.thread/name/updatedas a manual rename and inserts a confirmation history cell (source). Reusing that notification unchanged for automatic naming would add visible history noise.A robust implementation shape would be:
name, or separate generated-title metadata with display precedenceexplicit name > generated title > preview > UUID.ThreadManager/ThreadStore::update_thread_metadata, which is the documented metadata ownership boundary (source).The two acceptance cases that seem most important are: a concurrent manual
/renamealways wins, and the generated title refreshes the active TUI without inserting a manual-rename confirmation cell.