@dong-/cdxx
v0.1.0
Published
Multi-profile wrapper and live quota failover for Codex CLI
Maintainers
Readme
cdxx
cdxx is a small Codex CLI companion inspired by agyx.
It provides:
- local Codex auth profile save/use/next
- passive quota scanning from
$CODEX_HOME/sessions - optional shell integration so
codexruns throughcdxx session - live autoswitch and
codex resume <session_id>failover when a profile reaches quota
Install locally
cd ~/codexx
npm link
cdxx install
source ~/.zshrcFor the current terminal only:
eval "$(cdxx shell-init)"Profile workflow
Save the currently active Codex login:
cdxx save personalAdd another profile:
cdxx login workSwitch profiles:
cdxx list
cdxx use personal
cdxx next
cdxx currentcdxx stores profile credentials under ~/.config/cdxx/profiles/<name>/auth.json
with owner-only permissions. The active Codex credential remains
$CODEX_HOME/auth.json, normally ~/.codex/auth.json.
Quota workflow
Scan local Codex session transcripts:
cdxx scan
cdxx scan --json
cdxx scan --json --fullRun Codex through the wrapper:
cdxx session -- "inspect this repo"After a wrapped session exits, cdxx scans new or modified Codex transcripts
and records rate-limit status on the active profile. Enable live profile
failover:
cdxx autoswitch onWith autoswitch enabled, the wrapper tails the matched Codex transcript by byte
offset. If Codex reports an exhausted rate limit, cdxx terminates the current
Codex process, switches to the next available saved profile, and starts
codex resume <session_id> from the same working directory.
Session matching
Codex does not expose an agy --log-file style TUI transcript path option.
cdxx matches the child session from Codex's real transcript files instead:
- Snapshot
$CODEX_HOME/sessions/**/*.jsonlimmediately before launching Codex. - Poll new or modified JSONL files while Codex runs.
- Read only the first
session_metarecord and match:payload.cwd == process.cwd(),payload.originator == "codex-tui", andpayload.timestamp >= launchTime - 5s. - Tail the matched JSONL file from the pre-launch file size, so runtime quota checks depend only on newly appended log bytes.
The matched payload.session_id/payload.id is suitable for codex resume.
Notes
cdxxreads Codex JSONL transcripts but does not print prompts or responses.- A profile is treated as exhausted when Codex reports
primary.used_percent >= 100,secondary.used_percent >= 100, or a non-nullrate_limit_reached_type. - Reset times are derived from the
resets_atepoch fields stored by Codex.
