convex-cost

convex-cost is a command for Claude Code from get-convex/convex-agent-plugins. It costs 36 tokens per session (856 once invoked), scanned A, original, MIT.

A Convex cost-analysis workflow that uses usage data to rank functions by the data they read and how often they run. It estimates how spending may grow and identifies a lower-cost change.

In plain words
What is it for?
Use it to inspect Convex usage, estimate cost growth, compare expensive functions, and approve actions that create usage charges.
Why use it?
It shows which backend functions are driving current or future costs instead of leaving billing surprises hidden in query behavior.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

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/get-convex/convex-agent-plugins/convex-cost
Clone the repo
git clone --depth 1 https://github.com/get-convex/convex-agent-plugins

Made for: Claude Code.

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 convex-cost

README.md
[![agentmods](https://agentmods.dev/badge/commands/get-convex/convex-agent-plugins/convex-cost.svg)](https://agentmods.dev/commands/get-convex/convex-agent-plugins/convex-cost)
Your own site
<a href="https://agentmods.dev/commands/get-convex/convex-agent-plugins/convex-cost"><img src="https://agentmods.dev/badge/commands/get-convex/convex-agent-plugins/convex-cost.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 856 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.1 $0.00036 $0.00856
Opus 5 $0.00018 $0.00428
Sonnet 5 $0.00007 $0.00171
Haiku 4.5 $0.00004 $0.00086

Measured 6d ago against content hash b66da4f1a0b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

convex-cost 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 6d 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/convex-cost.md · 25 lines

How it starts

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

Preview what this app will cost

Cost surprises come from a handful of functions reading far more data than anyone realized — the same read-heavy patterns convex-advisor flags for perf, seen through the money lens. This capability makes spend legible: it reads the deployment's own bytes/documents-read evidence, attributes it to the functions driving it, projects how it grows with traffic, and names the cheapest fix. It also carries the confirm-cost discipline (Supabase's structural consent for paid actions): before anything metered, state the price and get an explicit yes.

Steps

  1. GUARD: deploy-guard — a cost read is read-only over dev/prod (insights is cloud+user-auth only; not previews). Announce the deployment.
  2. GATHER the spend evidence via the official MCP: insights for the bytes-read / documents-read events (the direct cost signal — Convex bills on function calls + bandwidth), tables for row counts (a table's size bounds its scan cost), functionSpec for the surface. If there's no usage/traffic yet, say so and estimate from the query SHAPES instead (a .collect() on a table projected to grow is a future cost even with zero traffic today).
  3. ATTRIBUTE: rank functions by bytes/documents read per call × observed (or asked-about) call volume — the product is the cost driver, not either alone. A cheap-per-call function called constantly can outweigh an expensive rare one; show both factors.
  4. PROJECT: state how the top drivers scale — a full-table .collect() grows LINEARLY with the table (cost compounds as data accumulates); an indexed .take(n) stays flat. Give the user the shape of the curve ('this is O(table size) per call — fine at 1k rows, a bill at 1M'), not a false-precision dollar figure.
  5. NAME THE CHEAPEST FIX per driver — index + .withIndex instead of scan, .paginate/.take instead of .collect, an aggregate component for counts, caching a hot read — and emit it as a cost-class finding on the bus (evidence: the insight event + the projected growth) pointing at convex-expert/convex-advisor for the actual change.
  6. CONFIRM-COST for paid actions: if the flow includes anything metered (a domain purchase, cloud provisioning, a plan change), STATE the price and recurrence explicitly and get an explicit yes BEFORE proceeding — never let a paid action happen as a side effect (the cost-confirm gate).
  7. REPORT: the current cost drivers ranked, each with its evidence + growth shape + fix, and a plain bottom line ('your spend is dominated by messages:list reading the whole table every call; index it and it drops ~100x'). Honest precision: Convex pricing changes and depends on plan — give relative/shape guidance and cite the pricing page for absolute numbers rather than inventing a dollar total.

Read the full file on GitHub · 25 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. 6d ago First seen · 25 lines · 36 tokens per session scan A b66da4f1a0b0

Subscribe to this mod's changes

convex-cost is a command published in the GitHub repository get-convex/convex-agent-plugins (112 stars, last pushed 8d ago), licensed MIT. It adds 36 tokens to every session and 856 once invoked, about $0.0002 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-30.