sw-usage
Use when the user asks what the current agent session has cost or used (tokens, context size, steps, tool calls, time, per subagent), wants a session summary or statistics, or invokes sw-usage.
Files1
View on GitHubSKILL.mdskills/sw-usage/SKILL.md
GitHubsw-usage
Shows what this session has cost so far: one row for the main session and one for each subagent it started. A script reads the record your tool keeps of the session; you read nothing yourself and write no file.
Run from the project root:
node docs/.sw/sw.mjs usage
It reports the session it runs in. For another session of this project, add --session <id or its first characters>; to look only at one tool's sessions, --tool claude|codex|copilot.
Answer
Show the table as printed, in a code block. Do not round, reorder or translate it.
Add at most three observations, in the user's language, each one a number from the table and what it means. Pick the ones that apply:
In the table Say one agent's sentis most of the totalwhich agent, and its share. That is where the session's cost is an agent's peakis several times itsfirstits context grew during the work; stepstimes a large context is what makessentlargefirstis large, formainor for the subagentsevery agent starts heavy before it reads anything: rules, memory, and the lists of skills and tools. sw-doctor shows what fills it and what can go cachedis well below the others for one agentmuch of what it sent was not served from the cache, which costs more per token. Long pauses do that mainhas manystepsor apeakfar above itsfirstwork is running in the main session that a subagent could do in a clean context Nothing else: no advice the table does not support, and no price. The table counts tokens; what a token costs depends on the user's plan.
Columns
So that you can answer a question about them:
steps: model requests.tools: tool calls.min: minutes between the agent's first and last record.first,peak: tokens sent with the first request and with the largest one.sent: tokens sent, summed over every step. A step sends the whole context again, so this is far larger thanpeak.cached: the share ofsentthat was read from the cache.output: tokens the model wrote.-: the tool's record does not hold that number.
If it fails
| Output | Do |
|---|---|
unknown command usage |
the project's docs/.sw/sw.mjs is older than this skill; offer to run sw-init, which updates it |
no agent session record found |
say so, and name the tool's own command instead: /cost or /context (Claude Code), /status (Codex), /usage (Copilot CLI). On Claude Code, beside /cost and /context, /insights reads the recent session transcripts on this machine and writes an HTML report of what the user works on, friction points and suggestions for using Claude Code more effectively; the user types it, the skill cannot run it. On Copilot, beside /usage, /chronicle cost-tips (Copilot CLI) or /chronicle:cost-tips (VS Code Copilot Chat) reads the token use of recent sessions from Copilot's session store and proposes savings; the user types it, the skill cannot run it. A session started in a subfolder of the project is recorded under that folder and is not found |
| a note that Copilot has not written token counts yet | pass the note on; steps and tool calls are still valid |