opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Session-specific stats command and exit summary

Open modelnova-ai opened this issue 1 week ago • 1 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Current Behavior:

  • opencode stats shows aggregate statistics across all sessions
  • Token and cost details are shown during the session
  • No way to see detailed session stats or get a summary when exiting

Requested Feature: Add a /stats command to view current session statistics, and automatically show the same summary when quitting.

Why this would be helpful:

  • See performance details like tool call success rates and cost breakdown
  • Get a complete view of token usage (input/output/cache) in one place
  • Check how much is being spent on the current session
  • Get immediate feedback on session efficiency when wrapping up

Example output:

Agent powering down. Goodbye!

Interaction Summary
Session ID:           ses_4de4db894ffekihkp0YJ6o352F
Tool Calls:          1 (✓ 1 × 0)
Success Rate:        100.0%

Performance
Wall Time:           2s
LLM Requests:        3
Total Tokens:        29.3K
  Input Tokens:      20.3K
  Output Tokens:     534
  Cache Tokens:      8.4K
Total Cost:          $0.0000

Model Usage
Model                Reqs    Input      Output
big-pickle           3       20.3K      534

Tool Usage (Top 5)
Tool                 Calls   Success    Errors
task                 1       1          0

Savings Highlight: 8.4K (29.4%) of input tokens were served from cache.

» Tip: For historical stats, run `opencode stats`.

This would complement the existing opencode stats command, which remains useful for historical analysis.

modelnova-ai avatar Dec 15 '25 11:12 modelnova-ai