ctx:usage

A usage-reporting command for Claude Code, the coding-agent tool. It records context use and gives estimates about limits, model use, parallel tasks, and possible savings.

In plain words
What is it for?
Use it to review current and historical usage, receive warnings, and decide when to change models, reduce parallel work, or wait for a reset.
Why use it?
It helps you notice when a session or weekly allowance is running low before a task is interrupted.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/shakestzd/contextune/ctx-usage
Clone the repo
git clone --depth 1 https://github.com/shakestzd/contextune
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 511 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.00511
Opus 5 $0.00006 $0.00255
Sonnet 5 $0.00002 $0.00102
Haiku 4.5 $0.00001 $0.00051

Measured 2d ago against content hash eac7e88fa186, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ctx:usage scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/ctx-usage.md · 98 lines

What it actually says

/ctx:usage - Context Usage Optimization

Track your Claude Code usage and get intelligent recommendations for cost optimization.

Usage

Quick Check (Manual Input)

# 1. Run Claude Code's built-in command:
/usage

# 2. Then run this command to log it:
/ctx:usage

Claude will ask you to paste the /usage output, then provide:

  • ✅ Current usage status
  • ⚠️ Warnings if approaching limits
  • 💡 Recommendations (model selection, parallel tasks, timing)
  • 📊 Historical trends

Automatic Tracking

Contextune automatically estimates your token usage based on:

  • Prompt lengths
  • Response sizes
  • Haiku vs Sonnet usage
  • Parallel task spawning

Example Output

📊 Context Usage Analysis

Current Status:
  Session: 7% (resets 12:59am)
  Weekly: 89% (resets Oct 29, 9:59pm)
  Opus: 0% available

⚠️  Warnings:
  • 89% weekly usage - approaching limit
  • Reset in: [time remaining]

💡 Recommendations:
  • Switch research tasks to Haiku (87% cost savings)
  • Max parallel tasks: 2 (based on remaining context)
  • ✨ Opus available (0% used) - great for complex architecture
  • Defer non-critical tasks until weekly reset

📈 Estimated Savings:
  • Using Haiku for next 5 tasks: ~$0.45 saved
  • Waiting until reset: +11% weekly capacity

Integration with Other Commands

/ctx:research

Automatically uses Haiku when weekly usage > 80%

/ctx:plan

Limits parallel tasks based on available context

/ctx:execute

Defers execution if approaching session limits

Manual Update

If you want to manually log usage data:

/ctx:usage --update

Then paste your /usage output when prompted.

Dashboard

View historical trends:

marimo edit notebooks/contextune_metrics_dashboard.py

The dashboard shows:

  • Usage trends over time
  • Cost savings from optimization
  • Model selection patterns
  • Parallel task efficiency
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 98 lines · 12 tokens per session scan A eac7e88fa186

Subscribe to this mod's changes

ctx:usage is a command published in the GitHub repository shakestzd/contextune (5 stars, last pushed 8mo ago), licensed MIT. It adds 12 tokens to every session and 511 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.