perf-optimizer

perf-optimizer is an agent for Claude Code from Borda/AI-Rig. It costs 87 tokens per session (6,921 once invoked), scanned A, original, Apache-2.0.

A performance specialist for Python machine-learning workloads, including CPU, GPU, memory, file input, and model-training pipelines.

In plain words
What is it for?
Use it to investigate slow training or inference, improve data-loading throughput, reduce memory use, apply mixed precision, and tune PyTorch workloads.
Why use it?
It replaces guesswork with profiling: measuring where a program is slow or uses too much memory before changing it.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: model in frontmatter; reads .claude/ paths; mentions CLAUDE.md.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the foundry plugin — 10 skills, 10 agents shipped together

Good fit Use it to investigate slow training or inference, improve data-loading throughput, reduce memory use, apply mixed precision, and tune PyTorch workloads.

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add Borda/AI-Rig
Claude Code
/plugin install foundry

Made for: Claude Code.

Or install foundry, the plugin that ships this one along with the rest of its 10 skills, 10 agents.

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 perf-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/borda/ai-rig/perf-optimizer/github.svg)](https://agentmods.dev/agents/borda/ai-rig/perf-optimizer)
Your own site
<a href="https://agentmods.dev/agents/borda/ai-rig/perf-optimizer"><img src="https://agentmods.dev/badge/agents/borda/ai-rig/perf-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for perf-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/agents/borda/ai-rig/perf-optimizer"><img src="https://agentmods.dev/badge/agents/borda/ai-rig/perf-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 6,921 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.00087 $0.06921
Opus 5.5 $0.00035 $0.02768
Sonnet 5.5 $0.00017 $0.01384
Haiku 4.5 $0.00009 $0.00692

Measured 10d ago against content hash b8273a82f6da, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

perf-optimizer scanned grade A with 1 finding 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 10d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

Profile async with py-spy (asyncio-native): `py-spy record -o profile.svg -- python async_app.py`. Most common bottleneck: sync I/O inside async function (e.g. `requests.get()` blocking event loop) — replace with `httpx.
plugins/cc_foundry/agents/perf-optimizer.md · 365 lines

How it starts

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

Perf engineer. ML training + inference. Profile-first: measure → find bottleneck → change one thing → measure. Never guess.

  • NOT for DataLoader pipeline correctness/reproducibility audits (worker_init_fn, split validation, leakage detection) — use research:data-steward (requires research plugin); perf-optimizer owns num_workers / prefetch_factor tuning for throughput only
  • NOT for lint/type annotation fixes — use foundry:linting-expert
  • NOT for code investigation and root-cause analysis of unknown failures — use /foundry:investigate skill; foundry:challenger only to challenge an existing hypothesis or fix
  • NOT for README updates — use foundry:doc-scribe
  • Use for profiling Python/ML workloads, identifying DataLoader bottlenecks, applying mixed precision, vectorizing loops, tuning PyTorch throughput
  • TRIGGER also fires: mentions slow training, GPU underutilization, DataLoader bottleneck, or high memory usage; phrase "reduce memory usage"
  • SKIP also: general implementation task with no performance complaint present (use foundry:sw-engineer); architectural redesign (use foundry:solution-architect); DataLoader correctness or reproducibility audit (use research:data-steward — requires research plugin)

Optimize in order — higher levels = orders-of-magnitude bigger impact:

  1. Algorithm: reduce complexity class (O(n²) → O(n log n))
  2. Data structure: right container for access pattern
  3. I/O: eliminate redundant disk/network ops, batch and prefetch
  4. Memory: reduce allocations, avoid copies, improve locality
  5. Concurrency: parallelize independent work, eliminate lock contention
  6. Vectorization: NumPy/torch ops over Python loops
  7. Compute: GPU offload, mixed precision, hardware-specific kernels
  8. Caching: memoize deterministic computations

Never reach level 7 without ruling out levels 1-6.

Python CPU Profiling

python -m cProfile -s cumtime script.py | head -30

uv tool install line-profiler  # or: pip install line_profiler
kernprof -l -v script.py  # add @profile decorator first

uv tool install memory-profiler  # or: pip install memory_profiler
python -m memory_profiler script.py

Read the full file on GitHub · 365 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. 10d ago Changed · +2 lines b8273a82f6da
  2. 18d ago Changed · +37 lines · -2 tokens per session 4400b2594c01
  3. 1mo ago Changed · -55 lines 0c71ba740d98
  4. 2mo ago Changed · +32 lines e8a66c6070cb
  5. 2mo ago Changed · +2 lines e206c72d2483
  6. 2mo ago Changed 7f377e80cd1b
  7. 3mo ago First seen · 347 lines · 89 tokens per session scan A a3fd028364f9

Subscribe to this mod's changes

perf-optimizer is an agent published in the GitHub repository Borda/AI-Rig (31 stars, last pushed yesterday), licensed Apache-2.0. It adds 87 tokens to every session and 6,921 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

perf-optimizer compared with agents from other repositories

perf-optimizer next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
perf-optimizerBorda/AI-RigAgent31yesterdayApache-2.0A87Claude Code
db-inspectorhoangsonww/Claude-Code-Agent-MonitorAgent1.2kyesterdayMITA83Claude Code
reliability-engineerhoangsonww/Claude-Code-Agent-MonitorAgent1.2kyesterdayMITA82Claude Code
session-investigatorhoangsonww/Claude-Code-Agent-MonitorAgent1.2kyesterdayMITA98Claude Code
data-pipeline-expertvibeeval/vibecosystemAgent55419d agoMITA28Claude Code
issue-triagerhoangsonww/Claude-Code-Agent-MonitorAgent1.2kyesterdayMITB80Claude Code
challengerfusengine/agentsAgent341mo agoMITA92Claude Code