loop-audit
Skill1 starsChanged 6 days agoMITView on GitHub
Designs or audits an unattended / scheduled agent loop before it is trusted to run unwatched. Pins down its 6-part contract (TRIGGER, SCOPE, ACTION, BUDGET, STOP, REPORT) and proves it cannot run away via three guardrails (iteration cap, no-progress detection, budget ceiling). Use when setting up a cron/launchd job or /loop, when a scheduled job spun without finishing or burned tokens for nothing, or when the user says "audit my nightly jobs", "is this loop safe to leave running", "harden the scheduled agents". Diagnoses only - never edits job scripts unless asked. Invoke with /loop-audit on a standalone install and /kaizen:loop-audit under the plugin. Also triggers on Ukrainian phrasings: "перевір нічні джоби".
3 other projects use a version of this.
Adopted by
Most recently taken up by
- HTMLGuyLLC/ClaudeSkillstheir own version, first seen Nov 1, 2026
- patr-coder/robobuilder-protheir own version, first seen Jul 3, 2026
- jpoindexter/ai-agent-skillstheir own version, first seen Jun 9, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- jpoindexter/ai-agent-skills★ 1same name
- HTMLGuyLLC/ClaudeSkills★ 0same name
- patr-coder/robobuilder-pro★ 0same name
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 repository8 other files it gives its agents.
- commitSkill
- fix-pr-commentsSkill
- githubSkill
- hoply-daySkill
- model-balanceSkill
- review-codeSkill
- self-learnSkill
- setupSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 67
If a job legitimately needs a background session (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
loop-audit - make an unattended loop provably safe before you walk away
A loop that runs while you sleep needs more than a cron line. Before you /schedule or
/loop anything, pin down its contract and prove it cannot spin forever, burn budget, or
"succeed" while achieving nothing. After it exists, audit it against the same checklist.
This complements the runners, it does not replace them: your scheduler (launchd, cron,
systemd) fires the job, /loop runs interactive loops, and your job log or digest reads the
results. This skill is the design contract and the guardrail audit that sits in front of all
of them.
The 6-part contract - answer all six, explicitly
| Part | Question | Smell of a bad answer |
| TRIGGER | What fires it, how often? | "whenever" with no stated cadence |
| SCOPE | Exactly what may it touch (repos, branches, files, envs)? | "the workspace" / unbounded |
| ACTION | The single job per tick? | three jobs crammed into one loop |
| BUDGET | Hard ceiling per run: max sub-agents, tokens/$, wall-clock? See references/subagent-guardrail-knobs.md for the concrete flags/env-vars. | none, or "the platform defaults cover it" on an ultracode-mode loop (they don't - see reference) |
| STOP | Exit rules (see guardrails below)? | only the time trigger |
| REPORT | Where the outcome + a status marker lands? | "it logs somewhere" |
A loop with a TRIGGER and no STOP is a bug, not a feature.
The three runaway guardrails - all three, every loop
- Iteration cap - a hard
MAX_ITER; never an unboundedwhile true. - No-progress detection - exit when the same error, an empty diff, or unchanged state repeats N times. Time and iteration caps alone do NOT catch a loop that looks busy but achieves nothing. This is the guardrail most setups are missing.
- Budget ceiling - a per-run token / dollar / sub-agent limit; stop the moment it is crossed.
Status markers - close the REPORT loop
Each run should emit an explicit terminal status, not just "it ran":
DONE / BLOCKED / INCOMPLETE / SKIPPED / AUTH_FAIL / TRANSIENT_FAIL. The REPORT reads the
marker, not a raw exit code. (The bundled lib/claude-retry.sh emits RETRY-WRAPPER: lines in
this vocabulary; new loops should emit the same so one digest can classify every job.)
Background-session autopush (since Claude Code 2.1.212)
Since Claude Code 2.1.212, a "background session" (as opposed to headless claude -p print-mode)
commits and pushes by default to preserve work, opening a draft PR only when the task calls for one.
A loop that spawns background sessions inherits this default even if the loop's own contract
never mentions git. Verify per job:
- Confirm the launchd
ProgramArgumentsinvokeclaude -p(headless, no autopush) rather than a daemon-managed background session.PlistBuddy -c "Print :ProgramArguments" <plist>on the job's~/Library/LaunchAgents/*.plist. - If a job legitimately needs a background session (e.g. it forks a long sub-task), check the SCOPE line names the exact repo/branch it may push to, and REPORT captures the push/PR link so it surfaces in your job digest rather than landing unnoticed.
Self-verification - something that can say no
"Half of loop engineering is design; the other half is something that can say no." Each tick:
act, then verify the state measurably changed (a test passed, a commit landed, a value was
written), then correct or exit. If verification fails twice on the same cause, mark BLOCKED
and stop - do not retry forever.
Audit checklist - run this over an existing loop
For each scheduled / looping job, confirm:
- STOP condition exists and is not merely the time trigger
- Iteration cap present (no unbounded
while) - No-progress / repeat-N exit present
- Per-run budget ceiling present - concretely:
--max-budget-usdset (mandatory if the loop runs at ultracode/high autonomy, since the count-based caps are not enforced there; seereferences/subagent-guardrail-knobs.md) - SCOPE narrowed to named repos / branches / files / envs
- Emits an explicit terminal status marker the REPORT reads
- Skip-permissions / destructive flags only inside an isolated worktree or container
- State persisted so a crash resumes from the last checkpoint, not from scratch
- If the job can spawn a 2.1.212-or-newer "background session" (
/bg, backgroundedclaude agents, background/fork) rather than headlessclaude -p, confirm its autopush behavior is accounted for - either the job only ever runs headless (no autopush), or any push it makes is scoped and expected, not a silent side effect
How to run
- Resolve targets. With an argument, audit that job or script. With none, find the scheduled
jobs:
launchctl list | grep -i claudeand the launchd plists under~/Library/LaunchAgents/(macOS),systemctl --user list-timers(Linux),crontab -l, plus anyscripts/*.shreferenced by skills such as self-learn.Grepthe scripts - do not dump them into context. - For each loop, fill in the 6-part contract from what the script actually does, then walk the audit checklist.
- Report a matrix:
loop | missing guardrails | suggested fix. Diagnose only - propose the fix, do not edit the job script unless the user asks.
Output
A per-loop table of which contract parts and guardrails are present vs missing, the single highest-risk gap per loop, and a one-line suggested fix. End with the count of loops audited and how many are fully guarded.
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.

