Single-binary, cross-platform TUI for:
- Local Codex usage stats (last 7/30 days, chart, top models) by scanning
CODEX_HOME/sessions. - Live account limits/credits by spawning
codex app-serverand callingaccount/rateLimits/read.
See CHANGELOG.md for release history.
- Added incremental session parsing with persisted offsets and parser state in
comon.db. - Reduced restart regressions: unchanged files outside current scan plan now stay visible via cache.
- Fixed full backfill behavior:
--full-scan --scan-time-budget-ms 0now forces a full reparse and cache refresh. - Fixed workspace startup behavior: non-repo launches show All workspaces and do not reuse a stale last workspace filter.
- Added
--scan-time-budget-msfor bounded per-refresh parse time (0disables budget). - Added
--max-jsonl-line-kibto cap parsed line size without hard-dropping large files. - Added cache DB schema migration (
v1 -> v2) for offset/parser-state fields. - For historical backfill after copying older sessions, run once:
comon --full-scan --scan-time-budget-ms 0
- Rust toolchain (stable) installed.
- C/C++ compiler toolchain available (needed to build bundled SQLite through
rusqlite). - Codex CLI installed and available as
codexon yourPATH(required for live limits/credits).- Usage stats still work without Codex CLI (they only need the session logs on disk).
- For portable Linux builds (
--musl),rustupand musl target toolchain support are required.
When started inside a git repository, comon auto-detects the repo root and:
- Filters usage stats to that project
- Uses it as the default working directory for
codex app-server
If started outside a git repo, usage is shown as All workspaces.
If you start outside a git repo but pass --cwd (or --project) pointing inside a git repo,
comon will auto-detect the git root from that path.
If --cwd (or --project) points to a non-git directory, comon shows All workspaces
even when launched from inside a git repo.
# If installed (recommended):
comon
# Or run from the repo without installing:
cargo run --releaseCommon flags:
--codex-home <path>: override CODEX_HOME (default:$CODEX_HOMEor~/.codex)--comon-home <path>: override COMON_HOME for comon state/cache files (default:$COMON_HOMEor~/.comon)--print-config-path: print effective comon config path and exit--codex-bin <path>: override Codex CLI binary (default:codex)--cwd <path>: directory to launchcodex app-serverin (default: current directory)--project <path>/--workspace <path>: filter usage stats to a specific project/workspace (also becomes default--cwdif--cwdnot set)--usage-days <n>: days to scan for usage (clamped 1..=90; default from config)--refresh-usage-secs <n>: usage refresh interval in seconds (default from config)--refresh-limits-secs <n>: limits refresh interval in seconds (default from config)--max-session-file-mib <n>: per-file planning weight (MiB) for scan budget (default from config)--max-session-total-mib <n>: max total size (MiB) to scan across session files (default from config)--max-session-files <n>: max number of session files to scan per refresh (default from config)--max-jsonl-line-kib <n>: max parsed JSONL line size in KiB (default from config)--scan-time-budget-ms <n>: max parse time budget per refresh in ms (0disables budget)--full-scan: scan all files underCODEX_HOME/sessions, including old months (ignores mtime cutoff and file/byte planning caps)--no-full-scan: disable full scan for this run (overrides config)--scan-cache-max-entries <n>: max entries kept in cache database (comon.db) (default from config)--rebuild-cache-on-start: delete local scan cache DB files (comon.db,comon.db-wal,comon.db-shm) before first usage scan
Config precedence:
- CLI flags
~/.comon/config.json(or$COMON_HOME/config.json, or--comon-home <path>/config.json)- built-in defaults
config.json is auto-created on first run. Example:
{
"schema_version": 1,
"usage_days": 30,
"refresh_usage_secs": 300,
"refresh_limits_secs": 60,
"max_session_file_mib": 256,
"max_session_total_mib": 256,
"max_session_files": 10000,
"max_jsonl_line_kib": 512,
"scan_time_budget_ms": 1500,
"full_scan": false,
"scan_cache_max_entries": 50000
}Example:
comon --codex-home "C:\\Users\\You\\.codex" --cwd "C:\\Repos\\some-git-repo"Large-log recovery/tuning example:
# One-time backfill for copied/old sessions (full reparse + cache refresh):
comon --full-scan --scan-time-budget-ms 0
# Normal usage with bounded incremental refresh:
comon --scan-time-budget-ms 1500 --max-jsonl-line-kib 512TabToggle data (Tokens/Time/Runs)wToggle timeframe (Week/Month)fToggle layout (Horz/Vert)r/F5Refresh now (usage + limits)?Help overlayEsc/qQuitEnter/yContinue past "no sessions found" warning (when shown)
If you don't have cargo yet, install Rust via the official rustup installer:
Linux/macOS:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"Windows:
- Download and run the installer from https://rustup.rs
Verify:
cargo --versionFrom the repository root:
cargo build --releaseThe binary will be at:
- Windows:
target\\release\\comon.exe - Linux/macOS:
target/release/comon
To run comon from anywhere:
cargo install --path . --locked --forceThis installs the binary into:
- Linux/macOS:
~/.cargo/bin - Windows:
%USERPROFILE%\\.cargo\\bin
Make sure that directory is on your PATH (the Rust installer typically does this for you).
Optional: install into ~/.local instead:
cargo install --path . --locked --force --root ~/.localLinux/macOS:
# Native install (default):
bash scripts/install-user.sh
# Portable Linux build/install (musl target, auto-detected arch):
bash scripts/install-user.sh --musl
# Explicit target example:
bash scripts/install-user.sh --musl --target x86_64-unknown-linux-muslWindows PowerShell:
powershell -ExecutionPolicy Bypass -File .\scripts\install-user.ps1Optional custom install root:
- Bash:
bash scripts/install-user.sh ~/.local - PowerShell:
.\scripts\install-user.ps1 -Root "$HOME\\.local"
Install script behavior:
- Installs
comoninto the chosen user root. - Supports optional
--target <triple>and--muslbuild/install mode on Linux. - Adds missing Rust target via
rustup target addwhen a target is requested. - Prepares
COMON_HOME(default~/.comon, or$COMON_HOMEif set). - Refuses to use symlink/reparse-point
COMON_HOMEpaths.
Portable Linux release order (Debian/Ubuntu example):
# 1) Build prerequisites
sudo apt update
sudo apt install -y build-essential musl-tools zip
# 2) Rust target for portable Linux builds
rustup toolchain install stable
rustup target add x86_64-unknown-linux-musl
# 3) Build + package from repo root
bash scripts/package-prebuilt.sh --musl
# 4) Upload generated zip to GitHub Release
ls dist/comon-v*-unknown-linux-musl.zipAdditional maintainer options:
# Linux: defaults to portable musl package
# Other OSes: defaults to host target package
bash scripts/package-prebuilt.sh
# Build portable Linux package (musl)
bash scripts/package-prebuilt.sh --musl
# Force host-target package (glibc on Linux)
bash scripts/package-prebuilt.sh --gnuPackage output:
dist/comon-v<version>-<target>.zip
On Linux, prefer *-unknown-linux-musl.zip for maximum compatibility across distros.
Each zip includes:
comonbinaryinstall.sh(user-scope install, no Cargo needed)LICENSE,README.txt
User flow:
unzip comon-v<version>-<target>.zip
cd comon-v<version>-<target>
bash install.shOptional custom install root:
bash install.sh ~/.localASCII-only guardrails for docs/code/scripts:
# Run full repository check (tracked files)
bash scripts/check-ascii.sh
# Install local pre-commit hook (checks staged files on commit)
bash scripts/install-pre-commit-hook.shCI also runs this check on each push and pull request via .github/workflows/ascii-check.yml.
- Usage stats are derived from Codex session JSONL logs. If you have no session data yet, values will be empty.
- Limits/credits require
codex app-serverto start successfully (auth, environment, and a usable working directory). - comon stores local app state in
~/.comon/state.jsonby default (or$COMON_HOME, or--comon-home). - comon stores scan cache in
~/.comon/comon.dbto avoid rereading unchanged session files. - Large session logs are parsed incrementally with persisted parser offsets in
comon.db; unchanged files are reused from cache. - If historical days look incomplete after adding old session files, run once with
--full-scan --scan-time-budget-ms 0to force a full reparse and refresh cached summaries. - comon uses embedded SQLite (
rusqlitewith bundled SQLite); no systemsqlite3CLI is required at runtime. - comon stores user-editable runtime settings in
~/.comon/config.jsonby default. - Privacy: comon stores metadata (workspace paths, timestamps, token/run/time aggregates) and does not persist prompt/completion text.
- File permissions: on Unix-like systems, comon enforces
0700onCOMON_HOMEand0600on files it writes (config.json,state.json,comon.db). - Symlink hardening: comon refuses symlink targets for
COMON_HOMEfiles (config.json,state.json,comon.db,comon.db-wal,comon.db-shm) and rejects symlink/reparse-pointCOMON_HOMEduring install scripts.