From wicked-garden
Ranks codebase symbols by incoming reference count to expose god-objects, coupling hotspots, and high-impact refactor targets.
How this command is triggered — by the user, by Claude, or both
Slash command
/wicked-garden:hotspots [--limit <n>]search/The summary Claude sees in its command listing — used to decide when to auto-load this command
# /wicked-garden:search:hotspots Rank symbols by incoming reference count to expose god-objects, coupling hotspots, and high-impact refactor targets. ## Instructions 1. **Freshness** — ensure the graph is current with `/wicked-garden:search:index` (brain's `graph-index` builds the codegraph graph + injected edges and reports a `staleness` stamp). The ranking below reads the graph DB it produces; if it's stale, re-run the index. 2. **Primary path — read the graph DB** brain built (`.codegraph/codegraph.db`, when present): Report the ranked list. Call out anything with an unusually ...
Rank symbols by incoming reference count to expose god-objects, coupling hotspots, and high-impact refactor targets.
Freshness — ensure the graph is current with /wicked-garden:search:index (brain's graph-index builds the codegraph graph + injected edges and reports a staleness stamp). The ranking below reads the graph DB it produces; if it's stale, re-run the index.
Primary path — read the graph DB brain built (.codegraph/codegraph.db, when present):
python3 - <<'PY'
import sqlite3, pathlib
db = pathlib.Path(".codegraph/codegraph.db")
if not db.exists():
print("no index — run `search:index` first"); raise SystemExit
c = sqlite3.connect(str(db))
# incoming edges per target = how heavily referenced a symbol is.
# Exclude 'contains' (structural nesting, not a real reference) and self-loops.
rows = c.execute(
"SELECT target, COUNT(*) AS refs FROM edges "
"WHERE kind != 'contains' AND source != target "
"GROUP BY target ORDER BY refs DESC LIMIT 25").fetchall()
for tgt, n in rows:
node = c.execute("SELECT name, kind, file_path FROM nodes WHERE id=?", (tgt,)).fetchone()
label = (node[0] if node else tgt)
kind = (node[1] if node else "?")
print(f"{n:4d} {kind:10s} {label}")
c.close()
PY
Report the ranked list. Call out anything with an unusually high count as a likely god-object or coupling hotspot worth refactoring. Note that injected edges (provenance LIKE 'injected:%') are included — a heavily-dispatched agent or capability appears here too.
Fallback — brain (no .codegraph index):
PORT="$(sh "${CLAUDE_PLUGIN_ROOT}/scripts/_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/_brain_port.py" 2>/dev/null || echo 4242)"
curl -s -X POST "http://localhost:${PORT}/api" \
-H "Content-Type: application/json" \
-d '{"action":"search","params":{"query":"class function module export","limit":30}}'
Tell the user codegraph gives a sharper, offline answer and suggest /wicked-garden:search:index to build it.
If neither is available: say so and suggest /wicked-garden:search:index.
/wicked-garden:search:hotspots
/wicked-garden:search:hotspots --limit 10
npx claudepluginhub mikeparcewski/wicked-garden --plugin wicked-garden/hotspotsFind the worst functions to fix first by combining refcount issues, error handling bugs, and complexity scoring. Use when the user asks where to focus review effort, which functions are most dangerous, what to fix first, or wants a prioritized list of hotspots in a C extension.