crafting-self-prompting-loops
Crafting Self-Prompting Loops
A self-prompting loop is a trusted harness that re-invokes a model with updated context each round — it is not the model executing its own output as commands. The harness calls the model, reads the answer as data, decides whether to call again, and if so folds new information into the next prompt. Internalize that framing before building: it is both the correct mental model and the security model. Everything below follows from it.
Your job with this skill: turn a fuzzy "make it keep going until it's good" request into a sound loop — one that always terminates, never drifts unnoticed, never executes its own output as instructions, and stays within budget. Skipping these is how loops burn money, never stop, or get hijacked.
The workflow
Follow these steps in order. The canonical 10-item spine is in references/checklist.md (items LSC-1…LSC-10); the terse per-item design rules are in references/spec.md; the research grounding for every non-obvious rule (citations → slot) is in references/literature.md. Read them if you need the full definitions — the summaries below are enough for most loops.
1. Nail the goal and the "done" test (LSC-1) — before anything else
Ask the user (or infer, then state your assumption): what is this loop trying to achieve, and what concretely counts as "done"? If you cannot write the success condition as one sentence an outside party could check, the loop is not ready — surface that gap rather than papering over it. A loop with no checkable "done" can never legitimately stop, and every later slot leans on this anchor.
Then ask: does this even need a loop? If the task has a verifiable or aggregatable answer, parallel sampling + majority vote (self-consistency) often beats iterative refinement at equal compute, and a one-shot call sidesteps every loop failure mode. Baseline that before committing to a loop — the cheapest sound loop is sometimes no loop.
2. Pick the family
Use the decision tree in references/families.md. Briefly: human in the path → human-checkpointed; one model critiquing its own output → self-refinement; one agent driving other agents → multi-agent; one agent driving itself toward a goal → autonomous. State which family you picked and why. When blended, pick the dominant shape and graft the extra slot.