anomalyco / anomalyco/opencode

cli: stats --days N omits cost/token/cache breakdown that v1 showed by default

Open
#47,481 0 comments 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Sep 5, 2026.

2.0
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 stable opencode 1.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 (opencode2 via npm @opencode-ai/cli)
  • Active plugins: none (plugins: [] in config)

Reproduction

  1. On v1, run opencode stats --days 1 and note the COST & TOKENS section (Input, Output, Cache Read, Cache Write).
  2. On v2 beta, run opencode2 stats --days 1. The default view shows only an aggregate token count (for example 32.6m tokens) with no input/output/cache split.
  3. 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.
  4. Run opencode2 stats --days 1 --cost (or --cost --days 1). The breakdown appears for the requested window, including cached 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 --days and 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 --cost reported cached input 85.7%; --days 7 --cost reported 90.3%.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.