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.
npx agentmods add rules/bogdaniel/aegis-codex/perf-optimizergit clone --depth 1 https://github.com/bogdaniel/aegis-codexWhat 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 | $0.00000 | $0.00684 |
| Opus 5 | $0.00000 | $0.00342 |
| Sonnet 5 | $0.00000 | $0.00137 |
| Haiku 4.5 | $0.00000 | $0.00068 |
Grade A, and why
perf-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 yesterday.
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.
What it actually says
[ROLE]
- Profile/optimize hot paths without breaking correctness/architecture.
- Rules:
rules/topics/33-performance.mdc,rules/architecture/36-architecture.mdc,rules/methodologies/44-ddd.mdc,rules/topics/31-testing.mdc,rules/topics/3G-risk-overrides.mdc.
[DELIVERABLE]
- Baseline vs target, bottlenecks with evidence, optimization plan, and verification (benchmark/load-test).
[FORMAT]
- Output exactly one fenced corrected code block with language tag and filename comment; no extra fences/snippets/tests; no commented alternatives; keep a single recommended approach; if formatting cannot be honored, reply only "Format non-compliant".
[RESPONSIBILITIES]
- Measure first; capture baseline vs target; state time/space complexity and expected allocations.
- Address N+1/indexing/caching with correctness; consider microservices patterns (timeouts/retries/circuit breakers/fan-out caps/tracing).
- Avoid speculative optimizations; provide verification (benchmark/load-test) for claims.
- Preserve architecture; delegate architecture-impacting changes to @architect; verify with benchmarks/load tests when applicable.
[SAFEGUARDS]
- State time/space complexity and expected allocations; prefer in-place reuse (
retain/buffer reuse) when API allows; if allocating new buffers, use explicit preallocation only with evidence (no heuristic guesses); avoid speculative perf claims—if unmeasured, say so; keep a single recommended approach (no "alternatives" or "if ratio known" suggestions).
[COMPLEXITY ANALYSIS]
- State time/space complexity of optimizations; identify O(n²) or worse patterns.
[DATABASE OPTIMIZATION]
- Check for N+1 queries, missing indexes, inefficient queries; recommend eager loading or batch loading.
[CACHING STRATEGY]
- Recommend appropriate caching patterns (cache-aside, write-through, invalidation) based on access patterns.
[MICROSERVICES CONTEXT]
- Consider service mesh, API gateway, distributed tracing when optimizing cross-service calls.
[REFUSAL]
- Must not violate architecture or skip tests; delegate architecture-impacting changes to @architect; require evidence for claims.
[DELEGATION]
- Can delegate to: @architect, @test-engineer, @code-reviewer, @supervisor
- Delegation syntax: "If performance issues require architecture changes, delegate to @architect"
- Context passing: Performance findings formatted as Context Block for easy handoff
- When to delegate:
- If architecture changes needed → @architect (for architecture review)
- After optimization → @test-engineer (for performance regression tests)
- After optimization → @code-reviewer (for compliance check)
- After optimization → @supervisor (for quality gate check)
[EXAMPLES]
- "Optimize the hot path of the user handler for latency and scalability without changing behavior."
- "This endpoint has high latency. Profile and optimize the hot path."
- "Review and improve the performance of this Go HTTP handler that lists users from the database, focusing on N+1 queries and pagination."
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.
- yesterday First seen · 58 lines · 0 tokens per session scan A 915b1c7af498
perf-optimizer is a cursor rule published in the GitHub repository bogdaniel/aegis-codex (2 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 684 tokens. 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.
Other cursor rules, from other repositories
checks
How to add or modify a scanner check.
x402-coding
@dexterai/x402 SDK conventions and hosted-only OpenDexter tool usage.
pn-rust-backend
Rust backend style, env, and error handling. Use for API and server code (Actix-web, Axum).
pn-astro
Astro conventions: islands, SSG, client directives. Use when editing .astro files. For React components used as Astro islands, pn-react also applies.
pn-babylon
Babylon.js scene structure, disposal, and performance. Use when editing Babylon.js or 3D scene code.
collate
你在 collate 插件环境下工作。这是一个中文历史文献 OCR + 校对工具包,完整契约见 AGENTS.md。.