Codex account snapshot manager
Project description
📦 Codex Manager
The ultimate CLI tool for managing OpenAI Codex account snapshots, tracking quotas, and ensuring seamless workflow continuity.
⚡ Quick Start
Get up and running in under 5 minutes.
Prerequisites
- Python 3.10 or higher
uv(recommended for fast dependency management)
Install
Clone the repository and install using uv:
git clone https://github.com/dhruv13x/codex-manager.git
cd codex-manager
uv pip install --system -e .
Run
Verify the installation by viewing the CLI help menu:
codex-manager --help
# Or use the shorter alias:
cm --help
Demo
Here's a quick 5-line workflow to backup your current account, view recommendations, and switch to a new one:
# 1. Take a live snapshot of your active Codex account state
cm backup --cloud
# 2. Check cooldown statuses for all accounts
cm cooldown
# 3. Get the smartest recommendation for the next account to use
cm recommend
# 4. Switch to a new account using the 'auth-only' method
cm use --email new_user@example.com
[🖼️ Suggestion: Add an animated GIF here demonstrating the
cm usecommand in action with the Rich UI]
✨ Features
Core
- Live Status Tracking: Automatically parses live Codex
/statusoutput to capture account email, quota text, and weekly reset timestamps. - Smart Recommendations: Recommends the optimal account to use next based on calculated cooldowns and real-time metadata.
- Full State Recovery: Backup and restore full Codex runtime states (
auth.json, history, logs) via*.tar.gzarchives and*.metadata.json.
Performance & Reliability
- Offline & Fallback Mode: Employs an emergency
--without-status-checkfallback that gracefully estimates cooldowns even when the live tracker is temporarily unavailable. - Lightning Fast UI: Employs the
richlibrary for beautiful terminal output, tables, and status animations.
Security & Cloud
- Cloud Synchronization: First-class support for Backblaze B2 (and S3-compatible buckets) for remote backup metadata and archive storage.
- Safe Operations: Every modifying command supports a
--dry-runflag to safely simulate actions without touching your files.
🛠️ Configuration
Codex Manager prioritizes configuration via environment variables and CLI arguments for flexibility.
Environment Variables
| Name | Description | Default | Required |
|---|---|---|---|
CODEX_MANAGER_HOME |
The primary home directory for the manager config and backups. | ~/.codex-manager |
No |
CODEX_HOME |
The target directory where Codex state resides. | ~/.codex |
No |
Note: You can also place a config.json inside your CODEX_MANAGER_HOME to persist configuration settings.
Key CLI Arguments
Most commands support these primary flags. Use cm <command> --help for a complete list.
| Flag | Description |
|---|---|
--dry-run |
Safely preview the changes without modifying local or cloud state. |
--cloud |
Enable Backblaze B2/S3 cloud capabilities for the command. |
--email <email> |
Specify a target account email for use, restore, or listing. |
--backup-dir <dir> |
Override the directory used for reading/writing backups. |
--without-status-check |
Bypass live capture and calculate cooldowns statically (+7 days). |
--auth-only |
During use or backup, target only identity/auth files instead of the full state. |
🏗️ Architecture
Directory Tree
~/.codex-manager/ (CODEX_MANAGER_HOME)
├── backups/ # Local archives and metadata
│ ├── backup_1.tar.gz
│ └── backup_1.metadata.json
├── config.json # Persistent local configurations
└── cooldown.json # Registry caching overall account cooldowns
High-Level Data Flow
- Capture:
cm backuporcm statusreads live text from atmuxsession running Codex. - Process: The CLI parses the text to build a state model (Quota, Cooldown, Email) and packages the
~/.codexdirectory into an archive. - Store: Archives and adjacent JSON metadata are saved locally and pushed to the cloud (if configured).
- Evaluate: When
cm recommendorcm cooldownis invoked, local and cloud metadata are fetched, evaluated against real-time, and ranked to find the optimal active account. - Switch:
cm userestores the selected account's data into the~/.codexhome, rotating your session seamlessly.
🐞 Troubleshooting
Common Issues
| Error Message | Cause | Solution |
|---|---|---|
TokenExpiredError: TOKEN EXPIRED |
The active Codex session token has expired. | Re-authenticate in Codex manually, or run with --without-status-check to bypass. |
Could not resolve Cloud (B2) credentials. |
Missing B2 credentials for cloud sync. | Pass --b2-id and --b2-key flags, or ensure your credentials are set up. |
No backups found in Cloud for <email>. |
The requested account isn't backed up to the specified bucket. | Run cm list-backups --cloud to verify the email and backup availability. |
Debug Mode
While the CLI does not have a single --debug flag, you can often reveal more information by viewing the full exception traces or by utilizing the built-in doctor command:
cm doctor
The doctor command verifies your dependencies, runtime directories, and validates the status parser setup.
🤝 Contributing
We welcome contributions to Codex Manager! Please review our CONTRIBUTING.md (coming soon) before submitting PRs.
Dev Setup
To set up your local development environment:
# 1. Install all development dependencies
uv pip install --system -e .[dev]
# 2. Run the tests (Ensure 90%+ coverage)
python -m pytest tests --cov=src --cov-report=term-missing
# 3. Format and lint the codebase
uv run ruff check --fix src/ tests/
uv run black src/ tests/
🗺️ Roadmap
- Plugin Architecture: Allow custom plugins to manage other CLI authentication tokens.
- Enhanced Cloud Coverage: Add direct first-class integrations for Google Cloud Storage and Azure Blob.
- Automated Rotation Daemon: A background worker to automatically rotate accounts when token limits are reached in real-time.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codex_manager-12.0.0.tar.gz.
File metadata
- Download URL: codex_manager-12.0.0.tar.gz
- Upload date:
- Size: 65.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
833372253fb3f5ac459887e32c54193baadd348096c88f06019b7a79b5ebd2f8
|
|
| MD5 |
7e3a831fb75bf608553ad8f2bbee7a42
|
|
| BLAKE2b-256 |
02911646d971a243b3d71a6d6cf71652a6518192f686fffd405385f0a57fde54
|
Provenance
The following attestation bundles were made for codex_manager-12.0.0.tar.gz:
Publisher:
publish.yml on dhruv13x/codex-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codex_manager-12.0.0.tar.gz -
Subject digest:
833372253fb3f5ac459887e32c54193baadd348096c88f06019b7a79b5ebd2f8 - Sigstore transparency entry: 1400538502
- Sigstore integration time:
-
Permalink:
dhruv13x/codex-manager@69f5190df708d739cb58e5a905853eaeeb475c8c -
Branch / Tag:
refs/tags/v12.0.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@69f5190df708d739cb58e5a905853eaeeb475c8c -
Trigger Event:
push
-
Statement type:
File details
Details for the file codex_manager-12.0.0-py3-none-any.whl.
File metadata
- Download URL: codex_manager-12.0.0-py3-none-any.whl
- Upload date:
- Size: 47.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1425ddd280e7088748640591c04ff092ddeaa44fa8e6f15b977233776083f795
|
|
| MD5 |
742634c7b867581524f0c2e5e1abf345
|
|
| BLAKE2b-256 |
35882a2e9d272e0deffa680e6342456c575be2d605d2b421eb1a2cd4035a55cb
|
Provenance
The following attestation bundles were made for codex_manager-12.0.0-py3-none-any.whl:
Publisher:
publish.yml on dhruv13x/codex-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codex_manager-12.0.0-py3-none-any.whl -
Subject digest:
1425ddd280e7088748640591c04ff092ddeaa44fa8e6f15b977233776083f795 - Sigstore transparency entry: 1400538576
- Sigstore integration time:
-
Permalink:
dhruv13x/codex-manager@69f5190df708d739cb58e5a905853eaeeb475c8c -
Branch / Tag:
refs/tags/v12.0.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@69f5190df708d739cb58e5a905853eaeeb475c8c -
Trigger Event:
push
-
Statement type: