soloopx.by solo lemon.
Back to loops
Maintenancemanual

Knip Until Clean

Find and remove dead exports, unused files, and orphan dependencies — loop until knip reports clean.

0 views0 usesby solo lemon.

// parameters

Triggermanual
Max iterations5
Check commandnpx knip
Exit conditionKnip reports no unused files, exports, or dependencies

// run_this_loop

Copy the kickoff into your agent first. The blueprint below explains how the loop evaluates progress and when it should stop.

Open in CursorOpen in Claude

Use loop copies the kickoff prompt. Share copies the loop link. Open in Cursor / Claude only pre-fill that prompt — they do not install hook files. Download loop saves the loop as knip-until-clean.md.

Start the "Knip Until Clean" loop.

Goal: knip reports no unused code or dependencies
Max iterations: 5
Between iterations run: npx knip
Exit when: knip exits 0

Step 1: Run knip. Remove dead exports and unused deps with minimal diffs; verify tests still pass.

Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.

// blueprint

The loop contract: target outcome, execution sequence, checks, stopping condition, and safety constraints.

Goal

knip reports no unused code or dependencies

// loop_sequence

// loop_sequence_diagram.json
closed loop

Trigger

Manual start

Actions block

2 steps
1Run knip
2Remove or justify

Feedback gate

Evaluate: npx knip

Run the check, read the output, then decide whether the loop is complete.

Check failed

Repeat actions with the latest feedback.

Success

Knip reports no unused files, exports, or dependencies

Safety capMax 5 iterations

// steps

  1. 1
    Run knip

    Run knip (or depcheck) and categorize unused files, exports, and dependencies.

    npx knip
  2. 2
    Remove or justify

    Delete confirmed dead code. For false positives, add knip ignore entries with a one-line reason.