ctx:stats

ctx:stats is a command for coding agents from shakestzd/contextune. It costs 9 tokens per session (1,067 once invoked), scanned A, original, MIT.

A statistics command for Contextune's command-detection system. It reads a local SQLite database, a small file-based database, and displays detection counts, speed, confidence, and frequently detected commands.

In plain words
What is it for?
Use it to inspect keyword, Model2Vec, and semantic-router results, top detected commands, and confidence ranges.
Why use it?
It shows how often detection methods are used and how they perform over time.

Command

Part of the contextune plugin — 8 skills, 14 commands, 5 agents, 6 hooks, 1 MCP server 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/shakestzd/contextune/ctx-stats
Clone the repo
git clone --depth 1 https://github.com/shakestzd/contextune

Or install contextune, the plugin that ships this one along with the rest of its 8 skills, 14 commands, 5 agents, 6 hooks, 1 MCP server.

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 ctx:stats

README.md
[![agentmods](https://agentmods.dev/badge/commands/shakestzd/contextune/ctx-stats.svg)](https://agentmods.dev/commands/shakestzd/contextune/ctx-stats)
Your own site
<a href="https://agentmods.dev/commands/shakestzd/contextune/ctx-stats"><img src="https://agentmods.dev/badge/commands/shakestzd/contextune/ctx-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 1,067 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.01067
Opus 5 $0.00005 $0.00534
Sonnet 5 $0.00002 $0.00213
Haiku 4.5 $0.00001 $0.00107

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

Security

Grade A, and why

ctx: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 3d 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-stats.md · 148 lines

How it starts

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

Contextune Statistics

Display detection performance metrics and usage statistics from the observability database.


Execution

This command runs automatically via the executable script. The markdown provides documentation only.

Script: commands/slashsense-stats.py Execution: Automatic when command is triggered Data Source: ~/.claude/plugins/contextune/data/observability.db


What This Command Does

Step 1: Load Statistics

Reads detection data from the observability database:

sqlite3 ~/.claude/plugins/contextune/data/observability.db \
  "SELECT tier, COUNT(*), AVG(latency_ms), AVG(confidence)
   FROM detections GROUP BY tier"

Step 2: Generate Report

Creates formatted output using Rich library showing:

  1. Detection Performance by Tier

    • Keyword: Detection count, average latency, accuracy
    • Model2Vec: Detection count, average latency, accuracy
    • Semantic Router: Detection count, average latency, accuracy
  2. Top Detected Commands

    • Command name and frequency count
    • Shows top 5 most-used commands
  3. Confidence Distribution

    • Breakdown by confidence range (50-70%, 70-85%, 85%+)
    • Visual progress bars

Step 3: Display to User

Outputs formatted tables and panels to terminal.


Example Output

╭─────────────────────────── Contextune Statistics ───────────────────────────╮
│                                                                              │
│ Total Detections: 1,247                                                     │
│                                                                              │
│ Performance by Tier                                                         │
│ ┌───────────────┬────────────┬─────────────┬──────────┐                    │
│ │ Tier          │ Detections │ Avg Latency │ Accuracy │                    │
│ ├───────────────┼────────────┼─────────────┼──────────┤                    │
│ │ Keyword       │        892 │      0.05ms │     98%  │                    │
│ │ Model2Vec     │        245 │      0.18ms │     94%  │                    │
│ │ Semantic      │        110 │     47.30ms │     89%  │                    │
│ └───────────────┴────────────┴─────────────┴──────────┘                    │
│                                                                              │
│ Top Commands                                                                │
│ 1. /sc:analyze       324 detections                                         │
│ 2. /sc:implement     218 detections                                         │
│ 3. /sc:test          187 detections                                         │
│ 4. /sc:git           156 detections                                         │
│ 5. /sc:improve       134 detections                                         │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Read the full file on GitHub · 148 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. 3d ago First seen · 148 lines · 9 tokens per session scan A f3a4966ca6c6

Subscribe to this mod's changes

ctx:stats is a command published in the GitHub repository shakestzd/contextune (5 stars, last pushed 8mo ago), licensed MIT. It adds 9 tokens to every session and 1,067 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.