New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Automated AI slop detection and safe cleanup for Claude Code projects, with certainty-based fixes.

version
1.3.0
GitHub stars
1K

What it does

  • Adds the /deslop command and a deslop-agent that scan code for debug statements, placeholder text, and empty catch blocks
  • Runs a three-phase pipeline: regex patterns (HIGH), structural analyzers (MEDIUM), and optional CLI linters (LOW)
  • Auto-fixes only HIGH-certainty findings in apply mode, restoring touched files if the test suite fails
  • Supports --scope=diff for pre-PR checks and --thoroughness levels from quick scans to deep analysis

3-phase AI slop detection: regex patterns (HIGH), multi-pass analyzers (MEDIUM), CLI tools (LOW)

Add marketplace

/plugin marketplace add agent-sh/agentsys

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install deslop@agentsys

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

deslop

Find AI slop in a codebase (debug output, placeholders, empty catches, stub functions, dead code, tracked artifacts) and return findings ranked by certainty, with a list of fixes that are safe to apply without review. This skill only reads; the caller applies fixes.

Arguments: $ARGUMENTS

  • mode: report (default) or apply. The mode is passed through to the result; it does not change what you scan.
  • --scope: all (default), diff (files changed on this branch), or a path.
  • --thoroughness: quick (regex only), normal (default, adds multi-pass analyzers), deep (adds jscpd, madge and similar CLI tools when installed).

Detection

The detector is scripts/detect.js at the plugin root, two directories up from this skill. Resolve it to an absolute path and run it from the repository root. It prints JSON by default (findings, summary); --compact prints a short markdown table without the autoFix field, so use the JSON when building fixes. Add --quick or --deep for those thoroughness levels.

node <plugin>/scripts/detect.js .                                   # scope all
node <plugin>/scripts/detect.js . src/api.js src/auth.js            # scope path: the files under it
git diff --name-only --diff-filter=d "origin/$BASE"...HEAD \
  | node <plugin>/scripts/detect.js . --files-from -                # scope diff

For diff scope, BASE is the default branch: git symbolic-ref --short refs/remotes/origin/HEAD with origin/ stripped, or main. Files after the repo path (or from --files-from) are exactly what gets scanned, relative to the repo root. Without them the detector scans at most 200 source files and skips tests, or only the repo-intel slop targets when a map exists, so a whole-repo run is a sample: say so in the result when metadata.filesAnalyzed is 200 or targeting was on. For a path scope, list its files (git ls-files <path>) and pass them, rather than passing the path as the repo root.

Finding paths are relative to the repo root. Exit code 2 means critical findings exist, not that the run failed. On a large repo the JSON is long: read summary first and filter findings by certainty with node -e or jq rather than reading all of it.

When the repo has repo-intel data, the detector folds in the analyzer's pre-located fixes. references/repo-intel.md covers what that adds and the one query you run yourself (files without test coupling).

Pattern names, certainty rules and fix strategies per language are in ../../references/slop-categories.md.

Judgment

The detector is a pattern matcher. Before a finding goes into fixes, read the line and confirm it is slop in this codebase:

  • console.log, print and fmt.Println in a CLI entry point or a logger are the program's output, not debugging. Drop those findings.
  • An empty catch with a comment explaining why is deliberate. Keep it out of fixes.
  • A finding in a test fixture, a generated file, or vendored code is not the repo's slop. Build output, vendor/, node_modules/, minified and generated files, and lockfiles are skipped by the detector; skip anything else of that kind you see.
  • In files with no test coupling, a wrong fix goes unnoticed. Rank their findings first in the report, and leave them out of fixes unless certainty is HIGH on its own.

Only HIGH certainty findings with a real fix strategy become fixes. MEDIUM and LOW stay in findings for a human.

autoFix: "remove" means the matched text is slop, not always the whole line. Pick the fix that removes exactly that:

  • The whole line is slop (a debug print, an unused debug import): remove-line.
  • Only part of the line is (trailing whitespace, a trailing // see #42 comment after live code): replace with the corrected line. Deleting it would delete the code in front.
  • The finding spans lines (commented_code reports its range in details.startLine and details.endLine): remove-line with endLine set from details.endLine.

Output

Return this block last. /deslop and /next-task parse the JSON between the markers and hand fixes to whatever applies them.

=== DESLOP_RESULT ===
{
  "mode": "report",
  "scope": "all",
  "filesScanned": 120,
  "findings": [
    { "file": "src/api.js", "line": 42, "pattern": "console_debugging", "message": "console.log found",
      "certainty": "HIGH", "severity": "medium", "autoFix": "remove", "untested": false }
  ],
  "fixes": [
    { "file": "src/api.js", "line": 42, "fixType": "remove-line", "pattern": "console_debugging" }
  ],
  "summary": { "high": 1, "medium": 0, "low": 0, "autoFixable": 1 }
}
=== END_RESULT ===

Paths are relative to the repository root. fixType is one of:

fixTypeFromMeaning
remove-linedetector autoFix: "remove" when the whole line or range is slop, analyzer delete-linesDelete line, or line through endLine.
add-commentdetector autoFix: "add_logging"Empty catch: log the error if the file has a logger, else add a comment saying it is ignored on purpose, in the file's comment syntax.
replacedetector autoFix: "replace", "remove" on part of a line, analyzer replace-linesReplace line (through endLine if set) with replacement.
remove-blockmulti-line constructsDelete the whole block starting at line.
delete-fileanalyzer delete-fileRemove the tracked file (artifacts such as .DS_Store).

If git is missing, skip git-based checks and say so. If the scope path does not exist, return the block with empty arrays and an "error" field. A file that fails to parse is skipped and the scan continues.

Readme

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

CheckFinds
stale-mentionA file, flag, env var, function or value the change removed or replaced, still named elsewhere
missing-path, broken-anchorCited paths and Markdown heading links that resolve to nothing
scope-claimPR text or commits claiming docs-only or test-only over a code change
review-provenanceReview history in code comments
test-cannot-fail, test-swallows-failureTests with no assertion, scripts with no failing exit, swallowed errors
displaced-doc-comment, duplicate-lineCode inserted between a doc comment and its item; lines written twice
no-caller, unread-settingAdded code nothing calls, settings nothing reads
dropped-ruleRules and reasons a doc or prompt rewrite removed
missing-companionFiles declared or historically changed together, where the change edited one side
changelog-missingA 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-staleA 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-mismatchA 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-codeAdded code of 60 tokens and 6 distinct lines or more that already exists elsewhere in the repo, or twice in the change
complexityA 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-configagnix 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-fileConflict markers, credentials, machine-local paths, unparseable JSON
lintshellcheck, ruff and actionlint on added lines, when installed
em-dashHouse style; off with .deslop.json

duplicate-code and complexity skip tests, generated files and snapshot or dated record folders; the doc sync checks skip those folders too (versioned_docs/, archive/), and version-mismatch skips manifests under test and fixture paths, since they keep old flags and versions on purpose. With --scope=repo they audit the whole repository instead of a change. eslint, golangci-lint and clippy read the checked-out files, so complexity skips JS/TS, Go and Rust when --head names another revision; clippy builds the crate, so its first run on a cold cache takes as long as cargo check.

Logic errors, edge cases and races need a reviewer, so deslop does not guess at them.

The small model

scripts/confirm.js sends each finding, with the flagged line and two lines around it, to a small model and keeps only what it confirms. Fixes come back in next-task:simple-fixer's format and are checked against the file before they are returned. It reads only files inside the repository: a path that leaves it or goes through a symlink gets no context and no fix. It runs, in this order:

  1. --cmd='["codex", "exec", "-p", "luna", "{prompt}"]': the command as a JSON array of strings, run without a shell. An element that is exactly {prompt} becomes the prompt; with none, the prompt goes to stdin.
  2. DESLOP_SMALL_CMD: the same JSON array, from the environment.
  3. The ladder.small rung in Tower Crane's project.json ($GISHRA_STATE/project.json, else .gishra/project.json at the root of the main checkout):
{ "harness": "codex", "ladder": { "small": { "profile": "luna", "effort": "low" } } }
harnesscommand
codexcodex exec -p <profile> <prompt> (or -m <model>; -c model_reasoning_effort=<effort>)
claudeclaude -p <prompt> --model <model> (--effort <effort>)
opencodeopencode run <prompt> -m <model> (--variant <effort>)
agyagy -p <prompt> --model <model> --effort <effort>
pipi -p <prompt> --model <model> --provider <provider> --thinking <effort>
commandthe command array, with an element {prompt} replaced by the prompt (or the prompt on stdin)

The rung inherits the project's harness unless it names its own. When the project file exists, each rung comes from it, then GISHRA_CONFIG (else ~/.config/gishra/config.json), then the built-in Codex Luna rung. A configured rung that lacks the model, profile or command its harness needs, names an unsupported harness, or has fields that harness does not use is refused. Legacy roles files are refused; use ladder. Optional fields are left out; args are appended last. The step edits nothing, so no permission flags are passed. --dry-run prints the command that would run.

With no model configured, confirm.js prints the findings ready to judge and exits 0; /deslop then hands them to deslop-agent, which uses the session's model. A reply that is not valid JSON in the expected shape, or that leaves a finding unjudged, is discarded: every finding comes back unconfirmed with an error. Prompts are batched to stay under the 128 KiB limit Linux puts on one argument.

detect.js --json prints every finding unless --max is given (the default cap of 40 is for the text listing), and confirm.js refuses input that holds fewer findings than the detector made. A check that failed, including a git, ripgrep or linter run that could not start, timed out, was killed or exited with an unexpected status, is carried into the result as detectorErrors, so a failed scan never reads as clean. What a check could not cover, such as a language whose linter is not installed or a symlinked path, is carried as skipped. Symlinked paths are excluded before every check, including agnix, and link targets are never read, even inside the repository.

Configuration

.deslop.json at the repository root:

{
  "ignore": ["vendor/**", "fixtures/**"],
  "disable": ["lint"],
  "style": { "emDash": false },
  "together": [{ "when": "rules.json", "also": "docs/RULES.md", "message": "rule changes need the rules doc" }],
  "mineCochange": true
}

Requirements

  • Git and Node.js
  • ripgrep recommended: on large repositories it is the difference between seconds and minutes
  • shellcheck, ruff and actionlint are used when installed
  • agnix is used for agent-config when installed
  • a small model for the confirm step (optional): a Tower Crane ladder.small rung, DESLOP_SMALL_CMD or --cmd

Related plugins

  • foreman workers can run deslop on their diff before review

Host authorization for command execution

The bundled benchmark and profiling helpers treat command strings as data. They now deny process execution unless trusted host code supplies a separate synchronous authorizeExecution(request) callback. Only literal true approves a launch. Missing callbacks, JSON flags, promises and policy errors deny it. Authorization failures expose a generic error without policy details.

Migration for callers:

  • runBenchmark(command, options, authorizeExecution)
  • runBenchmarkSeries(command, options, authorizeExecution)
  • runProfiling(options, authorizeExecution)
  • runBreakingPointSearch(options, authorizeExecution), runConstraintTest(options, authorizeExecution) and runOptimizationExperiment(options, authorizeExecution)

Each launch has its own immutable request containing the final executable, argv, platform, Windows shim plan, absolute cwd, effective environment and spawn options. Approve that complete invocation from a trusted policy or an operator decision. Profiler overrides and optimization warmup are separate launches. Never construct the callback from remote input, deserialize executable JavaScript, or return true unconditionally for untrusted data.

isToolAvailable(command) and checkTool(command, versionFlag) now accept only their existing fixed availability checks. Unknown commands and flags return unavailable. Pure parsing and Windows argument planning remain available without approval.

Approval permits host execution. It does not isolate filesystem, network or credentials, or make project code safe. Use a separate sandbox when the approved program or inspected repository needs isolation. Host code owns executable lookup, repository contents and environment policy, including PATH and interpreter startup variables.

License

MIT

Details

Marketplace
agent-sh/agentsys
Source
https://github.com/agent-sh/deslop.git
Category
Development
Listed since
Apr 7, 2026

More from agent-sh/agentsys

All 11