agentleFS
revealui-studiorevealui-studio/revskills/skills/redundancy-scan/SKILL.md

redundancy-scan

Skill2 starsChanged 40 days agoMITView on GitHub

Fleet workflow for finding duplication, deprecation, and redundancy (exact file clones, deprecation markers, lockstep/mirror comments, basename collisions). Multi-session friendly with machine findings + human classification (intentional vs accidental). Use when /redundancy-scan, /dedupe, fleet redundancy audit, find duplicates, dead dual implementations, deprecated code still shipping, or extend-before-create consolidation passes.

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default knobs: config/defaults.json (exclude dirs, marker lists, size limits).

    line 50
  2. Distinctive:

    Do not put private planning-repo paths in config committed to this package.

    line 58
  3. Distinctive:

    Prefer the fleet shared archive (not product git):

    line 62
  4. Very specific:

    Run run-scan.js for scope.

    line 109
  5. Distinctive:

    Do not delete code yet.

    line 111
  6. Very specific:

    Prefer consolidate onto @revealui/* native parts.

    line 141

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Redundancy / deprecation / duplication scan

Purpose

Find accidental duplication and stale dual paths across a repo or the whole fleet, without deleting intentional duals (decoupling, test isolation, public facades).

Complements:

Skill / laneRelationship
exhaustive-auditLine-level completeness of a tree
fleet-redundancy lane + remediation specProgram backlog for consolidation PRs
extend-before-create hardlineWhy we scan before building net-new
knowledge-graphOptional: after findings, map “who imports both”

Detection classes (this skill)

ClassDetectorWhat it means
exact-duplicatehash-dups.jsSame sha256 body, ≥2 paths
deprecation-markermarker-scan.js@deprecated, SUPERSEDED, DO NOT USE, TODO remove…
redundancy-markermarker-scan.js“keep in lockstep”, “mirrors”, “byte-identical”…
basename-collisionname-collision.jsSame filename in many dirs (heuristic)

Not automated here (session follow-ups): unused exports (knip), clone near-matches (jscpd), dual SECURITY_PATHS (GAP-404), package catalog drift (syncpack). Run those tools when the mechanical pass is done; record results into the same run directory.

Config

Default knobs: config/defaults.json (exclude dirs, marker lists, size limits).

Override:

node scripts/run-scan.js --root … --out-dir … --config /path/to/override.json

Do not put private planning-repo paths in config committed to this package.

Artifacts

Prefer the fleet shared archive (not product git):

export REVEALFLEET_ARCHIVE="${REVEALFLEET_ARCHIVE:-$REVEALFLEET_ROOT/archive/cold}"
OUT="$REVEALFLEET_ARCHIVE/audits/$(date -u +%Y-%m-%d)-redundancy-<scope>"
$OUT/
  RUN.json
  raw/*.jsonl          # per-detector outputs
  findings.jsonl       # merged
  report.md            # human summary
  summary.json
  classified/          # optional: agent-edited classifications

Quick start (one repo)

SKILL="$REVEALFLEET_ROOT/revskills/skills/redundancy-scan"
export REVEALFLEET_ARCHIVE="${REVEALFLEET_ARCHIVE:-$REVEALFLEET_ROOT/archive/cold}"
OUT="$REVEALFLEET_ARCHIVE/audits/$(date -u +%Y-%m-%d)-redundancy-revealui"
mkdir -p "$OUT"

node "$SKILL/scripts/run-scan.js" \
  --root "$REVEALFLEET_ROOT/revealui" \
  --out-dir "$OUT"

# read $OUT/report.md then classify findings

Fleet mode

node "$SKILL/scripts/run-scan.js" \
  --root "$REVEALFLEET_ROOT" \
  --fleet \
  --out-dir "$REVEALFLEET_ARCHIVE/audits/$(date -u +%Y-%m-%d)-redundancy-fleet"

Skips hidden directories, archive/, tmp/, docs/, scripts/, worktrees/, and *-wt sibling folders. Nested tmp/worktrees dirs are also in defaults.json excludeDirNames.

Workflow (multi-session)

Session A — detect (mechanical)

  1. Run run-scan.js for scope.
  2. Workboard note: redundancy-scan:<date>-<scope>.
  3. Do not delete code yet.

Session B — classify (judgment)

For each high-signal finding (start with exact-duplicate and deprecation markers on runtime paths):

ClassificationAction
intentionalRecord reason (decoupling, test isolation, facade). Leave code.
accidental + smallOne PR consolidate / delete (extend-before-create).
accidental + largeFile a gap or fleet-redundancy lane item; link finding ids.
deprecation without ownerEither remove, or gap with removal plan + deadline.

Append classifications to classified/decisions.jsonl:

{
  "id": "DUP-EXACT-0001",
  "classification": "accidental",
  "action": "gap|pr|leave",
  "gap": null,
  "notes": "two copies of PEM unescape; keep packages/security",
  "agent": "…",
  "ts": "…"
}

Session C — remediate

  1. Implement only classified accidental items (or owner-authorized).
  2. Prefer consolidate onto @revealui/* native parts.
  3. Public PRs: no private planning paths in bodies.
  4. Re-run scan on touched packages; delta should shrink.

Optional tools (document in RUN.json)

# near-dupe clones (if available)
pnpm dlx jscpd <root> --ignore "**/node_modules/**,**/dist/**"

# unused (if configured in monorepo)
pnpm exec knip   # only when package supports it

# catalog drift
pnpm exec syncpack lint

Paste summary counts into $OUT/optional-tools.md.

Severity guide

SignalSuggested severity
Exact dup in packages/ runtimemedium → high if security/billing
Exact dup only in tests/fixtureslow / often intentional
Deprecation marker in hot path still importedhigh
Deprecation marker in docs onlyinfo
Basename collision for unique domain filesmedium (investigate)
Basename collision for common namesignore / allowlist

Multi-agent concurrency

  • Detect phase is single-writer on $OUT (one agent runs run-scan.js).
  • Classify can shard by finding id ranges or by class (exact-duplicate vs deprecation-marker).
  • Remediate uses normal worktrees from origin/test; one PR cluster per theme (logger, ValidationError, PEM unescape…).

Anti-patterns

Do notWhy
Delete every exact dup without classificationBreaks intentional duals
Treat jscpd % as a gate without filtering drafts/untrackedInflated (blog-drafts history)
Open a second “redundancy backlog” at docs rootUse findings.jsonl + gaps/lanes
Re-author extend-before-create policy in GrokPointer to claude-config hardline only

Related references

  • references/methodology.md — full taxonomy and intentional-dup examples
  • config/defaults.json — markers and excludes
  • Fleet lane: operator planning fleet-redundancy + remediation spec (when authorized)
  • Hardlines: extend-before-create, audit-first mindfulness, code-over-docs

Scripts

ScriptRole
run-scan.jsOrchestrate all detectors + merge report
hash-dups.jsExact content clones
marker-scan.jsDeprecation + redundancy phrase hits
name-collision.jsBasename multipaths
merge-report.jsCombine JSONL → report.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.