What do you want to change?
Make ccusage codex include archived Codex sessions by default when CODEX_HOME points to a Codex home.
Today the Rust adapter reads ~/.codex/sessions, but not ~/.codex/archived_sessions. I would like Codex home discovery to include both directories, while preserving the current behavior where a direct JSONL directory can still be used for saved codex exec --json output.
I opened an implementation PR at #1176, but it was auto-closed by the contributor gate.
Why?
Archived Codex sessions are still part of local usage history. Ignoring them makes token and cost reports look much lower than the real local history for users who archive conversations.
On my machine, the difference is large:
- active
sessions/: 18 JSONL files, about 289M total tokens
- active +
archived_sessions/: 51 JSONL files, about 1.66B total tokens
So the current default undercounts my Codex usage by excluding archived sessions.
How? (optional)
The implementation in #1176 does this in the Rust adapter:
- Treat entries with
sessions/ or archived_sessions/ as Codex homes.
- Read both directories by default for Codex homes.
- Keep direct JSONL directory behavior unchanged.
- Deduplicate by relative JSONL path before parsing, with the active
sessions/ copy winning over an archived copy.
- Use the same discovery behavior in both the event loader and aggregate streaming path.
Validation from the PR branch:
cargo test --manifest-path rust/Cargo.toml --workspace codex -- --nocapture
cargo check --manifest-path rust/Cargo.toml --workspace
git diff --check
What do you want to change?
Make
ccusage codexinclude archived Codex sessions by default whenCODEX_HOMEpoints to a Codex home.Today the Rust adapter reads
~/.codex/sessions, but not~/.codex/archived_sessions. I would like Codex home discovery to include both directories, while preserving the current behavior where a direct JSONL directory can still be used for savedcodex exec --jsonoutput.I opened an implementation PR at #1176, but it was auto-closed by the contributor gate.
Why?
Archived Codex sessions are still part of local usage history. Ignoring them makes token and cost reports look much lower than the real local history for users who archive conversations.
On my machine, the difference is large:
sessions/: 18 JSONL files, about 289M total tokensarchived_sessions/: 51 JSONL files, about 1.66B total tokensSo the current default undercounts my Codex usage by excluding archived sessions.
How? (optional)
The implementation in #1176 does this in the Rust adapter:
sessions/orarchived_sessions/as Codex homes.sessions/copy winning over an archived copy.Validation from the PR branch:
cargo test --manifest-path rust/Cargo.toml --workspace codex -- --nocapturecargo check --manifest-path rust/Cargo.toml --workspacegit diff --check