Codex Session History
Overview
Use this skill to enumerate local Codex sessions and map each session to its id, title, project, and workspace path.
Prefer the bundled script so the output stays consistent and works even when session_index.jsonl is incomplete.
Workflow
- Run the script to collect unarchived sessions by default.
- Use
session_meta.payload.idas the canonical session id. - Use
session_meta.payload.cwdas the workspace anchor. - Derive the project from the Git root when possible; otherwise fall back to
cwd. - Use
session_index.jsonlonly as enrichment forthread_nameandupdated_at. - Convert stored UTC timestamps into local time before display and time-window filtering.
- If no
thread_nameis available, fall back to the first user message summary.
Commands
List recent sessions:
python3 scripts/list_codex_sessions.py
List active and archived sessions together:
python3 scripts/list_codex_sessions.py --source all
List more rows:
python3 scripts/list_codex_sessions.py --limit 50
Filter by project:
python3 scripts/list_codex_sessions.py --project PlayGround
Filter by a local time window on today's date:
python3 scripts/list_codex_sessions.py --from 11:00 --to 12:00
Filter by a local time window on a specific date:
python3 scripts/list_codex_sessions.py --date 2026-03-19 --from 11:00 --to 12:00
Inspect one session id:
python3 scripts/list_codex_sessions.py --session-id 019ce206-aa11-7c81-a65a-fece3708ecf4 --details
Only show archived sessions:
python3 scripts/list_codex_sessions.py --source archived
Return JSON:
python3 scripts/list_codex_sessions.py --json
Output
Default table columns:
idprojectstarted_atupdated_atsourcetitle
With --details, also show:
matched_frommatched_tocwdproject_pathstarted_atsession_filefirst_user_message
Notes
- Prefer the script over ad hoc
rgbecausesession_index.jsonlmay be incomplete. - Treat the session file itself as the source of truth for
idandcwd. started_atandupdated_atare displayed in local time, not rawZtime.- Time-window filters match actual session events inside the requested interval, not only broad session span coverage.
- If a workspace no longer exists on disk, still report the recorded
cwd. - When the user only asks for "有哪些会话、id 是什么、属于哪个项目", the default table is enough.
Script
Use:
python3 scripts/list_codex_sessions.py --help