К основному содержанию
скилл CX Codex

loop · sethgammon — скилл для Claude Code и Codex: повторные попытки до успеха

Скилл loop для Claude Code и Codex, который запускает действие несколько раз подряд и проверяет результат каждый раз, пока не пройдёт проверка или не кончатся попытки.

MIT ★ 937 обновлён 2026-11-05

Установить в Claude Code · Через маркетплейс плагинов Все способы и платформы ↓
/plugin marketplace add SethGammon/Citadel
/plugin install citadel@citadel-local
Открыть на GitHub

Что делает loop

Loop создаёт контракт повторений с явным лимитом попыток и проверкой успеха. Каждая попытка записывается в .planning/loops/ с данными о действии, результате и причине остановки. Работает на Claude Code и Codex.

Чтобы запустить loop, нужна явная проверка — команда, которая подтвердит успех (например, npm run lint или npm run test). Без неё скилл попросит уточнить проверку и не будет выполнять действие. Лимит попыток указывается явно: --max 3 означает ровно три попытки, не больше.

Луп останавливается, когда проверка прошла, попытки кончились, действие сломалось или нужна помощь человека. Каждый запуск сохраняет улики — договор с действием, проверкой, результатами и остановкой.

Какие задачи решает

  • запустить проверку кода несколько раз, пока не пройдёт линтер
  • повторить тесты до прохождения, но не больше трёх раз
  • исправлять ошибки в цикле за одну сессию
  • сохранять историю попыток для анализа

Примеры запросов агенту

  • Повтори проверку кода максимум 5 раз с проверкой npm run lint
  • Запусти loop: действие — исправить синтаксис, проверка — npm run test, макс 3 попытки
  • /loop run "npm run format" --verify "npm run lint" --max 4

Как установить loop

1Через маркетплейс плагинов

/plugin marketplace add SethGammon/Citadel
/plugin install citadel@citadel-local

Команда ставит плагин citadel целиком, со всеми его скиллами

2Через Skills CLI (Vercel)

npx skills add SethGammon/Citadel --skill loop -a claude-code

3Вручную: положить файлы

~/.claude/skills/loop/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/loop/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о loop

Как установить loop в Claude Code?

Запусти /plugin marketplace add SethGammon/Citadel, затем /plugin install citadel@citadel-local и npx skills add SethGammon/Citadel --skill loop -a claude-code. Скилл появится в ~/.claude/skills/loop/SKILL.md.

Что делает loop?

Запускает действие (например, исправление ошибок) и проверяет результат командой, которую ты указал. Повторяет до тех пор, пока проверка не пройдёт или не закончатся попытки. Все результаты сохраняются в .planning/loops/.

Почему loop требует явную проверку?

Без конкретной команды проверки loop не знает, когда остановиться. Слова вроде «пока не пройдёт» — не команда. Укажи точно: --verify "npm run test" или --verify "npm run lint".

Исходный текст

SKILL.md · MIT
---
name: loop
license: MIT
description: >-
  Bounded foreground repetition for the current session. Creates a loop
  contract, runs or coordinates an action plus verifier up to a declared attempt
  limit, and records evidence under .planning/loops/. Use for repeat-until-pass
  work that is too small for daemon and not time-based scheduling.
user-invocable: true
auto-trigger: false
trigger_keywords:
  - loop
  - repeat until
  - until tests pass
  - until lint passes
  - max attempts
  - retry until
last-updated: 2026-11-04
---

# /loop -- Bounded Foreground Loop

## Orientation

**Use when:** the user wants a visible repeat-until-pass cycle inside the
current session, such as "loop until lint passes" or "try this up to three
times and stop if tests still fail."

**Don't use when:** the work should run unattended across sessions (`/daemon`),
on a clock (`/schedule`), on file changes (`/watch`), or as a metric-driven
optimization experiment (`/experiment`).

In Claude Code, invoke `/citadel:loop` to select this skill explicitly.
The host also has a timer-based `/loop` command with different semantics.

## Commands

| Command | Behavior |
|---|---|
| `/loop status` | Show all known Citadel loops with active/stopped grouping. |
| `/loop inspect {id}` | Show one loop's contract, verifier, budget, runs, and stop reason. |
| `/loop templates` | List built-in loop templates. |
| `/loop plan --template {name}` | Create a loop contract from a template. |
| `/loop run "{action}" --verify "{command}" --max {N}` | Run a bounded foreground loop. |
| `/loop stop {id}` | Mark a loop stopped. |

## Protocol

### Step 1: Classify the loop

Determine which kind of loop the user requested:

| User intent | Route |
|---|---|
| Repeat within this active session | `/loop` |
| Continue campaign across sessions | `/daemon` |
| Run on a schedule | `/schedule` |
| Watch PR checks/reviews | `/pr-watch` |
| Watch files or marker comments | `/watch` |
| Optimize a numeric metric | `/experiment` |

If another route is clearly better, say so and route there.

### Step 2: Require a verifier

A `/loop run` must have an explicit verifier. Explicit means the user supplied
`--verify "<command>"` or an equally concrete verifier command in plain language.
Do not infer a verifier from words like "lint", "test", "until it works", or
"fix until passing." If the verifier is missing, ask for it before executing and
do not run `loop-runner.js`, shell commands, or manual repair steps.

Accept examples like:

```text
--verify "npm run lint"
--verify "npm run test"
--verify "node scripts/operating-proof.js --write"
```

If missing, respond in this shape:

```text
/loop needs an explicit verifier before it can run. Please provide one, for example:
--verify "npm run lint"

I will not run the loop until the verifier is explicit.
```

### Step 3: Create the contract

For status, inspect, templates, and stop commands, run:

```bash
node .citadel/scripts/loops.js <command>
```

For template planning:

```bash
node .citadel/scripts/loops.js plan --template <name> --write
```

For foreground execution:

```bash
node .citadel/scripts/loop-runner.js --action "<action>" --verify "<verifier>" --max-attempts <N> --write
```

If `.citadel/scripts/` is not present and this is the Citadel harness repo
itself, use `node scripts/loops.js` or `node scripts/loop-runner.js` instead.

The runner writes a contract under `.planning/loops/{id}.json`, appends each
attempt, and stops with a shared stop status.

Loop commands run in a shell, so each exact action and verifier command must
be approved for the project first. If the runner fails with
`LOOP_COMMAND_NOT_APPROVED`, nothing ran. Stop and show the user the
`approve-command.js approve loop ...` lines from the error; they must run those
themselves in an interactive terminal. Do not retry, rewrite the command to
dodge the check, or try to approve it yourself.

### Step 4: Stop on the first terminal condition

Stop when any of these are true:

- verifier passes
- attempt limit is reached
- the action fails in a way that needs human review
- the requested action would cross a safety or approval boundary
- the user asks to stop

Never silently continue beyond the declared attempt limit.

### Step 5: Report the outcome

Summarize:

- loop id
- status
- attempts used
- verifier
- runner command, including `--verify` and `--max-attempts`
- state path
- next action if stopped before success

## Fringe Cases

**If `.planning/` does not exist:** create `.planning/loops/` before writing
loop state. If writing fails, output the contract inline and tell the user
setup is needed.

**No verifier:** ask for one. Do not infer a destructive or expensive verifier.

**Action is an agent command, not a shell command:** run the action manually as
the agent for each attempt, then record the loop with `node scripts/loops.js
register` or use the loop contract as the state artifact. Do not pass slash
commands to the shell runner.

**Verifier keeps failing with the same cause:** stop at the attempt limit and
report `attempt-limit` with the latest evidence.

**User asks for unattended looping:** route to `/daemon` or `/schedule`, not
`/loop`.

## Contextual Gates

**Disclosure:** "Running foreground loop: action `{action}`, verifier
`{verifier}`, max attempts `{N}`."

**Reversibility:** amber -- the loop may run user-provided shell commands and
modify files; inspect the diff or loop-owned artifacts to revert.

**Trust gates:**
- Any: require verifier and attempt cap.
- Familiar: may execute shell action/verifier after disclosing the contract.
- Risky commands: require normal tool approval boundaries before running.

## Quality Gates

- A loop contract exists under `.planning/loops/` unless the filesystem blocks it.
- The verifier is explicit.
- The attempt limit is explicit and >= 1.
- The final status uses the shared loop vocabulary from `docs/LOOP_CONTRACT.md`.
- The final answer includes the loop id and state path.

## Exit Protocol

```
---HANDOFF---
- Loop: {id}
- Status: {status}
- Attempts: {used}/{max}
- Verifier: {command}
- Runner: node .citadel/scripts/loop-runner.js --action "{action}" --verify "{command}" --max-attempts {max} --write
- State: .planning/loops/{id}.json
- Next: {next action or "none"}
---
```

© SethGammon · MIT · SethGammon/Citadel

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →

Сначала — loop от других авторов.

loop Alireza Rezvani Скилл loop для Claude Code, который запускает автономный цикл экспериментов autoresearch по расписанию. Задаётся интервал от 10 минут до месяца, дальше агент сам читает конфиг, правит код, коммитит и оценивает результат. CX Codex +1 1 557установок loop ZaxbyHub Скилл loop для Claude Code проводит задачу через планирование, сборку, проверку и улучшения, сохраняя состояние между запусками. Организует последовательную работу над целью с контрольными этапами. CX Codex +1 ★ 539звёзд репо pua-loop tanweai Загружает протокол циклической проверки кода. Запускается командой $pua-loop. CX Codex +1 1 800установок install-loop Cobus Greyling Скилл install-loop для Claude Code устанавливает Loop Engineering в проект через единую CLI-команду. Он выбирает шаблон цикла по проблеме и оставляет запуск в режиме отчётов на первую неделю. CX Codex +1 ★ 11 819звёзд репо ralph-loop официальный Anthropic Команда ralph-loop запускает автономный цикл доработки задачи в Claude Code, возвращая агенту тот же промпт при каждой попытке выхода. CX Codex +1 ★ 47 914звёзд репо loop-verifier Cobus Greyling Скилл loop-verifier для Claude Code проверяет правки в цикле исправлений: сам запускает тесты проекта, сверяет дифф с задачей и выносит вердикт APPROVE, REJECT или ESCALATE_HUMAN. CX Codex +1 ★ 11 819звёзд репо codex-autoresearch-loop reason-machines Скилл codex-autoresearch-loop циклически правит код, проверяет метрику и сохраняет удачные изменения в git. Запускается для автономного устранения ошибок типов или повышения тестового покрытия. CX Codex +1 1 200установок the-loop oxbshw Скилл the-loop записывает, как ведёт себя интерфейс, анимация или игра, сверяет запись с вашими критериями и повторяет прогон, пока не пройдёт. CX Codex +1 737установок

Из того же набора55

Весь набор →
policy-enforcer Субагент policy-enforcer для Claude Code сверяет планируемое действие с правилами Citadel и возвращает вердикт: разрешить или заблокировать. Archon и Fleet запускают его перед операциями с низкой обратимостью. CX Codex ★ 937звёзд репо systematic-debugging Скилл systematic-debugging ограничивает хаотичные правки: заставляет модель сначала воспроизвести баг, проверить гипотезы без изменения кода и остановиться после двух неудачных правок. CX Codex +1 ★ 937звёзд репо decision-map Скилл decision-map превращает расплывчатую идею в карту вопросов, которую можно продолжать между сессиями. Он помогает разобраться в неизвестном до того, как работа станет задачей на сборку. CX Codex +1 ★ 937звёзд репо archon Субагент archon, который ведёт большую задачу по фазам: разбивает направление на шаги, передаёт их другим агентам и хранит состояние кампании между запусками. CX Codex ★ 937звёзд репо marshal Скилл marshal для Claude Code разбирает задачу, собирает контекст из кода и памяти и связывает скиллы в цепочку. Работает за одну сессию и спрашивает, только если не может продолжить. CX Codex +1 ★ 937звёзд репо test-gen Скилл test-gen генерирует и прогоняет тесты под существующий фреймворк проекта с проверкой типичных сценариев, краевых случаев и ошибок. CX Codex +1 ★ 937звёзд репо design Скилл design собирает дизайн-манифест из стилей проекта или ответов на вопросы. Хук после правок отмечает отклонения в CSS и компонентах. CX Codex +1 ★ 937звёзд репо live-preview Скилл live-preview делает скриншоты компонентов в процессе сборки, а не по готовности. Ловит регрессии вёрстки и невидимые блоки до того, как они уйдут дальше. CX Codex +1 ★ 937звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой