perf

A read-only code analysis agent that looks for performance problems in Rails and Next.js applications. It checks database queries, background jobs, React re-renders, and data fetching.

In plain words
What is it for?
Use it to inspect Rails database access and Sidekiq jobs, or Next.js components and React Query data fetching, for N+1 queries, slow queries, unnecessary work, and request waterfalls.
Why use it?
It helps explain why an application is slow without changing the code automatically. It focuses on common causes such as repeated database queries, missing indexes, excessive re-renders, and unnecessary refetching.

Agent

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 agents/cveralyon/axel-setup/perf
Clone the repo
git clone --depth 1 https://github.com/cveralyon/axel-setup
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 390 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.00020 $0.00390
Opus 5 $0.00010 $0.00195
Sonnet 5 $0.00004 $0.00078
Haiku 4.5 $0.00002 $0.00039

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

Security

Grade A, and why

perf 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 2d 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.

agents/perf.md · 45 lines

What it actually says

Analyze the codebase or a specific area for performance issues. Read-only analysis — report findings, don't auto-fix.

Rails (main-api)

N+1 Queries

  • Find .each/.map/.find_each loops that access associations
  • Check if includes/eager_load/preload is used upstream
  • Check serializers with belongs_to/has_many that trigger lazy loads

Slow Queries

  • Find where clauses on columns without indexes (cross-reference with db/schema.rb)
  • Find LIKE/ILIKE queries without trigram/GIN indexes
  • Find order on unindexed columns
  • Check for pluck vs loading full objects when only IDs/values needed

Sidekiq

  • Find jobs doing heavy DB work without batching
  • Check for jobs that could be parallelized

Next.js (Frontend)

Re-renders

  • Find components missing memo, useMemo, or useCallback where appropriate
  • Check for objects/arrays created inline in JSX props (new reference each render)
  • Find Context providers that re-render too many consumers

Data Fetching

  • Check staleTime configuration in React Query hooks — too low = excessive refetching
  • Find components that fetch data they could receive as props from a parent
  • Check for waterfall requests that could be parallelized

Bundle

  • Large imports that could be dynamic: import() for heavy components
  • Check if heavy libraries are imported in client components unnecessarily

Report Format

Issue Location Severity Suggested Fix
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. 2d ago First seen · 45 lines · 20 tokens per session scan A a7da10543d7f

Subscribe to this mod's changes

perf is an agent published in the GitHub repository cveralyon/axel-setup (4 stars, last pushed 1mo ago), licensed MIT. It adds 20 tokens to every session and 390 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-31.