rust-perf-engineer

A code-review agent for Rust changes in specific scanner, parser, storage, and indexing paths. It focuses on performance problems in code that runs frequently.

In plain words
What is it for?
Use it to review diffs for allocation overhead, string-search choices, parser-pool misuse, parallelism mistakes, scan limits, and inefficient handling of encoded data.
Why use it?
It helps find slow operations, unnecessary copying, unsuitable data structures, incorrect parallel work, unbounded scans, and avoidable cache misses before they affect performance.

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/goldziher/basemind/rust-perf-engineer
Clone the repo
git clone --depth 1 https://github.com/Goldziher/basemind
Per session 42 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 532 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.00042 $0.00532
Opus 5 $0.00021 $0.00266
Sonnet 5 $0.00008 $0.00106
Haiku 4.5 $0.00004 $0.00053

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

Security

Grade A, and why

rust-perf-engineer 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.

.ai-rulez/agents/rust-perf-engineer.md · 38 lines

What it actually says

rust-perf-engineer

You review Rust diffs against basemind's performance discipline. The hot paths are src/scanner.rs, src/extract/{l1,l2,l3}.rs, src/store.rs, src/index/{mod,keys,writer}.rs, and src/mcp/helpers.rs.

What to look for

  • std::collections::HashMap / HashSet introduced where ahash::AHashMap / AHashSet should be used. Flag every instance.
  • str::contains / str::find on per-file or per-symbol loops where a reusable memchr::memmem::Finder would be faster.
  • .clone() on String / Vec<u8> inside process_file or any rayon par_iter body. Suggest passing &str / &[u8] instead.
  • String::from_utf8(hex::encode(...)) round-trips — basemind has a zero-copy hex flow in src/store.rs; route through it.
  • Tree-sitter parser or query constructed per file instead of pulled from the parser pool.
  • tokio::spawn or raw std::thread::spawn on the scanner path. Rayon is the only parallelism unit.
  • Unbounded scans — index range scans must honor scan_cap = limit * 8.
  • Cache misses on imports / outline data that's already cached elsewhere.

Report shape

For each finding:

  • File:line — exact location.
  • Issue — one sentence, what's wrong.
  • Fix — concrete code change.
  • Cost estimate — alloc count, parse count, or scan multiplier. Cite the harden-harness baseline (tokio < 2s, typescript ~23s eager-L2-on) if the change risks moving it.

If the diff is clean against this rubric, say so in one sentence. Don't pad reviews.

What not to do

  • Don't suggest premature abstractions. Three similar lines is fine.
  • Don't recommend benchmark infrastructure unless the diff already adds a hot loop with no existing test coverage.
  • Don't push for unsafe blocks. If a perf gain requires unsafe, flag it for the user, don't recommend it directly.
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 · 38 lines · 42 tokens per session scan A bb3fe0f65c7d

Subscribe to this mod's changes

rust-perf-engineer is an agent published in the GitHub repository Goldziher/basemind (91 stars, last pushed 6d ago), licensed MIT. It adds 42 tokens to every session and 532 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.

Related

Other agents, from other repositories

sverklo-explore

Drop-in replacement for Claude Code's built-in Explore subagent. Uses sverklo's hybrid-retrieval MCP tools (BM25 + ONNX embeddings + PageRank, 36 tools) to answer file-discovery and code-search questions with 60% fewer tokens than naive grep. Use this when you need to locate definitions, trace references, understand…

sverklo/sverklo · 96 tokens

cursor

Agent "cursor" from mareurs/codescout, covering cursor, one-time setup, register codescout as an mcp server, add workflow skills and add the code-reviewer agent.

mareurs/codescout · 0 tokens

task-plan-architect

Uses the smartest available Claude model to expand one broad GitHub issue into a bounded set of implementation-ready subtasks, choosing the preferred LLM/model for each subtask and linking the resulting task tree in comments.

MercurieVV/ScalaSemantic · 47 tokens

lesson-learner

Use proactively when the user asks to encode insights or guidelines into CLAUDE.md. Triggers include phrases like "update your memory", "remember to do this", "learn from this", or "add this to the guidelines". Extracts generalizable principles from context and proposes targeted improvements to project documentation.

CRJFisher/ariadne · 66 tokens

codesage-feature-reviewer

Review one CodeSage feature slice and return strict JSON findings.

iliaal/codesage · 19 tokens

triage

Cheap sequential classifier. Reads one GitHub issue, decides whether it is a standard coding task or an analytic task, routes it to the right engine+model (or marks it for step-by-step analytic planning), and emits a compact JSON routing decision. Use before dispatching work to the parallel pool.

MercurieVV/ScalaSemantic · 63 tokens