/rdf:r-audit-slopfrom RDF: rfxn Development Framework
Audits codebases for dead code, orphan helpers, noop functions, tautological guards, redundant implementations, and over-engineered abstractions. Uses multi-pass static analysis with peer review and false-positive validation.
Ships in RDF: rfxn Development Framework. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
AI slop audit. Finds dead code, orphan helpers, noop functions, tautological guards, redundant implementations, and over-engineered abstractions. Read-only static analysis. Uses a discovery-first protocol to build a per-project call-site manifest before scanning — prevents the false-positive wall that hits naive dead-code scanners when projects use runtime-sourced templates, CLI dispatch tables, or vendored shared libraries.
After candidate verification, dispatches an independent sentinel peer-review pass (rdf-reviewer) and an engineer FP-validation pass (rdf-engineer, read-only) over HIGH findings. Final report includes only findings that survive both passes.
$ARGUMENTS — optional flags and category filter:
--quick — single-agent mode (skip sentinel + engineer FP passes,
behavior of the legacy /r-util-slop-scan)--no-sentinel — skip Phase 5 (sentinel peer review)--no-engineer — skip Phase 6 (engineer FP-validation)dead, orphan, noop, redundant,
over-engineeredRead .rdf/governance/index.md to identify:
If no governance is present, fall back to auto-discovery in Phase 0.
Dead — defined but never reachable at runtime
if false, code after unconditional return)Orphan / Disconnected
_foo()) called only by a dead public functionNoop / Tautological
foo() { bar "$@"; } with no logic){ return 0; }, { :; }, single-echo)[ -n "$x" ] || [ -z "$x" ])|| true on commands that cannot failRedundant
Over-engineered
case arms or config branches with no live callers_LOADED idempotency checks at top of libraries)Build a verification manifest. The manifest gates every subsequent finding. Record the output of each step.
.gitfiles|src|lib|bin|internals
at depth <= 3 under PROJECT_ROOTfind $PROJECT_ROOT -maxdepth 3 -type f -executable,
filter by bash/sh shebanggrep -rnE '^\s*(source|\.)\s+[^#]' $PRIMARY_DIRS $ENTRY_EXECUTABLES
Resolve each source target (handle ${VAR} and relative paths by reading
the containing file's defaults). Every function/variable reference inside
a RUNTIME_SOURCE file is a live call site.
For each entry executable, find the dominant case "$1" / case "$cmd"
block. Extract every function name appearing in a case arm. These
functions are alive via string-dispatch even if direct grep shows them
unreferenced.
find $PROJECT_ROOT -maxdepth 4 -type f \( \
-path '*/cron.*' -o -name 'cron.*' -o -name '*.service' -o \
-name '*.timer' -o -name 'hook_*' -o -name 'init.d.*' -o \
-name 'install.sh' -o -name 'uninstall.sh' -o -name 'postinst' -o \
-name 'preinst' -o -name 'postrm' -o -name 'prerm' \)
Treat as live call sites. Also include cron scripts and init units.
For each file in $PRIMARY_DIRS matching *_lib.sh or lib*.sh, check
for a sibling canonical repo at $(dirname $PROJECT_ROOT)/<basename>/.
find $(dirname $PROJECT_ROOT) -maxdepth 2 -type d -name '*_lib'
Vendored functions must be verified against the canonical repo's tree
and tests before being flagged. If the canonical has callers or test
coverage, the finding is CANONICAL-FIRST (raise against canonical),
not DELETE.
find $PROJECT_ROOT -type f \( -name '*.bats' -o -name '*_test.*' -o \
-name 'test_*.*' -o -name '*.test.*' -o -name '*.spec.*' \)
Tested functions are not dead.
find $PROJECT_ROOT -type f \( -name '*.spec' -o -path '*/debian/*' -o \
-name 'Makefile' -path '*/pkg/*' \)
Scriptlet blocks and Makefile recipes reference runtime code.
Print a summary block:
Manifest:
PRIMARY_DIRS: <list>
ENTRY_EXECUTABLES: <list>
RUNTIME_SOURCES: <N files>
DISPATCH_TARGETS: <N functions>
ENTRY_POINTS: <N files>
CANONICAL_LIB_ROOTS: <list or none>
TEST_SOURCES: <N files>
PACKAGE_SPECS: <N files>
If RUNTIME_SOURCES or DISPATCH_TARGETS is empty in a non-trivial Bash project, STOP and flag the discovery gap — most maintained Bash projects have at least one of each. An empty result usually means the discovery missed something and will cause a false-positive wall downstream.
Scan primary sources for each category above. Collect raw candidates with file:line + symbol + category. Do not assign confidence yet.
For EVERY candidate, run and attach the output of each relevant check. A finding cannot be HIGH unless every relevant check returned zero hits.
Function candidates:
Variable candidates:
local[[:space:]].*\bVAR\b returns zero — rules out scope error$VAR or ${VAR anywheresource "$VAR", . "$VAR")Density safeguard: if HIGH findings in a single category exceed 10, or total HIGH findings exceed 25, STOP and self-audit. At those densities in a maintained codebase, Phase 0 probably missed an extended-scope class. Re-run discovery with a wider net before emitting. Do not dispatch sentinel or engineer passes on a discovery-failure result — re-run Phase 0 first.
For each HIGH finding, attempt to DISPROVE it in one line: "If this were alive, the caller would look like ___. I checked ___ and found ___."
If you cannot describe what a live caller would look like, downgrade to MED. This forces the scanner to reason about the call graph rather than rely on grep negatives alone.
Skip if:
--quick or --no-sentinel was passedDispatch the rdf-reviewer subagent in sentinel mode with a
read-only adversarial review payload. The reviewer attempts to disprove
each HIGH finding using independent grep / source reading.
Dispatch payload:
MODE: sentinel
DEPTH: full
SCOPE: AI-slop audit findings (read-only review of static-analysis output)
TARGET_FINDINGS: <inline copy of the HIGH findings table from Phase 4>
DISCOVERY_MANIFEST: <inline copy of Phase 0 manifest>
PROJECT_ROOT: <absolute path>
GOVERNANCE:
index: .rdf/governance/index.md
anti-patterns: .rdf/governance/anti-patterns.md
constraints: .rdf/governance/constraints.md
conventions: .rdf/governance/conventions.md
REVIEW_TASK:
For each HIGH finding, perform an independent adversarial cross-check:
1. Re-grep for the symbol with a fresh pattern (word boundary, including
mid-line and inside $() / `` substitutions).
2. Check for indirect references — eval, ${!var}, dispatch tables,
config-driven exec (BAN_COMMAND, ALERT_*, etc.), template
expansion, alert variants (_JSON, _TG suffixes).
3. Identify any extended-scope file the discovery agent likely skipped
(cron.daily, install.sh, importconf, postinst, postrm, RPM/DEB
scriptlets, man pages, sample configs).
4. For each finding, return one of:
- SENTINEL-CONFIRMED-DEAD — independent check agrees, action stands
- SENTINEL-FALSE-POSITIVE — found a live reference, with file:line
- SENTINEL-NEEDS-ENGINEER — ambiguous; engineer pass should verify
REPORT_FORMAT:
Per finding: file:line · symbol · sentinel verdict · evidence (one
line, with grep cmd or file:line of the contradicting reference).
Footer: counts by verdict, plus any new findings discovered during
the cross-check (extended-scope misses).
On reviewer return:
--no-engineer).--no-engineer is
set, downgrade them to MED in the final report rather than emitting
HIGH without engineer verification.Skip if:
--quick or --no-engineer was passedDispatch the rdf-engineer subagent with explicit read-only
constraints (no edits, no commits, no test execution beyond verification
greps). Engineer is dispatched here for its toolset (Bash for git log -S, Read for source files, Grep for cross-references), not its TDD
protocol.
Dispatch payload:
MODE: read-only verification (do NOT modify any file, do NOT commit,
do NOT run tests, do NOT invoke /rdf:r-build or any write workflow)
SCOPE: Final FP-validation pass for AI-slop audit
TARGET_ITEMS: <inline list of SENTINEL-CONFIRMED-DEAD +
SENTINEL-NEEDS-ENGINEER findings from Phase 5>
DISCOVERY_MANIFEST: <inline copy of Phase 0 manifest>
SENTINEL_NOTES: <inline copy of Phase 5 evidence per item>
PROJECT_ROOT: <absolute path>
GOVERNANCE:
index: .rdf/governance/index.md
architecture: .rdf/governance/architecture.md
conventions: .rdf/governance/conventions.md
VALIDATION_TASK:
For each TARGET_ITEM, run and report:
1. git log -S '<symbol>' -- '<path>' — was it added in a recent commit
with a deferred consumer? Was it removed and re-added?
2. Package manifest scan — grep for the symbol in pkg/rpm/*.spec,
pkg/deb/debian/*, pkg/symlink-manifest, Makefile recipes.
3. Public surface scan — grep in man pages (*.1, *.5, *.8), README*,
docs/, sample config files, completion scripts (*.bash-completion).
4. External-config scan — for variables: check if the name is part of
a documented public config surface that consumers may set without
source visibility.
5. Final per-item verdict (one of):
- DEAD-SAFE-TO-REMOVE — all checks zero, action stands
- KEEP-PUBLIC-API — public CLI/config surface, deletion would break
- KEEP-PACKAGED — referenced in package scriptlets / install path
- KEEP-DESIGN-SYMMETRY — part of intentional dispatch parity (e.g.,
N-backend × M-op matrix); deletion would break the pattern
- KEEP-FUTURE-CONSUMER — git log shows recent add with planned use
OUTPUT_FORMAT:
Per item: file:line · symbol · final verdict · one-line evidence
(specific grep result, commit hash, or man-page reference).
Strictly read-only. No file modifications. No commits.
On engineer return:
# AI Slop Audit — <project>
## Discovery Manifest
<Phase 0 summary — reviewer uses this to audit scan scope>
## Pipeline Summary
| Phase | Count | Notes |
|-----------------------------|-------|-------|
| Phase 1 raw candidates | N | |
| Phase 3 HIGH (pre-challenge)| N | |
| Phase 4 HIGH (post-challenge)| N | |
| Phase 5 sentinel filtered | N | <skipped if --no-sentinel> |
| Phase 6 engineer filtered | N | <skipped if --no-engineer> |
| **Final HIGH** | N | |
## Summary
| Category | HIGH | MED | LOW | Total |
|-------------------|------|-----|-----|-------|
| Dead | N | N | N | N |
| Orphan | N | N | N | N |
| Noop | N | N | N | N |
| Redundant | N | N | N | N |
| Over-engineered | N | N | N | N |
| **Total** | N | N | N | N |
## Findings (post-sentinel + post-engineer)
### <Category>
**[file:line] symbol — category tag**
Evidence:
V1 (direct callers): <grep cmd> → <count>
V2 (runtime sources): <grep cmd> → <count>
V3 (dispatch): <not in DISPATCH_TARGETS>
V4 (entry points): <grep cmd> → <count>
V5 (tests): <grep cmd> → <count>
V6 (packaging): <grep cmd> → <count>
V7 (canonical): <N/A or canonical grep result>
Challenge attempted: <one line>
Sentinel: SENTINEL-CONFIRMED-DEAD — <evidence>
Engineer: DEAD-SAFE-TO-REMOVE — <evidence>
Confidence: HIGH
Action: DELETE | PARAMETERIZE | LEAVE | CANONICAL-FIRST
## FP Filter Log
Items dropped by sentinel or engineer passes, with the disqualifying
reference. This section is the audit trail for everything the discovery
phase wanted to flag but the FP passes vetoed.
### Dropped by Sentinel
- **[file:line] symbol** — SENTINEL-FALSE-POSITIVE: <evidence>
### Dropped by Engineer
- **[file:line] symbol** — KEEP-PUBLIC-API: man bfd.1 line 240
- **[file:line] symbol** — KEEP-PACKAGED: pkg/rpm/bfd.spec %install
- **[file:line] symbol** — KEEP-DESIGN-SYMMETRY: 8-backend × 4-op matrix
## Skipped (known-alive, verified in Phase 0)
- <N> functions reachable via DISPATCH_TARGETS
- <N> functions referenced in RUNTIME_SOURCES
- <N> vendored-library public API (canonical-managed)
- <N> hook skeleton files (user-override contract)
CANONICAL-FIRST unless the
canonical repo itself has zero callers — per workspace Shared Libraries
rule 1 (canonical project edits first)--no-engineer is
set, downgrade those items to MED in the final report — never emit
HIGH without the engineer pass when the reviewer specifically
requested itWhat SKILL.md sets; muted values are Claude Code's defaults
38 skills in this plugin
/r-auditUse when you want a full codebase audit: dispatches parallel reviewer and QA passes across the tree.
/r-buildUse when a plan exists and you want it built: dispatches the plan-execution orchestrator (engineer/QA/review gates) per phase at the right tier.
/r-context-auditMeasure, score, and report on Claude Code context overhead for this
/r-envUse to assess the environment against an optimal Claude Code + RDF setup: code intelligence plugins and language servers, tools, limits, sandbox, Claude Code currency, .claude files and the price table, with exact fix commands.
npx claudepluginhub rfxn/rdf --plugin rdfOther plugins' skills for the same job