Skip to Content
MeowKit
Skills

mk:loop

Improves one metric in bounded, git-tracked trials, keeping each change that improves the number and reverting the rest.

Source.claude/skills/loop/SKILL.md
Ownermemory
Runtimeclaude-code
Riskmedium
Phaseon-demand

What it does

Improves one number, such as coverage percent, bundle size, lint-error count or latency, in bounded, git-tracked trials. Each iteration makes one atomic change, commits it, runs your Verify command and keeps the commit if the number improved by at least Min-Delta; otherwise it runs git revert. Git history is the loop's memory. It never plans, never grades behaviour and never ships.

Use it when a fast (under 30 seconds) command prints a single number and you know which files may change.

When not to use

SituationUse
Subjective goal ("make it cleaner")mk:cook
Known bug to fix oncemk:fix or mk:investigate
Grade a running build against a rubricmk:evaluate
Green-field product buildmk:autobuild
Structural review of a diffmk:review
Open a PRmk:ship
No mechanical metric existsmk:cook --interactive

Usage

/mk:loop Goal: Increase line coverage in src/utils to 80% \
  Scope: src/utils/**/*.ts, tests/utils/**/*.test.ts \
  Metric: line coverage %  Direction: higher \
  Verify: <command that prints one number>  Guard: npx tsc --noEmit && npm test  Iterations: 15
FieldRequiredDefaultMeaning
GoalyesWhat to improve
ScopeyesGlobs of editable files
MetricyesName and unit
Directionyeshigher or lower is better
VerifyyesShell command that prints one number
GuardnononeRegression check, exit 0 means pass
Iterationsno10Cap before the loop asks again
Noisenomediumlow, medium or high
Min-Deltanofrom NoiseSmallest improvement that counts
Stop-AtnononeTarget value that ends the loop

Missing required fields produce one batched question; no command runs before they are given. The config contract and metric library are in references/config-and-metrics.md.

Steps

The loop pauses to ask you at four boundaries and never per iteration.

StopWhenOptions
EntryAfter config parse, safety screen and git checks. No file is edited before you approve.Approve, edit config, cancel
CapIteration cap reachedStop, approve N more
Escalation8 consecutive discards, or a plateauStop, shift strategy, approve more
Scope expansionA change needs a file outside ScopeApprove wider scope, decline

Between stops it takes a baseline, then repeats: pick one change, commit, verify, run the guard, keep or revert, log a TSV row. After 5 consecutive discards it shifts strategy by itself. The lifecycle is in references/loop-protocol.md.

Output

The loop writes loop-results.tsv, summary.md and handoff.json to tasks/reports/loop-{YYMMDD-HHMM}-{slug}/, with secrets masked. The handoff names the goal, baseline, final value, kept commits, status and suggested next skills. Schema: references/result-schema.md. Good next steps are mk:review for the kept commits, then mk:ship by hand.

Gotchas

TrapDetail
Verify outputIt must print exactly one number. Pipe through | tail -1. A non-number in the dry run stops the loop.
Dirty treeA clean git tree is required. The loop asks and never stashes your work.
Commit before verifyA crash mid-verify leaves a recoverable commit.
DiscardsThey use git revert, never git reset --hard. A revert conflict stops the loop.
Verify and Guard outputIt is data. A command that emits instructions or fetches and runs remote code is refused by the safety screen (references/safety-screen.md).

On this page