How to View & Search OpenAI Codex CLI Sessions
When using OpenAI Codex in your terminal, the agent executes complex shell scripts, builds test fixtures, and writes code across multiple directories. Finding past prompt reasoning and tool commands shouldn't require manual file hunting. Here is how to access and search Codex session rollouts across macOS, Linux, and Windows.
Inspect any Codex rollout-*.jsonl session with zero cloud uploads:
Use our free, in-browser viewer to inspect user messages, system completions, and tool executions in any web browser.
Where Are Codex Sessions Stored?
OpenAI Codex organizes transcripts in date-based directories under your user home directory:
macOS & Linux:
~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
Windows:
%USERPROFILE%\.codex\sessions\YYYY\MM\DD\rollout-*.jsonl
Each session is assigned a unique rollout ID containing the full conversation history, agent actions, tool inputs, and return results formatted in JSON Lines.
Built-in Command: Resuming Codex Sessions
To pick up where you left off in your current or recent coding session:
# Resume recent Codex sessions interactively codex resume
Limitations of Directory-Based Rollout Files:
- Date Fragmented: Because sessions are partitioned by
YYYY/MM/DD, finding a prompt from 3 weeks ago requires recursively searching across multiple nested folders. - Nested Tool Payloads: Tool executions are stored as JSON strings inside JSON objects, making quick visual scanning difficult in standard text editors.
Parsing Codex Sessions via CLI
You can search across all Codex session files recursively using ripgrep and jq:
# Search all past Codex prompts for a keyword
find ~/.codex/sessions -name "rollout-*.jsonl" -exec jq -r 'select(.type=="USER_INPUT") | .content' {} + | grep -i "docker"
# Find recently executed shell commands
find ~/.codex/sessions -name "rollout-*.jsonl" -exec jq -r 'select(.tool_calls? != null) | .tool_calls[] | .args' {} +
Automated Capture with L2Cache for Mac
Rather than running multi-line shell pipelines to find old prompts, L2Cache for Mac runs natively in your menu bar:
- Automatic Developer Albums: Categorizes AI prompts, Git commands, SQL queries, and code blocks automatically.
- Sub-Millisecond Offline Search: Uses native SQLite FTS5 for lightning-fast retrieval across thousands of entries.
- Private & Encrypted: Keeps all history locally on your Mac with biometric Touch ID lock for sensitive API keys and tokens.
Never Lose an AI Prompt or Shell Command
L2Cache gives you instant, private, offline access to every command, prompt, and code snippet you work with on macOS.
Download L2Cache on the Mac App StoremacOS 13 Ventura or later · No subscription required
Frequently Asked Questions
How do I view Codex session rollouts visually?
Drop any rollout-*.jsonl into the free L2Cache Session Viewer. It parses and renders the entire step-by-step history right in your browser.
Does Codex session data leave my Mac?
The local rollout files in ~/.codex/sessions remain on your machine. Using L2Cache also guarantees zero-cloud data storage with on-device indexing.
Can I search Claude Code transcripts as well?
Yes! Check out our guide on searching Claude Code session history on Mac.