README.md

July 24, 2026 ยท View on GitHub

CI Zero Dependencies CodeFactor Latest Release License: MIT

A fast, zero-dependency CLI cost calculator, tool analytics, and customizable statusline for Claude Code. Breakdowns by model, day, project, and branch. Single binary, no runtime needed.

demo

Table of Contents

Installation

Homebrew (macOS / Linux)

brew install backstabslash/tap/goccc

Go install

go install github.com/backstabslash/goccc@latest

Pre-built binaries

Available on the releases page for macOS, Linux, and Windows (amd64 / arm64).

From source

git clone https://github.com/backstabslash/goccc.git && cd goccc
go build -o goccc .     # macOS / Linux
go build -o goccc.exe . # Windows

Usage

goccc                              # Summary of all-time usage
goccc -days 7 -all                 # Last 7 days with daily and project breakdowns
goccc -daily                       # Daily breakdown only
goccc -monthly                     # Monthly breakdown
goccc -projects                    # Project breakdown only
goccc -project webapp -daily       # Filter by project name (substring match)
goccc -days 1                      # Today's usage
goccc -projects -top 5             # Top 5 most expensive projects
goccc -days 30 -all -json          # JSON output for scripting
goccc -json | jq '.summary.total_cost'  # Pipe to jq for custom analysis
goccc -currency-symbol "โ‚ฌ" -currency-rate 0.92  # One-off currency override
goccc -tools -days 30             # Tool & skill usage analytics
goccc -tools -project myapp -json # Tool analytics filtered by project, as JSON

Claude Code Statusline

goccc can serve as a Claude Code statusline โ€” a fully customizable, live cost dashboard right in your terminal prompt.

๐Ÿ’ธ \$1.23 session ยท ๐Ÿ’ฐ \$5.67 today ยท ๐Ÿ’ญ 45% ctx ยท ๐Ÿ”‹ 94% (1.5/5h) ยท ๐Ÿค– Opus 4.6
  • ๐Ÿ’ธ Session cost โ€” parsed from the current session's JSONL files using goccc's pricing table
  • ๐Ÿ’ฐ Today's total โ€” aggregated across all sessions today (shown only when higher than session cost)
  • ๐Ÿ’ญ Context % โ€” context window usage percentage
  • ๐Ÿ”‹ 5h / 7d window โ€” remaining percentage of the usage window with elapsed time (subscription users only; hidden for API billing). Emoji switches to ๐Ÿชซ below 25%
  • ๐Ÿค– Model โ€” current model

The mcp segment (active MCP servers) is available but off by default โ€” add it to segments to enable it.

Values are color-coded: cost and context turn yellow โ†’ red as they increase; rate limit windows are inverted โ€” yellow below 50%, red below 25% remaining.

Setup

Add to ~/.claude/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "goccc -statusline"
  }
}

Works with any install method. To run without installing: go run github.com/backstabslash/goccc@latest -statusline.

Customization

The statusline is fully customizable via ~/.goccc.json. With no config, you get the default layout shown above.

{
  "statusline": {
    "segments": ["session_cost", "today_cost", "ctx", "model", "|", "5h", "cwd", "branch"],
    "separator": " ยท ",
    "segment_options": {
      "session_cost": { "emoji": "๐Ÿค‘", "label": "sess" },
      "today_cost": { "label": "day" },
      "ctx": { "emoji": "๐Ÿง ", "label": "context" },
      "5h": { "emoji": "โณ" },
      "branch": { "emoji": "๐Ÿ”€" }
    }
  }
}

segments โ€” ordered list of segments to display. Only listed segments are shown; segments with no data auto-hide. "|" forces a line break.

The config above produces:

๐Ÿค‘ \$1.23 sess ยท ๐Ÿ’ฐ \$5.67 day ยท ๐Ÿง  45% context ยท ๐Ÿค– Opus 4.6
โณ 94% (1.5/5h) ยท ๐Ÿ“ my-project ยท ๐Ÿ”€ feature/auth

Available segments:

SegmentDefaultAuto-hides whenOverrides
session_cost๐Ÿ’ธ $X.XX sessioncost is $0emoji, label
today_cost๐Ÿ’ฐ $X.XX todaycost is $0emoji, label
ctx๐Ÿ’ญ XX% ctxโ€”emoji, label
model๐Ÿค– Model Nameโ€”emoji
mcp๐Ÿ”Œ N MCPs (...)no MCPs detectedemoji, label
branch๐ŸŒฟ branch-nameno branchemoji
5h๐Ÿ”‹ XX% (X/5h)absent (API billing)emoji
7d๐Ÿ”‹ XX% (X/7d)absent (API billing)emoji
tokens๐Ÿ“Š XK in / XK outboth zeroemoji
lines๐Ÿ“ +N -Nboth zeroemoji
durationโฑ๏ธ Xmzeroemoji
cwd๐Ÿ“ dirnameemptyemoji
worktree๐ŸŒณ worktree-namenot in a linked worktree (submodules don't count)emoji
version๐Ÿท๏ธ X.Y.Zemptyemoji

separator โ€” string between segments (default: " ยท ").

segment_options โ€” per-segment overrides. emoji replaces the default icon (for 5h/7d, replaces the dynamic ๐Ÿ”‹/๐Ÿชซ). label replaces trailing text (only on segments marked above).

Session Exit Hook

goccc can show a cost summary when a Claude Code session ends โ€” the feature users miss most since Anthropic removed it.

๐Ÿ’ธ \$1.87 session (14 reqs, 23m) ยท ๐Ÿ’ฐ \$12.34 today ยท ๐Ÿค– Opus 4.6, Haiku 4.5

Add to ~/.claude/settings.json:

{
  "hooks": {
    "SessionEnd": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "goccc -session-end"
          }
        ]
      }
    ]
  }
}

The hook runs within Claude Code's 1.5-second timeout. If anything fails, it exits silently โ€” it will never break session teardown.

Tool & Skill Analytics

The -tools flag shows how often each tool and skill was invoked across your sessions โ€” useful for understanding your workflow patterns, auditing MCP tool usage, and spotting unused skills.

goccc -tools                    # All-time tool usage
goccc -tools -days 7            # Last 7 days
goccc -tools -project myapp     # Filter by project
goccc -tools -top 5             # Top 5 in each breakdown
goccc -tools -json              # JSON output for scripting
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  TOOL BREAKDOWN (3,960 total, 24 unique, 82 sessions)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Tool                                     Invocations     Errors     Projects
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Bash                                           1,373       5.1%           12
  Read                                           1,231       4.3%           13
  Edit                                             459       2.4%            9
  ...

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  AGENT BREAKDOWN (83 spawned, 5 unique, 33 sessions)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Agent Type                     Invocations    Avg Time     Total    Projects
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Explore                                 46      2m 39s     2h 2m           8
  general-purpose                         29       4m 8s        2h           6
  ...

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  SKILL BREAKDOWN (32 invocations, 13 unique, 24 sessions, 46 available)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Skill                                              Invocations      Projects
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  superpowers:brainstorming                                   14             7
  review-diff                                                  1             1
  ...

  โš  37 unused skills (0 invocations):
    update-config, create-prd, ...

Supports all the same filtering flags (-days, -project) and output modes (-json) as the cost report.

Configuration

All configuration lives in ~/.goccc.json. Every field is optional.

KeyDescription
currencyISO 4217 currency code (e.g. EUR, GBP, JPY). Rate auto-fetched and cached 24h
warn_thresholdYellow color-coding threshold (default: $25, auto-scales with currency; custom values used as-is)
alert_thresholdRed color-coding threshold (default: $50, auto-scales with currency; custom values used as-is)
statuslineStatusline customization โ€” segments, separator, per-segment overrides

Local Currency

Set "currency": "EUR" (or any ISO 4217 code) in ~/.goccc.json. goccc auto-fetches the exchange rate from USD and caches it for 24 hours. If the API is unreachable, the last cached rate is used. For one-off overrides without a config file, use -currency-symbol "โ‚ฌ" -currency-rate 0.92 together.

JSON output always reports costs in USD, with a currency metadata object when a non-USD currency is active.

Flags

FlagShortDefaultDescription
-days-d0Only show the last N calendar days (0 = all time)
-project-pโ€”Filter by project name (substring, case-insensitive)
-dailyโ€”falseShow daily breakdown
-monthly-mfalseShow monthly breakdown (mutually exclusive with -daily)
-projectsโ€”falseShow per-project breakdown
-allโ€”falseShow all breakdowns (daily + projects)
-top-n0Max entries in breakdowns (0 = all)
-toolsโ€”falseShow tool and skill usage analytics
-jsonโ€”falseOutput as JSON
-no-colorโ€”falseDisable colored output (also respects NO_COLOR env)
-base-dirโ€”~/.claudeBase directory for Claude Code data
-utcโ€”falseBucket days by UTC instead of local time (matches Anthropic API reporting)
-session-endโ€”falseSession exit hook mode (reads SessionEnd JSON from stdin)
-statuslineโ€”falseStatusline mode for Claude Code (reads session JSON from stdin)
-currency-symbolโ€”โ€”Override currency symbol (requires -currency-rate)
-currency-rateโ€”0Override exchange rate from USD (requires -currency-symbol)
-version-Vโ€”Print version and exit

Preserving Log History

Claude Code periodically deletes old log files. To keep more history for cost tracking, increase the cleanup period in ~/.claude/settings.json:

{
  "cleanupPeriodDays": 365
}

The default is 30 days. Set it higher to retain more data for goccc to analyze.