Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from bundle
Locate repo-scoped Codex sessions and extract plain prompts and replies from JSONL logs without tool calls.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: codex-session-browser3description: Inspect local Codex conversation history, locate which repo or worktree a session belongs to, and extract plain user/assistant messages from Codex JSONL logs without tool calls. Use when someone asks where Codex stores sessions, wants the latest prompts or replies for a project, needs to parse `~/.codex/sessions`, or wants only the text conversation for a repo such as `forgedemy`.4---56# Codex Session Browser78Use the bundled parser instead of hand-grepping raw JSONL.910Preferred entrypoint:1112- `python3 scripts/codex_sessions.py list --repo /abs/repo/path`13- `python3 scripts/codex_sessions.py messages --repo /abs/repo/path --limit-sessions 3 --tail 10`1415## What this skill knows1617- Codex sessions live under `~/.codex/sessions/YYYY/MM/DD/*.jsonl`.18- The repo or worktree is recorded in `session_meta.payload.cwd` near the top of each file.19- Plain conversation text is easiest to extract from `event_msg` records:20- `user_message` -> user prompt text21- `agent_message` -> assistant text output, with `phase` such as `commentary` or `final_answer`22- Tool calls and tool outputs live in other record types such as `response_item` with `function_call`, `function_call_output`, or `custom_tool_call`; ignore them unless the user explicitly asks for tool traces.23- Some sessions may not have `event_msg` conversation entries. In that case the parser falls back to `response_item` records whose payload is a plain `message` from `user` or `assistant`.2425## Workflow26271. Identify the target repo or session.2829- For one repo/worktree, use `--repo /absolute/path` for exact `cwd` matching.30- If the exact path is unknown, use `--cwd-contains partial-name` first.31- If the user already knows a session id or filename fragment, use `messages --session <id-or-path>`.32332. List candidate sessions first.3435- Run `python3 scripts/codex_sessions.py list --repo /abs/repo/path --limit 10`36- This shows session timestamp, file path, repo `cwd`, message count, and short previews of the last user and assistant text.37383. Extract plain conversation text.3940- Run `python3 scripts/codex_sessions.py messages --repo /abs/repo/path --limit-sessions 1 --tail 8`41- This prints only user/assistant text messages, not tool calls.42- Increase `--limit-sessions` to inspect multiple recent sessions.43- Use `--tail 0` to print the full text conversation for each matched session.44454. Narrow the assistant output when needed.4647- Use `--assistant-phase final_answer` when the user wants only final answers.48- Use `--assistant-phase commentary` when the user wants progress updates instead.49- Use `--role user` or `--role assistant` to isolate one side.50515. Use JSON output when another script or agent will consume the result.5253- `python3 scripts/codex_sessions.py list --repo /abs/repo/path --json`54- `python3 scripts/codex_sessions.py messages --repo /abs/repo/path --limit-sessions 3 --tail 12 --json`5556## Examples5758Find the latest `forgedemy` Codex sessions:5960```bash61python3 scripts/codex_sessions.py list \62--repo /home/latand/Projects/forgedemy \63--limit 564```6566Pull the last few prompts and replies for that repo, without tool calls:6768```bash69python3 scripts/codex_sessions.py messages \70--repo /home/latand/Projects/forgedemy \71--limit-sessions 2 \72--tail 873```7475Only show final assistant answers from the latest matched session:7677```bash78python3 scripts/codex_sessions.py messages \79--repo /home/latand/Projects/forgedemy \80--assistant-phase final_answer \81--tail 482```8384Inspect one exact session by filename fragment:8586```bash87python3 scripts/codex_sessions.py messages \88--session 019cf134-ec89-77d3-a78f-1710bc2a8c03 \89--tail 090```9192## Reporting back9394When summarizing results for the user, include:9596- the matched repo path or session id97- the session timestamp98- the last relevant user prompt(s)99- the assistant reply text the user actually cares about100- a note that tool calls were excluded unless the user asked for them101