{"slug": "show-hn-lupen-an-itemized-verified-receipt-for-claude-code-and-codex-spend", "title": "Show HN: Lupen – an itemized, verified receipt for Claude Code and Codex spend", "summary": "Developer Raul Momo released Lupen, a macOS app that provides itemized, verified receipts for AI coding tool spend from Claude Code and Codex logs. The tool breaks down costs by turn, step, and sub-agent, recomputes them from raw tokens against public price tables, and flags any discrepancies without sending data over the network.", "body_md": "*Lupen recomputes your spend straight from the raw Claude Code and Codex logs — broken down by turn, step, and sub-agent, checked against the tokens, and never leaving your Mac.*\n\nInstall:`brew install --cask momoraul/lupen/lupen`\n\n— or grab the[signed DMG]. Requires macOS 26 (Tahoe) on Apple Silicon.\n\nYour AI coding spend says `$50 today`\n\n. Which provider was it? Which session?\nWhich turn? Which sub-agent or tool loop? A daily total can't answer that, so\nLupen breaks the number down and recomputes each cost from the raw tokens.\n\n**Provider-scoped totals**—`$50 today · Claude Code · 12 sessions · 84 turns`\n\n. Claude Code and Codex stay in separate modes instead of one mixed list.**Cost per Turn, Step, SkillGroup, and SubAgent**, where the data allows it.** Recomputed, then diffed**— each cost is recomputed from raw tokens and the public price table and compared to the reported total, so any difference is shown rather than assumed.**Origin-tagged attachments**— every file, image, and URL is labelled by where it entered the context.** Sub-agent cost**rolls up into the parent turn and stays attributable on its own.\n\n**Provider mode**— Choose Claude Code or Codex. Lupen shows only that provider's sessions, conversations, dropdown totals, reports, diagnostics, and verification results.**Cost drift verification**— Run the** Verify Usage**window to recompute every cost from raw tokens and the public price table, then diff it against the reported total; any difference is flagged. Claude Code is checked against its per-request totals; Codex gets an independent local verifier over rollout`token_count`\n\nevents.**Search and resume**— Full-text search finds a session by any prompt it contains (across every turn), plus its project and slug. Reopen any result in Claude Code (or Codex) to pick up where you left off — Lupen runs`claude --resume`\n\n/`codex resume`\n\nin a new Terminal window, or copies the command for you.**Turn boundaries that match Anthropic's API**— Lupen uses`stop_reason`\n\nto mark Turn boundaries instead of timestamps. Tool-use loops stay inside one Turn instead of fragmenting into a dozen rows.**Codex rollout support**— Lupen reads`~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`\n\n, normalizes cached input, preserves reasoning tokens, handles cumulative token deltas, and watches new day folders live.**Sub-agent cost rollup**— When a Turn spawns sub-agents, their cost rolls up into the parent in the outline but stays separately attributable in the detail pane. The aggregate and the per-agent figures come from the same source, so they stay consistent.**Origin-tagged attachment tracking**— File paths, image bytes, and URLs are classified by where they entered the conversation (inline prompt, tool input, tool output, reply, …) so you can see what's filling the context window.**5-hour limit tracking**— A Bayesian estimate of`$ per 1 % of limit consumed`\n\nacross your last 7 days, surfaced in the menu-bar icon's ring tint (yellow at 70 %, orange at 90 %, red at 100 %).**Scriptable**— The same app binary is a command line over the same local index: every report as a table,`lupen`\n\nCLI`--json`\n\n, or`--csv`\n\n, plus`verify`\n\n/`budget`\n\nexit-code gates for a CI step or commit hook. See[Command line](#command-line).**Zero network**— Lupen only reads local Claude Code and Codex files on disk. No API keys, no telemetry, no cloud sync.\n\n```\nbrew install --cask momoraul/lupen/lupen\n```\n\n…or grab the signed DMG from the [latest release](https://github.com/momoraul/Lupen/releases/latest). Both are notarized and keep themselves up to date via Sparkle.\n\n```\ngit clone https://github.com/momoraul/Lupen.git\ncd Lupen\ncp Config/Local.xcconfig.example Config/Local.xcconfig  # set DEVELOPMENT_TEAM\nxcodebuild build -project Lupen.xcodeproj -scheme Lupen -destination 'platform=macOS'\nopen ~/Library/Developer/Xcode/DerivedData/Lupen-*/Build/Products/Debug/Lupen.app\n```\n\nThe app binary doubles as a `lupen`\n\nCLI — same local index the menu-bar app\nbuilds, every report scriptable and local:\n\n```\nlupen skills --last 30d            # per-skill cost, $/run, top model\nlupen top --by sessions --limit 5  # the costliest sessions\nlupen budget --over 20 --last 7d   # exit 4 if this week ran over $20\nlupen verify                       # exit 4 if any cost drifts from the recomputed truth\nlupen daily --json | jq            # any report as JSON / CSV\n```\n\nThe full command set, grouped:\n\n| Commands | |\n|---|---|\nSpend |\n`summary` (default) · `daily` / `weekly` / `monthly` |\nBreakdowns |\n`skills` · `models` · `projects` · `top` |\nFind & resume |\n`search <text>` · `resume <session-id>` |\nGuards (exit-code gates for CI) |\n`verify` · `budget --over <usd>` · `statusline` |\nIndex & setup |\n`refresh` · `config` · `install-cli` |\n\nEvery reporting command takes `--provider`\n\n, a period (`--last 30d`\n\n/ `--month 2026-06`\n\n/ `--since … --until …`\n\n), and `--json`\n\n/ `--csv`\n\n— except `verify`\n\n,\nwhich audits the whole corpus and ignores the period.\n\nHomebrew installs put `lupen`\n\non your PATH automatically;\non a DMG or source build, run `lupen install-cli`\n\nonce. Full reference — every\nflag and exit code: [docs/CLI.md](/momoraul/Lupen/blob/main/docs/CLI.md).\n\nA single Claude Code session once cost me more than the rest of the day combined, and the daily total couldn't tell me which turn — or which runaway sub-agent — ate the money. Lupen is the itemized receipt I wanted: every turn priced, and every price checked against the raw tokens, without anything leaving my Mac.\n\nLupen reads local session files on your Mac:\n\n- Claude Code:\n`~/.claude/projects/**/*.jsonl`\n\n- Codex:\n`$CODEX_HOME/sessions/**/rollout-*.jsonl`\n\nor`~/.codex/sessions/**/rollout-*.jsonl`\n\nIt makes **zero network requests**. No telemetry, no analytics, no cloud sync.\nYour conversations, prompts, file paths, and attachments never leave your\nmachine. The `Info.plist`\n\ncarries no `NSAppTransportSecurity`\n\nblock because\nLupen opens no sockets — you can confirm this with Little Snitch or any\noutbound-connection monitor.\n\nDetailed model: [SECURITY.md](/momoraul/Lupen/blob/main/SECURITY.md).\n\n- macOS 26 (Tahoe) or later, Apple Silicon\n- Xcode 26 with Swift 6 (build from source only)\n- An active Claude Code or Codex installation with local session data\n\n—`docs/CLAUDE-CODE-TOKEN-GUIDE.md`\n\n`~/.claude/projects/`\n\nJSONL schema + token-field interpretation.—`docs/CODEX-LOCAL-DATA.md`\n\n`~/.codex/sessions/`\n\nrollout JSONL schema + token-field interpretation.— How Anthropic's token counts, cache savings, and billable totals relate.`docs/TOKEN-BILLING-EXPLAINED.md`\n\nSee [CONTRIBUTING.md](/momoraul/Lupen/blob/main/CONTRIBUTING.md) for the workflow, commit style,\nand how to file a bug with a sanitised JSONL repro.\n\nMIT. Copyright © 2026 jaden (@momoraul). See [LICENSE](/momoraul/Lupen/blob/main/LICENSE).\n\nLupen is an independent project. It is **not affiliated with Anthropic or\nOpenAI**; it only reads local log files written to your machine.\n\n[Sparkle](https://sparkle-project.org)— auto-update framework (MIT).[GRDB.swift](https://github.com/groue/GRDB.swift)— SQLite toolkit for the on-device index (MIT).\n\nFixes a freeze on very large turns and cold-launch selection.\n\n**Large-turn performance**— the Conversation tab no longer freezes on multi-thousand-step turns; long runs of supporting activity (tools, thinking) fold into a collapsed group so the card count stays bounded.**Cold-launch selection**— the first session is now auto-selected on a cold launch with a proper focus ring, instead of opening with nothing selected.\n\nReimagines the Conversation tab as a rich Turn reader.\n\n**Conversation rich reader**— a selected Turn now renders as a card stack (prompt → thinking → tools → reply) instead of two plain-text blocks, with rich markdown (headings, lists, code blocks with copy, tables, quotes) and multi-line selection.**Curation**— thinking and tool calls collapse into one-line disclosures you can expand; interrupted / API-error / compacted turns show a clear status banner instead of \"(no response available)\".**Readability**— prompts and replies stand out as cards while side content (thinking, tools) fades into indented lines; the selected step is highlighted and scrolled into view.\n\nAdds a storage manager and sharpens the Codex sidebar.\n\n**Manage Sessions & Storage window**(⌘⇧M) — browse and clean up Claude Code and Codex sessions by disk usage, with Lupen cache inspection (index / WAL / snapshot) and a read-only all-disk view. Deletion is trash-only with an allowlist + Undo; auth/config/state files are hard-blocked.**Codex first-prompt titles**— sessions without a`session_index.jsonl`\n\nthread name now show their first user prompt instead of the raw id prefix.**Zero-cost session hiding**— low-signal $0 sessions (Codex auto-review/guardian, idle) collapse behind a small`(N)`\n\ntoggle per project group; active, selected, and no-cost-aggregate sessions stay visible.**Cost recoloring**— cost ≥ $1 reads orange (softer on dark), N/A reads slate, sub-$1 stays dim; colors adapt per light/dark and invert on selection.\n\nMaintenance release — cost-accuracy fixes and a clearer cost in the sidebar.\n\n- Per-session cost now has a dedicated, compression-resistant sidebar label — the title truncates first so the cost stays visible, with the same confidence tinting as the turn rows.\n- Codex: sessions backed by valid rollout JSONL now appear in the sidebar even\nwhen they're missing from\n`session_index.jsonl`\n\n, matching the local Codex view. - Verify Costs:\n`usage`\n\nblocks that omit input/output tokens are kept (coerced to 0) instead of silently dropping the line — fixes an undercount versus the ground-truth scan. - Codex usage verifier: fold\n`last`\n\n-only token events into the running total so the verifier matches the importer. - Codex: bound memory when importing/verifying oversized single-piece rollouts, preventing an out-of-memory spike on very large sessions.\n\nFirst release of the `lupen`\n\ncommand line — the app binary doubles as a\nscriptable CLI over the same local index the menu-bar app builds.\n\n—`lupen`\n\nCLI`summary`\n\n,`daily`\n\n/`weekly`\n\n/`monthly`\n\n,`skills`\n\n,`models`\n\n,`projects`\n\n,`top`\n\n,`search`\n\n/`resume`\n\n,`verify`\n\n,`budget`\n\n,`statusline`\n\n,`refresh`\n\n,`config`\n\n,`install-cli`\n\n.- Every report as a table,\n`--json`\n\n, or`--csv`\n\n;`--provider`\n\nand the period flags (`--last`\n\n/`--month`\n\n/`--since`\n\n+`--until`\n\n) throughout. `verify`\n\n(exit 4 on cost drift) and`budget --over`\n\n(exit 4) make CI or commit-hook cost gates.- Homebrew installs put\n`lupen`\n\non your PATH automatically; DMG / source builds run`lupen install-cli`\n\nonce. - Log window is now a DEBUG-only diagnostic (hidden in release builds).\n\nFirst public release. Highlights:\n\n- Session → Turn → Step → SkillGroup → SubAgent outline with per-row cost and 4-way token breakdown\n- Provider mode for Claude Code and Codex\n- Codex rollout JSONL parsing with cached-input normalization, reasoning tokens, cumulative dedup, fork replay handling, and live watching\n`CostVerifier`\n\n/`Verify Usage`\n\n— provider-aware independent scans for local accounting confidence- 5-hour-limit tracking with Bayesian shrinkage (\n`$ per 1 % limit`\n\n) and severity-tinted menu-bar icon - Origin-tagged attachment classification with inline image preview\n- Snapshot cache for incremental launch (full reparse only when the schema bumps)\n- Sparkle 2 auto-update, with a signed appcast hosted on GitHub Pages\n- Status-item rendered as a single attributed run — no icon-text gap on macOS 26", "url": "https://wpnews.pro/news/show-hn-lupen-an-itemized-verified-receipt-for-claude-code-and-codex-spend", "canonical_source": "https://github.com/momoraul/Lupen", "published_at": "2026-06-21 23:32:03+00:00", "updated_at": "2026-06-21 23:56:24.223813+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools"], "entities": ["Lupen", "Claude Code", "Codex", "Anthropic", "Raul Momo", "macOS"], "alternates": {"html": "https://wpnews.pro/news/show-hn-lupen-an-itemized-verified-receipt-for-claude-code-and-codex-spend", "markdown": "https://wpnews.pro/news/show-hn-lupen-an-itemized-verified-receipt-for-claude-code-and-codex-spend.md", "text": "https://wpnews.pro/news/show-hn-lupen-an-itemized-verified-receipt-for-claude-code-and-codex-spend.txt", "jsonld": "https://wpnews.pro/news/show-hn-lupen-an-itemized-verified-receipt-for-claude-code-and-codex-spend.jsonld"}}