benchmark

benchmark is a command for Claude Code from solanabr/solana-ai-kit. It costs 10 tokens per session (1,554 once invoked), scanned A, original, MIT.

A benchmark command for measuring Solana program compute-unit usage and comparing it with a saved baseline. Compute units are Solana's measure of the processing work a transaction consumes.

In plain words
What is it for?
Use it to build an Anchor or native Solana program, run tests that measure compute use, and save current results alongside a baseline.
Why use it?
It helps detect performance regressions by showing whether a program now uses more compute than before.

Command for Claude Code

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/solanabr/solana-ai-kit/benchmark
Clone the repo
git clone --depth 1 https://github.com/solanabr/solana-ai-kit

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 benchmark

README.md
[![agentmods](https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/benchmark.svg)](https://agentmods.dev/commands/solanabr/solana-ai-kit/benchmark)
Your own site
<a href="https://agentmods.dev/commands/solanabr/solana-ai-kit/benchmark"><img src="https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/benchmark.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 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,554 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.00010 $0.01554
Opus 5 $0.00005 $0.00777
Sonnet 5 $0.00002 $0.00311
Haiku 4.5 $0.00001 $0.00155

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

Security

Grade A, and why

benchmark 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

2 near-identical copies found in the catalogue:

  • benchmark — 100% identical, 0 lines differ
  • benchmark — 100% identical, 0 lines differ
.claude/commands/benchmark.md · 228 lines

How it starts

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

You are running CU benchmarks for a Solana program and comparing results against a stored baseline. This detects performance regressions and tracks optimization progress.

Step 1: Setup

BENCHMARK_DIR=".claude/benchmarks"
BASELINE_FILE="$BENCHMARK_DIR/cu-baseline.json"
CURRENT_FILE="$BENCHMARK_DIR/cu-current.json"

mkdir -p "$BENCHMARK_DIR"

echo "Benchmark configuration:"
echo "  Baseline: $BASELINE_FILE"
echo "  Output:   $CURRENT_FILE"
echo ""

# Verify project
if [ ! -f "Anchor.toml" ] && [ ! -f "Cargo.toml" ]; then
    echo "No Anchor.toml or Cargo.toml found. Cannot benchmark."
    exit 1
fi

Step 2: Build Program

echo "Building program..."

if [ -f "Anchor.toml" ]; then
    anchor build
else
    cargo build-sbf
fi

if [ $? -ne 0 ]; then
    echo "Build failed. Fix compilation errors before benchmarking."
    exit 1
fi

echo "Build successful."
echo ""

Step 3: Run Tests with CU Measurement

echo "Running test suite with CU measurement..."
echo ""

export SBF_OUT_DIR=target/deploy

if [ -f "Anchor.toml" ]; then
    # Run Anchor tests, capture CU output
    anchor test --skip-deploy 2>&1 | tee /tmp/benchmark-output.txt
else
    cargo test 2>&1 | tee /tmp/benchmark-output.txt
fi

TEST_STATUS=$?
if [ $TEST_STATUS -ne 0 ]; then
    echo ""
    echo "Tests failed. Fix failures before benchmarking."
    exit 1
fi

echo ""
echo "Tests passed. Parsing CU data..."

Step 4: Parse CU Results

Extract CU consumption per instruction from test output.

echo "Parsing CU usage from test output..."

# Extract lines with CU data
# Pattern: "Program <ID> consumed <N> of <M> compute units"
grep -i "consumed.*compute units" /tmp/benchmark-output.txt > /tmp/cu-lines.txt

TOTAL_INSTRUCTIONS=$(wc -l < /tmp/cu-lines.txt)
echo "Found $TOTAL_INSTRUCTIONS instruction CU measurements."
echo ""

# Display raw CU data
echo "Raw CU measurements:"
cat /tmp/cu-lines.txt

Read the full file on GitHub · 228 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 · 228 lines · 10 tokens per session scan A ed099fa97974

Subscribe to this mod's changes

benchmark is a command published in the GitHub repository solanabr/solana-ai-kit (98 stars, last pushed 15d ago), licensed MIT. It adds 10 tokens to every session and 1,554 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-30.