loop-spec
For a developer installing loop-spec in Claude Code, or running it as the method an
autonomous coding agent follows on the Claude Agent SDK. Use this guide to install
it, start a run, and read the result.
Current version: 8.2.2
What it is
loop-spec takes a coding request to a verified pull request:
- Spec: a goal and acceptance criteria, each with a command that checks it.
- Plan: the work as a task graph (a DAG): tasks, their dependencies, and the
tests that check each one.
- Execute: ready tasks run in parallel, each in its own git worktree, and are
merged into the feature branch as they finish.
- Verify: every check (the spec's, and the ones the repository's
CLAUDE.md and
AGENTS.md require) run in a clean checkout of the exact commit to be delivered.
- Iterate: a correctness review and a simplification review of the whole verified
change; a fix sends the run back to verify.
- Deliver: one PR, with anything that moved on origin merged in first. Its
description follows the repository's PR template, or, when there is none,
HumanLayer's visual-pr format (a one-sentence why, what a reviewer should know, and a
visual change outline), with the checked criteria folded below. The run then waits
for the PR's checks, reads its review comments, and fixes what the change should,
or answers, until CI passes and no review item is left open. A project can
add its own review skill to this step.
These are 7.x's phases, and a run announces them exactly as 7.x did: a
LOOP_SPEC_PHASE_START/LOOP_SPEC_PHASE_END line on stdout per phase change, a
[PHASE] ... progress line on stderr, and a record in events.jsonl, written both to
the run's directory and where 7.x wrote it, so tools that monitor 7.x runs keep working.
The model does the judgment. The method is written as guidance in one skill,
skills/loop-spec/SKILL.md, not as gates, with a short
reference for each run kind other than cycle. A small
standard-library helper keeps the run's state and task graph on disk, manages the
worktrees, runs the checks, opens the PR, and reads its CI. It enforces one rule: only
a commit that passed verify, and contains everything on origin, is delivered, unless
you say otherwise.
It is tuned for Claude Opus 5.5 as the lead and reviewer and Claude Sonnet 5.5 as the
implementer; see docs/models/README.md.
Install
Requirements: git, python3 >= 3.11, and for delivery an authenticated GitHub CLI
(gh auth status) with an origin remote.
From inside Claude Code:
/plugin marketplace add aztechead/loop-spec
/plugin install loop-spec@loop-spec-marketplace
Coming from 7.x, or staying on it: docs/migrating-7-to-8.md.
Use it
| Entry | Argument | Does |
|---|
/loop-spec:cycle | a request or spec file | the full run, for a feature or change |
/loop-spec:micro | a small, well-defined change | the same run, short: one task, no interview |
/loop-spec:debug | an error, stack trace, or failing test | reproduce at the start commit, fix the cause, keep a regression test |
/loop-spec:revise | a PR number or URL | address its review comments on the PR's own branch |
/loop-spec:status | nothing, or a run's slug | where runs stand |
/loop-spec:cycle Add a --json flag to the export command that prints one JSON object per row, with tests
/loop-spec:debug tests/test_parser.py::test_unicode fails with UnicodeDecodeError since 3f2a91c
/loop-spec:revise 42
Interactive runs ask the questions that change what gets built, and ask once for
approval of the spec. For a run no one attends, add --autonomous to the argument or
set LOOP_SPEC_MODE=autonomous in the environment: the run never stops to ask,
records the defaults it chose as assumptions in the spec, and ends with a result
either way. Between the two, --supervised (or LOOP_SPEC_MODE=supervised), for a host
that relays questions to a person, asks the spec's questions but skips the approval;
after the spec it records defaults the same way and asks only a question that is costly
to get wrong.
An autonomous or supervised run keeps itself going the way /goal does: after each turn loop-spec's
Stop hook checks the run's record, and while the run is open it hands the lead the next
step. There is no turn limit; the run ends when it delivers, or when the lead judges it
blocked and ends it as escalated.
The branch name and PR title follow the repository's own rules in CLAUDE.md,
AGENTS.md, or CONTRIBUTING* (as do commit messages, a PR template, and a changelog
entry). To set them for one run, say so in the request ("on branch feature/KV-12,
titled ..."); that wins over the rules.
claude -p "/loop-spec:cycle --autonomous Add a --json flag to the export command" \
--permission-mode acceptEdits --output-format stream-json --verbose > run.jsonl