Skip to content

skilldrop·docs·Reference

The loop contract

Every rule a new loop must meet — the closed loop.json fields, the three stage types, gate ids and verdicts, what LOOP.md carries, and how a loop is registered and checked.

This page is the detail behind Author a new loop. The full rules and the pre-commit checklist are in AGENTS.md; the design rationale is RFC-0028.

When a loop is the right thing

A loop is a sequence over skills that already exist. Write one when the order and the gates between existing skills are the thing worth shipping; write a skill when a new artifact is. A loop that needs a skill nobody has written yet is blocked on that skill.

Loops are a primitive, so adding one is a structural decision: it starts with an RFC copied from docs/rfcs/0000-template.md to the next number, marked accepted before building.

loop.json

The contract is contracts/loop.schema.json and it is closed — an unknown key fails, it is not ignored.

{
  "name": "build",
  "description": "Use-case-first. What the loop delivers, then the trigger phrases an agent matches on.",
  "entrypoint": "LOOP.md",
  "kind": "loop",
  "cap": 3,
  "stages": [
    { "id": "implement", "type": "generate", "intent": "One line.", "skills": ["feature-implement-loop"] },
    { "id": "verify", "type": "verify", "intent": "One line.", "skills": ["pre-merge-review"],
      "gate": { "id": "G2", "kind": "mechanical",
                "script": "packs/dev-team/skills/pre-merge-review/scripts/gate.py",
                "verdicts": ["READY", "NOT READY", "BLOCKED"],
                "revise_to": "implement" } }
  ]
}
FieldRule
name, descriptiondescription is use-case-first, with trigger phrases at the end.
versionMAJOR.MINOR.PATCH, required. Bump it whenever LOOP.md or loop.json changes: skilldrop update refreshes an installed loop only when its version moves.
entrypoint"LOOP.md".
kindloop advances toward a terminal; wrapper has a middle stage that is any generator, chosen at run time. Only a wrapper may use "*" in skills.
capBounds revision rounds. Default 3.
stages[].typegenerate, verify or gate — the three states agent-loop-design mandates.
stages[].skillsReal skill folder names.

Gates

This is where a loop is won or lost. A gate that cannot fail is decoration.

LOOP.md

Registration

Checks

python3 validate.py
node bin/skilldrop.js validate
python3 build_loops.py --check

validate.py runs the build_loops.py drift check as well. After the checks pass, install the loop into a clean session (node bin/skilldrop.js install --loop <name> --dest /tmp/try) and run it on a realistic input. Confirm each stage advances only through its gate, that the cap is honoured, and — the invariant everything rests on — that a single skill from the loop still runs standalone when installed on its own.

Edit this page on GitHub · View source