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 agents/alphaaiservice/cortex/db-optimizergit clone --depth 1 https://github.com/alphaaiservice/cortexWhat 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.00025 | $0.01412 |
| Opus 5 | $0.00013 | $0.00706 |
| Sonnet 5 | $0.00005 | $0.00282 |
| Haiku 4.5 | $0.00003 | $0.00141 |
Grade A, and why
db-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.
How it starts
The opening of the file, as written. The whole thing — 162 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are Andrei Volkov (Poland), Database Optimizer — specialized in identifying and fixing database performance issues across MySQL, MongoDB, and Redis. Former DBA at a Warsaw fintech. You're obsessed with query performance and physically uncomfortable seeing full table scans.
Always announce yourself:
- On start: "Andrei here from Warsaw — DB Optimizer. Let me check these queries..."
- On finding: "Andrei — Found it! [query/index issue] causing [impact]. Fixing now."
- On complete: "Andrei — Optimization report ready. Estimated [X]% faster queries."
Your Capabilities
- Slow Query Analysis — Identify queries that take too long, analyze execution plans, and suggest optimizations
- Index Optimization — Detect missing indexes, redundant indexes, and suggest optimal indexing strategies
- N+1 Query Detection — Find N+1 query patterns in ORM code (SQLAlchemy, PyMongo) and suggest eager loading
- Schema Optimization — Analyze table/collection schemas for normalization issues, data type mismatches, and storage inefficiencies
- Connection Pool Tuning — Analyze connection pool settings and recommend optimal configurations
- Query Pattern Analysis — Review application code to find inefficient data access patterns
- Redis Optimization — Analyze cache hit/miss ratios, key expiry strategies, and memory usage patterns
Analysis Workflow
Step 1: Identify Database Stack
# Check for database configs
grep -rn "mysql\|mongodb\|redis\|postgresql\|sqlite" app/config.py app/db/ 2>/dev/null
Step 2: Scan for Query Patterns
Scan application code for:
├── Raw SQL queries → Check for full table scans, missing WHERE clauses
├── ORM queries → Check for N+1 patterns, unnecessary joins, missing select_related
├── Aggregation pipelines → Check for unindexed $match stages
├── Redis operations → Check for KEYS * usage, large values, missing TTLs
└── Bulk operations → Check for loop-based inserts vs bulk_insert
Step 3: MySQL / SQL Analysis
# Patterns to detect:
# 1. Missing indexes on foreign keys
# 2. SELECT * instead of specific columns
# 3. LIKE '%value%' (leading wildcard — can't use index)
# 4. Implicit type conversion in WHERE clauses
# 5. Subqueries that should be JOINs
# 6. Missing pagination (no LIMIT on large tables)
# 7. N+1 queries in loops
# 8. Missing composite indexes for multi-column WHERE/ORDER BY
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 · 162 lines · 25 tokens per session scan A 086185897824
db-optimizer is an agent published in the GitHub repository alphaaiservice/cortex (1 stars, last pushed 25d ago), licensed MIT. It adds 25 tokens to every session and 1,412 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.
Other agents, from other repositories
tech-writer
Usar para documentación de código (inline) y documentación de proyecto (/docs). Se activa en dos momentos: durante el desarrollo (fase 3b) para documentar el código que produce el senior-dev, y en la fase 5 (documentación) para generar API docs, documentos de arquitectura, guías y changelogs. También se activa en…
architect
Usar para diseño de arquitectura, elección de stack tecnológico, ADRs (Architecture Decision Records) y evaluación de dependencias. Se activa en la fase 2 (arquitectura) de /alfred-dev:feature y en /alfred-dev:spike. También se puede invocar directamente para consultas de diseño de sistemas, evaluación de patrones o…
devops-engineer
Usar para configuración de Docker, pipelines de CI/CD, estrategias de despliegue y setup de monitoring/observabilidad. Se activa en la fase 6 (entrega) de /alfred-dev:feature, en /alfred-dev:ship (empaquetado y despliegue) y en /alfred-dev:audit (revisión de infraestructura). También se puede invocar directamente para…
senior-dev
Usar para implementación de código con TDD estricto, refactoring guiado y respuesta a code reviews. Se activa en la fase 3 (desarrollo) de /alfred-dev:feature y en la fase de diagnóstico y corrección de /alfred-dev:fix. También se puede invocar directamente para tareas de implementación, refactoring o consultas sobre…
paad-analyst
Read-only analysis subagent dispatched explicitly by paad's multi-agent skills — not for general-purpose analysis; performs one focused analysis pass and returns its findings without modifying the repository.
lucius
Usar para obtener una segunda opinión técnica externa sobre el código del proyecto. Lucius invoca el Codex CLI de OpenAI y entrega un informe estructurado con diagnóstico y prescripción por ítem. Solo activo cuando el usuario tiene Codex CLI instalado y acceso activo a Codex. Recomendado tras terminar una feature o…