loop
Skill1 starsChanged 5 months agoMITView on GitHub
Claude Code loop setup and operation: /loop, CronCreate, and ScheduleWakeup. Decision framework, loop.md authoring, context hygiene, self-termination patterns, and platform caveats.
55 other projects use a version of this.
Adopted by
Most recently taken up by
- Eclipter/agentstheir own version, first seen Nov 8, 2026
- SethGammon/Citadeltheir own version, first seen Nov 4, 2026
- drevendev/HungryCrabtheir own version, first seen Nov 1, 2026
- Railly/skillstheir own version, first seen Nov 1, 2026
- HeshamFS/swarmweavertheir own version, first seen Nov 1, 2026
- jtaroreh/agystacktheir own version, first seen Oct 29, 2026
Used with
Projects with it also use review-bugbot, origin and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
0mlkrizzz655335vSkillreview-bugbot
缺陷导向代码审查。用 Bugbot 子代理找 bug。
Also in 4 projects that use this
0mlkrizzz655335vSkillorigin
origin CLI 管理。安装、登录、更新、修复 origin.cursor.com 的 CLI。"disabled-environments:
Also in 3 projects that use this
PandelisZSkillupdate-cli-config
View and modify Cursor CLI configuration settings in ~/.cursor/cli-config.json. Use when the user wants to change CLI settings, configure permissions, switch approval mode, enable vim mode, toggle display options, configure sandbox, or manage any CLI preferences.
Also in 4 projects that use this
32103210Skillmigrate-to-skills
Convert 'Applied intelligently' Cursor rules (.cursor/rules/*.mdc) and slash commands (.cursor/commands/*.md) to Agent Skills format (.cursor/skills/). Use when you want to migrate rules or commands to skills, convert .mdc rules to SKILL.md format, or consolidate commands into the skills directory.
Also in 4 projects that use this
32103210Skillupdate-cursor-settings
Modify Cursor/VSCode user settings in settings.json. Use when you want to change editor settings, preferences, configuration, themes, font size, tab size, format on save, auto save, keybindings, or any settings.json values.
Also in 4 projects that use this
MicrosoftSkillautomate
Propose an automation from a completed task or a new idea, then create it after approval. Use when the user asks to create an automation or wants scheduled local or cloud agent work.
Also in 4 projects that use this
- +3 more from 0mlkrizzz655335v
- +1 more from 32103210
Other versions55 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 55
- SethGammon/Citadel★ 927same name
- breezewish/CodexPotter★ 629same name
- jtaroreh/agystack★ 128same name
- dannys-code-corner/incan★ 73same name
- ww-w-ai/bkit-gemini★ 66same name
- IsuruMaduranga/one-code★ 50same name
- unclejobs-ai/second-claude-code★ 41same name
- BULDEE/ai-craftsman-superpowers★ 35same name
- Hassaan146/claude-skills★ 18same name
- woxiangyangzhimao/skills★ 14same name
45 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository26 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- audit-legalSkill
- audit-securitySkill
- echartsSkill
- explainSkill
- file-changelogSkill
- file-claudeSkill
- file-licenseSkill
- file-projectSkill
- file-readmeSkill
- frontendSkill
- hooksSkill
- lean-reviewSkill
- masterpromptSkill
- mcpSkill
- mermaidSkill
- new-projectSkill
- outputstyleSkill
- proofreadSkill
- rulesSkill
- settingsSkill
- skillsSkill
- sotaSkill
- subagentsSkill
- tasksSkill
- toonSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 11 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 50 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Do not use for:
- Very specific: line 28
Never rely on a session-scoped loop to survive session end.
- Distinctive: line 30
Always embed an explicit stopping condition in every loop prompt.
- Very specific: line 33
Never poll background output with Read, Bash tail, or Bash cat between iterations.
- Distinctive: line 36
Always specify scope limits in the loop prompt — what Claude is not allowed to touch.
- Distinctive: line 59
Use AskUserQuestion for the four decisions that determine the correct setup.
- Distinctive: line 63
Call AskUserQuestion with header "Loop type" and question "Will you keep an active Claude Code session open while this runs?" with options …
- Distinctive: line 69
Call AskUserQuestion with header "Cadence" and question "Should this run on a fixed schedule or let Claude adjust the wait based on what it …
- Distinctive: line 74
Call AskUserQuestion with header "Stopping" and question "What stops this loop?" with options "Explicit condition — a checkable state (e.g.
- Very specific: line 80
If the prompt describes a recurring project-level or global maintenance task, call AskUserQuestion with header "Persistence" and question …
- Distinctive: line 91
Always embed the stopping condition and scope limits in the final prompt, regardless of cadence.
- Distinctive: line 105
Use [assets/loop.template.md] as the starting point.
- Very specific: line 122
Write all loop state to a file (_work/loop-state.md) or the task work board before context reaches 70%.
- Distinctive: line 125
Use TaskCreate/TaskUpdate to track items — the work board survives compaction and session restarts.
- Distinctive: line 127
Prefer Monitor for event-triggered work — zero tokens between events vs a fixed loop that checks even when nothing changed.
“Common” is measured: kept by at least 6 in 10 of the 50 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Loop
1§ Purpose
Design, launch, and safely operate Claude Code loops — choosing the right recurring-task
system, configuring cadence and stopping conditions, authoring loop.md override files,
and preventing context bloat and runaway iterations.
2§ Use when
- User asks to set up
/loop, recurring tasks, or a scheduled prompt in an active session - CI/CD watching, PR babysitting, deployment polling, or iterative background research
- Deciding between loop, Monitor, desktop scheduled task, and cloud routine
- Authoring or updating a
loop.mdoverride file - User needs to understand why a loop is running, stuck, or consuming unexpected tokens
Do not use for:
- One-shot tasks — use Bash or a single Agent call
- Real-time stream observation where events arrive unpredictably — use Monitor instead
- Tasks that must survive machine shutdown — use cloud routines
- Non-interactive pipelines — set
CLAUDE_CODE_DISABLE_CRON=1to block accidental scheduling
3§ Hard constraints
- Never rely on a session-scoped loop to survive session end. Cron tasks are in-memory only.
They can be restored via
claude --resumewithin 7 days, then vanish permanently. - Always embed an explicit stopping condition in every loop prompt. The 7-day auto-expiry is a backstop, not a design feature — a loop with no stopping condition will run until it expires, draining tokens silently.
- Never poll background output with
Read,Bash tail, orBash catbetween iterations. Each call injects the full output into context; use Monitor for streams and self-paced ScheduleWakeup for reasoning-based polling. - Always specify scope limits in the loop prompt — what Claude is not allowed to touch. Without explicit exclusions, each iteration may take wider action than intended.
ScheduleWakeuphas no cancellation API (issue #58235). A running self-paced loop can only be stopped by pressing Esc or closing the session. Warn the user before launching.loop.mdis silently ignored on Bedrock, Vertex AI, and Microsoft Foundry. Verify the provider before relying on aloop.mdoverride.
4§ System comparison
| System | Needs open session | Survives machine off | Cadence | Best for |
/loop (session) | Yes | No | Fixed or self-paced | CI watching, PR tending, iterative research |
| Desktop scheduled task | No | No | Cron expression | Nightly local jobs |
| Cloud routine | No | Yes | Cron expression | Fully autonomous background automation |
| Monitor | Yes | No | Event-driven | Log tailing, stream observation, file watching |
Decision rule:
- User will have an active session open →
/loop - Task must run overnight or survive session end → desktop task (machine must stay on) or cloud routine
- Trigger is a stream event, not a time interval → Monitor
- Cost matters and the trigger is irregular → Monitor (zero tokens between events vs fixed-interval loop burning tokens whether or not anything changed)
5§ Setup workflow
Use AskUserQuestion for the four decisions that determine the correct setup. Ask all questions before composing any command.
Step 1 — determine system fit: Call AskUserQuestion with header "Loop type" and question "Will you keep an active Claude Code session open while this runs?" with options "Yes — I'll be at my machine with a session open" and "No — I need it to run in the background or overnight". If the user answers "No": redirect to a desktop scheduled task or cloud routine and exit this skill.
Step 2 — determine cadence: Call AskUserQuestion with header "Cadence" and question "Should this run on a fixed schedule or let Claude adjust the wait based on what it finds?" with options "Fixed interval — same gap every time (e.g. every 5 minutes)" and "Self-paced — Claude adjusts the wait based on what it finds".
Step 3 — determine stopping condition: Call AskUserQuestion with header "Stopping" and question "What stops this loop?" with options "Explicit condition — a checkable state (e.g. CI is green, queue is empty)", "Manual only — I'll press Esc or close the session when done", and "Iteration limit — run a fixed number of times then stop".
Step 4 — offer loop.md persistence (only if the prompt is reusable): If the prompt describes a recurring project-level or global maintenance task, call AskUserQuestion with header "Persistence" and question "Should this be saved as loop.md so bare /loop always runs it?" with options "Project scope — .claude/loop.md (this project only)", "User scope — ~/.claude/loop.md (all projects)", and "No — one-off only".
Step 5 — compose and deliver:
- Self-paced:
/loop <prompt> - Fixed interval:
/loop <interval> <prompt>(e.g./loop 5m check CI on PR #1234) - With
loop.md: write the file using the template at [assets/loop.template.md], then instruct the user to run bare/loop
Always embed the stopping condition and scope limits in the final prompt, regardless of cadence.
6§ loop.md authoring
loop.md replaces the built-in maintenance prompt for bare /loop calls with no arguments.
Two locations, first match wins: .claude/loop.md (project) or ~/.claude/loop.md (user).
Edits take effect on the next iteration. Max size: 25,000 bytes.
A complete loop.md has four parts:
- Objective — one sentence: the goal and what success looks like
- Scope — what Claude is allowed to touch; list explicit exclusions to prevent drift
- Escalation — what to do when stuck, to prevent infinite retry on the same failure
- Stopping condition — a check run at the start of each iteration; if met, do not reschedule
Use [assets/loop.template.md] as the starting point. Fill all four parts and strip comments before saving.
Rules for effective loop.md:
- Concise: the file is read every iteration. Keep it under 200 lines.
- Unambiguous success state: "CI is green and all review threads are resolved" works; "improve code quality" does not.
- Explicit scope: "Allowed:
src/auth/only. Not allowed: new PRs, dependency changes." - Stopping instruction: "If conditions are met, output 'LOOP DONE' and do not call ScheduleWakeup." This is how self-paced loops terminate gracefully.
7§ Context and token hygiene
Session-scoped loops accumulate context across iterations. At approximately 83.5% context capacity, compaction fires — the conversation is summarized and history is replaced by the summary. State not written to files or tasks is lost at this point.
Rules for long-running loops:
- Write all loop state to a file (
_work/loop-state.md) or the task work board before context reaches 70%. - At each iteration start: read the state file first, then act, then update the state.
- Use TaskCreate/TaskUpdate to track items — the work board survives compaction and session restarts.
- Prefer Monitor for event-triggered work — zero tokens between events vs a fixed loop that checks even when nothing changed.
Token cost estimate: a self-paced iteration at 2,000 prompt tokens with a standard model costs
approximately 1 USD per 500 iterations. A /loop 1m loop running 8 hours fires ~480 times.
Set the interval no shorter than the task actually requires.
8§ Self-termination patterns
Three reliable mechanisms for loops that should stop on their own:
- Prompt condition (self-paced only) — embed the check directly: "If all CI checks are green and there are no open review comments, output 'LOOP DONE' and do not call ScheduleWakeup." Claude ends the loop when the condition is met. Only works in self-paced mode — fixed-interval loops keep running regardless.
- Task sentinel — create a TaskCreate entry before starting. Each iteration calls TaskUpdate(status: "completed") when done. The loop prompt reads TaskGet at the start of each iteration; if status is "completed", skip all work and do not reschedule.
- File sentinel — write
_work/loop-donewhen the condition is met. The loop prompt checks for the file first: "If_work/loop-doneexists, do nothing and do not reschedule." Simple and survives compaction.
Recommendation: use self-paced mode + prompt condition for any loop with a natural end state. Reserve fixed-interval for loops that truly have no stopping condition (dashboards, health monitors) — and warn the user that they must press Esc manually.
9§ Platform caveats
- Bedrock / Vertex AI / Microsoft Foundry:
ScheduleWakeupis unavailable. Self-paced/loopfalls back to a fixed 10-minute interval, not user-configurable.loop.mdis ignored and bare/loopshows the usage message. - Disable loops in CI or pipeline contexts: set
CLAUDE_CODE_DISABLE_CRON=1in the environment or insettings.jsonunderenv. This blocks allCronCreate,CronList,CronDelete, and/loopcommands for the session. - 7-day expiry: all session-scoped cron tasks expire after 7 days.
claude --resumewithin 7 days restores them. After 7 days they are gone without warning — no notification, no error.
10§ Output contract
A valid loop setup produced by this skill must include:
- The exact
/loopcommand or CronCreate call with the final prompt - An explicit stopping condition in the prompt, or an acknowledgment that stop is manual-only
- Scope limits in the prompt
loop.mdwritten to the correct location if the user chose persistence- A platform caveat note if the current provider is Bedrock, Vertex AI, or Foundry
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

