analyze-usage

analyze-usage is a command for coding agents from openshift-eng/ai-helpers. It costs 9 tokens per session (1,839 once invoked), scanned A, original, Apache-2.0.

A command that reviews BigQuery usage for a cloud project. BigQuery is a service for storing and querying large datasets, and the review covers usage, estimated costs, users, and query performance.

In plain words
What is it for?
Use it with a project ID and time period to find expensive queries, heavy users, usage thresholds, optimization opportunities, and optionally produce a report.
Why use it?
It helps reveal which users, queries, and recurring patterns are driving data-scanning costs or inefficient performance.

Command

Part of the bigquery plugin — 2 skills, 1 command 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/openshift-eng/ai-helpers/analyze-usage
Clone the repo
git clone --depth 1 https://github.com/openshift-eng/ai-helpers

Or install bigquery, the plugin that ships this one along with the rest of its 2 skills, 1 command.

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 analyze-usage

README.md
[![agentmods](https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/analyze-usage.svg)](https://agentmods.dev/commands/openshift-eng/ai-helpers/analyze-usage)
Your own site
<a href="https://agentmods.dev/commands/openshift-eng/ai-helpers/analyze-usage"><img src="https://agentmods.dev/badge/commands/openshift-eng/ai-helpers/analyze-usage.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,839 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.01839
Opus 5 $0.00005 $0.00920
Sonnet 5 $0.00002 $0.00368
Haiku 4.5 $0.00001 $0.00184

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

Security

Grade A, and why

analyze-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 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

plugins/bigquery/commands/analyze-usage.md · 219 lines

How it starts

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

Name

bigquery:analyze-usage

Synopsis

/bigquery:analyze-usage <project-id> <timeframe>
/bigquery:analyze-usage openshift-ci-data-analysis "24 hours"
/bigquery:analyze-usage my-project "7 days"

Description

The analyze-usage command provides comprehensive analysis of BigQuery usage patterns, costs, and query performance for a given project. It identifies expensive queries, heavy users, and provides actionable optimization recommendations.

This command helps answer questions like:

  • Which users or service accounts are consuming the most data?
  • What are the most expensive queries?
  • Which query patterns are running most frequently?
  • How can we reduce BigQuery costs?
  • Are we over any usage thresholds?

The analysis includes:

  • Total usage summary (queries, data scanned, estimated costs)
  • Usage breakdown by user/service account
  • Per-user deep dive analysis for top 2-3 users
  • Top individual queries by cost
  • Query pattern analysis to identify optimization opportunities
  • Specific, actionable optimization recommendations
  • Optional markdown report generation

Implementation

This command uses the bigquery:analyze-usage skill to perform the analysis.

Prerequisites

  • Google Cloud SDK (bq command-line tool) must be installed
  • User must have BigQuery read access to the project
  • User must be authenticated (gcloud auth login)

Steps

  1. Parse and Validate Arguments:

    • If project-id is missing: Use AskUserQuestion to prompt for it
    • If timeframe is missing: Use AskUserQuestion to prompt for it (options: "1 hour", "6 hours", "24 hours", "7 days", "30 days")
    • Parse timeframe into hours (e.g., "24 hours" → 24, "7 days" → 168)
  2. Invoke the analyze-usage Skill:

    Use the Skill tool to invoke "bigquery:analyze-usage"
    

    The skill will handle all the data collection and analysis.

  3. Present Results: The skill returns a comprehensive report. Present it to the user in a clear, readable format with:

    • Executive summary at the top
    • Tables for user usage and top queries
    • Per-user deep dive for top 2-3 users showing their specific query patterns
    • Detailed query pattern analysis
    • Prioritized optimization recommendations

Read the full file on GitHub · 219 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 · 219 lines · 9 tokens per session scan A 2f93d44be52e

Subscribe to this mod's changes

analyze-usage is a command published in the GitHub repository openshift-eng/ai-helpers (114 stars, last pushed yesterday), licensed Apache-2.0. It adds 9 tokens to every session and 1,839 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-30.