---
name: codeflash-scan
user-invocable: false
disable-model-invocation: true
description: >-
  Quick cross-domain performance scan. Profiles CPU, memory, import time, and async
  patterns in one pass without making changes. Activated when the user mentions "scan for issues",
  "diagnose performance", "find bottlenecks", "performance audit", "what should I optimize",
  or "where are the performance problems".
allowed-tools: "Agent, Read"
---

# Quick cross-domain performance scan

Launch the codeflash-scan agent to perform a read-only diagnostic across all performance domains.

## Instructions

Launch the scan agent directly:
- **Agent type:** `codeflash-scan`
- **run_in_background:** `false` (scan is fast — wait for the result)
- **Prompt:** `scan` followed by the user's scope if they specified one, otherwise just `scan`.

The scan agent will:
1. Profile CPU hotspots via cProfile
2. Profile memory allocation via tracemalloc
3. Measure import time via `-X importtime`
4. Detect async antipatterns via static analysis
5. Rank all findings by estimated impact

Show the scan report to the user. If the user wants to act on the findings, launch a full optimization session targeting the highest-impact findings.
