codex-session-history

Search and filter local Codex session history stored in SQLite and session_index.jsonl.

2|Updated Jun 18, 2026
One-click install
npx skills add https://github.com/zero-yx/static_flow --skill codex-session-history-zero-yx
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: codex-session-history
Source: https://github.com/zero-yx/static_flow/tree/main/skills/codex-session-history
Command: npx skills add https://github.com/zero-yx/static_flow --skill codex-session-history-zero-yx

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Codex stores session metadata across state_*.sqlite databases and a session_index.jsonl file, making it hard to locate a past conversation by provider, time, or content. This Skill queries those local stores so you can find, filter, and resume any saved Codex session without manually digging through database files. ## Core Features & Use Cases - Flexible Search and Filtering: Query sessions by id, provider, source, cwd, thread name, title, or preview text, with time-range filters supporting ISO dates, epochs, and relative values like 7d or 12h. - Multiple Output Views: Render results as detailed cards, a compact table, or JSON for piping into other tools, with optional provider/source statistics. - Ready-to-Resume Output: Each result includes a copyable codex resume <session_id> command so you can immediately continue a located session. - Use Case: You remember discussing a provider configuration last week but not the session id. Run a query for "provider" filtered to the last 7 days, scan the previews, and resume the matching session directly. ## Quick Start Ask the assistant to list your recent Codex sessions or search session history for a keyword, provider, or date range using the codex-session-history skill.

Frequently Asked Questions about codex-session-history

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search my local Codex session history?▼

Run the bundled script with python3 scripts/codex_session_history.py and a --query flag to search across session id, provider, cwd, thread name, title, and preview text. Add --limit to control how many results are shown.

How to filter Codex sessions by date or time range?▼

Use the --since and --until flags, which accept ISO timestamps, YYYY-MM-DD dates, epoch seconds, relative values like 7d or 12h, and keywords such as today, yesterday, and now. The --sort-by flag chooses whether filtering applies to created or updated time.

Where does the script find the Codex SQLite database?▼

It auto-discovers the newest state_*.sqlite file by checking the CODEX_SQLITE_HOME environment variable, the sqlite_home setting in config.toml, and the ~/.codex directory. If discovery fails, pass --db with an explicit path or --codex-home to override the home directory.

Can I resume a Codex session after finding it?▼

Yes, each result in the cards view includes a ready-to-run codex resume <session_id> command. Copy that command into your terminal to continue the located session directly.

Why is the thread name missing for some Codex sessions?▼

Thread names come from session_index.jsonl, which may not contain an entry for every session. When it is absent, the output falls back to the session title or the first user message preview stored in the SQLite database.

Can I get Codex session history as JSON for scripting?▼

Yes, pass --view json to emit the filtered sessions as a JSON array including ISO timestamps and archived flags. This is intended for piping into other tools or ad hoc analysis.