Remove Stale Code
SkillMonitoring & opsSafely remove deletion-ready findings from logs/nightly-reports/stale-code.json. Use when asked to clean stale code, dead code, unused imports, variables, functions, classes, exports, components, or selectors from the deterministic daily report.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Remove Stale Code skill
What this skill tells your AI
The instructions your AI receives, as published by glowingkitty/openmates in .agents/skills/remove-stale-code/SKILL.md and read by ahel’s review.
Use the deterministic report as a lead, never as authorization by itself. This
workflow handles only deletion_ready findings and revalidates every guard
against the current checkout before editing.
Workflow
- Start or resume a
sessions.pymaintenance session before edits. - Read
logs/nightly-reports/stale-code.json. Stop if it is missing, malformed, hasstatus != "ok", or contains nodeletion_readyfindings. - Compare
subject_commitwithgit rev-parse HEAD. If they differ, runpython3 scripts/stale_code_daily.py --dry-run-notifyand reread the report. - Select only findings whose
classificationis exactlydeletion_ready. Apply a user-provided fingerprint/path filter when present. Otherwise process at most five findings from one category in one run. - For every selected finding, recompute its SHA-256 fingerprint from
category,subcategory, repository-relativefile, numericline(or zero), andcode, joined with NUL bytes. Skip it if the fingerprint differs. - Reread the target and search the repository for the symbol and its dynamic forms. Skip it if references, metadata registration, glob loading, decorators, reflection, public exports, generated paths, migrations, fixtures, route conventions, or compatibility markers make usage ambiguous.
- Apply only the smallest finding-specific change. For Ruff F401 imports,
reread and remove only the selected import statement or selected imported
name from a multi-name statement with
apply_patch; never run a file-wide autofix. Then runruff check --select F401 <file>and inspect the diff. For an unsupported finding kind, stop rather than inventing a deletion strategy. - Rerun
python3 scripts/find_dead_code.py --json --alland confirm each selected fingerprint disappeared without creating detector errors. - Run the smallest targeted lint/test command for every changed file. Do not treat the detector rerun as a substitute for product tests.
- Review the final diff. Use
python3 scripts/sessions.py deployonly after all selected candidates and targeted checks pass. Never commit or deploy skipped candidates as if they were removed.
Refusal Rules
- Never edit
review_onlyorsuppressedfindings. - Never trust a report from another commit.
- Never bulk-remove more than five findings or mix categories in one run.
- Never delete a Svelte component or CSS selector solely from zero literal references.
- Never delete compatibility, public API, framework registration, generated, migration, fixture, or route code without a separately approved contract.
- Never continue when a required analyzer, reference search, or targeted test fails.
Output
Report selected fingerprints, removed findings, skipped findings with reasons, changed files, detector rerun result, targeted verification commands, and deploy commit when applicable.
Signals
- GitHub stars
- 46
- Forks
- 3
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
remove-stale-code- Source
- github.com/glowingkitty/openmates