Agent skill

Loop

by SethGammon in SethGammon/Citadel

Bounded foreground repetition for the current session. An agent skill from SethGammon/Citadel.

MITAuto-check passedAgent Workflows

Install Loop

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

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install SethGammon/Citadel loop --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/SethGammon/Citadel.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/loop .claude/skills/loop && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
loop
GitHub stars
922
Token cost
~1.4k tokens
SKILL.md length
617 words
Files
3
Skills in repo
48
Repo updated
First seen
Licence
MIT

At a glance

Bounded foreground repetition for the current session. An agent skill from SethGammon/Citadel.

  • Works in 5 steps: Classify the loop → Require a verifier → Create the contract → …
  • Repeat-until-pass work that is too small for daemon and not time-based scheduling
  • SKILL.md covers Orientation, Commands, Protocol and Fringe Cases, plus 3 more sections
  • Calls node

What it does

Loop is an agent skill from SethGammon/Citadel. 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.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files (for example `__benchmarks__/foreground-verify.md` and `__benchmarks__/missing-verifier.md`).

It sits in Agent Workflows. The repository describes itself as: The operating layer for Claude Code + OpenAI Codex: persistent project memory, intent routing, safety hooks, cost telemetry, and parallel agent fleets. The licence is MIT.

When your agent uses it

  • Repeat-until-pass work that is too small for daemon and not time-based scheduling

Example prompts

  • “/loop”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Classify the loop
  2. Require a verifier
  3. Create the contract
  4. Stop on the first terminal condition
  5. Report the outcome

What it can do on your machine

Read from SKILL.md and the folder at commit e41ff1d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • node

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Loop loads about 1.4k tokens when it runs. Until then it costs about 74 tokens; SKILL.md has 617 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~74
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from SethGammon/Citadel at commit e41ff1d, republished under its MIT licence (© SethGammon). 617 words, ~1,434 tokens.

Download SKILL.mdSave it as .claude/skills/loop/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
loop
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.
license
MIT
user-invocable
true
auto-trigger
false
trigger_keywords
loop, repeat until, until tests pass, until lint passes, max attempts, retry until
last-updated
2026-06-09

/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).

Commands

CommandBehavior
/loop statusShow all known Citadel loops with active/stopped grouping.
/loop inspect {id}Show one loop's contract, verifier, budget, runs, and stop reason.
/loop templatesList 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 intentRoute
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.

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.

Show full SKILL.md (247 more words)Show less
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. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files in skills/loop of SethGammon/Citadel.

  • SKILL.md
  • __benchmarks__/foreground-verify.md
  • __benchmarks__/missing-verifier.md

Open the folder on GitHubat commit e41ff1d

Compare with similar skills

Loop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Loop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Loop this skillSethGammon/Citadel922—~1.4kAutomated safety check: PassMIT
MCP Server Builderanthropics/skills180k62 repos~2.3kAutomated safety check: PassApache-2.0
Hook Development for Claude Code Pluginsanthropics/claude-plugins-official37k11 repos~4.1kAutomated safety check: NotesApache-2.0
Using Superpowersfarm-fe/farm5.6k34 repos~1.4kAutomated safety check: PassMIT
Executing Plans Inlineobra/superpowers296k2 repos~5.1kAutomated safety check: PassMIT
Claude Code Agent Developmentanthropics/claude-plugins-official37k8 repos~2.8kAutomated safety check: PassApache-2.0

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 62 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • Hook Development for Claude Code Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.

    37k GitHub starsUsed in 11 repos~4.1k tokens
    Agent WorkflowsAuto-check: notes
  • Using Superpowers

    farm-fe/farm

    A skill your agent uses when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions

    5.6k GitHub starsUsed in 34 repos~1.4k tokens
    Agent WorkflowsAuto-check passed
  • Executing Plans Inline

    obra/superpowers

    Has the agent carry out an implementation plan itself, task by task in the current session, keeping a ledger, proving each step with a test and ending with one whole-branch review.

    296k GitHub starsUsed in 2 repos~5.1k tokens
    Agent WorkflowsAuto-check passed
  • Claude Code Agent Development

    anthropics/claude-plugins-official

    Official

    Explains how to write agents for Claude Code plugins: the markdown file with YAML frontmatter, trigger descriptions, model and color settings, and system prompt design.

    37k GitHub starsUsed in 8 repos~2.8k tokens
    Agent WorkflowsAuto-check passed
  • Skill Creator

    Azure/azqr

    Official

    Create new skills, modify and improve existing skills, and measure skill performance.

    794 GitHub starsUsed in 89 repos~8.2k tokens
    Agent WorkflowsAuto-check passed

More from SethGammon/Citadel

All 48 skills in this repo
  • Create Skill

    SethGammon/Citadel

    Creates new skills from the user's repeating patterns. An agent skill from SethGammon/Citadel.

    922 GitHub stars~1.9k tokensUpdated 6 days ago
    Auto-check passed
  • Houseclean

    SethGammon/Citadel

    Cross-drive storage audit and cleanup. An agent skill from SethGammon/Citadel.

    922 GitHub stars~2.2k tokensUpdated 6 days ago
    Auto-check passed
  • Triage

    SethGammon/Citadel

    GitHub issue and PR investigator. An agent skill from SethGammon/Citadel.

    922 GitHub stars~2.7k tokensUpdated 6 days ago
    Auto-check passed
  • Watch

    SethGammon/Citadel

    File sentinel that monitors the working directory for changes and marker comments, then auto-triggers appropriate skills.

    922 GitHub stars~2.9k tokensUpdated 6 days ago
    Auto-check passed
  • Archon

    SethGammon/Citadel

    Autonomous multi-session campaign agent. An agent skill from SethGammon/Citadel.

    922 GitHub stars~5.4k tokensUpdated 6 days ago
    Auto-check passed
  • Fleet

    SethGammon/Citadel

    Parallel campaign orchestrator. An agent skill from SethGammon/Citadel.

    922 GitHub stars~6.3k tokensUpdated 6 days ago
    Auto-check passed

Categories

Questions about Loop

What does Loop do?

Bounded foreground repetition for the current session. An agent skill from SethGammon/Citadel. Loop is an agent skill from SethGammon/Citadel. Bounded foreground repetition for the current session.

When should I use Loop?

Loop fits situations like: repeat-until-pass work that is too small for daemon and not time-based scheduling.

How do I install Loop in Claude Code?

Run `npx skills add SethGammon/Citadel --skill loop -a claude-code`. Or copy the skill folder (skills/loop in SethGammon/Citadel) into .claude/skills/loop in your project. Claude Code loads it when a task matches its description.

How do I install Loop in Codex?

Run `npx skills add SethGammon/Citadel --skill loop -a codex`. Or copy the skill folder (skills/loop in SethGammon/Citadel) into .agents/skills/loop in your project. Codex loads it when a task matches its description.

Can I use Loop in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add SethGammon/Citadel --skill loop -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/loop, .gemini/skills/loop, .github/skills/loop and .opencode/skills/loop in your project.

What does Loop need to run?

Going by SKILL.md and its folder, Loop needs the command-line tools its instructions call (node).

Does Loop access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Loop safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Loop use?

Loop is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Loop use?

About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Loop?

Skills that share tags, products or a category with Loop: MCP Server Builder (anthropics/skills, 180k stars), Hook Development for Claude Code Plugins (anthropics/claude-plugins-official, 37k stars), Using Superpowers (farm-fe/farm, 5.6k stars) and Executing Plans Inline (obra/superpowers, 296k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Loop?

SethGammon (a GitHub user) maintains it in SethGammon/Citadel, which has 922 GitHub stars. The repository holds 48 skills in this directory. The repository was last updated on October 1, 2026.

Source: SethGammon/Citadel on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.