$ recombobulate _
home / tips / track-your-session-cost-with-cost
0

Track Your Session Cost with /cost

bagwaa @bagwaa · Mar 25, 2026 · Performance
track-your-session-cost-with-cost

Token costs can creep up during a long session, especially when Claude is reading large files or looping through complex tasks. The /cost command gives you an instant snapshot.

Just type it mid-conversation:

/cost

You'll get a breakdown of input tokens, output tokens, and the estimated cost for everything since the session started — useful for keeping an eye on burn rate during a long refactor or an automated pipeline run.

This pairs well with /compact — if you notice the cost climbing and the context is bloated with earlier context you no longer need, run /compact to summarise and reset, then check /cost again to see the difference.

/compact
/cost

If you're running Claude in CI or scripted pipelines with --output-format stream-json, the cost data is also emitted in the final JSON event under usage, so you can log it programmatically:

claude -p "your task" --output-format stream-json | \
  jq 'select(.type == "result") | .usage'

Run /cost whenever you're curious — it takes one second and keeps surprises off your bill.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Filter Test Output with a PreToolUse Hook to Cut Token Costs

A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.

bagwaa @bagwaa · 3 hours ago
0
Move Specialised CLAUDE.md Instructions into Skills to Shrink Context

CLAUDE.md loads into every message. Move workflow-specific instructions into skills that load on demand to reduce token costs across your session.

bagwaa @bagwaa · 3 hours ago
0
Use prompt.id to Trace All Activity from a Single User Prompt

Every event emitted while processing a single prompt shares a prompt.id UUID, letting you trace the complete chain of API calls and tool executions.

bagwaa @bagwaa · 3 hours ago