Skip to content
OpenAgentSkill
Browsing is open · Catalog captured 2026-11-21 · Automatic updates and account services are paused.
Development

dead-code-audit

Systematic codebase audit for unwired code — identify unregistered routers, uninvoked hooks, orphaned components, and file discovery issues. All findings become "wire it in" issues — never deletion issues.

mrveiss · Static checks on file

Installation

Read the source and dependencies before running a command. Copying does not install or execute anything.

npx skills add mrveiss/AutoBot-AI --skill dead-code-audit

About this skill


name: dead-code-audit description: Systematic codebase audit for unwired code — identify unregistered routers, uninvoked hooks, orphaned components, and file discovery issues. All findings become "wire it in" issues — never deletion issues.

/dead-code-audit — Codebase Unwired Code Audit

POLICY: Code is never deleted. It was created for a reason. Every finding becomes a "wire it in" issue.

Performs a comprehensive scan of the AutoBot codebase to find:

  • Not wired — complete, implemented code that exists but isn't connected to the app
  • Intentionally isolated — test fixtures, examples, stubs (marked SKIP)

There is no "DEAD" classification. Code with zero references is still NOT_WIRED — find the right place to connect it.

Findings are classified, deduplicated against existing issues, and batch-filed as GitHub issues for human review. No automatic deletion or wiring.

Usage

/dead-code-audit

Scans the entire codebase (no arguments). Runs 3 audit agents in parallel, classifies findings, and files issues.


Workflow

Phase 0: Tracker Cross-Reference Pre-flight (REQUIRED)

Before launching agents, run the automated tracker-cross-reference audit. This catches a class of findings the structural agents miss: production modules whose docstring cites a CLOSED tracker issue but have zero production callers. This is the systemic premature-closure pattern surfaced by #6836.

python3 pipeline-scripts/audit-unwired-trackers.py --json > /tmp/tracker-findings.json
jq 'length' /tmp/tracker-findings.json

Each entry in the output represents a feature whose tracker was closed before the integration step. Treat each as a NOT_WIRED finding for Phase 2 below.

The same script runs weekly via .github/workflows/unwired-tracker-audit.yml and files capped batches automatically — but running it interactively at audit time gives full visibility.


Phase 1: Parallel Audit Agents

Three agents run simultaneously, each scanning a different domain:

Agent A: Backend — Unregistered API Routers

Task: Find all Python files in autobot-backend/api/ that define an APIRouter but are not registered in any router registry.

Scan steps:

  1. Find all files defining routers:

    grep -rl "router = APIRouter" autobot-backend/api/ --include="*.py"
    
  2. Find all router files actually imported in registries:

    grep -rh "from api\." autobot-backend/initialization/router_registry/ --include="*.py" | sort -u
    grep -rh "import.*api\." autobot-backend/initialization/router_registry/ --include="*.py" | sort -u
    
  3. Compare: files in step 1 but not referenced in step 2 = unregistered

  4. For each unregistered router:

    • Read the file and extract endpoint definitions
    • Check if it's imported anywhere else (tests, docstrings)
    • Check if there's already a GitHub issue for it (gh issue list --search "<filename>")
    • Classify:
      • Has complete endpoints + never imported anywhere → NOT_WIRED
      • Has only placeholder/empty endpoints → DEAD
      • Imported only in tests → SKIP (test fixtures are intentional)
  5. For NOT_WIRED findings, extract:

    • Endpoints defined (path + method)
    • Module name and prefix
    • Any git blame to understand why it wasn't wired

Report back with:

ROUTERS_FOUND: <count>
NOT_WIRED_ROUTERS: <list of filenames>
DEAD_ROUTERS: <list of filenames>
SKIPPED_ROUTERS: <list of filenames>

Per router:
<filename>: <count> endpoints, <endpoint_list>, classified as <NOT_WIRED|DEAD|SKIP>

Agent B: Backend — Uninvoked HookPoints + Unregistered Extensions

Task: Find HookPoint enum values that are defined but never emitted, and extensions that are defined but never registered.

HookPoint scan:

  1. Get all defined HookPoints:

    grep "    [A-Z_]*" autobot-backend/extensions/hooks.py | sed 's/[[:space:]]*\([A-Z_]*\).*/\1/'
    
  2. Find actual invocation sites (where hooks are emitted):

    grep -rn "invoke_hook\|\.invoke(" autobot-backend/ \
      --include="*.py" \
      --exclude="hooks.py" \
      --exclude="manager.py" \
      --exclude="*_test.py"
    
  3. Extract which HookPoints are actually invoked from step 2

  4. Compare: HookPoints in step 1 but not in step 2 = uninvoked

  5. Classify all uninvoked HookPoints as NOT_WIRED (they were defined with intent, never used)

Extension registration scan:

  1. List all extensions in builtin:

    ls -1 autobot-backend/extensions/builtin/ | grep -E "\.py$" | sed 's/\.py$//'
    
  2. Find which extensions are registered at startup:

    grep -rn "register_extension\|add_extension\|ExtensionManager" autobot-backend/initialization/ \
      --include="*.py"
    
  3. Compare: extensions in builtin/ but not registered = NOT_WIRED

  4. For each NOT_WIRED extension:

    • Read class definition
    • Check if it's referenced anywhere (tests, docs, plugins)
    • Classify as NOT_WIRED or SKIP if only in tests

Report back with:

HOOKPOINTS_TOTAL: <count>
HOOKPOINTS_INVOKED: <count> (e.g., 3 of 24)
HOOKPOINTS_NOT_WIRED: <list of names>

EXTENSIONS_IN_BUILTIN: <list>
EXTENSIONS_REGISTERED: <list>
EXTENSIONS_NOT_WIRED: <list>

Per hookpoint:
<NAME>: defined in hooks.py, 0 invocation sites, classified as NOT_WIRED

Per extension:
<ClassName>: defined in <file>, not registered at startup, classified as NOT_WIRED

Agent C: Frontend — Orphaned Views + Components + Shadow Files

Task: Find Vue views not in the router, orphaned components, and duplicate/shadow router files.

Orphaned views scan:

  1. List all Vue files in views directory:

    find autobot-frontend/src/views -name "*.vue" | sed 's|.*/||;s|\.vue||'
    
  2. Find all component registrations in routers:

    cat autobot-frontend/src/router/index.ts | grep -oE "[A-Z][a-zA-Z]*View"
    cat autobot-frontend/src/App.vue | grep -oE "[A-Z][a-zA-Z]*View"
    
  3. Compare: views in step

Read the complete source ↗