The self-improve loop
The loop takes a goal ("improve onboarding and the paywall"), turns it into a checklist, and works through it one item at a time. Each item is reviewed by one or two specialists and only ticked when the build and tests are green. It is installed in every app and stays off until you start it.
Install into an app
The kickoff skill does this for new apps. For an existing app:
kapp-loop-install ~/projects/Sprout
kapp-loop-install --check # report agent drift between the template, ~/.claude/agents and projects
It adds scripts/start-loop.sh, scripts/stop-loop.sh, scripts/loop-guard.sh, the playbooks in
AiGuidelines/loop/, a .loop/ folder, CLAUDE.loop.md, and a Stop hook in the app's .claude/settings.json.
The loop is built for apps made from the KAppMaker template (Kotlin Multiplatform, Gradle root in MobileApp/).
The gate finds the Gradle module by itself (:shared, else :composeApp, else :app). Other layouts can set
module and task names in .loop/gate.env.
Start
Plain words, in the terminal or over Telegram:
Run the dev loop on Sprout: improve onboarding conversion and keep going.
What happens:
prompt-architectwrites a brief from your message.scripts/start-loop.sh "<goal>"takes a git checkpoint, seedsPLAN.md(or resumes it if the goal is the same; a new goal archives the old plan), moves owner-only items toOWNER_TODO.md, writes.loop/STATE.mdand raises the flag.claude/.loop-active.- The orchestrator tailors
PLAN.md: small items under milestones, each tagged with its reviewers, ordered by impact on conversion.
You can run the script yourself too: scripts/start-loop.sh --fresh "improve the paywall".
One pass
- The main session spawns a fresh
orchestrator. It reads.loop/STATE.md, the current milestone ofPLAN.mdand the last 50 lines of.loop/decisions.md. Nothing else in full. - It does the top unchecked item, or 2 to 4 small items with the same tag. Money, purchase, entitlement, database, analytics and threading changes always go alone.
- It spawns 1 or 2 reviewers in parallel, picked by the item's tag and the files changed. Pure doc and copy items are reviewed in one batch at milestone end.
- It decides on each finding (accept or reject, with the reason in
.loop/decisions.md). - It runs the gate. Green: tick the item, commit, rewrite
STATE.md. Red: nothing is ticked. - It returns at most 10 lines to the main session.
The gate
scripts/loop-guard.sh gate fast # every item: spotless + JVM tests, UI snapshots only if UI changed, iOS compile only if iOS code changed
scripts/loop-guard.sh gate full # milestone end and before any merge to main: all snapshots, iOS compile, extras
scripts/loop-guard.sh plan fast # print the Gradle command, run nothing
kappmaker-army gate Sprout full # same gate from anywhere, short output
One Gradle call per gate, always through gradle-slot. Changes with no Kotlin or Gradle files skip Gradle. Time
limits: 15 minutes fast, 20 minutes full.
Reviews are advice. The build and tests decide. A red build is never ticked and never forced green.
If the only failures are UI snapshot changes, the gate says SNAPSHOT-ONLY and lists them. Look at each compare image. If every change is one you meant to make:
scripts/loop-guard.sh accept-snapshots
Stop
Say "stop", "pause the loop" or "that's enough". The agent runs scripts/stop-loop.sh, which removes the flag.
Committed work stays. Nothing is reverted.
The loop also stops by itself:
| Reason | Flag |
|---|---|
every item in PLAN.md is done (after a final full gate and a run report in .loop/reports/) |
removed |
200 passes (40 when the app has a FACTORY.md) |
removed |
| 8 passes in a row with no item finished | removed |
| red gate | kept, so it resumes once the build is fixed |
| no Gradle wrapper found | kept |
Each stop costs one last turn in which the agent tells you in plain words what happened. Change the caps with
KAPP_LOOP_CAP and KAPP_LOOP_STALL_CAP in the worker's environment.
Chatting with the session while the loop runs does not start a pass. Only turns marked as loop turns
(.loop/in-iteration) get gated and counted.
Files to look at
| File | What |
|---|---|
PLAN.md |
the checklist |
OWNER_TODO.md |
steps only you can do. The loop never picks from it |
.loop/STATE.md |
the orchestrator's working memory, 60 lines at most |
.loop/decisions.md |
every accept and reject, with the reason |
.loop/reviews/ |
review files |
.loop/reports/run-<time>.md |
end-of-run report |
$(git rev-parse --git-path kapp-loop)/gate.log |
full gate log |
Full audit and improvement pass
After the first build runs, the main session works AiGuidelines/loop/IMPROVEMENT_PASS.md: onboarding, paywall,
UI, quality, growth, delight, each as a specialist audit turned into items. For a whole-app review say "do a full
audit of Sprout"; the full-audit-run skill dispatches one fresh orchestrator per batch.
Ethics
The loop works for conversion, by honest means. The orchestrator and the conversion reviewers refuse fake scarcity, countdowns, hidden cancel flows, pre-checked upsells, misleading "free" labels and confusing price anchors. If you ask for one, it stops and tells you why.
Docs for the App Army kit. The Claude Code plugin has its own page.