My-Skills/codex-tokens/SKILL.md
Collect and audit Codex token usage with a bundled Python CLI and optional Windows batch launchers. Use this skill when the user asks to check Codex token usage, generate daily token audit logs, calculate monthly CostUSD totals, review Codex spending, or run Codex token usage scripts on Windows, Bash, WSL, or Linux.
npx skillsauth add develata/deve-skills codex-tokensInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use scripts/codex_tokens.py to collect Codex token usage into daily audit logs. Use scripts/calc_monthly_cost.py to calculate monthly CostUSD totals.
scripts/
├─ audit_format.py # shared audit row parser and Markdown format
├─ codex_tokens.py # cross-platform collect CLI
├─ calc_monthly_cost.py # cross-platform summary CLI
├─ run_codex_tokens.bat # Windows collect launcher
└─ calc_monthly_cost.bat # Windows summary launcher
bunx for collect.python3 on macOS/Linux/WSL. If only python exists, use it after confirming python --version reports Python 3.8+.Run the collector from the skill root.
python3 scripts/codex_tokens.py collect --since-days 40 --align-window 2
Windows double-click entry:
scripts/run_codex_tokens.bat
The collector writes monthly daily logs:
scripts/data/YYYYMM.md
Each daily log uses this row format:
| Date | InputTokens | CachedInputTokens | OutputTokens | ReasoningOutputTokens | TotalTokens | CostUSD | Models | FallbackModels | Status |
Run after collecting daily usage:
python3 scripts/calc_monthly_cost.py
Use this command on macOS, Linux, and WSL. Windows double-click entry:
scripts/calc_monthly_cost.bat
The calculator writes:
scripts/CostUSD.md
Treat scripts/data/YYYYMM.md as the daily audit log and scripts/CostUSD.md as the monthly summary. scripts/.gitignore excludes both generated output paths from Git.
collect updates an existing trusted row only after finding AlignWindow consecutive matching days. A day matches when InputTokens, CachedInputTokens, OutputTokens, ReasoningOutputTokens, TotalTokens, CostUSD, Models, and FallbackModels all match; CostUSD equality uses a 1e-6 tolerance.
Interpret statuses as follows:
NEW: append a newly observed day.UPDATED: update a trusted row because CostUSD increased after the alignment window.CONFLICT: append a suspicious mismatch and never overwrite the trusted row.Exclude CONFLICT rows from scripts/CostUSD.md.
Fail on malformed non-empty audit rows instead of silently skipping them.
Run collect only when the user wants to query local Codex usage data. Do not fabricate usage data. If bunx @ccusage/codex@latest fails or returns unexpected JSON, report the failure before changing audit files.
tools
Use when giving the user an INLINE reply that carries a trade-off, a decision, a verdict, or a non-trivial finding (decision brief / round verdict / failure root-cause). NOT for "done"/status confirmations, one-line answers, or pure data dumps. Forces a compact decision-brief shape and blocks internal tool-name / file-path bleed into user-facing text.
development
Use for cross-file or cross-chapter terminology audits and corpus-wide term unification in thesis/paper sources — extract candidate term drift, build a decision queue, classify each occurrence, apply accepted replacements safely, and verify counts/build. Trigger on "术语审计", "术语统一", "术语一致性", "逐词审", "这个词全文怎么用", "把 X 全文改成 Y", "terminology audit", or "unify term X". Do NOT use for ordinary prose drafting or a single known-location edit; use academic-writing for prose quality and claim-boundary judgment.
tools
Use for ANY codex CLI dispatch via dispatch wrapper (no time threshold; presence-of-risk triggers, not estimated wall — stdin-EOF stalls occur at <60s). Combines internal log-inactivity watchdog wrapper + external Claude-session cron probe + sentinel hook enforcement. Detects stalls in ≤60-270s vs hours-without-detection failure mode.
testing
Use BEFORE proposing any multi-hour task, recommending compromise-vs-clean choice, citing a "named" rule/mechanism, or skipping plan iteration. Five guards against Claude's training-time biases that systematically override user-aligned principles. Triggered by proposal, recommendation, citation, or plan authoring.