How to Find & Resume OpenAI Codex CLI Sessions on Mac
When using OpenAI Codex in your terminal, the agent executes complex multi-file refactors, runs bash tests, and generates code diffs across your projects. Finding past prompt reasoning, reviewing modified files, and resuming interrupted sessions shouldn't require manual file hunting. Here is how to find, inspect, and resume OpenAI Codex sessions on macOS.
⚡ OpenAI Codex CLI Session Quick Reference
| Codex Rollout Logs: | ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl |
| Long-Term Memory: | ~/.codex/memories.sqlite |
| CLI Resume Command: | codex resume |
| GUI Search & Token Tracker: | L2Cache for Mac (1-click resume & token analytics) |
Inspect any Codex rollout-*.jsonl session with zero cloud uploads:
Use our free, in-browser viewer to inspect user messages, system completions, tool executions, and diffs in any browser.
Where Are Codex Session Logs Stored on macOS?
OpenAI Codex organizes transcripts into date-partitioned JSON Lines files in your home directory:
macOS & Linux Path:
~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
~/.codex/memories.sqlite
Windows Path:
%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.
Inside the JSONL: What OpenAI Codex CLI Tracks
Every Codex CLI rollout is an append-only JSON Lines (.jsonl) stream. Each line captures a distinct phase in the agent's turn loop:
{"type":"session_meta","session_id":"rollout-2026-09-30-0814-jwt-auth","cwd":"/Users/developer/backend","timestamp":"2026-09-30T08:14:10.052Z","model":"o3-mini","aiTitle":"Refactor JWT token validator with clock skew leeway"}
{"type":"event_msg","role":"user","turn":1,"timestamp":"2026-09-30T08:14:11.120Z","content":"Update our auth middleware to allow 60 seconds clock skew leeway on JWT token expiration"}
{"type":"tool_call","turn":1,"tool_name":"file_search","arguments":{"pattern":"*auth*.go","dir":"pkg/auth"}}
{"type":"item_completed","turn":1,"tool_name":"file_search","status":"success","result":"pkg/auth/jwt_validator.go\npkg/auth/middleware.go"}
{"type":"tool_call","turn":1,"tool_name":"edit_file","arguments":{"file_path":"pkg/auth/jwt_validator.go","instructions":"Add WithLeeway(60 * time.Second) to jwt.ParseWithClaims"}}
{"type":"item_completed","turn":1,"tool_name":"edit_file","status":"success","diff":"+ claims := &CustomClaims{}\n+ token, err := jwt.ParseWithClaims(tokenString, claims, keyFunc, jwt.WithLeeway(60*time.Second))"}
{"type":"response_item","role":"assistant","turn":1,"content":"I have updated `pkg/auth/jwt_validator.go` with 60s leeway. All test suites pass."}
{"type":"turn_metrics","turn":1,"tokens":{"prompt_tokens":3120,"completion_tokens":420,"cached_tokens":18500,"total_tokens":22040},"duration_ms":1890}
Key Fields Tracked in Codex Rollout Logs:
aiTitle: A concise, model-generated synopsis of the session's objective (e.g., "Refactor JWT token validator with clock skew leeway"). L2Cache uses this to render clean, readable session cards instead of cryptic UUID hashes.session_id&model: Unique identifier along with the exact model (such aso3-miniorgpt-4o) utilized during that session.event_msg&response_item: Full user prompt inputs paired with the assistant's final response and explanation.tool_call&item_completed: Tool executions (such as file searching, command execution, or file editing) including inputs, return data, and inline git-style code diffs.- Token Analytics & Prompt Caching: Detailed breakdown of
prompt_tokens,completion_tokens, andcached_tokens(showing tokens retrieved from OpenAI's prompt cache).
Why Codex Conversation History Changes How You Work
Treating your Codex transcripts as a searchable repository memory—rather than a pile of disposable terminal sessions—fundamentally transforms day-to-day engineering velocity:
🔄 Stop Re-Explaining Complex Modules
If you spent 15 turns giving Codex deep architectural context on your auth layer or SQLite schema, don't start from scratch. Resume that exact session to maintain full context instantly.
🎯 Keep Architectural Decisions Consistent
Technical decisions compound across PRs. Resuming the original session prevents the agent from contradicting patterns, conventions, or design choices established days earlier.
⚡ Slash Token Costs & Prompt Latency
Re-explaining code burns input tokens and model warmup time. Continuing a warm session maximizes prompt cache hit rates, saving up to 90% on API costs and cutting response times.
🧘 Manage Multi-Repo Contexts Calmly
When you can search and resume any Codex conversation across multiple projects in one global hotkey panel, repository hopping stops incurring a massive cognitive context switch.
💡 Never Lose a Late-Night Fix
That brilliant regex or tricky concurrency workaround you found at midnight is indexed in your history. Search the tool output, resume the session, and reuse it effortlessly.
How to Resume OpenAI Codex Sessions
OpenAI Codex CLI provides built-in terminal commands to inspect and pick up where you left off in past coding sessions:
💻 Native Codex CLI History and Resume Commands
| Command | Use |
|---|---|
codex resume |
Open the interactive session picker. |
codex resume --last |
Continue the most recent session. |
codex resume --all |
Include sessions from other directories. |
codex resume SESSION_ID |
Resume a specific session by ID. |
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 dozens of nested folders. - Nested Tool Payloads: Tool executions are stored as JSON strings inside JSON objects, making quick visual scanning difficult in standard text editors.
- Context Loss: The native CLI picker shows limited metadata without token counts or search across tool diffs.
Searching Codex Sessions via Terminal (ripgrep & jq)
If you prefer shell scripting, you can search across all Codex session files recursively using find, jq, and grep:
# Search all past Codex prompts for a keyword
find ~/.codex/sessions -name "rollout-*.jsonl" -exec jq -r 'select(.type=="event_msg") | .content' {} + | grep -i "docker"
# Find recently executed tool commands and file paths
find ~/.codex/sessions -name "rollout-*.jsonl" -exec jq -r 'select(.type=="tool_call") | .arguments' {} +
Native Codex Resume vs. L2Cache History
While the native codex resume CLI command is great for quick terminal rollbacks, L2Cache for Mac adds visual search, token analytics, and cross-project indexing:
Never Lose an AI Prompt or Agent Session
L2Cache gives you instant, private, offline access to every AI session, command, prompt, and code snippet you work with on macOS.
Download L2Cache on the Mac App StoremacOS 13 Ventura or later · Free download
Frequently Asked Questions
Where does OpenAI Codex store session logs on Mac?
OpenAI Codex stores session rollout files under ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl organized by date, with long-term memory in ~/.codex/memories.sqlite.
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 How to Search, View & Resume Claude Code Sessions.