Enter planning mode. Systematically audit the codebase for dead code and write a removal plan.
This project has changed significantly over time. Find code that is no longer serving a purpose: unused functions, unread variables, unreachable branches, orphaned helpers. Use maximum parallelism — spawn explore agents for independent areas of the codebase.
What Counts as Dead Code
- Functions defined but never called (check ALL callers, including indirect via timer callbacks, hotkeys, and
SetTimer)
- Global variables declared and written but never read by any consumer
- Local variables assigned but never used after assignment
- Unreachable code after unconditional
return, throw, or ExitApp
- Stale parameters that are always passed the same constant or never inspected by the function body
- Orphaned
#Include files whose exports are entirely unused
What Does NOT Count
- Functions in
src/lib/ (third-party code — excluded from analysis)
- Public API functions in utility files that have zero callers today but form a coherent interface (e.g., a Map helper with Get/Set/Delete where only Get/Set are used)
- Intentional TODO scaffolding or commented explanations of why code was removed
- Test mocks and stubs — they exist to shadow production code
- Config registry entries — even if no code reads them yet, they define the schema
Methodology
Use the query tools to validate findings — do NOT rely on grep alone:
query_function_visibility.ps1 <funcName> — authoritative caller list (public/private, all call sites)
query_global_ownership.ps1 <globalName> — who declares, writes, and reads a global
query_interface.ps1 <filename> — public surface of a file (spot unused exports)
query_visibility.ps1 — lists public functions with 0 or 1 external callers (direct dead code signal)
query_includes.ps1 — include tree for finding orphaned #Include files whose exports are entirely unused
For each candidate:
- Cite evidence: "I verified by reading
file.ahk lines X–Y" with the actual code. Vague references without quoting code are not sufficient.
- Trace downstream: "How is this data used downstream?" — for variables and data structures, trace the access pattern, not just creation.
- Counter-argument: "What would make removal counterproductive?" — note if the code is defensive, if removal would break a contract, or if it's wired up indirectly (timers, hotkeys, DllCall callbacks).
- Observed vs inferred: State whether you saw the dead pattern directly or inferred it from similar code elsewhere.
Explore Strategy
Split the codebase into independent zones and explore in parallel:
src/gui/ — GUI rendering, state machine, overlay
src/core/ — Producers (WinEventHook, Komorebi, pumps)
src/shared/ — Window list, config, IPC, blacklist, theme
src/editors/ — Config/blacklist editors
src/pump/ — EnrichmentPump subprocess
- Root
src/ files — Entry points, launcher, installation, update
After explore agents report back, validate every finding yourself before including it in the plan. Explore agents sometimes identify issues that are handled elsewhere in a larger context. Read the cited lines, trace the usage, and confirm it's genuinely dead.
Plan Format
Group findings by file. For each item:
| File |
Lines |
What |
Evidence |
Counter-argument |
file.ahk |
42–58 |
_UnusedHelper() — 0 callers |
query_function_visibility.ps1 shows no call sites |
None — private function, safe to remove |
Then list the removals as action items. Order by risk (safest first). Note any removals that should be tested together because they're interdependent.
Ignore any existing plans — create a fresh one.
1---2name: review-dead-code3description: Find and plan removal of dead code (unused functions, variables, unreachable paths)4---5Enter planning mode. Systematically audit the codebase for dead code and write a removal plan.
6
7This project has changed significantly over time. Find code that is no longer serving a purpose: unused functions, unread variables, unreachable branches, orphaned helpers. Use maximum parallelism — spawn explore agents for independent areas of the codebase.
8
9## What Counts as Dead Code
10
11- Functions defined but never called (check ALL callers, including indirect via timer callbacks, hotkeys, and `SetTimer`)
12- Global variables declared and written but never read by any consumer
13- Local variables assigned but never used after assignment
14- Unreachable code after unconditional `return`, `throw`, or `ExitApp`
15- Stale parameters that are always passed the same constant or never inspected by the function body
16- Orphaned `#Include` files whose exports are entirely unused
17
18## What Does NOT Count
19
20- Functions in `src/lib/` (third-party code — excluded from analysis)
21- Public API functions in utility files that have zero callers today but form a coherent interface (e.g., a Map helper with Get/Set/Delete where only Get/Set are used)
22- Intentional TODO scaffolding or commented explanations of *why* code was removed
23- Test mocks and stubs — they exist to shadow production code
24- Config registry entries — even if no code reads them yet, they define the schema
25
26## Methodology
27
28Use the query tools to validate findings — do NOT rely on grep alone:
29
30- `query_function_visibility.ps1 <funcName>` — authoritative caller list (public/private, all call sites)
31- `query_global_ownership.ps1 <globalName>` — who declares, writes, and reads a global
32- `query_interface.ps1 <filename>` — public surface of a file (spot unused exports)
33- `query_visibility.ps1` — lists public functions with 0 or 1 external callers (direct dead code signal)
34- `query_includes.ps1` — include tree for finding orphaned `#Include` files whose exports are entirely unused
35
36For each candidate:
37
381. **Cite evidence**: "I verified by reading `file.ahk` lines X–Y" with the actual code. Vague references without quoting code are not sufficient.
392. **Trace downstream**: "How is this data used downstream?" — for variables and data structures, trace the access pattern, not just creation.
403. **Counter-argument**: "What would make removal counterproductive?" — note if the code is defensive, if removal would break a contract, or if it's wired up indirectly (timers, hotkeys, DllCall callbacks).
414. **Observed vs inferred**: State whether you saw the dead pattern directly or inferred it from similar code elsewhere.
42
43## Explore Strategy
44
45Split the codebase into independent zones and explore in parallel:
46
47- `src/gui/` — GUI rendering, state machine, overlay
48- `src/core/` — Producers (WinEventHook, Komorebi, pumps)
49- `src/shared/` — Window list, config, IPC, blacklist, theme
50- `src/editors/` — Config/blacklist editors
51- `src/pump/` — EnrichmentPump subprocess
52- Root `src/` files — Entry points, launcher, installation, update
53
54After explore agents report back, **validate every finding yourself** before including it in the plan. Explore agents sometimes identify issues that are handled elsewhere in a larger context. Read the cited lines, trace the usage, and confirm it's genuinely dead.
55
56## Plan Format
57
58Group findings by file. For each item:
59
60| File | Lines | What | Evidence | Counter-argument |
61|------|-------|------|----------|-----------------|
62| `file.ahk` | 42–58 | `_UnusedHelper()` — 0 callers | `query_function_visibility.ps1` shows no call sites | None — private function, safe to remove |
63
64Then list the removals as action items. Order by risk (safest first). Note any removals that should be tested together because they're interdependent.
65
66Ignore any existing plans — create a fresh one.