context-stats

context-stats is a command for coding agents from primeline-ai/claude-code-starter-system. It costs 9 tokens per session (583 once invoked), scanned A, original, MIT.

A command that displays the percentage of the coding agent’s context window currently in use. It shows a visual bar and labels the level as healthy, warning, or critical.

In plain words
What is it for?
Use it during a session to check context usage and decide whether to continue, reduce context, or create a handoff.
Why use it?
It helps you notice when the conversation is becoming too large to work with comfortably. The recommendations can guide when to summarize or start a handoff.

Command

Part of the claude-code-starter-system plugin — 1 skill, 4 commands shipped together

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/primeline-ai/claude-code-starter-system/context-stats
Clone the repo
git clone --depth 1 https://github.com/primeline-ai/claude-code-starter-system

Or install claude-code-starter-system, the plugin that ships this one along with the rest of its 1 skill, 4 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-stats

README.md
[![agentmods](https://agentmods.dev/badge/commands/primeline-ai/claude-code-starter-system/context-stats.svg)](https://agentmods.dev/commands/primeline-ai/claude-code-starter-system/context-stats)
Your own site
<a href="https://agentmods.dev/commands/primeline-ai/claude-code-starter-system/context-stats"><img src="https://agentmods.dev/badge/commands/primeline-ai/claude-code-starter-system/context-stats.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 583 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.00009 $0.00583
Opus 5 $0.00005 $0.00292
Sonnet 5 $0.00002 $0.00117
Haiku 4.5 $0.00001 $0.00058

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

Security

Grade A, and why

context-stats 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 4d 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/context-stats.md · 102 lines

How it starts

The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/context-stats

Show how much of your context window is currently used, with a visual indicator and action recommendations.

Workflow

Step 1: Read Context Percentage

Run this bash command to find the latest context file:

ls -t /tmp/claude-context-pct-*.txt 2>/dev/null | head -1 | xargs cat 2>/dev/null

If the command returns nothing or fails, skip to the "Not Available" fallback at the bottom.

Store the result as {pct} (an integer 0-100).

Step 2: Generate Visual Bar

Calculate the filled and empty portions for a 30-character wide bar:

filled = round(pct * 30 / 100)
empty  = 30 - filled
bar    = "█" * filled + "░" * empty

Step 3: Determine Status

Range Status Label
0-59% Healthy Healthy
60-79% Warning Warning
80-100% Critical Critical

Step 4: Render the Dashboard

╔═══════════════════════════════════════════════════════╗
║            CONTEXT WINDOW USAGE                       ║
╠═══════════════════════════════════════════════════════╣
║ {bar}  {pct}%                                        ║
║                                                       ║
║ Status: {status label}                               ║
╠═══════════════════════════════════════════════════════╣
║ {recommendations}                                     ║
╚═══════════════════════════════════════════════════════╝

Step 5: Recommendations by Status

Healthy (0-59%):

CAPACITY
  Good capacity for complex tasks
  Multi-step operations safe

Warning (60-79%):

RECOMMENDATIONS
  Consider running /handoff soon
  Avoid starting new complex tasks
  Current work can continue safely

Critical (80-100%):

ACTION REQUIRED
  Run /handoff now to save your session
  Start a new session for fresh context
  Use: continue - to resume where you left off

Not Available Fallback

If no context file was found, output:

Context percentage not available. Check your statusline configuration.

To enable context tracking, add the statusline script to your shell config.
See the plugin README for setup instructions.

Read the full file on GitHub · 102 lines

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. 4d ago First seen · 102 lines · 9 tokens per session scan A d58f79bfcbd8

Subscribe to this mod's changes

context-stats is a command published in the GitHub repository primeline-ai/claude-code-starter-system (5 stars, last pushed 19d ago), licensed MIT. It adds 9 tokens to every session and 583 once invoked, about $0.0000 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.