deslop
One cleanup pass over a change: leftovers of what it removed or renamed, docs that no longer match the code, duplicated code, functions grown too large, and agent-config errors. Software finds the candidates; a small model confirms each one; confirmed fixes are applied on request.
Why
The slop changed. Current models do not leave debug prints, TODO stubs or empty catch blocks; in a study of 2,912 defects that reviewers found in agent-written pull requests, 6 were that kind. What they leave is text that was true before the change:
- a doc, comment or setting that still names the script, flag or env var the change deleted
- a count or version updated in one file and not in its copies
- a link to a heading that was renamed, a cited path that does not exist
- a code comment that records the review round instead of the reason
- a test that cannot fail, a PR body that says "docs-only" over a code change
- a rewritten instruction file that lost a rule or its reason
deslop 1.x looked for the old kind. Measured on 39 recent pull requests, 0.5% of its findings were real and it caught none of the 106 defects reviewers found, while a run cost 15 to 25K tokens. deslop 2 is a git-based detector: it costs nothing when the change is clean, and a small model reads only the lines it flags.
The same pass covers the cleanup that used to need separate tools: docs kept in sync with the code (changelog entries, CLI examples, versions), code copied instead of reused, functions a change pushed past a readable size, and agent configuration checked by agnix.
Installation
agentsys install deslop
Usage
/deslop # report on the current branch against its merge base
/deslop apply # apply the fixes the agent confirmed, run tests, commit
/deslop --base=release/2.x # another base
/deslop --scope=docs/ # every tracked file under docs/, no diff
The detector and the confirm step run on their own too:
node scripts/detect.js . # text report
node scripts/detect.js . --json --worktree # include uncommitted changes
gh pr view --json body -q .body | node scripts/detect.js . --pr-body=-
node scripts/detect.js . --json | node scripts/confirm.js # findings confirmed by the small model
What it checks
| Check | Finds |
|---|
stale-mention | A file, flag, env var, function or value the change removed or replaced, still named elsewhere |
missing-path, broken-anchor | Cited paths and Markdown heading links that resolve to nothing |
scope-claim | PR text or commits claiming docs-only or test-only over a code change |
review-provenance | Review history in code comments |
test-cannot-fail, test-swallows-failure | Tests with no assertion, scripts with no failing exit, swallowed errors |
displaced-doc-comment, duplicate-line | Code inserted between a doc comment and its item; lines written twice |
no-caller, unread-setting | Added code nothing calls, settings nothing reads |
dropped-rule | Rules and reasons a doc or prompt rewrite removed |
missing-companion | Files declared or historically changed together, where the change edited one side |
changelog-missing | A user-visible change (CLI flag, env var, command, skill or agent file, package bin, or a feat:/fix:/perf: commit over code) with no entry under Unreleased |
doc-example-stale | A docs example running a command the change removed: a slash command whose file it deleted or renamed, or a package bin it took out of package.json. Flags the change removed or renamed show up as stale-mention |
version-mismatch | A package version moved in one manifest and not in another manifest with the same exact package name (plugin.json, marketplace.json, Cargo.toml, pyproject.toml; @one/kit, kit, foo-bar and foo_bar are four different names), or a new docs line pinning another version |
duplicate-code | Added code of 60 tokens and 6 distinct lines or more that already exists elsewhere in the repo, or twice in the change |
complexity | A function the change made too complex, as the language's linter measures it, on a line the change added: ruff (C901, PLR0912, PLR0913, PLR0915) for Python; the repository's eslint (complexity 10, max-depth 4, max-params 5) for JS/TS when it has an eslint config; golangci-lint (gocyclo, nestif) for Go; clippy cognitive_complexity for Rust. A language whose linter is missing is named under skipped |
agent-config | agnix errors in instruction files, skills, agents, commands, plugin manifests, hooks and MCP configs the change touched, when agnix is installed |
merge-residue, secret, local-path, broken-file | Conflict markers, credentials, machine-local paths, unparseable JSON |
lint | shellcheck, ruff and actionlint on added lines, when installed |
em-dash | House style; off with .deslop.json |