anomalyco / anomalyco/opencode
cli: stats --days N omits cost/token/cache breakdown that v1 showed by default
@kommander is already working on this.
Since Sep 5, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
v1 opencode stats --days N showed input, output, cache read, and cache write so cache hit rate was obvious. v2 opencode2 stats --days N only prints a total token count; the old breakdown requires combining --days and --cost, which is easy to miss or mix up.
Environment
- opencode version: 0.0.0-beta-19151 (
opencode2); compared against stableopencode1.18.16 - OS: Microsoft Windows [Version 10.0.26200.9278] (Windows_NT 10.0.26200, win32 x64)
- Terminal: TERM=xterm-256color; TERM_PROGRAM and COLORTERM unset
- Shell: C:\WINDOWS\system32\cmd.exe
- Install/channel: beta (
opencode2via npm@opencode-ai/cli) - Active plugins: none (
plugins: []in config)
Reproduction
- On v1, run
opencode stats --days 1and note the COST & TOKENS section (Input, Output, Cache Read, Cache Write). - On v2 beta, run
opencode2 stats --days 1. The default view shows only an aggregate token count (for example32.6m tokens) with no input/output/cache split. - Run
opencode2 stats --cost. This shows the token/cache breakdown, but the range is year-to-date (2026 so far), not the last N days. - Run
opencode2 stats --days 1 --cost(or--cost --days 1). The breakdown appears for the requested window, includingcached input.
Expected Behavior
opencode2 stats --days N should include cost and token details (input, output, reasoning, cache read/write, cache hit rate) in the default view, matching v1. Users should not need a second flag to inspect cache hit rate for a day range.
Actual Behavior
Default opencode2 stats --days N omits the breakdown:
opencode stats · today · all projects
20 sessions · 24 subagents
47 prompts · 589 steps · 32.6m tokens
98.1% tool success · 1 active day · best streak 1 day
--cost alone defaults to the calendar year:
2026 so far · all projects
COST & TOKENS
cost $493.76
input 510.7m
output 25.7m
reasoning 9.5m
cache read 3.1b
cache write 30.1m
cached input 85.3%
Combining both flags works and flag order does not matter, but it is more complex than v1 and easy to mix up. --json also contains the per-range token/cache fields, so the data is available; it is just hidden from the default --days output.
Additional Context
- Reproduces every time.
- Workaround:
opencode2 stats --days N --cost(also--full). - v1 help had
--daysand always showed COST & TOKENS. v2 help adds--cost/--full/--json, so the split is intentional, but it regresses the common “last N days, what was my cache hit rate?” workflow. - Sample from this machine:
--days 1 --costreportedcached input 85.7%;--days 7 --costreported90.3%.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.