Developer Guide · AI Agent History

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)
⚡ Instant Session Inspection (Works on Any OS)

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.

Open Free Session Viewer Tool ↗ Get L2Cache for Mac ↗

Updated October 2026 · By the team behind L2Cache

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:

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:

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:

Capability Native Codex CLI (codex resume) L2Cache for Mac
Search Scope First prompt only; no middle turns or tools Full SQLite FTS5 search across prompts, tool outputs & code diffs
Session Titles Cryptic rollout IDs or date paths Auto-surfaces model-generated aiTitle for instant recognition
Token & Cost Analytics None in CLI picker Prompt tokens, completion tokens & prompt cache hit ratios
Resumption Method Navigate to folder & run shell command 1-Click "Resume in Terminal" from floating panel (⌥Space)
Multi-Project Discovery Requires manual --all flag Unified timeline across all repositories and agent providers
Privacy & Telemetry Local disk 100% On-Device, zero-cloud encrypted storage

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 Store

macOS 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.

🗂️ Search sessions in L2Cache: Visit the Codex CLI history viewer for Mac to find earlier prompts and project context.
🛠️ Free Tool: Use our In-Browser Claude & Codex Session Viewer.
📖 Production Scenarios: Read How OpenAI Codex Session History Can Save Your Production: 3 Real Scenarios.
📖 Architecture Guide: Explore Understanding AI Coding Agent JSONL & Session Resumption.
📖 Claude Code Guide: Read How to Search, View & Resume Claude Code Sessions.
📖 Terminal Guide: Learn how to search and manage Mac terminal command history.