| name | rename-codex-thread |
| description | Rename Codex app thread labels and titles in local Codex state. Use when a user asks to rename, retitle, relabel, or make a Codex chat/thread easier to find in the Codex app sidebar or thread list, especially when the visible label still shows the first prompt such as "$start-new-task ZON-218". |
Rename Codex Thread
Workflow
Use scripts/rename_codex_thread.py for all writes. The Codex app sidebar is backed by ~/.codex/state_5.sqlite or another state_*.sqlite database, not just ~/.codex/session_index.jsonl.
- Pick a concise, human-readable title using the default format below.
- Identify the target thread id.
- Run the script with
--thread-id <id> when known.
- For the active/recent thread, use
--current only when that is clearly what the user means.
- Ask the user to refresh or reopen the Codex app if the old label is still cached.
Default Title Format
Use this format by default:
<tracker id>: <natural language explanatory title>
Examples:
ZON-221: Research Stanford Autonomous Agents Lab collaboration path
owner/repo#123: Fix webhook retry idempotency
[no ticker]: Investigate local notification spam
For tracker-backed work, use the human-facing tracker identifier from task metadata or local context, such as a Linear identifier (ZON-221) or an equivalent GitHub issue reference (owner/repo#123). Do not use raw tracker UUIDs. If no Linear ticket, GitHub issue, or equivalent tracker exists, use [no ticker] as the prefix. The title after the colon should explain the work in natural language, not repeat the first prompt or skill invocation.
Commands
Rename a known thread:
python /home/azureuser/pro/botfiles/codex/skills/rename-codex-thread/scripts/rename_codex_thread.py \
--thread-id 019eedf1-89cc-7c23-8cc7-a7d2bffd4bff \
--title "ZON-218: Find the best ways to contribute to Ambuda again"
Rename the most recently updated unarchived thread:
python /home/azureuser/pro/botfiles/codex/skills/rename-codex-thread/scripts/rename_codex_thread.py \
--current \
--title "[no ticker]: Investigate ncmpcpp crashes and media keys"
Preview recent candidates:
python /home/azureuser/pro/botfiles/codex/skills/rename-codex-thread/scripts/rename_codex_thread.py --list
Notes
- The script creates a timestamped SQLite backup before writing unless
--no-backup is passed.
- The script updates
threads.title and threads.preview; it leaves first_user_message unchanged by default.
- The script appends a matching line to
session_index.jsonl when that file exists, but the SQLite threads table is the authoritative app label source.
- Prefer
--thread-id over --current if multiple Codex sessions may be active.