Skip to content
Back to skills

Report

ASecurity

Print a TokenWise session report — tokens per model, $ saved vs all-Opus baseline, escalations, quality flags. Reads from .tokenwise/log.ndjson filtered to the current session. Use when the user asks "how much did I save", "show me tokenwise stats", or runs /tokenwise:report.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 1, 2026
ai-agentsbash

Works with

  • claude code

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add CodeShuX/tokenwise --skill report --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Report?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Report
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/codeshux-report/badge)](https://www.skillsdirectory.com/skills/codeshux-report)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Print a TokenWise session report — tokens per model, $ saved vs all-Opus baseline, escalations, quality flags. Reads from .tokenwise/log.ndjson filtered to the current session. Use when the user asks "how much did I save", "show me tokenwise stats", or runs /tokenwise:report.
---

# /tokenwise:report — Session routing report

Print a routing report for the current Claude Code session.

## Steps

1. **Locate the log file:**
   - Default: `./.tokenwise/log.ndjson` (current project)
   - If user provides a path via `$ARGUMENTS` (e.g. `/tokenwise:report /path/to/log.ndjson`), use that

2. **If the file doesn't exist:**
   ```
   No TokenWise log found at <path>.

   Possible reasons:
   1. TokenWise hasn't logged any routed tasks yet — run a few tasks first
   2. You're in a different project than the one with the log
   3. TokenWise install didn't write the routing rules — check ~/.claude/CLAUDE.md for the "BEGIN TokenWise" marker

   See: /tokenwise:install
   ```

3. **Determine current session:**
   - Look at the most recent contiguous block of log entries with the same `session_id`
   - If `$ARGUMENTS` contains `--session <id>`, use that session_id instead

4. **Aggregate per model:**
   - Group entries by `model_used`
   - Sum `input_tokens`, `output_tokens`, `cost_actual_usd`, `cost_baseline_usd`, `savings_usd`
   - Count tasks per model

5. **Print the report:**

```
TokenWise Session Report
========================

Session ID:       <id>
Started:          <ts of first entry>
Duration:         <wall time>

Tasks routed:     <total count>

Per model:
  Haiku    <count> tasks   <input_sum> input  /  <output_sum> output   →  $<cost_sum>
  Sonnet   <count> tasks   <input_sum> input  /  <output_sum> output   →  $<cost_sum>
  Opus     <count> tasks   <input_sum> input  /  <output_sum> output   →  $<cost_sum>

Total spent:                                                              $<total>
Baseline (all-Opus):                                                      $<baseline>
Savings:                                                                  $<savings>  (<pct>%)

Quality flags:
  Escalations:    <count> (<top reason>)
  User overrides: <count>
  Regressions:    <count if logged, else "—">

Pricing snapshot:
  Opus 4.7    $5 / $25 per 1M tokens
  Sonnet 4.6  $3 / $15
  Haiku 4.5   $1 / $5
```

6. **Format numbers cleanly:**
   - Token counts: `1.2M`, `480K`, `28.4k`
   - Costs: `$1.62`, `$0.017` (keep 2-3 sig figs, no trailing zeros)
   - Percentages: `79.5%` (one decimal)

7. **If $ARGUMENTS contains `--json`**, output the aggregated data as JSON instead of the text report.

## Tools

Read, Bash (for `jq` or simple awk if needed).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.