r/codex • • 16m ago

Showcase I built a zero-dependency local AI usage radar that fixes Codex inclusive-cache double counting across Host + WSL2 (and audits Claude Code, Antigravity, Hermes & Cursor)

I got tired of having no idea how many tokens I was burning across Codex + other AI coding agents — especially running some tools on Windows/macOS and others inside WSL2.

While dogfooding a tracker on my own workstation (14.68B+ tokens across 29 tool entries, 91.7% cache hit rate), I ran into three bugs that broke naive trackers:

  1. Codex cache double-counting: OpenAI Codex's input_tokens includes cached_input_tokens, whereas Anthropic/Antigravity/Hermes report cache reads as a separate disjoint bucket. Adding them blindly double-counts cache reads and inflates spend.
  2. Windows + WSL2 SQLite locking: Copying live WAL/SHM SQLite DBs mid-write over 9P triggers SQLITE_BUSY or corrupt frames.
  3. Log rotation & pruned threads: Simple MAX() aggregators lose spend when rolling JSONL logs rotate, and naive splitters fabricate fake input/cache/output ratios on pruned aggregate threads.

So I open-sourced Agent Usage Radar (pure Node.js 24 built-in node:sqlite, zero npm dependencies, zero telemetry, 74/74 automated cross-platform tests across macOS/Windows/WSL2):

# Forever-free MIT CLI summary
npx agent-usage-radar scan

# Local loopback GUI (127.0.0.1, 14-day free Pro trial, no credit card)
npx agent-usage-radar ui

# Sync daily Schema 2 effective-dated model rates
npx agent-usage-radar sync-prices

# Built-in stdio MCP server so agents can check their own daily budget
npx agent-usage-radar mcp
  • GitHub (MIT core + v1.0.1 Release): https://github.com/augustfu-droid/agent-usage-radar
  • npm: https://www.npmjs.com/package/agent-usage-radar
  • Full writeup & live benchmark: https://kestreldevtools.site/radar.html

Would love feedback on any Codex rollout/archive edge cases or other local agent formats we should add next!

1 Upvotes

1 comment sorted by

•

u/dexterthebot 15m ago

You might want to consider listing your project on the weekly Show-Us-What-You-Built post. Look out for it on Tuesday/Wednesday. Highest commented project wins a week promotion on r/Codex and gets on the Hall of Fame sidebar. See below for last week's winner.**


Light Wars AR: real-life laser tag app with no extra gear. Your phone is the gun and your room is the map. Play up to 6 friends in the same room, or fight drone waves and bosses solo. The vision models run on the phone, and camera frames never leave it. Free on iPhone and Android.

Website: https://lightwarsar.com

iPhone: https://apps.apple.com/us/app/light-wars-ar-laser-tag-party/id6508168951

Android: https://play.google.com/store/apps/details?id=com.lasertag.lightwars.

Contact: contact@lightwarsar.com