Check Codex Tabs
Use this skill to answer Codex tab-status questions from local filesystem data instead of guessing from the visible app UI.
Source Of Truth
Check these locations in order:
~/.codex/state_5.sqliteUse thethreadstable.archived = 0is the best local proxy for an open Codex tab or thread.rollout_pathfrom eachthreadsrow Open the referenced JSONL transcript, usually under~/.codex/sessions/..., and inspect the last JSON object.~/.codex/session_index.jsonlUse only as fallback if the state database is unavailable.~/Library/Application Support/CodexIgnore for this task unless~/.codexis missing. It contains app caches, but it is not the fast path for open-thread status.
Do not start with logs_*.sqlite. The logs database is useful for internal debugging, not for quickly classifying tabs.
Fast Workflow
Determine the scope first. If the user asks about the current repo, run
git rev-parse --show-topleveland filterthreads.cwdto that exact absolute path. If the user asks about all open Codex tabs on the laptop, do not filter bycwd.Prefer the helper script. Run:
python3 /Users/Henry/.codex/skills/check-codex-tabs/scripts/check_codex_tabs.pyAdd
--cwd /absolute/repo/rootfor repo-specific output. Add--active-onlywhen the user only wants unfinished tabs. Add--limit Nwhen the user wants a larger or smaller slice of recent open threads.Fall back to a direct SQLite query if the script is unavailable or you need to inspect raw rows.
For each returned row, inspect the last JSON object in
rollout_pathand classify the tab from that last event.
Manual Query
Use this query for the current repo after resolving the repo root:
select
datetime(updated_at, 'unixepoch', 'localtime') as updated,
title,
cwd,
rollout_path
from threads
where archived = 0
and cwd = '/absolute/repo/root'
order by updated_at desc
limit 40;
Run it with:
sqlite3 -header -column ~/.codex/state_5.sqlite "<query above>"
Then inspect the last JSON line in each transcript:
tail -n 1 "$rollout_path"
Status Rules
Use the last rollout event, not the thread title, to decide whether the tab is still active:
event_msgplustask_complete:done-openevent_msgplusturn_aborted:interrupted- anything else as the last event:
active - missing or unreadable rollout file:
unknown
Common active signals include last events such as exec_command_end, function_call_output, patch_apply_end, or token_count.
Do not equate archived = 0 with active work. Many tabs remain open after they finish cleanly.
Output
When answering the user:
- Group the results into
Active,Done But Open, andInterrupted Or Unknown. - Include each tab's title,
cwd, updated time, and the last event you used to classify it. - If the user only asked which tabs are still in-flight, report only the
Activegroup. - If there are no active tabs in scope, say that explicitly.
Constraints
- Treat unarchived threads as open tabs for this skill's purpose.
- Do not claim to know which tab is frontmost or visually selected in the app.
- Prefer exact
cwdmatching for repo-specific requests. - Prefer the helper script over fragile shell pipelines that parse SQLite output with tabs or newlines in titles.
- If
state_5.sqliteis missing, search for the neweststate_*.sqliteunder~/.codexbefore falling back tosession_index.jsonl.