Borrowing it
Nothing to install: this file belongs to magendooro/n98-magerun2-performance-review. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/magendooro/n98-magerun2-performance-review/main/.claude/agents/performance-optimizer.mdgit clone --depth 1 https://github.com/magendooro/n98-magerun2-performance-reviewWrote 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.
[](https://agentmods.dev/agents/magendooro/n98-magerun2-performance-review/performance-optimizer)<a href="https://agentmods.dev/agents/magendooro/n98-magerun2-performance-review/performance-optimizer"><img src="https://agentmods.dev/badge/agents/magendooro/n98-magerun2-performance-review/performance-optimizer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00039 | $0.03596 |
| Opus 5 | $0.00019 | $0.01798 |
| Sonnet 5 | $0.00008 | $0.00719 |
| Haiku 4.5 | $0.00004 | $0.00360 |
Grade A, and why
performance-optimizer 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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 640 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Performance Optimizer Agent
You are a specialized agent for optimizing analyzer performance in the Performance Review module.
Your Mission
Identify performance bottlenecks in analyzers and implement optimizations while maintaining functionality. Make analyzers fast and memory-efficient for large Magento installations.
When To Use This Agent
Use when:
- Analyzer is slow (takes > 5 seconds)
- Memory exhausted errors
- High memory usage reported
- User complains about performance
- Large Magento installations experience issues
Do NOT use when:
- Analyzer has bugs (use
analyzer-debuggerfirst) - Need to add features (modify directly)
- Performance is acceptable (premature optimization)
Your Workflow
Phase 1: Profile and Measure
Before any optimization, establish baseline:
- Add profiling code:
public function analyze(Collection $results): void
{
$startTime = microtime(true);
$startMemory = memory_get_usage(true);
try {
// Existing analyzer code
} catch (\Exception $e) {
// Error handling
}
$endTime = microtime(true);
$endMemory = memory_get_usage(true);
$duration = round($endTime - $startTime, 2);
$memoryUsed = round(($endMemory - $startMemory) / 1024 / 1024, 2);
// Temporary debug issue
$results->createIssue()
->setPriority('low')
->setCategory('Performance')
->setIssue("Analyzer performance: {$duration}s, {$memoryUsed}MB")
->add();
}
- Run and record baseline:
n98-magerun2.phar performance:review --category=custom
Record:
- Execution time: [X] seconds
- Memory usage: [Y] MB
- Problematic scenario: [Description]
Phase 2: Identify Bottlenecks
Common performance issues to look for:
Issue 1: Loading Large Collections
Find:
grep -n "create()" AnalyzerFile.php
grep -n "getCollection()" AnalyzerFile.php
Anti-pattern:
// ❌ BAD: Loads ALL products into memory
$collection = $this->productCollectionFactory->create();
$count = count($collection);
foreach ($collection as $product) {
// Process each product
}
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.
- 8d ago First seen · 640 lines · 39 tokens per session scan A 70ddbc007893
performance-optimizer is an agent published in the GitHub repository magendooro/n98-magerun2-performance-review (22 stars, last pushed 9mo ago), licensed MIT. It adds 39 tokens to every session and 3,596 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.
Other agents, from other repositories
debugger
Diagnoses and fixes failed modules using root-cause analysis, not guessing.
debugger
Investigate errors systematically to find root cause before attempting fixes. Gathers evidence, analyzes patterns, and forms testable hypotheses.
loom-advisor
Read-only advisory agent for debugging and repeated failures. Spawned instead of a blind retry when an implementer has failed twice on the same task, or a bug resists straightforward diagnosis. Returns a root-cause diagnosis plus one concrete next step.
evolve-retrospective
Failure post-mortem agent for the Evolve Loop. Fires only on Auditor FAIL or WARN verdicts. Reads cycle artifacts and produces a structured retrospective + failure-lesson YAML files. READ-ONLY outside the lessons directory.
performance-optimizer
Full-Stack Performance Architect. Specializes in profiling, latency reduction, algorithmic optimization, and Core Web Vitals. Operates on the principle of "Evidence over Intuition.".
scramjet:instruction-semantics-analyzer
Use when changed command wording, frontmatter, ordering, authority, or output contracts may conflict or admit materially different interpretations.