mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-10-19 18:23:41 +00:00
README: tell the story first, keep the manual in docs (#1527)
Some checks are pending
CI / semgrep (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
Some checks are pending
CI / semgrep (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
* docs: move the README reference manual into docs/ * assets: designed README images and their sources * README: tell the story first, keep the manual in docs
This commit is contained in:
parent
8319a05f38
commit
f54345a5c3
15 changed files with 1007 additions and 803 deletions
BIN
assets/readme/all-surfaces.png
Normal file
BIN
assets/readme/all-surfaces.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 608 KiB |
BIN
assets/readme/optimize.png
Normal file
BIN
assets/readme/optimize.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 329 KiB |
BIN
assets/readme/terminal.png
Normal file
BIN
assets/readme/terminal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 574 KiB |
|
|
@ -6,10 +6,19 @@ One line per file in this directory, recursively.
|
|||
|
||||
- [architecture.md](architecture.md) — A map of the codebase.
|
||||
- [by-branch.md](by-branch.md) — The Spend view in CodeBurn Desktop has a By branch panel: pick a project and see where its AI spend went, per git branch, with the recorded worktrees and the individual sessions behind each branch.
|
||||
- [cli.md](cli.md) — Every CodeBurn command and keyboard shortcut, plus the report-focused flags for filtering, JSON output, and diagnosing detection.
|
||||
- [compare-cohorts.md](compare-cohorts.md) — The classic Compare view answers "how do these two models differ across my whole history?" by aggregating everything each model ever did.
|
||||
- [compare-periods.md](compare-periods.md) — Compare two date ranges side by side and see exactly what drove the change in usage and cost.
|
||||
- [configuration.md](configuration.md) — Currency, model aliases, local/custom-priced/proxy models, and environment variables.
|
||||
- [drill-through.md](drill-through.md) — CodeBurn Desktop can open any aggregate as a session list that explains exactly what composes it, without losing your place.
|
||||
- [guard.md](guard.md) — Opt-in Claude Code hooks that watch session cost while you work: soft cap, hard cap, checkpoint nudge, session openers.
|
||||
- [how-it-works.md](how-it-works.md) — Pricing, task categories, breakdowns, one-shot rate, per-tool data locations and parsing, and how to read the dashboard.
|
||||
- [mcp.md](mcp.md) — `codeburn mcp` runs a local MCP server over stdio so an AI agent can ask about your usage and savings mid-conversation.
|
||||
- [menubar.md](menubar.md) — The macOS menu bar app, Windows tray app (with WSL discovery), and Linux GNOME Shell extension.
|
||||
- [optimize.md](optimize.md) — `codeburn optimize` scans your Claude Code sessions and your `~/.claude/` setup, reports what is costing tokens without earning them, and grades the setup A to F.
|
||||
- [plans-and-quota.md](plans-and-quota.md) — Subscription plan tracking and live provider quota via `codeburn quota`.
|
||||
- [web.md](web.md) — The local browser dashboard and combining usage across your paired devices.
|
||||
- [yield.md](yield.md) — `codeburn yield` correlates AI sessions with git commits to show what actually shipped.
|
||||
|
||||
## docs/design/
|
||||
|
||||
|
|
|
|||
205
docs/cli.md
Normal file
205
docs/cli.md
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
# Command reference
|
||||
|
||||
Every CodeBurn command and keyboard shortcut, plus the report-focused flags for filtering, JSON output, and diagnosing detection.
|
||||
|
||||
Run `codeburn` for the dashboard, or use a subcommand below. Most commands also accept `--provider`, `--project` / `--exclude`, and a period flag (`-p today|week|30days|month|all|lifetime`).
|
||||
|
||||
**Dashboard & reports**
|
||||
|
||||
| Command | What it does |
|
||||
|---------|--------------|
|
||||
| `codeburn` | Interactive dashboard, today (falls back to the last 7 days when today is empty) |
|
||||
| `codeburn today` | Today's usage |
|
||||
| `codeburn month` | This calendar month's usage |
|
||||
| `codeburn overview` | Plain-text monthly summary, copy-pasteable (`--no-color`, `--from`/`--to`) |
|
||||
| `codeburn report -p 30days` | Rolling 30-day window |
|
||||
| `codeburn report -p all` | Every recorded session |
|
||||
| `codeburn report --from 2026-04-01 --to 2026-04-10` | An exact date range |
|
||||
| `codeburn report --format json` | Full dashboard data as JSON, printed to stdout |
|
||||
| `codeburn report --refresh 60` | Auto-refresh every 60s (the minimum and default; `--refresh 0` disables) |
|
||||
|
||||
**Status & export**
|
||||
|
||||
| Command | What it does |
|
||||
|---------|--------------|
|
||||
| `codeburn status` | Compact one-liner: today + month totals |
|
||||
| `codeburn status --format json` | The same totals as JSON |
|
||||
| `codeburn export` | CSV covering today, 7 days, and 30 days |
|
||||
| `codeburn export -f json` | Export as JSON instead of CSV |
|
||||
| `codeburn export -f json -o <dir>/` | Write the export inside a folder, as `codeburn-export-YYYY-MM-DD.json` |
|
||||
|
||||
**Sync (team telemetry)** _preview_
|
||||
|
||||
| Command | What it does |
|
||||
|---------|--------------|
|
||||
| `codeburn sync setup <url>` | One-time setup: OIDC login via browser, stores token securely |
|
||||
| `codeburn sync push` | Push unsent usage to remote endpoint (default: last 7 days) |
|
||||
| `codeburn sync push --since 30d` | Push a larger window |
|
||||
| `codeburn sync status` | Show endpoint, auth state, last sync time |
|
||||
| `codeburn sync logout` | Revoke token and remove credentials |
|
||||
| `codeburn sync reset --confirm` | Clear sent-ledger (re-send all data on next push) |
|
||||
|
||||
Sync sends token counts, costs, models, and projects, never prompts or code. This feature is in preview; the protocol may change between releases. See [sync/](sync/) for details.
|
||||
|
||||
**Web & devices**
|
||||
|
||||
| Command | What it does |
|
||||
|---------|--------------|
|
||||
| `codeburn web` | Local browser dashboard with charts (http://localhost:4747) |
|
||||
| `codeburn share --pair` | Share this device's usage to your other devices (PIN pairing) |
|
||||
| `codeburn devices add` | Find and pair a nearby device |
|
||||
| `codeburn devices` | Combined usage totals across your paired devices |
|
||||
|
||||
**Analysis**
|
||||
|
||||
| Command | What it does |
|
||||
|---------|--------------|
|
||||
| `codeburn quota` | Live provider capacity: quota windows for each signed-in coding tool |
|
||||
| `codeburn quota --format json` | The same capacity readings as JSON |
|
||||
| `codeburn gateway-totals` | Show whether Vercel AI Gateway spend counts toward totals (`include`, `exclude`) |
|
||||
| `codeburn doctor` | Per-provider detection status: paths probed, sessions found, parse health (`--json`, `--provider`) |
|
||||
| `codeburn audit` | Per provider-model token source table: where every number comes from |
|
||||
| `codeburn context` | What fills a session's context window: interactive browser (Claude Code and Codex) |
|
||||
| `codeburn context <id> --json` | The same context tree, scriptable |
|
||||
| `codeburn optimize` | Scan for waste and print copy-paste fixes (last 30 days) |
|
||||
| `codeburn optimize -p week` | Scope the waste scan to the last 7 days |
|
||||
| `codeburn compare` | Side-by-side model comparison |
|
||||
| `codeburn yield` | Productive vs reverted/abandoned spend, correlated against git |
|
||||
| `codeburn yield -p 30days` | Yield analysis for the last 30 days |
|
||||
|
||||
**Fix & control**
|
||||
|
||||
| Command | What it does |
|
||||
|---------|--------------|
|
||||
| `codeburn optimize --apply` | Interactively apply config-class fixes (`--yes`, `--dry-run`, `--only <ids>`) |
|
||||
| `codeburn act list` | Every change CodeBurn has applied, newest first |
|
||||
| `codeburn act undo <id>` | Roll a change back (`--last` for the most recent, `--force` if files drifted) |
|
||||
| `codeburn act report` | Realized vs estimated savings for applied fixes |
|
||||
| `codeburn guard install` | Budget-cap hooks for Claude Code (`--global`, `--statusline`) |
|
||||
| `codeburn guard status` | Show caps, install locations, and flagged projects |
|
||||
| `codeburn guard allow` | Lift the hard cap for the current session |
|
||||
| `codeburn mcp` | MCP server (stdio) exposing usage and savings to AI agents |
|
||||
|
||||
**Models**
|
||||
|
||||
| Command | What it does |
|
||||
|---------|--------------|
|
||||
| `codeburn models` | Per-model token + cost table (last 30 days) |
|
||||
| `codeburn models --by-task` | Break each model into per-task-type rows |
|
||||
| `codeburn models --by-agent` | Break each model into per-agent rows: which agent drove which model's spend (`(main)` covers non-agent sessions; `--min-cost 0` shows sub-cent agents) |
|
||||
| `codeburn models --top 10` | Only the 10 most expensive models |
|
||||
| `codeburn models --unpriced` | Only models with usage that currently price at $0 — the copyable form of the unpriced-models warning. Shows raw model IDs (not friendly names). Per-token gaps go to `model-alias`; subscription / flat-rate SKUs go to `model-flat-rate`. JSON keeps IDs exact |
|
||||
| `codeburn models --format markdown` | Emit a paste-friendly markdown table |
|
||||
| `codeburn models --task feature` | Filter to feature-development work |
|
||||
| `codeburn models --provider claude` | Filter to a single provider |
|
||||
|
||||
Left/right arrow keys switch between Today, 7 Days, 30 Days, Month, 6 Months, and Lifetime (use `--from` / `--to` for an exact historical window). Up/down scroll the full dashboard one line, Page Up/Page Down move one screen, and Home/End jump to either end. The main Daily Activity panel shows at least 10 dates from scrollable full history: use `j`/`k` to move one day, Shift+Space/Space to page, and `g`/`G` to jump to either end. Panels flow in the same order across three columns at maximum width, two at medium width, and one when narrow. In the three-column layout, all panels widen equally by one character for every three additional terminal columns until the dashboard reaches the lesser of 256 characters or the widest renderable source row. Press `q` to quit, `1` `2` `3` `4` `5` `6` as period shortcuts, `c` to open model comparison, or `o` to open optimize. Today, 7 Days, and concrete-day views refresh in place at most once per minute by default (`--refresh 0` to disable) without changing the active view or scroll position. The heavier aggregate views remain static between deliberate navigation changes. The dashboard also shows average cost per session and the five most expensive sessions across all projects.
|
||||
|
||||
## Your month at a glance
|
||||
|
||||
```bash
|
||||
codeburn overview # this month, clean tables
|
||||
codeburn overview --no-color # plain text, ready to paste
|
||||
codeburn overview --from 2026-06-01 --to 2026-06-15 # any date range
|
||||
codeburn overview -p all # last 6 months
|
||||
codeburn overview -p lifetime # full history (uncapped)
|
||||
codeburn overview --provider claude # one tool only
|
||||
```
|
||||
|
||||
`codeburn overview` prints a copy-pasteable summary of where your AI spend went: totals (cost, tokens, cache hit), a breakdown by tool and by top model, your highest-value days, top projects, a per-day table, and activity and tool usage. Pipe it anywhere (into `pbcopy`, a PR, Slack, or a tweet); color drops automatically when the output is not a terminal, or pass `--no-color`.
|
||||
|
||||
```text
|
||||
CodeBurn June 2026
|
||||
|
||||
Totals
|
||||
Cost $2,795.10
|
||||
Tokens 3.49B in 23.9M / out 20.2M / cache-w 72.5M / cache-r 3.38B
|
||||
Calls 14,755 sessions 753
|
||||
Cache hit 99.3%
|
||||
|
||||
By tool
|
||||
┌──────────┬───────────┬────────┬───────┐
|
||||
│ Tool │ Cost │ Tokens │ Share │
|
||||
├──────────┼───────────┼────────┼───────┤
|
||||
│ claude │ $2,662.37 │ 3.34B │ 95% │
|
||||
│ codex │ $119.12 │ 128.1M │ 4% │
|
||||
└──────────┴───────────┴────────┴───────┘
|
||||
|
||||
(plus Top models, Highest-value days, Top projects, a per-day table, By activity, and Tools)
|
||||
```
|
||||
|
||||
## Compare models
|
||||
|
||||
```bash
|
||||
codeburn compare # interactive model picker (default: last 6 months)
|
||||
codeburn compare -p week # last 7 days
|
||||
codeburn compare -p today # today only
|
||||
codeburn compare --provider claude # Claude Code sessions only
|
||||
```
|
||||
|
||||
Which model is actually better for *your* work? Press `c` in the dashboard, or run `codeburn compare`. Arrow keys switch periods, `b` to return.
|
||||
|
||||
| Section | Metric | What it measures |
|
||||
|---------|--------|-----------------|
|
||||
| Performance | One-shot rate | Edits that succeed without retries |
|
||||
| Performance | Retry rate | Average retries per edit turn |
|
||||
| Performance | Self-correction | Turns where the model corrected its own mistake |
|
||||
| Efficiency | Cost per call | Average cost per API call |
|
||||
| Efficiency | Cost per edit | Average cost per edit turn |
|
||||
| Efficiency | Output tokens per call | Average output tokens per call |
|
||||
| Efficiency | Cache hit rate | Proportion of input from cache |
|
||||
|
||||
Also compares per-category one-shot rates, delegation rate, planning rate, average tools per turn, and fast mode usage.
|
||||
|
||||
## Filtering
|
||||
|
||||
```bash
|
||||
codeburn report --project myapp # show only projects matching "myapp"
|
||||
codeburn report --exclude myapp # show everything except "myapp"
|
||||
codeburn report --exclude myapp --exclude tests # exclude multiple projects
|
||||
codeburn month --project api --project web # include multiple projects
|
||||
codeburn export --project inventory # export only "inventory" project data
|
||||
```
|
||||
|
||||
Filter by provider, project, or exact date range. The `--project` and `--exclude` flags work on every reporting command and can be combined with `--provider`. A plain word matches a project's name or path as a case-insensitive substring, so `--project my-company` also covers `my-company-kit` and its worktrees. An absolute path selects that one project and anything inside it, so `--exclude /Users/me/work/my-company` leaves the sibling `/Users/me/work/my-company-kit` alone. A leading `~` is expanded against your home directory, so a quoted `'~/work/my-company'` selects the same project as the path the shell would have expanded. An absolute POSIX path is case-sensitive, the same rule that decides project identity everywhere else (`/Users/me/Vault` and `/Users/me/vault` are two projects); a Windows drive or UNC path folds case. An absolute path that matches no project in the period you asked for is reported on stderr, since it would otherwise leave a total that looks right.
|
||||
|
||||
```bash
|
||||
codeburn report --from 2026-04-01 --to 2026-04-10 # explicit window
|
||||
codeburn report --from 2026-04-01 # this date through today
|
||||
codeburn report --to 2026-04-10 # earliest data through this date
|
||||
```
|
||||
|
||||
Either flag alone is valid. Inverted or malformed dates exit with a clear error. In the TUI, the custom range sets the initial load only; pressing `1` through `6` switches back to predefined periods.
|
||||
|
||||
## JSON output
|
||||
|
||||
`report`, `today`, and `month` support `--format json` to output the full dashboard data as structured JSON to stdout:
|
||||
|
||||
```bash
|
||||
codeburn report --format json # 7-day JSON report
|
||||
codeburn today --format json # today's data as JSON
|
||||
codeburn month --format json # this month as JSON
|
||||
codeburn report -p 30days --format json # 30-day window
|
||||
```
|
||||
|
||||
The JSON includes all dashboard panels: overview (cost, calls, sessions, cache hit %), daily breakdown, projects (with `avgCostPerSession`), models with token counts, activities with one-shot rates, core tools, MCP servers, and shell commands. Pipe to `jq` for filtering:
|
||||
|
||||
```bash
|
||||
codeburn report --format json | jq '.projects'
|
||||
codeburn today --format json | jq '.overview.cost'
|
||||
```
|
||||
|
||||
For lighter output, use `status --format json` (today and month totals only), `optimize --format json` (setup health, findings, and copy-paste fixes), `yield --format json` (productive/reverted/abandoned/ambiguous spend), or file exports (`export -f json`).
|
||||
|
||||
## Diagnosing detection
|
||||
|
||||
When a tool shows zero (or a number that looks wrong), `codeburn doctor` explains why. It runs fully offline and read-only, and never writes to caches or config.
|
||||
|
||||
```bash
|
||||
codeburn doctor # every provider, human-readable table
|
||||
codeburn doctor --provider opencode # diagnose one provider
|
||||
codeburn doctor --json # machine-readable, pipe to jq
|
||||
```
|
||||
|
||||
For each provider it shows the exact directories or databases probed (with any env override such as `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, or `OPENCODE_DATA_DIR` and whether the path exists), how many session files were found, how many of a bounded sample parsed cleanly, the cached file count, and a one-line verdict: `OK (n sessions)`, `NOTHING FOUND` with the likely cause (directory missing, override points at an empty dir, or the tool is not installed), or `ERRORS (n parse failures)`. A provider that throws is caught and reported as its own error row, never crashing the rest of the report.
|
||||
|
||||
62
docs/configuration.md
Normal file
62
docs/configuration.md
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# Configuration
|
||||
|
||||
## Currency
|
||||
|
||||
```bash
|
||||
codeburn currency GBP # set to British Pounds
|
||||
codeburn currency AUD # set to Australian Dollars
|
||||
codeburn currency JPY # set to Japanese Yen
|
||||
codeburn currency CNY # set to Chinese Yuan
|
||||
codeburn currency RON # set to Romanian Leu
|
||||
codeburn currency # show current setting
|
||||
codeburn currency --reset # back to USD
|
||||
```
|
||||
|
||||
Any [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes) is supported (162 currencies). Exchange rates fetched from [Frankfurter](https://www.frankfurter.app/) (European Central Bank data, free, no API key) and cached for 24 hours. Config stored at `~/.config/codeburn/config.json`. The currency setting applies everywhere: dashboard, status bar, menu bar, CSV/JSON exports, and JSON API output.
|
||||
|
||||
## Model aliases
|
||||
|
||||
If you see `$0.00` for some models, the model name reported by your provider does not match any entry in the LiteLLM pricing data. This commonly happens when using a proxy that rewrites model names.
|
||||
|
||||
```bash
|
||||
codeburn model-alias "my-proxy-model" "claude-opus-4-6" # add alias
|
||||
codeburn model-alias --list # show configured aliases
|
||||
codeburn model-alias --remove "my-proxy-model" # remove alias
|
||||
```
|
||||
|
||||
Aliases are stored in `~/.config/codeburn/config.json` and applied at runtime before pricing lookup. The target name can be anything in the [LiteLLM model list](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) or a canonical name from the fallback table (e.g. `claude-sonnet-4-6`, `claude-opus-4-5`, `gpt-4o`). Built-in aliases ship for known proxy model name variants. User-configured aliases take precedence over built-ins.
|
||||
|
||||
## Local models, custom prices, and proxies
|
||||
|
||||
```bash
|
||||
codeburn price-override my-model --input 0.27 --output 1.10 # USD per 1M tokens
|
||||
codeburn model-savings "llama3.1:8b" gpt-4o # local model, counted as savings
|
||||
codeburn model-flat-rate auto-genius # subscription SKU, $0 is correct
|
||||
codeburn proxy-path ~/work/copilot-repo # subscription-covered project
|
||||
```
|
||||
|
||||
`price-override` sets exact rates for any model (input, output, cache read, cache creation), useful for private deployments or models LiteLLM prices wrong. `model-savings` maps a free local model to a paid baseline: the local calls stay $0, and the dashboard shows what the same tokens would have cost on the baseline. `model-flat-rate` marks a subscription-billed product SKU so the unpriced warning stays quiet and `model-alias` is not suggested — aliasing those ids invents spend. `--remove` also opts out of a built-in SKU. `proxy-path` marks a project routed through a subscription-backed proxy (e.g. Claude Code over GitHub Copilot), so its API-rate cost is reported as subscription-covered and your net out-of-pocket stays honest. All four support `--list` and `--remove`.
|
||||
|
||||
## Environment variables
|
||||
|
||||
Override data directories and paths.
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `CLAUDE_CONFIG_DIR` | Override Claude Code data directory (default: `~/.claude`) |
|
||||
| `CLAUDE_CONFIG_DIRS` | OS-delimited list of Claude data directories to scan together (e.g. `~/.claude-work:~/.claude-personal`). Sessions merge into one row per project. Overrides `CLAUDE_CONFIG_DIR` when set. |
|
||||
| `CODEX_HOME` | Override Codex data directory (default: `~/.codex`) |
|
||||
| `CODEBUFF_DATA_DIR` | Override Codebuff data directory (default: `~/.config/manicode`) |
|
||||
| `CODEWHALE_HOME` | Override the exact CodeWhale home directory; sessions are read from `<CODEWHALE_HOME>/sessions` |
|
||||
| `FACTORY_DIR` | Override Droid data directory (default: `~/.factory`) |
|
||||
| `KIMI_SHARE_DIR` | Override Kimi Code CLI share directory (default: `~/.kimi`) |
|
||||
| `KIMI_MODEL_NAME` | Override Kimi model name when Kimi sessions do not record the model |
|
||||
| `LINGTAI_HOME` | Override LingTai data directory (default: `~/.lingtai`) |
|
||||
| `LINGTAI_TUI_HOME` | Alternate override for LingTai data directory; `LINGTAI_HOME` takes precedence |
|
||||
| `LINGTAI_TUI_GLOBAL_DIR` | Override LingTai TUI global directory used for project registry discovery (default: `~/.lingtai-tui`) |
|
||||
| `OPENCODE_DATA_DIR` | Override the OpenCode-compatible data directory (default: `$XDG_DATA_HOME/opencode` or `~/.local/share/opencode`). Point at a renamed/forked build, e.g. `~/.local/share/mimicode`. Exact directory; no `opencode` suffix is appended. |
|
||||
| `OPENCODE_DB_PREFIX` | Override the SQLite DB filename prefix for OpenCode discovery (default: `opencode`, matching `opencode*.db`); e.g. `mimicode` discovers `mimicode*.db`. SQLite storage only. |
|
||||
| `QWEN_DATA_DIR` | Override Qwen data directory (default: `~/.qwen/projects`) |
|
||||
| `VIBE_HOME` | Override Mistral Vibe home directory (default: `~/.vibe`) |
|
||||
| `WARP_DB_PATH` | Override Warp database path (default: Warp Stable, then Warp Preview) |
|
||||
|
||||
18
docs/guard.md
Normal file
18
docs/guard.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Guard your budget
|
||||
|
||||
```bash
|
||||
codeburn guard install # hooks into this project's .claude/settings.json
|
||||
codeburn guard install --global # or into ~/.claude/settings.json
|
||||
codeburn guard status # caps, install locations, flagged projects
|
||||
codeburn guard uninstall # removes cleanly, leaves your own hooks alone
|
||||
```
|
||||
|
||||
Guard installs opt-in hooks into Claude Code that watch session cost while you work:
|
||||
|
||||
- **Soft cap** (default $5): a one-time in-session warning when a session passes it.
|
||||
- **Hard cap** (default $15): stops the session; `codeburn guard allow` lifts it for that session only.
|
||||
- **Checkpoint** (default $3): if a session ends past this with no edits and no commits, a nudge suggests starting fresh with a named deliverable.
|
||||
- **Session openers**: projects where optimize found waste get a one-line flag at session start.
|
||||
|
||||
Caps are edited in `~/.config/codeburn/guard.json` (set a value to `null` to disable it). Add `--statusline` to show session cost in the Claude Code status line. Installs go through the same journal as everything else, so `codeburn act undo` removes them too. Hooks fail open: a broken guard never blocks a session.
|
||||
|
||||
83
docs/how-it-works.md
Normal file
83
docs/how-it-works.md
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
# How CodeBurn reads your data
|
||||
|
||||
## Pricing
|
||||
|
||||
Prices every API call using input, output, cache read, cache write, and web search token counts, with a fast mode multiplier for Claude. Prices are fetched from [LiteLLM](https://github.com/BerriAI/litellm) and cached locally for 24 hours at `~/.cache/codeburn/`. Hardcoded fallbacks for all Claude and GPT-5 models prevent fuzzy-matching mispricing. Routing-gateway model ids are priced as the model they wrap: [OrcaRouter](https://www.orcarouter.ai) fusion route ids peel to their current upstream (`openai/gpt-oss-120b`), `orcarouter/auto` stays unpriced until a live probe pins the rotating target, and a nested upstream spelling (`orcarouter/deepseek/deepseek-v4-pro`) prices at that exact row, so a gateway-routed session reports real spend instead of $0. Codex sessions routed through [codex-cliproxy-gateway](https://github.com/aceHubert/codex-cliproxy-gateway) record `cliproxy/<model>` ids — including CLIProxyAPI provider paths like `cliproxy/zcode/glm-5.3-flash` — and the wrapper and the known provider segment peel the same way.
|
||||
|
||||
## Task categories
|
||||
|
||||
13 categories classified from tool usage patterns and user message keywords. No LLM calls, fully deterministic.
|
||||
|
||||
| Category | What triggers it |
|
||||
|---|---|
|
||||
| Coding | Edit, Write tools |
|
||||
| Debugging | Error/fix keywords + tool usage |
|
||||
| Feature Dev | "add", "create", "implement" keywords |
|
||||
| Refactoring | "refactor", "rename", "simplify" |
|
||||
| Testing | pytest, vitest, jest in Bash |
|
||||
| Exploration | Read, Grep, WebSearch without edits |
|
||||
| Planning | EnterPlanMode, TaskCreate tools |
|
||||
| Delegation | Agent tool spawns |
|
||||
| Git Ops | git push/commit/merge in Bash |
|
||||
| Build/Deploy | npm build, docker, pm2 |
|
||||
| Brainstorming | "brainstorm", "what if", "design" |
|
||||
| Conversation | No tools, pure text exchange |
|
||||
| General | Skill tool, uncategorized |
|
||||
|
||||
## Breakdowns
|
||||
|
||||
Daily cost chart, per-project, per-model (Opus, Sonnet, Haiku, GPT-5, GPT-4o, Gemini, Kiro, and more), per-activity with one-shot rate, core tools, shell commands, and MCP servers.
|
||||
|
||||
## One-shot rate
|
||||
|
||||
For categories that involve code edits, CodeBurn tracks file-aware retry cycles. A retry is when the same file is re-edited after a shell command in between (Edit foo.ts, Bash, Edit foo.ts). Editing different files across shell steps is not a retry. The one-shot column shows the percentage of edit turns that succeeded without retries. Coding at 90% means the AI got it right first try 9 out of 10 times. File-level tracking is available for Claude, Codex, and Goose; other providers fall back to tool-name-based detection.
|
||||
|
||||
## Per-tool data locations and parsing
|
||||
|
||||
| Provider | Data location | Notes |
|
||||
|----------|---------------|-------|
|
||||
| **Claude Code** | `~/.claude/projects/<sanitized-path>/<session-id>.jsonl` | Each assistant entry carries model name, token usage (input, output, cache read, cache write), `tool_use` blocks, and timestamps. |
|
||||
| **Claude (multiple config dirs)** | Set via `CLAUDE_CONFIG_DIRS` (e.g. `~/.claude-work:~/.claude-personal`) | Scans every listed directory and merges sessions into one row per project so totals reflect all your Claude usage. Use `:` on POSIX, `;` on Windows; overrides `CLAUDE_CONFIG_DIR`. Missing or unreadable directories are skipped. |
|
||||
| **Codex (OpenAI)** | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`, `~/.codex/archived_sessions/rollout-*.jsonl` | Reads `token_count` events (per-call and cumulative usage) and `function_call` entries for tool tracking; attributes cost by project working directory. `codeburn report --provider codex` views Codex alone. |
|
||||
| **Cursor** | SQLite `state.vscdb` under `globalStorage`: macOS `~/Library/Application Support/Cursor/User/globalStorage/`, Linux `~/.config/Cursor/User/globalStorage/`, Windows `%APPDATA%/Cursor/User/globalStorage/`; results cached at `~/.cache/codeburn/cursor-results.v<n>.json` | Input tokens come from Cursor's own per-conversation context meter (`composerData.promptTokenBreakdown`), credited once per conversation on a stable anchor; tool calls and shell commands are read from the agent stream (`agentKv`), and Composer house models are priced from Cursor's published rates. Output is a reply-text estimate and cache tokens are server-side only, so figures are marked estimated and undercount the Cursor admin console for long conversations. The cache auto-invalidates when the database changes; the first run on a large database can take a minute. |
|
||||
| **OpenCode** | SQLite `~/.local/share/opencode/opencode*.db` or file-based `~/.local/share/opencode/storage/` (respects `XDG_DATA_HOME`; `OPENCODE_DATA_DIR`/`OPENCODE_DB_PREFIX` for renamed/forked builds) | Queries `session`, `message`, and `part` read-only and recalculates cost via LiteLLM (falling back to OpenCode's own cost field for unpriced models). Subtask sessions (`parent_id IS NOT NULL`) are excluded to avoid double counting; multiple channel databases are supported. |
|
||||
| **Gemini CLI** | `~/.gemini/tmp/<project>/chats/session-*.json` | One JSON file per session with real token counts (input, output, cached, thoughts) per message, so no estimation is needed. Input is reported inclusive of cached, so CodeBurn subtracts cached before pricing to avoid double charging. |
|
||||
| **Antigravity (CLI & IDE)** | Session files under `.gemini/` folders, plus the running language server | Pulls granular trajectory and pricing from the language server process. For the short-lived CLI, optionally install a status-line hook with `codeburn antigravity-hook install` so usage is captured between menubar refreshes. The IDE is detected via the `--app-data-dir antigravity-ide` flag on Windows. |
|
||||
| **GitHub Copilot** | `~/.copilot/session-state/` (legacy CLI); VS Code/VSCodium `workspaceStorage/*` chat sessions, `GitHub.copilot-chat/transcripts/`, and the `agent-traces.db` OpenTelemetry store; JetBrains IDEs (IntelliJ, PyCharm, …) under `~/.config/github-copilot/<ide>/<kind>/<storeId>/copilot-*-nitrite.db` | The OTel SQLite store is preferred when present (it carries real input/output/cache token counts). Other sources carry no explicit counts, so tokens are estimated from content length and the model is inferred from tool call ID prefixes. JetBrains sessions read from a Nitrite (H2 MVStore) `.db`; project comes from the plugin's `projectName` field (else the `.git` root of a referenced file). See [providers/copilot.md](providers/copilot.md). |
|
||||
| **Kiro** | `.chat` JSON files | Token counts are estimated from content length. The model is not exposed, so sessions are labeled `kiro-auto` and costed at Sonnet rates. |
|
||||
| **Mistral Vibe** | `~/.vibe/logs/session/` (or `$VIBE_HOME/logs/session/`); each folder has `meta.json` + `messages.jsonl` | Reads cumulative prompt/completion totals and model pricing from `meta.json`, then the first user prompt and tool calls from `messages.jsonl`. Emits one record per session (source data is cumulative, not per turn); subagent sessions under `agents/` are counted separately. |
|
||||
| **OpenClaw** | `~/.openclaw/agents/*.jsonl` (legacy `.clawdbot`, `.moltbot`, `.moldbot`) | Token usage comes from assistant message `usage` blocks; the model from `modelId` or `message.model`. |
|
||||
| **OpenClaude** | `~/.openclaude/projects/<slug>/*.jsonl` (or `$CODEBURN_OPENCLAUDE_DIR/projects/`) | Claude Code fork routed to any LLM backend; transcripts are Claude-Code schema. Only usage-bearing assistant lines become calls; no cost field exists, so every call is priced from the shared tables and flagged estimated. Sidechain (subagent) lines are counted as real spend. |
|
||||
| **Warp** | `~/Library/Group Containers/2BBY89MBSN.dev.warp/Library/Application Support/dev.warp.Warp-Stable/warp.sqlite` (Preview fallback) | Reads `agent_conversations`, `ai_queries`, and `blocks`, emitting one call per finalized exchange. Exchange token share is estimated from prompt-size weighting normalized to conversation totals; `run_command` blocks attach to the nearest preceding exchange by timestamp. |
|
||||
| **Zed** | SQLite `~/Library/Application Support/Zed/threads/threads.db` (Linux `~/.local/share/zed/threads/`) | One row per agent thread; the blob is zstd-compressed JSON with per-request token usage (input, output, cache read, cache write) and the thread's model. Threads are topped up to the exact cumulative counter so totals match the store. Needs Node 22.15+ for built-in zstd. |
|
||||
| **Forge** | SQLite `~/.forge/.forge.db` | Queries `conversations` read-only and parses `context.messages`. Assistant usage entries provide prompt, completion, and cached counts; CodeBurn subtracts cached from prompt for input pricing, emits one call per assistant message, and extracts tool calls plus shell commands. |
|
||||
| **Pi / OMP** | `~/.pi/agent/sessions/<sanitized-cwd>/*.jsonl` (Pi), `~/.omp/agent/sessions/<sanitized-cwd>/*.jsonl` (OMP) | Each assistant message carries usage (input, output, cacheRead, cacheWrite) plus inline `toolCall` blocks. Tool names normalize to the standard set (`bash` → `Bash`, `dispatch_agent` → `Agent`); bash commands come from `toolCall.arguments.command`. |
|
||||
| **Codebuff** (formerly Manicode) | `~/.config/manicode/projects/<project>/chats/<chatId>/chat-messages.json` (honors `CODEBUFF_DATA_DIR`; walks `manicode-dev` / `manicode-staging`) | Bills in credits, so each completed assistant message is costed at the public rate of $0.01/credit via `msg.credits`. When an upstream provider's stashed RunState records token-level usage (`message.metadata.runState.sessionState.mainAgentState.messageHistory[*].providerOptions`), the real tokens and LiteLLM cost take precedence. Native tool names (`read_files`, `str_replace`, `run_terminal_command`, `spawn_agents`) normalize to `Read`, `Edit`, `Bash`, `Agent`. |
|
||||
| **Cline / Roo Code / KiloCode** | VS Code `globalStorage` across VS Code, VS Code Insiders, and VSCodium (Cline at `saoudrizwan.claude-dev`, plus `~/.cline/data`) | Cline-family agents. CodeBurn reads `ui_messages.json` from each task directory, extracting token counts from `type: "say"` entries with `say: "api_req_started"`. |
|
||||
| **Cline CLI** | `~/.cline/data/sessions/<session-id>/` (honors `CLINE_SESSION_DATA_DIR`, `CLINE_DATA_DIR`, `CLINE_DIR`) | The Cline command-line agent, whose layout is unrelated to the VS Code extension's. Reads `<session-id>.json` for session metadata and the rolled-up `usage`, and `<session-id>.messages.json` for the per-message `metrics` block (input, output, cacheRead, cacheWrite, cost) that becomes one call each. |
|
||||
| **CodeWhale** | `~/.codewhale/sessions/*.json` plus unmigrated legacy `~/.deepseek/sessions/*.json`; `$CODEWHALE_HOME/sessions` is an exact override | Emits one cumulative record per saved session. CodeWhale exposes only `total_tokens`, so CodeBurn preserves that aggregate in the input column rather than inventing an input/output split. Cost is the exact stored parent-session plus subagent USD total; model pricing is used only when the cost snapshot is absent. Tool blocks, shell commands, skills, and subagent types are retained. |
|
||||
| **DeepSeek Harness** (`dsh`) | `~/.dsh/sessions/--<slug>--/<session-id>/session.jsonl.zstd` (or `session.jsonl` when compression is off); `DSH_HOME` relocates the root | DeepSeek's open-source agent harness, unrelated to the CodeWhale desktop app. The `.zstd` log is a concatenation of independent zstd frames (one per write batch), decoded frame by frame; needs Node 22.15+. One call per `(turn, step)`, with usage from the step's `assistant/message` (the streamed `assistant/chunk` sample is a draft of the same call, never a second one). DSH records tokens but no cost, so calls are priced from the shared tables with reasoning billed at the output rate. |
|
||||
| **IBM Bob** | `User/globalStorage/ibm.bob-code/tasks/<task-id>/` (GA `IBM Bob` and preview `Bob-IDE` app folders) | Reads `ui_messages.json` for API request token/cost records and `api_conversation_history.json` for the selected model. |
|
||||
| **Kimi Code CLI** | `$KIMI_SHARE_DIR/sessions/<workdir-hash>/<session-id>/` or `~/.kimi/sessions/<workdir-hash>/<session-id>/` | Reads `wire.jsonl` `StatusUpdate.token_usage` records, mapping `input_other`, `input_cache_read`, `input_cache_creation`, and `output` into the standard token columns; includes subagents under each session's `subagents/` folder. |
|
||||
| **LingTai TUI** | `~/.lingtai/<agent>/logs/token_ledger.jsonl` plus project homes from `~/.lingtai-tui/registry.jsonl` (`<project>/.lingtai/<agent>/logs/token_ledger.jsonl`); honors `LINGTAI_HOME` / `LINGTAI_TUI_HOME` | Reads LingTai's append-only token ledger, mapping `input - cached` to fresh input, `cached` to cache reads, `output` to output, and `thinking` to reasoning. Nested daemon ledgers are skipped because parent ledgers already mirror daemon usage with `source`/`run_id` tags. |
|
||||
| **Vercel AI Gateway** | [Vercel AI Gateway reporting API](https://vercel.com/docs/ai-gateway/capabilities/custom-reporting) (cloud, not local logs) | Set `AI_GATEWAY_API_KEY` or `VERCEL_OIDC_TOKEN` (from `vercel env pull` / `vercel dev`); requires a Vercel plan with Custom Reporting. Without credentials, it's skipped silently in the combined dashboard. Rows are **daily aggregates per model** with no request identity, so they may duplicate spend the local tools you pointed at the gateway already report — gateway spend is shown as its own row but **excluded from totals by default**. Include it with `codeburn gateway-totals include`. |
|
||||
|
||||
CodeBurn deduplicates messages (by API message ID for Claude, by cumulative token cross-check for Codex, by conversation/timestamp for Cursor, by session ID for Gemini, by session+message ID for OpenCode, by responseId for Pi/OMP, by chat folder + message ID for Codebuff, by session+message ID for Kimi), filters by date range per entry, and classifies each turn.
|
||||
|
||||
## Reading the dashboard
|
||||
|
||||
CodeBurn surfaces the data; you read the story. A few patterns worth knowing:
|
||||
|
||||
| Signal you see | What it might mean |
|
||||
|---|---|
|
||||
| Cache hit < 80% | System prompt or context is not stable, or caching is not enabled |
|
||||
| Lots of `Read` calls per session | Agent re-reading same files, missing context |
|
||||
| Low 1-shot rate (Coding 30%) | Agent struggling with edits, retry loops |
|
||||
| Opus 4.8 dominating cost on small turns | Overpowered model for simple tasks |
|
||||
| `dispatch_agent` / `task` heavy | Sub-agent fan-out, expected or excessive |
|
||||
| No MCP usage shown | Either you don't use MCP servers, or your config is broken |
|
||||
| Bash dominated by `git status`, `ls` | Agent exploring instead of executing |
|
||||
| Conversation category dominant | Agent talking instead of doing |
|
||||
|
||||
These are starting points, not verdicts. A 60% cache hit on a single experimental session is fine. A persistent 60% cache hit across weeks of work is a config issue.
|
||||
|
||||
15
docs/mcp.md
Normal file
15
docs/mcp.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# CodeBurn in your agent (MCP)
|
||||
|
||||
```bash
|
||||
claude mcp add codeburn -- npx -y codeburn mcp
|
||||
```
|
||||
|
||||
`codeburn mcp` runs a local MCP server over stdio, so Claude Code, Cursor, or any MCP client can ask "where did my tokens go this week?" or "how do I spend less?" mid-conversation. It exposes two tools:
|
||||
|
||||
| Tool | What it returns |
|
||||
|------|-----------------|
|
||||
| `get_usage` | Spend and usage with breakdowns by tool, model, project, and task (fast) |
|
||||
| `get_savings` | Cost reductions: waste findings, retry tax, routing waste (slower, deeper analysis) |
|
||||
|
||||
Everything is read from local disk, same as the CLI. Project names are pseudonymized by default; the agent only sees real names if it asks with `include_project_names: true`. For other MCP clients, configure a stdio server with command `npx` and args `-y codeburn mcp`.
|
||||
|
||||
99
docs/menubar.md
Normal file
99
docs/menubar.md
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
# Menu bar, tray, and Capacity Dock
|
||||
|
||||
## macOS
|
||||
|
||||
```bash
|
||||
codeburn menubar
|
||||
```
|
||||
|
||||
One command: downloads the latest `.app`, installs it, and launches it. A copy you already have is replaced where it lives, in `/Applications` or `~/Applications`, so you never end up with two bundles and two login items; if that folder cannot be written to, the install goes to `~/Applications` and names the old copy for you to move to the Trash. Re-run with `--force` to reinstall. Launching the app retires the copy already running, so there is only ever one flame in the menu bar. You can also install and manage it from the desktop app's Plugins page. The native Swift and SwiftUI app lives in `mac/` (see `mac/README.md` for build details).
|
||||
|
||||
The menubar icon shows the spend period selected in Settings (Today by default; Week, Month, and 6 Months are also available). Non-today periods add a short suffix such as `$42 / mo` so the menu bar value stays clear. Click to open a popover with agent tabs, period switcher (Today, 7 Days, 30 Days, Month, All), Trend, Forecast, Pulse, Stats, and Plan insights, activity and model breakdowns, optimize findings, and CSV/JSON export. Refreshes every 30 seconds.
|
||||
|
||||
You can also set the menubar status period from Terminal:
|
||||
|
||||
```bash
|
||||
defaults write org.agentseal.codeburn-menubar CodeBurnMenubarPeriod -string month
|
||||
```
|
||||
|
||||
Allowed values are `today`, `week`, `month`, and `sixMonths`. Relaunch the app to apply external defaults changes.
|
||||
|
||||
**Compact mode** shrinks the menubar item to fit the text, dropping decimals (e.g. `$110` instead of `$110.20`):
|
||||
|
||||
```bash
|
||||
defaults write org.agentseal.codeburn-menubar CodeBurnMenubarCompact -bool true
|
||||
```
|
||||
|
||||
Relaunch the app to apply. To revert: `defaults delete org.agentseal.codeburn-menubar CodeBurnMenubarCompact`.
|
||||
|
||||
**Second row** adds an optional smaller line under the menubar figure. Turn it on in Settings → General → Display and pick what it shows: quota remaining with its reset countdown (for whichever connected provider is nearest its limit), today's cost, today's tokens, or running sessions. It is off by default, and the line hides itself while the chosen metric has no data, so the item falls back to its single-row figure. From Terminal:
|
||||
|
||||
```bash
|
||||
defaults write org.agentseal.codeburn-menubar CodeBurnMenubarSecondRowEnabled -bool true
|
||||
defaults write org.agentseal.codeburn-menubar CodeBurnMenubarSecondRowMetric -string todayCost
|
||||
```
|
||||
|
||||
Allowed metric values are `quotaRemaining`, `todayCost`, `todayTokens`, and `activeSessions`. Relaunch the app to apply external defaults changes.
|
||||
|
||||
**Refresh cadence** is set in Settings under Usage Refresh. Auto (the default) refreshes every 30 seconds on AC power and backs off on battery, in Low Power Mode, and while the display sleeps; fixed 1, 5, or 15 minute cadences and a Manual mode (refresh only when you open the popover or click Refresh Now) are also available. From Terminal:
|
||||
|
||||
```bash
|
||||
defaults write org.agentseal.codeburn-menubar CodeBurnMenubarRefreshSeconds -int 300
|
||||
```
|
||||
|
||||
Seconds between refreshes: `60`, `300`, or `900`; `0` is Manual and `-1` is Auto. Takes effect on the next refresh tick, no relaunch needed.
|
||||
|
||||
**Preferred terminal** decides where Full Report and Optimize open. Set it in Settings → General → Terminal, or from Terminal:
|
||||
|
||||
```bash
|
||||
defaults write org.agentseal.codeburn-menubar CodeBurnPreferredTerminal -string iterm2
|
||||
```
|
||||
|
||||
Allowed values are `terminal` (macOS Terminal.app, the default) and `iterm2`. Anything else falls back to `terminal`. Only terminals that can script a command into a live window are offered; if the chosen app is missing or fails to accept the command, CodeBurn tries Terminal.app and then runs the command in the background, logging each step to Console.app. Takes effect on the next launch of a command, no relaunch needed.
|
||||
|
||||
## Windows
|
||||
|
||||
The recommended install is the [Microsoft Store](https://apps.microsoft.com/detail/9P0R4ZL5XMB8) (Store ID `9P0R4ZL5XMB8`), which ships the desktop app with the tray app inside it. Microsoft signs that package at submission, and the Store keeps it up to date, so the tray app leaves its own update checker switched off there.
|
||||
|
||||
Windows gets the same ambient view from the system tray, from the same one command:
|
||||
|
||||
```powershell
|
||||
codeburn menubar
|
||||
```
|
||||
|
||||
It downloads the `.msi` for your CLI version, verifies its sha256, runs it through `msiexec /passive`, and launches the tray app. Re-run with `--force` to reinstall; an already-installed matching version is just launched. You can also download the `.msi` yourself from the [latest Windows Menubar release](https://github.com/getagentseal/codeburn/releases/tag/windows-v0.9.25).
|
||||
|
||||
Today's spend sits in the tray as a number beside the flame icon (turn it off in Settings, and the tooltip always carries it). Click for the same popover the macOS app shows: agent tabs, period switcher, Trend, Forecast, Pulse, Stats and Plan insights, activity and model breakdowns, optimize findings, and CSV/JSON export. Settings covers launch at login, the tray number, theme, and currency. It refreshes every 60 seconds while the popover is open and every 2 minutes while it is closed.
|
||||
|
||||
Turn on **Show Capacity Dock** in the tray menu, or from the desktop app, for the same edge-docked quota rail the macOS menubar has: one ring per connected provider, hover for every quota window with its reset time, drag it to any screen edge. It is off by default and needs codeburn 0.9.24 or newer for `codeburn quota`.
|
||||
|
||||
The desktop app installs and configures the tray companion from a card on its **Plugins** page, the way it does the macOS menu bar: Install, Update, Open, Settings, Quit and Uninstall, a Running dot with the installed version, and the Capacity Dock switch. `codeburn menubar --uninstall` removes it from the command line.
|
||||
|
||||
The tray app reads everything through the CLI, so install that first (`npm install -g codeburn`). It needs **codeburn 0.9.9 or newer**, and shows a setup screen with the install command until it finds one. Source and build instructions are in [`windows/`](../windows/) ([windows/DEVELOPMENT.md](../windows/DEVELOPMENT.md)).
|
||||
|
||||
The `.msi` under the `windows-v*` releases and the desktop setup `.exe` are a developer preview. Both are unsigned, so SmartScreen prompts on first run: click "More info", then "Run anyway". The preview builds also do not update themselves. The tray app still tells you when a newer version exists and links to the release; taking it means re-running `codeburn menubar --force` or downloading the new build yourself.
|
||||
|
||||
### WSL
|
||||
|
||||
Agents you run *inside* a WSL distro write their history to the distro's Linux home, not to your Windows user profile, so a Windows-only scan reports nothing for them. CodeBurn on Windows now also scans each WSL distro's home directories (`\\wsl$\<distro>\home\*` and `\\wsl$\<distro>\root`) for Claude Code (`~/.claude`) and Codex (`~/.codex`) history, merging what it finds with your Windows sessions. It is read-only, and the tray app inherits it — it reads everything through the CLI.
|
||||
|
||||
Only **running** distros are scanned by default: reaching into `\\wsl$\<distro>` boots a stopped distro, which CodeBurn will not do behind your back. Start the distro (or set `CODEBURN_WSL=all`) if you want the others included. Stopping a distro does not lose its numbers — an offline root is not a deleted transcript, so its usage keeps counting and comes straight back out of the cache when you start it again. When that home is reachable, an ordinary transcript actually deleted there is evicted normally instead of being mistaken for an offline root; Claude rows carrying PR attribution keep the existing historical-retention exception. `codeburn doctor` lists every root it probed, WSL ones included, and says so in one line when it probed none.
|
||||
|
||||
| Value | Behaviour |
|
||||
| --- | --- |
|
||||
| `CODEBURN_WSL=running` | Default. Scans running distros only. |
|
||||
| `CODEBURN_WSL=all` | Scans every installed distro, starting stopped ones on first access. |
|
||||
| `CODEBURN_WSL=off` | Disables WSL discovery and UNC access immediately; `wsl.exe` is never run. Historical usage already in CodeBurn's cache remains reportable and is reused if discovery is re-enabled. |
|
||||
|
||||
## Linux (GNOME)
|
||||
|
||||
Linux gets the same ambient view through a GNOME Shell extension (GNOME 45+): spend in the top panel, period switcher, compact mode, and daily budget alerts. It lives in [`gnome/`](../gnome/):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/getagentseal/codeburn && cd codeburn/gnome
|
||||
./install.sh
|
||||
gnome-extensions enable codeburn@codeburn.dev
|
||||
```
|
||||
|
||||
See [gnome/README.md](../gnome/README.md) for settings and development notes. The Tauri tray app in `windows/` also builds and runs on Linux, but it is experimental and unreleased there — the GNOME extension is the supported Linux surface.
|
||||
|
||||
|
|
@ -137,3 +137,43 @@ its own. The grade is a band over that score:
|
|||
|
||||
The grade rates your setup, not your spending: an expensive month with a clean configuration still
|
||||
scores an A.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
codeburn optimize # scan the last 30 days
|
||||
codeburn optimize -p today # today only
|
||||
codeburn optimize -p week # last 7 days
|
||||
codeburn optimize --provider claude # restrict to one provider
|
||||
codeburn optimize --format json # setup health + findings as JSON
|
||||
```
|
||||
|
||||
## Claude Code session population
|
||||
|
||||
For Claude Code, the optimize session count, the per-session findings, coaching,
|
||||
and model-default recommendations use user-started (main) sessions. Subagent
|
||||
sidechain transcripts are excluded from that population because their delegated
|
||||
context and delivery behavior are structurally different, and so is the re-read
|
||||
finding, since a subagent starts on a fresh context. Findings about how Claude
|
||||
uses tools (junk reads, read:edit ratio) and every spend, MCP, and
|
||||
configuration-overhead finding keep counting them.
|
||||
|
||||
## More waste patterns
|
||||
|
||||
- Wasted bash output (uncapped `BASH_MAX_OUTPUT_LENGTH`, trailing noise)
|
||||
- Cache creation overhead and junk directory reads
|
||||
- Context-heavy sessions where effective input/cache tokens swamp output
|
||||
- Possibly low-worth expensive sessions with no edit turns or repeated retries
|
||||
when no `git`/`gh` delivery command is observed
|
||||
|
||||
## Ranking and repeat runs
|
||||
|
||||
Findings are ranked by urgency (impact weighted against observed waste) and rolled up into an A to F setup health grade. Repeat runs classify each finding as new, improving, or resolved against a 48-hour recent window.
|
||||
|
||||
## Dashboard shortcut
|
||||
|
||||
You can also open it inline from the dashboard: press `o` when a finding count appears in the status bar, `b` to return.
|
||||
|
||||
## When results get checked
|
||||
|
||||
The loop closes on honesty: once an applied fix is at least 3 days old, `codeburn act report` compares its estimated savings against what your sessions actually did, and every later `codeburn optimize` run lists it under `Applied fixes` with a plain verdict — worked, under its estimate, or did not help, with the undo command for that last case.
|
||||
|
|
|
|||
44
docs/plans-and-quota.md
Normal file
44
docs/plans-and-quota.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Plans and provider quota
|
||||
|
||||
## Plans
|
||||
|
||||
```bash
|
||||
codeburn plan set claude-max # $200/month
|
||||
codeburn plan set claude-pro # $20/month
|
||||
codeburn plan set cursor-pro # $20/month
|
||||
codeburn plan set copilot-pro # 1500 AI Credits ($15 equivalent)
|
||||
codeburn plan set custom --monthly-usd 200 --provider codex # ChatGPT Pro-style custom plan
|
||||
codeburn plan set custom --credits 20000 --provider copilot # org Copilot allotment
|
||||
codeburn plan reset --provider codex # remove one provider plan
|
||||
codeburn plan set none # disable plan view
|
||||
codeburn plan # show configured plans
|
||||
codeburn plan reset # remove plan config
|
||||
```
|
||||
|
||||
Subscription tracking for Claude Pro, Claude Max, Cursor Pro, Copilot (AI credits), and custom provider plans. Plans are stored per provider, so you can track Claude and Codex/Cursor subscriptions at the same time; the dashboard shows one overage line per active provider plan. A legacy/custom `all` plan remains a single aggregate plan and is replaced when you add a provider-specific plan, avoiding double-counted overage rows. Existing single-plan config is still read as a fallback. USD presets use publicly stated plan prices (as of April 2026). Copilot presets use official individual AI-credit allotments (Pro 1,500 / Pro+ 7,000 / Max 20,000; fetched 2026-08-23) — not the $10 / $39 / $100 sticker prices — and spend is `total_nano_aiu / 1e9`, never token-priced USD.
|
||||
|
||||
## Provider quota
|
||||
|
||||
`codeburn quota` reads how much of each provider's plan you have already spent, from the credentials the tools themselves keep on this machine. Claude, Codex, Gemini, GitHub Copilot and Kimi are read from their own signed-in sessions; Antigravity is read from its local language server.
|
||||
|
||||
```bash
|
||||
codeburn quota # table of every provider and its windows
|
||||
codeburn quota --format json # machine-readable, pipe to jq
|
||||
```
|
||||
|
||||
Providers you are not signed in to are listed with `available: false` and no error. Reads run in parallel with a short per-provider timeout, and the command always exits 0 so a status bar or tray can poll it safely.
|
||||
|
||||
```json
|
||||
{
|
||||
"providers": [
|
||||
{
|
||||
"id": "claude",
|
||||
"name": "Claude",
|
||||
"available": true,
|
||||
"plan": "Max 20x",
|
||||
"windows": [{ "label": "Weekly", "usedPct": 42.5, "resetsAt": "2026-09-08T12:00:00.000Z" }]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
29
docs/web.md
Normal file
29
docs/web.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Browser dashboard
|
||||
|
||||
```bash
|
||||
codeburn web # opens http://localhost:4747 in your browser
|
||||
codeburn web -p 30days # start on a different period
|
||||
codeburn web --port 8080 # pick a port (falls back to a free one if taken)
|
||||
codeburn web --no-open # start the server without opening a browser
|
||||
```
|
||||
|
||||
A local web dashboard with the same task, model, tool, and project breakdowns as the TUI, rendered with charts. The usage graph follows the selected period with 15-minute, hourly, or daily buckets and can switch between per-session and per-model lines. Everything is read from disk on your machine and the server binds to localhost; nothing is uploaded.
|
||||
|
||||
## Combine usage across your devices
|
||||
|
||||
See one total across your laptop, desktop, and work machine on the same network. On each other device, share its usage:
|
||||
|
||||
```bash
|
||||
codeburn share --pair # opens a pairing window and prints a PIN
|
||||
```
|
||||
|
||||
Then add it once from your main device (the PIN authorizes the pairing):
|
||||
|
||||
```bash
|
||||
codeburn devices add # find nearby devices and pair, or: add <host> --pin <pin>
|
||||
codeburn devices # combined totals by machine
|
||||
codeburn devices rm <name> # forget a device
|
||||
```
|
||||
|
||||
Pairing is PIN-authorized and stays on your local network. You can also discover and pair devices straight from the browser dashboard.
|
||||
|
||||
23
docs/yield.md
Normal file
23
docs/yield.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Track what shipped
|
||||
|
||||
```bash
|
||||
codeburn yield # last 7 days (default)
|
||||
codeburn yield -p today # today only
|
||||
codeburn yield -p 30days # last 30 days
|
||||
codeburn yield -p month # this calendar month
|
||||
codeburn yield --format json # productive/reverted/abandoned/ambiguous spend as JSON
|
||||
```
|
||||
|
||||
Did the spend actually ship? `codeburn yield` correlates AI sessions with git commits by timestamp:
|
||||
|
||||
| Category | Meaning |
|
||||
|----------|---------|
|
||||
| Productive | Commits from this session landed in main |
|
||||
| Reverted | Commits were later reverted |
|
||||
| Abandoned | No commits near session, or commits never merged |
|
||||
| Ambiguous | Session ran parallel to another and its window's commits were attributed to the tighter one |
|
||||
|
||||
Attribution is timestamp-window based (heuristic): each commit is credited to at most one session, the tightest window containing it. The JSON report carries `methodology: "timestamp-window"`. A session the window heuristics would leave as abandoned or ambiguous is rescued to productive when a branch it was observed on demonstrably shipped through a squash merge: the branch carries commits of its own, its tip's tree hash matches a commit on main (the squashed tree is byte-identical to the branch tip), and at least one of those commits was made inside the session's own window — so the session contributed the work rather than merely having run on the branch. The rescue needs branch metadata in the session logs, which Claude Code records and most other providers do not.
|
||||
|
||||
Requires a git repository. Run from your project directory.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue