# Summary

> Summary

- Skill: `codeshux/summary` (Agent Skill)
- Install (CLI): `npx skillmds@latest add codeshux/summary`
- Raw SKILL.md: https://api.skillmd.com/api/skills/codeshux/summary/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: CodeShuX (https://skillmd.com/u/codeshux)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/codeshux/summary

---


# /tokenwise:summary — Multi-session trend report

Aggregate `.tokenwise/log.ndjson` over a time window.

## Parse $ARGUMENTS

- `--week` (default) — last 7 days
- `--month` — last 30 days
- `--all` — entire log
- `--days <N>` — last N days
- `--out <path>` — write the report to a markdown file instead of stdout
- `--json` — output JSON instead of text

## Steps

1. **Read** `./.tokenwise/log.ndjson` (or the path the user provides)

2. **Filter** entries to the time window:
   - Compute cutoff: `now - <days>*86400`
   - Keep entries where `ts > cutoff`

3. **Aggregate:**
   - **Total:** sessions (unique session_id), tasks, total cost, baseline cost, savings
   - **Per model:** task count, cost, % of total
   - **Per task_class** (`mechanical|execution|review|planning`): task count, avg cost, dominant model
   - **Trend** (only for `--week` or `--days <≤14>`): per-day cost + savings bar chart in plain text

4. **Print:**

```
TokenWise Summary — last <N> days
==================================

Sessions:        <count>
Tasks routed:    <count>
Total spent:     $<total>
Baseline:        $<baseline>
Savings:         $<savings> (<pct>%)

Per model:
  Haiku    <count> tasks  $<cost>  (<pct>%)
  Sonnet   <count> tasks  $<cost>  (<pct>%)
  Opus     <count> tasks  $<cost>  (<pct>%)
  Fable    <count> tasks  $<cost>  (<pct>%)

Top task classes:
  <class>          <count> tasks   avg cost $<avg>   model: <dominant>
  ...

Daily trend (cost):
  Mon  ███████░░░ $4.21
  Tue  ███░░░░░░░ $1.82
  Wed  ████████░░ $5.04
  ...
```

5. **If `--out <path>`** was provided, write the markdown version of the report to that path. Use a proper markdown table for the trend section.

6. **If `--json`**, dump the aggregated data structure as pretty-printed JSON.

## Notes on small log files

- If <2 sessions in the window: print the report but add `Note: too few sessions for meaningful trend data.`
- If log file is empty/missing: print the same "No TokenWise log found" message that `/tokenwise:report` uses.
- Omit any "Per model" row whose count is 0 for the window — Fable's row will legitimately be absent for most users most of the time.

## Tools

Read, Bash (for jq aggregation if helpful), Write (for `--out`).

