Desloppify

From ActiveInferenceInstitute/ActiveInferAnts · View interactive version

Desloppify is an AI agent skill from the GitHub repository ActiveInferenceInstitute/ActiveInferAnts. Codebase health scanner and technical debt tracker. Use when the user asks about code quality, technical debt, dead code, large files, god classes, duplicate functions, code smells, naming issues, import cycles, or coupling problems. Also use when asked for a health score, what to fix next, or to cr

How to use this skill

Skill file

<!-- desloppify-begin -->

<!-- desloppify-skill-version: 5 -->

Desloppify

1. Your Job

Maximise the strict score honestly. Your main cycle: scan → plan → execute → rescan. Follow the scan output's INSTRUCTIONS FOR AGENTS — don't substitute your own analysis.

Don't be lazy. Do large refactors and small detailed fixes with equal energy. If it takes touching 20 files, touch 20 files. If it's a one-line change, make it. No task is too big or too small — fix things properly, not minimally.

2. The Workflow

Three phases, repeated as a cycle.

Phase 1: Scan and review — understand the codebase

desloppify scan --path .       # analyse the codebase
desloppify status              # check scores — are we at target?

The scan will tell you if subjective dimensions need review. Follow its instructions. To trigger a review manually:

desloppify review --prepare    # then follow your runner's review workflow

Phase 2: Plan — decide what to work on

After reviews, triage stages and plan creation appear as queue items in next. Complete them in order:

desloppify next                                        # shows the next workflow step
desloppify plan triage --stage observe --report "themes and root causes..."
desloppify plan triage --stage reflect --report "comparison against completed work..."
desloppify plan triage --stage organize --report "summary of priorities..."
desloppify plan triage --complete --strategy "execution plan..."

Automated triage (subagent runners)

For Codex: desloppify plan triage --run-stages --runner codex

For Claude: desloppify plan triage --run-stages --runner claude — then follow orchestrator instructions per stage

Options: --only-stages observe,reflect (subset), --dry-run (prompts only), --stage-timeout-seconds N (per-stage).

Then shape the queue. The plan shapes everything next gives you — don't skip this step.

desloppify plan                          # see the full ordered queue
desloppify plan reorder <pat> top        # reorder — what unblocks the most?
desloppify plan cluster create <name>    # group related issues to batch-fix
desloppify plan focus <cluster>          # scope next to one cluster
desloppify plan skip <pat>              # defer — hide from next

More plan commands:

desloppify plan reorder <cluster> top    # move all cluster members at once
desloppify plan reorder <a> <b> top     # mix clusters + findings in one reorder
desloppify plan reorder <pat> before -t X  # position relative to another item/cluster
desloppify plan cluster reorder a,b top # reorder multiple clusters as one block
desloppify plan resolve <pat>           # mark complete
desloppify plan reopen <pat>             # reopen

Phase 3: Execute — grind the queue to completion

Trust the plan and execute. Don't rescan mid-queue — finish the queue first.

Branch first. Create a dedicated branch for health work — never commit directly to main:

git checkout -b desloppify/code-health    # or desloppify/<focus-area>

Set up commit tracking. If you have a PR, link it for auto-updated descriptions:

desloppify config set commit_pr 42        # PR number for auto-updates

The loop:

1. desloppify next              ← what to fix next
2. Fix the issue in code
3. Resolve it (next shows you the exact command including required attestation)
4. When you have a logical batch, commit:
   git add <files> && git commit -m "desloppify: fix 3 deferred_import findings"
5. Record the commit:
   desloppify plan commit-log record      # moves findings uncommitted → committed, updates PR
6. Push periodically:
   git push -u origin desloppify/code-health
7. Repeat until the queue is empty

Score may temporarily drop after fixes — cascade effects are normal, keep going.

If next suggests an auto-fixer, run desloppify autofix <fixer> --dry-run to preview, then apply.

When the queue is clear, go back to Phase 1. New issues will surface, cascades will have resolved, priorities will have shifted. This is the cycle.

Other useful commands

desloppify next --count 5                         # top 5 priorities
desloppify next --cluster <name>                  # drill into a cluster
desloppify show <pattern>                         # filter by file/detector/ID
desloppify show --status open                     # all open findings
desloppify plan skip --permanent "<id>" --note "reason" --attest "..." # accept debt
desloppify exclude <path>                         # exclude a directory from scanning
desloppify config show                            # show all config including excludes
desloppify scan --path . --reset-subjective       # reset subjective baseline to 0

3. Reference

How scoring works

Overall score = 40% mechanical + 60% subjective.

Subjective reviews in detail

Review output format

Return machine-readable JSON for review imports. For --external-submit, include session from the generated template:

{
  "session": {
    "id": "<session_id_from_template>",
    "token": "<session_token_from_template>"
  },
  "assessments": {
    "<dimension_from_query>": 0
  },
  "findings": [
    {
      "dimension": "<dimension_from_query>",
      "identifier": "short_id",
      "summary": "one-line defect summary",
      "related_files": ["relative/path/to/file.py"],
      "evidence": ["specific code observation"],
      "suggestion": "concrete fix recommendation",
      "confidence": "high|medium|low"
    }
  ]
}

Import rules:

Import paths:

Review integrity

  1. Do not use prior chat context, score history, or target-threshold anchoring.
  2. Score from evidence only; when mixed, score lower and explain uncertainty.
  3. Assess every requested dimension; never drop one. If evidence is weak, score lower.

Reviewer agent prompt

Runners that support agent definitions (Cursor, Copilot, Gemini) can create a dedicated reviewer agent. Use this system prompt:

You are a code quality reviewer. You will be given a codebase path, a set of
dimensions to score, and what each dimension means. Read the code, score each
dimension 0-100 from evidence only, and return JSON in the required format.
Do not anchor to target thresholds. When evidence is mixed, score lower and
explain uncertainty.

See your editor's overlay section below for the agent config format.

Commit tracking & branch workflow

Work on a dedicated branch named desloppify/<description> (e.g., desloppify/code-health, desloppify/fix-smells). Never push health work directly to main.

desloppify config set commit_pr 42              # link to your PR
desloppify plan commit-log                      # see uncommitted + committed status
desloppify plan commit-log record               # record HEAD commit, update PR description
desloppify plan commit-log record --note "why"  # with rationale
desloppify plan commit-log record --only "smells::*"  # record specific findings only
desloppify plan commit-log history              # show commit records
desloppify plan commit-log pr                   # preview PR body markdown
desloppify config set commit_tracking_enabled false  # disable guidance

After resolving findings as fixed, the tool shows uncommitted work, committed history, and a suggested commit message. After committing externally, run record to move findings from uncommitted to committed and auto-update the linked PR description.

Key concepts

4. Escalate Tool Issues Upstream

When desloppify itself appears wrong or inconsistent:

  1. Capture a minimal repro (command, path, expected, actual).
  2. Open a GitHub issue in peteromallet/desloppify.
  3. If you can fix it safely, open a PR linked to that issue.
  4. If unsure whether it is tool bug vs user workflow, issue first, PR second.

Prerequisite

command -v desloppify >/dev/null 2>&1 && echo "desloppify: installed" || echo "NOT INSTALLED — run: pip install --upgrade git+https://github.com/peteromallet/desloppify.git"

<!-- desloppify-end -->

Claude Code Overlay

Use Claude subagents for subjective scoring work. Do not use --runner codex — use Claude subagents exclusively.

Review workflow

Run desloppify review --prepare first to generate review data, then use Claude subagents:

  1. Prepare: desloppify review --prepare — writes query.json and .desloppify/review_packet_blind.json.
  2. Launch subagents: Split the review across N parallel Claude subagents (one message, multiple Task calls). Each agent reviews a subset of dimensions.
  3. Merge & import: Merge agent outputs, then desloppify review --import merged.json --manual-override --attest "Claude subagents ran blind reviews against review_packet_blind.json" --scan-after-import.
How to split dimensions across subagents

Subagent rules

  1. Each agent must be context-isolated — do not pass conversation history or score targets.
  2. Agents must consume .desloppify/review_packet_blind.json (not full query.json) to avoid score anchoring.

Triage workflow

Orchestrate triage with per-stage subagents:

  1. desloppify plan triage --run-stages --runner claude — prints orchestrator instructions
  2. For each stage (observe → reflect → organize → enrich):
  1. Complete: desloppify plan triage --complete --strategy "..." --attestation "..."

<!-- desloppify-overlay: claude -->

<!-- desloppify-end -->

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.