From quantum-loop
Scans changed files post-review for AI-slop: duplicates, dead code, needless abstraction, boundary violations, missing tests. Proposes deletions with regression-test gate and rollback.
npx claudepluginhub andyzengmath/quantum-loop --plugin quantum-loopThis skill is limited to using the following tools:
Review approval does not mean the code is clean. LLM-authored code routinely introduces:
Detects and strips AI-generated slop from code: simplifies unnecessary complexity, removes rotten comments, checks design patterns. Runs on git changes or paths before PRs.
Cleans AI-generated code by systematically removing LLM smells like dead code, over-commenting, verbose naming while preserving exact behavior via tests. Use after generation or on 'clean up', 'deslop' requests.
Identifies and interactively removes AI-generated slop like unnecessary comments and verbosity from staged or recent git changes.
Share bugs, ideas, or general feedback.
Review approval does not mean the code is clean. LLM-authored code routinely introduces:
Per Schreiber & Tippe 2025, 12.1% of AI-generated files contain ≥1 CWE, and per Zhong et al. 2026 (278k conversations) AI suggestions increase cyclomatic complexity 10-50× more than human edits. Without an explicit cleanup step, every autonomous run accumulates slop.
ql-deslop adds an explicit cleanup pass AFTER the story's review gate passes but BEFORE the merge to the feature branch. Borrowed directly from OMC Ralph Steps 7.5 (deslop) + 7.6 (regression re-verify).
ql-review PASS and the git merge in ql-execute.Single flag: --no-deslop. Used only when:
Deslop: skipped | <reason>).The deslop pass operates on git diff --name-only BASE_SHA..HEAD_SHA — the EXACT files the story touched. It never broadens scope silently. Reaching into unchanged files is an anti-pattern and is explicitly forbidden.
Detectors:
parseRequest / parseReq / handleParse) via Levenshtein or canonical-alpha-rename + exact match (per HyClone arXiv:2508.01357).Action: extract common code into a shared lib; update callers; delete the duplicates.
Detectors:
knip or ts-prune on the changed-files subset.vulture on the changed-files subset.staticcheck -checks=U1000 on the changed-files subset.cargo udeps on the changed-files subset.Action: delete the unused export / function / variable. Re-run tests.
Detectors:
Action: propose refactoring with regression-test gate.
Detectors:
module["_privateFn"], reflection-style private access.../../../../other-module/internal).Action: reshape through the public API, or promote the private API if genuinely needed externally.
Detectors:
AC-3 → tests/feature.test.ts::test_ac_3). Missing maps surface as findings.Action: write the missing test BEFORE deleting alleged dead code (deletion is safe only when the test suite exercises the surviving behavior).
Each deslop invocation runs ONE pass from the taxonomy at a time:
Running multiple passes in one agent invocation risks intra-pass interference (deletion invalidates duplication analysis; refactoring invalidates test mappings). Each pass commits independently with a Deslop: trailer.
After each pass's edits:
npm test / bash tests/*.sh / project-specific per runners/<tool>.json).If ANY of these regress compared to the pre-deslop baseline:
git restore . && git checkout BASE_SHA -- <changed-files>).progress.txt with the specific test or lint failure.<quantum>DESLOP_ROLLED_BACK</quantum> with the failure details.If all regression checks pass, commit the pass's edits with trailer:
Deslop-pass: 1 (dead-code)
Deslop-deletions: 3 | src/foo.ts:handleOldV1 src/bar.ts:legacyParse src/baz.ts:unusedExport
Regression-tests: 28 passed, 0 failed (matches baseline)
For removing anything whose tests do NOT currently exercise it, first SYNTHESIZE a regression test. Snapshot the current behavior before deletion. If the alleged dead code is actually reachable via a path the existing tests miss, the synthesized test fails and deletion is cancelled.
Invocation flag: --review. When passed:
--review) must apply after a human reviewer approves.This separation is mandatory for high-impact cleanup (large delete counts; cross-module moves).
Per-pass structured report at quantum.deslop[<story-id>].pass_<n>:
{
"story_id": "US-042",
"pass": 1,
"pass_name": "dead-code",
"scope_files": ["src/foo.ts", "src/bar.ts", "src/baz.ts"],
"findings": [
{
"smell": "unused-export",
"file": "src/foo.ts",
"line_start": 42, "line_end": 48,
"symbol": "handleOldV1",
"confidence": 95,
"action": "delete",
"regression_test_added": false
}
],
"edits_applied": true,
"regression_check": "passed",
"commit": "<sha>"
}
| The agent says… | The truth is… |
|---|---|
| "The tests passed, so this code must be live" | Tests pass with OR without dead code. Use reachability analysis, not test-pass state, for dead-code detection. |
| "This abstraction will be useful later" | YAGNI. Delete now; re-introduce if a second caller ever appears. |
| "Two functions look similar but surely have different intent" | Alpha-rename both to canonical form and diff. If the tree-sitter AST is identical, they have the same intent. Extract. |
"The file is bigger than BASE_SHA..HEAD_SHA; I'll clean up adjacent areas too" | NO. Scope stays to the diff. Adjacent cleanup is a separate story. |
| "The regression check is pedantic, let's skip when changes are small" | The 7.6 step is mandatory. Small changes are the ones where slop is hardest to see and easiest to silently break. |
| "I'll do all 4 passes in one go to save time" | Intra-pass interference is real. Commit each pass separately. |
ql-review (per-story): MUST pass before ql-deslop runs. Deslop never cleans failing code — fix first.ql-verify: runs the regression check; deslop reuses ql-verify's infrastructure.ql-execute: orchestrator invokes ql-deslop between review passed and git merge (opt-out via --no-deslop).ql-deep-review: runs AFTER ql-deslop (whole-feature review of the post-cleanup state).lib/known-failures.sh: records deslop rollbacks so future iterations learn which cleanups are risky./quantum-loop:ql-deslop # runs all 4 passes on current story's diff
/quantum-loop:ql-deslop --pass=1 # just the dead-code pass
/quantum-loop:ql-deslop --review # findings only, no edits
/quantum-loop:ql-deslop --story=US-042 # explicit story scope
/quantum-loop:ql-deslop --no-rollback # commit each pass even on regression (debug use only)