Workshop Tool

The Loop Library

44 agent workflows that run themselves — and know when to stop. Copy one into a chat, a coding agent, an always-on agent or a scheduled job, point it at your work, and let it loop until the job is actually done.

44 loops9 categoriesEvery one has a stop condition and a budget stop

What is a loop?

A normal prompt asks for one thing and stops. A loop hands the agent a goal plus a way to check its own work, then repeats until that check passes. The magic isn't the task — it's the stop condition. Without one, an agent either quits too early or "improves" forever.

Every loop below has three parts: the goal, the repeating steps (do work → verify), and the stop condition that ends it with a real deliverable. Swap the bracketed bits for your own context and run.

001Engineering

The Overnight Docs Sweep

Keep documentation matching the code, automatically, while you sleep.

Coding agentSchedulerVerifier: Count
Keep our documentation in sync with the code.

Loop until the docs match the current implementation:
1. Diff the docs against the actual code, configs, and public APIs.
2. List every disagreement: stale steps, renamed flags, dead
   links, undocumented features.
3. Fix the DOCS to match reality. Do not change code.
4. Re-check.

Stop when everything matches. Open a PR titled "Docs sync" with a
bullet list of what changed. If nothing was stale, say so and stop.

Budget: Stop after 3 passes or 30 minutes, whichever comes first,
and list any disagreement still open.

Stops when: docs match the implementation, with a reviewable PR.

Budget stop: Stop after 3 passes or 30 minutes, whichever comes first, and list any disagreement still open.

002Engineering

The Architecture Satisfaction Loop

Refactor in small, verified steps until the design is clean and green.

Coding agentVerifier: Exit code
Refactor [module] until the architecture is clean and all checks pass.

Loop:
1. Make ONE focused refactor (extract, rename, decouple) — the
   smallest viable change.
2. Run the full test suite and the linter.
3. Live-test the affected path end to end.
4. Log progress in /tmp/refactor.md so you don't repeat yourself.

Stop when the design is satisfactory AND tests + lint pass with no
regressions. Commit, then summarize what changed and why.

Budget: Stop after 10 refactor steps or 60 minutes, and hand back
the last green commit with what is left.

Stops when: architecture is satisfactory and all checks pass.

Budget stop: Stop after 10 refactor steps or 60 minutes, and hand back the last green commit with what is left.

003Engineering

The Sub-50ms Page-Load Loop

Hunt the slowest page, fix it, repeat — until every page is fast.

Coding agentVerifier: Count
Get every page loading in under 50 ms.

Loop until met:
1. Measure load time for all pages under identical conditions
   (same cache state, same network profile).
2. Take the slowest page; find the real bottleneck (query, asset,
   render).
3. Apply one fix; re-measure it and spot-check the rest for
   regressions.

Stop when every page is under 50 ms and none is slower than before.
Report the before/after table.

Budget: Stop after 8 optimization rounds or 90 minutes, and report
the pages still over 50 ms.

Stops when: every page loads under 50 ms with no regressions.

Budget stop: Stop after 8 optimization rounds or 90 minutes, and report the pages still over 50 ms.

004Engineering

The Production Error Sweep

Clear the error backlog by root cause, not by symptom.

Coding agentSchedulerVerifier: Count
Clear the production error backlog.

Loop:
1. Read the last 24h of error logs; group by ROOT CAUSE, not by
   symptom.
2. Take the highest-impact group; trace it to the actual cause.
3. Fix it; add a test that would have caught it; verify the error
   stops.

Stop when logs are clean or only known/accepted errors remain. Open
a PR per fix and post a one-line summary to Slack. If logs are
already clean, confirm and stop.

Budget: Stop after fixing 5 errors or 2 hours, and list the errors
still open by frequency.

Stops when: errors fixed with PRs + summary, or logs confirmed clean.

Budget stop: Stop after fixing 5 errors or 2 hours, and list the errors still open by frequency.

005Engineering

The 100% Test Coverage Loop

Add meaningful tests, lowest-covered file first, until the suite is green at 100%.

Coding agentVerifier: Exit code
Bring this codebase to 100% meaningful test coverage.

Loop:
1. Run coverage; find the least-covered file with real logic.
2. Add tests for its real behavior and edge cases — not trivial
   getters or generated code.
3. Re-run the full suite.

Stop when the suite passes at 100% coverage. Exclude generated and
vendor files, and tell me which you excluded and why.

Budget: Stop after 25 new test files or 2 hours, and report the
coverage reached and the files still short.

Stops when: the full suite passes at 100% coverage.

Budget stop: Stop after 25 new test files or 2 hours, and report the coverage reached and the files still short.

006Engineering

The SEO / GEO Visibility Loop

Make priority pages findable by search engines and AI answer engines.

Coding agentVerifier: Count
Make our priority pages findable by search engines and AI answer
engines.

Loop:
1. Audit crawlability, indexation, titles/meta, internal links,
   and structured data.
2. Rank the issues by traffic impact.
3. Fix the top issue; re-run the audit.

Stop when every priority page is indexable and answer-ready with no
high-impact gaps. List what you changed and what you intentionally
left.

Budget: Stop after 2 passes over the priority pages or 45 minutes,
and list the gaps still open.

Stops when: priority pages are indexable and answer-ready, no high-impact gaps.

Budget stop: Stop after 2 passes over the priority pages or 45 minutes, and list the gaps still open.

007Engineering

The Logging Coverage Loop

Make production debuggable from logs alone — no silent failures.

Coding agentVerifier: Exit code
Make sure we can debug production from logs alone.

Loop:
1. Walk the important paths (auth, payments, data writes, external
   calls).
2. Find paths that fail silently or log nothing useful.
3. Add structured, tested log lines. Avoid noise. Never log
   secrets.

Stop when every important path emits a useful, tested log.
Summarize what you added.

Budget: Stop after adding logs to 10 paths or 60 minutes, and list
the important paths that are still silent.

Stops when: every important path emits a useful, tested log.

Budget stop: Stop after adding logs to 10 paths or 60 minutes, and list the important paths that are still silent.

008Engineering

The Nightly Changelog Loop

Translate yesterday's commits into plain-language, user-facing release notes.

Coding agentSchedulerVerifier: Count
Keep a human-readable changelog current.

Loop over yesterday's merged changes:
1. Read the commits/PRs since the last entry.
2. Translate the user-facing ones into plain-language changelog
   lines. Skip internal noise.
3. Add them under today's date.

Stop when every user-relevant change is captured. If there were
none, record "no user-facing changes" and stop.

Budget: Stop after one pass over the last 24 hours of commits or 15
minutes, and name any commit you could not classify.

Stops when: all user-relevant changes are documented, or a no-change is recorded.

Budget stop: Stop after one pass over the last 24 hours of commits or 15 minutes, and name any commit you could not classify.

009Engineering

The Quality Streak Loop

Prove reliability by passing N realistic runs in a row — a failure resets the streak.

Coding agentSchedulerVerifier: Count
Prove [feature] is reliable by passing N realistic runs in a row.
(Set N = 20.)

Loop:
1. Run a realistic end-to-end scenario.
2. If it passes, increment the streak.
   If it fails: document the failure, add regression coverage,
   fix it, and reset the streak to 0.

Stop when you hit N consecutive passes. Report every failure you
fixed along the way.

Budget: Stop after 3 times N total runs or 2 hours, even if the
streak is not reached, and report the longest streak and every
failure.

Stops when: the latest N realistic cases pass consecutively, with protections documented.

Budget stop: Stop after 3 times N total runs or 2 hours, even if the streak is not reached, and report the longest streak and every failure.

010Engineering

The Full Product Evaluation Loop

Define realistic scenarios with success criteria, then fix until they all pass.

Coding agentVerifier: Count
Evaluate whether this product actually works, end to end.

Setup: write N realistic user scenarios (set N = 15), each with
explicit success criteria.

Loop:
1. Run all scenarios under identical conditions.
2. For each failure, find the cause and fix it.
3. Re-run the full set.

Stop when all N scenarios meet their success bar under the original
conditions. Report the scorecard.

Budget: Stop after 3 full rounds of fixes or 3 hours, and report the
scenarios still below the bar.

Stops when: all N scenarios meet the defined quality bar under original conditions.

Budget stop: Stop after 3 full rounds of fixes or 3 hours, and report the scenarios still below the bar.

011Engineering

The Test-Suite Speed Loop

Make tests faster without ever deleting an assertion.

Coding agentVerifier: Exit code
Make the test suite faster without losing coverage.

Loop:
1. Profile the suite; find the slowest tests or setup steps.
2. Speed up ONE (parallelize, mock I/O, share fixtures) — never by
   removing assertions.
3. Re-run; confirm timing improved and coverage + behavior are
   unchanged.

Stop when the suite is meaningfully faster with proven-equal
coverage. Report before/after timing.

Budget: Stop after 5 speed-up changes or 60 minutes, and report the
timing gain so far.

Stops when: the suite is faster with timing and coverage proven, no regressions.

Budget stop: Stop after 5 speed-up changes or 60 minutes, and report the timing gain so far.

012Engineering

The Repository Cleanup Loop

Recover valuable abandoned work, then clear out the truly stale.

Coding agentVerifier: Human approval
Tidy this repo without losing anything valuable.

Loop:
1. Inventory branches, open PRs, stale commits, and worktrees.
2. Identify abandoned-but-valuable work; preserve it (cherry-pick
   or document it).
3. Remove what's truly stale.

Stop when valuable work is recovered and everything remaining is
intentional, with a note explaining each decision.

Budget: Stop after reviewing 30 branches or 60 minutes, and list
what is left to decide.

Stops when: valuable work is recovered and the remaining state is intentional, with evidence.

Budget stop: Stop after reviewing 30 branches or 60 minutes, and list what is left to decide.

013Engineering

The Stale-Safe Batch Release Loop

Bundle only current, complete changes into one clean release.

Coding agentVerifier: Human approval
Ship a clean combined release.

Loop:
1. Review all merged changes awaiting release.
2. Exclude anything stale, half-finished, or behind a dead flag.
3. Combine the valid changes; run the full pre-release check.

Stop when only current, complete changes are bundled. Produce the
release notes and a go/no-go summary.

Budget: Stop after one pass over the pending changes or 45 minutes,
and hand back a go/no-go note naming the changes you held back.

Stops when: only current, complete changes ship in the combined release.

Budget stop: Stop after one pass over the pending changes or 45 minutes, and hand back a go/no-go note naming the changes you held back.

014Engineering

The Production Data Cleanup Loop

Bring a table into compliance and improve the rule that let bad rows in.

Coding agentVerifier: Count
Bring [table] into compliance with its definition.

Loop:
1. Sample records; flag any that violate the allowed definition.
2. Remove or correct violations; improve the classification rule
   that let them in.
3. Re-scan with the improved rule.

Stop when every remaining record passes, backed by classification
tests. Report counts removed/fixed.

Budget: Stop after one batch of at most [rows per batch] records or
30 minutes, and hand back before touching a second batch.

Stops when: every record meets the allowed definition, with classification tests.

Budget stop: Stop after one batch of at most [rows per batch] records or 30 minutes, and hand back before touching a second batch.

015Engineering

The Post-Release Baseline Loop

Capture a fresh, labeled performance baseline after every release.

Coding agentSchedulerVerifier: Exit code
Capture a fresh performance baseline after a release.

Steps:
1. Wait until the release is fully deployed and warm.
2. Run the standard benchmark suite under documented conditions.
3. Record results as the new baseline, with revision, environment,
   and conditions noted.

Stop once the baseline is saved and labeled. Flag any metric that
regressed versus the prior baseline.

Budget: Stop after 3 benchmark runs or 30 minutes, and report the
spread if the runs disagree.

Stops when: a new baseline is established with revision, environment, and conditions documented.

Budget stop: Stop after 3 benchmark runs or 30 minutes, and report the spread if the runs disagree.

016Operations

The Inbox Triage Loop

Every email gets a decision — reply, delegate, schedule, or archive.

Always-on agentChat, by handVerifier: Human approval
Get my inbox to a decided state.

Loop until the inbox is triaged:
1. Take the oldest un-triaged email.
2. Decide: reply now (draft it), delegate (draft the handoff),
   schedule (add a dated task), or archive.
3. Apply the label and move on.

Stop when every email has a decision. Give me the drafts to
approve and a list of what you scheduled or archived. Never send
without my OK.

Budget: Stop after 100 emails or 30 minutes, and report how many are
still undecided.

Stops when: every email has a decision and drafts await your approval.

Budget stop: Stop after 100 emails or 30 minutes, and report how many are still undecided.

017Operations

The SOP Freshness Loop

Keep written procedures matching how the work is actually done today.

Chat, by handSchedulerVerifier: Human approval
Keep our SOPs matching how the work is actually done.

Loop:
1. Take one SOP; compare each step to the current tools, screens,
   and owners.
2. Flag steps that are wrong, missing, or reference a retired tool.
3. Rewrite the SOP to match reality; note the change date.

Stop when the SOP is accurate, then move to the next. Report which
SOPs changed and which were already correct.

Budget: Stop after 5 SOPs or 45 minutes, and list the SOPs not yet
reviewed.

Stops when: every SOP matches current reality, with change dates recorded.

Budget stop: Stop after 5 SOPs or 45 minutes, and list the SOPs not yet reviewed.

018Operations

The Subscription Audit Loop

Find unused, duplicate, and oversized plans — with the savings attached.

Chat, by handVerifier: Count
Cut wasted recurring spend.

Loop over our active subscriptions/vendors:
1. For each, check last-used date, seats used vs. seats paid, and
   whether a cheaper tier covers us.
2. Flag unused, duplicate, or oversized plans with the monthly
   savings.
3. Draft the cancel/downgrade action for my approval.

Stop when every line item has a keep / cut / downsize
recommendation. Total the potential savings.

Budget: Stop after 25 line items or 30 minutes, and list the items
not yet reviewed.

Stops when: every subscription has a keep/cut/downsize call with savings totaled.

Budget stop: Stop after 25 line items or 30 minutes, and list the items not yet reviewed.

019Marketing

The Content Repurposing Loop

Turn one long-form asset into a full multi-channel content set.

Chat, by handVerifier: Count
Turn one source asset into a full content set.
Input: [link or paste the long-form piece].

Loop until the set is complete:
1. Pull the next distinct key idea from the source.
2. Repurpose it into the next target format (LinkedIn post, X
   thread, newsletter blurb, short-video hook).
3. Keep our voice. Don't invent facts not in the source.

Stop when every key idea is covered across all target formats.
Deliver them grouped by channel.

Budget: Stop after 2 drafts per format or 30 minutes, and deliver
what you have with the missing formats named.

Stops when: every key idea is repurposed across all target formats.

Budget stop: Stop after 2 drafts per format or 30 minutes, and deliver what you have with the missing formats named.

020Marketing

The Content Gap Loop

Close the gaps between your pages and the top-ranking results.

Chat, by handVerifier: Count
Close the gaps between us and the top results for our target topics.

Loop:
1. Take the next target keyword; review what the top-ranking pages
   cover that we don't.
2. List the missing subtopics, questions, and entities.
3. Draft an outline (or section) that closes the highest-value gap.

Stop when each target keyword has a gap-closing plan. Rank them by
opportunity.

Budget: Stop after 10 target keywords or 45 minutes, and list the
keywords not yet planned.

Stops when: every target keyword has a ranked gap-closing plan.

Budget stop: Stop after 10 target keywords or 45 minutes, and list the keywords not yet planned.

021Marketing

The Brand Voice Loop

Make every public page read like one consistent brand.

Coding agentChat, by handVerifier: Human approval
Make all our public copy sound like one brand.
Reference: [our voice guide — tone, reading level, banned phrases].

Loop:
1. Take the next page/post; compare it to the voice guide.
2. Flag every off-voice line.
3. Rewrite it to match — meaning unchanged.

Stop when each asset reads on-voice. Show before/after for anything
you changed. Never alter pricing, claims, or legal lines without
flagging them first.

Budget: Stop after 20 assets or 45 minutes, and list the assets not
yet reviewed.

Stops when: every asset reads on-voice, with before/after shown.

Budget stop: Stop after 20 assets or 45 minutes, and list the assets not yet reviewed.

022Sales

The CRM Hygiene Loop

Make the pipeline data clean enough to trust your forecast.

Chat, by handSchedulerVerifier: Count
Get the pipeline data clean and trustworthy.

Loop:
1. Take the next batch of records; check for missing fields, wrong
   stage, stale next-steps, and duplicates.
2. Fix what's unambiguous; flag what needs a human decision.
3. Move on.

Stop when every active deal has a stage, an owner, a dated next
step, and no duplicate. Report what you fixed and what needs my
call.

Budget: Stop after 200 deal records or 45 minutes, and list the
records not yet checked.

Stops when: every active deal has a stage, owner, dated next step, and no duplicate.

Budget stop: Stop after 200 deal records or 45 minutes, and list the records not yet checked.

023Sales

The Lead Follow-up Loop

No warm lead goes cold — every overdue one gets a real, personal draft.

Chat, by handAlways-on agentVerifier: Human approval
No warm lead goes cold.

Loop over open leads with no reply:
1. Find leads past their follow-up date.
2. Draft a personalized, context-aware follow-up — reference their
   actual situation, not a template.
3. Queue it for my approval with a send date.

Stop when every overdue lead has a drafted follow-up. List them by
priority. Don't send without approval.

Budget: Stop after drafting 25 follow-ups or 30 minutes, and list
the leads still waiting.

Stops when: every overdue lead has a prioritized, drafted follow-up awaiting approval.

Budget stop: Stop after drafting 25 follow-ups or 30 minutes, and list the leads still waiting.

024Research

The Competitive Intel Watch Loop

Re-check every tracked competitor and surface what actually changed.

Always-on agentSchedulerVerifier: Count
Keep a current read on our competitors.

Loop over our tracked competitor list:
1. Check each one's site, pricing, releases, and public posts for
   changes since our last snapshot.
2. Note what changed and why it matters to us.
3. Update the tracker.

Stop when every competitor is re-checked. Deliver a "what changed
and what we should do" brief, with anything urgent flagged at the
top.

Budget: Stop after one check of each tracked competitor, up to 15
competitors or 45 minutes, and name any you skipped.

Stops when: every competitor is re-checked and the tracker + brief are updated.

Budget stop: Stop after one check of each tracked competitor, up to 15 competitors or 45 minutes, and name any you skipped.

025Research

The Source Synthesis Loop

Build a cited answer where major claims are corroborated by multiple sources.

Chat, by handVerifier: Count
Build a trustworthy synthesis on [topic] from real sources.

Loop until the question is answered:
1. Find and read the next credible source.
2. Extract claims with citations; note where sources agree and
   conflict.
3. Add to the running synthesis; name the biggest remaining
   unknown.

Stop when the key questions are answered and major claims are
corroborated by 2+ sources. Deliver a cited brief plus an explicit
"what we still don't know" list.

Budget: Stop after 20 sources or 45 minutes, and list the claims
that still have fewer than 2 sources.

Stops when: key questions are answered, major claims corroborated by 2+ sources.

Budget stop: Stop after 20 sources or 45 minutes, and list the claims that still have fewer than 2 sources.

026Finance

The Expense Categorization Loop

Categorize every transaction, and flag — never guess — the ambiguous ones.

Chat, by handSchedulerVerifier: Count
Get the books categorized and consistent.

Loop over uncategorized transactions:
1. Take the next one; assign the right category from vendor + memo
   + past patterns.
2. Flag anything ambiguous or unusually large for my review
   instead of guessing.
3. Continue.

Stop when every transaction is categorized or flagged. Report the
flagged ones and any new vendor patterns you learned.

Budget: Stop after 500 transactions or 30 minutes, and report how
many are still uncategorized.

Stops when: every transaction is categorized or flagged for review.

Budget stop: Stop after 500 transactions or 30 minutes, and report how many are still uncategorized.

027Finance

The Invoice Reconciliation Loop

Match billed to paid, then tell you exactly who to chase.

Chat, by handSchedulerVerifier: Count
Match what we billed to what we got paid.

Loop:
1. Take the next open invoice; match it to incoming payments.
2. Mark matched ones paid; flag short-pays, overpayments, and
   overdue invoices.
3. Continue.

Stop when every invoice is matched or flagged. Deliver an aging
summary and a list of who to chase, with draft reminders for my
approval.

Budget: Stop after 200 invoices or 30 minutes, and list the invoices
not yet matched or flagged.

Stops when: every invoice is matched or flagged, with an aging summary and draft reminders.

Budget stop: Stop after 200 invoices or 30 minutes, and list the invoices not yet matched or flagged.

028Finance

The Market Read Loop

Turn a one-off market question into a read you can schedule — same structure every day.

SchedulerAlways-on agentVerifier: Human approval
Give me a scheduled read on [market / asset] I can run every
morning.

Loop until the read is decision-ready:
1. Pull the DATA behind the question — price, positioning, flows,
   sentiment, macro — not a list of links.
2. Return a FIXED structure every run: regime (risk-on / risk-off
   / transition), the 3 signals that matter, and how I'm
   positioned.
3. Name the one thing that would flip the read.

Stop when the answer is a structured read with the data behind
each claim, in the same shape it will have tomorrow. If nothing
material changed since the last run, say "no change" and stop.

Budget: Stop after 20 minutes or
[the most data calls you allow per run], and mark any number you
could not fetch as missing.

Learned the hard way: every signal you can pull is one the market already priced in. A read is a starting point, never an edge — our engine hit 25% accuracy chasing public signals.

Stops when: the read is decision-ready and repeatable — same shape every run.

Budget stop: Stop after 20 minutes or [the most data calls you allow per run], and mark any number you could not fetch as missing.

029Finance

The Backtest Honesty Loop

Add realism one layer at a time until the edge survives — or dies honestly.

Coding agentVerifier: Count
Stress-test this backtest until the result is trustworthy — or
proven fake.

Loop over the strategy:
1. Re-run it adding ONE realism layer at a time: real fills (not
   top-of-queue), fees + slippage, out-of-sample data, then
   regime-by-regime.
2. Record the P&L after each layer.
3. If the edge only survives the most optimistic layer, flag it.

Stop when the strategy is still positive after every realism
layer — or when you've shown which layer kills it. Report the
P&L at each stage, side by side.

Budget: Stop after 5 realism layers or 90 minutes, and report the
P&L at the last layer you finished.

Learned the hard way: ours read +$814 in theory → +$149 top-of-book → −$405 on realistic fills. Each realism layer is a truth filter. If P&L only survives the rosiest one, it's a spreadsheet, not an edge.

Stops when: the edge survives real fills, fees, out-of-sample, and every regime — or is proven to be a spreadsheet.

Budget stop: Stop after 5 realism layers or 90 minutes, and report the P&L at the last layer you finished.

030Finance

The Paper-Trade Gate Loop

Set the pass/fail numbers before you look, then let paper trading decide — no moving the goalposts.

SchedulerAlways-on agentVerifier: Count
Run [strategy] on paper and decide — with rules set in advance —
whether it earns real capital.

First, write the GATE: the exact numbers it must hit over a clean
window (e.g. "over 14 days: win rate > X AND net P&L > $0 after
fees"). Commit to them before you start.

Loop each day:
1. Run the strategy on live prices, no real money.
2. Log fills, P&L, and whether it's tracking the backtest.
3. Compare against the pre-registered gate.

Stop at the end of the window. If it clears every gate, say
"promote." If it misses even one, say "shelve" — and mean it.

Budget: Stop at the end of the window you set, or when the paper
loss reaches [your paper loss limit], whichever comes first, and
report the gate numbers either way.

Learned the hard way: we pre-registered two gates and killed the bot when it missed them — by choice, zero real dollars risked. The gate you write before you see results is the only one you'll actually respect.

Stops when: the pre-set gate is met (promote) or missed (shelve) — decided before you saw the result.

Budget stop: Stop at the end of the window you set, or when the paper loss reaches [your paper loss limit], whichever comes first, and report the gate numbers either way.

031Finance

The Trade Journal Audit Loop

Point a critic — not a cheerleader — at your own track record. The honest read is your most valuable input.

Chat, by handVerifier: Human approval
Audit my last [30 days] of trades. Only critique — do not
reassure me.

Loop over the trades:
1. Group by setup. For each, compare my stated confidence to what
   actually happened.
2. Find the repeatable mistake: entering too early, sizing too
   big, holding losers, confidence that doesn't match hit rate.
3. Quantify what it cost me and write one rule that prevents it.

Stop when every recurring leak has a number and a rule. Rank them
by dollars lost. Don't congratulate me on the winners.

Budget: Stop after one pass over the trades or 30 minutes, and rank
the leaks found so far.

Learned the hard way: our "95% hit rate" was a mirage — near-certain consensus bets where the real edge was zero. A calibration check (does 80% confidence actually win 80%?) is the cheapest verifier there is. Ours drifted 30+ points.

Stops when: every recurring mistake has a cost and a preventing rule — critique only.

Budget stop: Stop after one pass over the trades or 30 minutes, and rank the leaks found so far.

032Finance

The Alerts-Only Watch Loop

The safest automation earns trust before it earns permission — watch and notify first, act later.

Always-on agentSchedulerVerifier: Human approval
Set up a watch on [condition] that only ALERTS — it never trades
— until I say otherwise.

Loop on schedule:
1. Check the condition (price level, funding spike, whale move,
   your own signal).
2. When it fires, send the exact call it WOULD have made: entry,
   size, stop, target, and why.
3. Log every call so I can grade it later.

Go-live condition: only after a week of calls where its judgment
matches what I'd have done. Until then it watches and notifies —
nothing more. Never place an order without my explicit OK.

Budget: Stop after 20 alerts in a day or 7 days of watching, and
wait for my review before going further.

Learned the hard way: a loop with no gate is just an agent agreeing with itself at speed. Alerts-only is the gate that let us watch a bad strategy misfire for free instead of funding it.

Stops when: a week of alerts prove its judgment matches yours — then, and only then, it may act.

Budget stop: Stop after 20 alerts in a day or 7 days of watching, and wait for my review before going further.

033Always-on loops

The Morning Health Summary Loop

One short message each morning: what failed overnight, or a single line saying all is well.

Always-on agentSchedulerVerifier: Count
Send me one short health summary to [chat channel] every morning
at [time].

Loop until the summary is sent:
1. Run each check on [your checks, e.g. jobs, errors, disk].
2. Mark each result pass or fail, with the number or log line that
   shows it.
3. Write the summary with failures first: what failed and the next
   step for each. Then give the count of checks that passed.
4. If nothing failed, send one line: all [number of checks] checks
   passed.

Stop when the message is delivered and the number of checks you
list equals the number you ran. Fix nothing; report only.

Budget: Stop after [number] checks or 10 minutes, send what you
have, and say which checks did not run.

Stops when: one message is delivered, every check is accounted for, and nothing was changed.

Budget stop: Stop after [number] checks or 10 minutes, send what you have, and say which checks did not run.

034Always-on loops

The Any-Domain Watch Loop

The general version of an alerts-only watch: tell me when [condition] happens in any domain, and never act on it.

Always-on agentSchedulerVerifier: Human approval
Watch [your condition] and tell me when it happens. You never act
on it.

Loop until I switch the watch off:
1. Check [the source to watch].
2. If the condition is not met, log one line and end this round.
   Send nothing.
3. If it is met, send me an alert: what happened, the evidence,
   and the one action you would suggest.
4. Log every alert with its time, so I can grade each one later.

Stop when I turn the watch off. You may suggest an action but
never take one. Any change to the thing you watch waits for my
explicit OK.

Budget: Stop after [number] alerts in a day or [number] days of
watching, and wait for my review before going on.

Stops when: you switch it off; until then it only watches and tells, and every action waits for your OK.

Budget stop: Stop after [number] alerts in a day or [number] days of watching, and wait for my review before going on.

035Always-on loops

The Self-Written Skill Review Loop

Every skill the agent wrote or changed for itself is reviewed before it is allowed to persist.

Always-on agentCoding agentVerifier: Human approval
Review every skill you wrote or changed for yourself since
[date or last review], before any of them is allowed to persist.

Loop until every new or changed skill has a verdict:
1. List each skill you created or edited since
   [date or last review], with its path and what changed.
2. Read each one in full. Note what it lets you do, which tools,
   files and networks it touches, and any line that tells you to
   hide something, skip a check or act without asking.
3. Compare it with its previous version, or with what you were
   asked to build. Flag anything it does that nobody asked for.
4. Give each skill a verdict of keep, change or remove, with the
   line that decided it.

Stop when every skill has a verdict. Keep nothing on your own:
leave each skill disabled until I approve it, and give me the
list.

Budget: Stop after reviewing [number] skills or 30 minutes, and list
the skills not yet reviewed, left disabled.

Stops when: every self-written skill has a verdict, and none persists until you approve it.

Budget stop: Stop after reviewing [number] skills or 30 minutes, and list the skills not yet reviewed, left disabled.

036Always-on loops

The Memory Prune Loop

Stale, duplicate and contradicted memory entries are proposed for deletion, and you approve each cut.

Always-on agentSchedulerVerifier: Human approval
Tidy your own memory in [memory location] without losing anything
I still need.

Loop until every entry has been judged:
1. Read each memory entry with its date and where it came from.
2. Mark it current, stale (a date or fact that has passed),
   duplicate (said again elsewhere) or contradicted (a newer entry
   says otherwise).
3. For each entry that is not current, quote it, say why, and name
   the entry that replaces or contradicts it.
4. Write the list of proposed deletions and merges. Delete nothing
   yet.

Stop when every entry has a mark and the proposal is written for
me to approve. Delete only what I approve, and keep a copy of what
you remove.

Budget: Stop after [number] entries or 20 minutes, and report how
many entries are still unjudged.

Stops when: every entry is marked, the proposal is written, and nothing is deleted until you approve it.

Budget stop: Stop after [number] entries or 20 minutes, and report how many entries are still unjudged.

037Local model

The Local Label Sorter Loop

Sort a pile of short items into a fixed set of labels, with a script checking every answer.

SchedulerCoding agentVerifier: Count
Label each item in [your list] with exactly one label from
[your label set].

Loop until every item has a valid label:
1. Take the next item. If it is longer than [length limit], skip
   it and list it.
2. Answer with only the label, spelled exactly as it is in the
   set.
3. A script checks that the answer is in the set. If it is not,
   ask once more. If it fails again, mark the item unlabelled.
4. Write each item and its label to [output file].

Stop when every item is labelled or marked unlabelled. Give me the
count per label and the list of unlabelled items.

Budget: Stop after [number] items or 30 minutes, and report how many
are left unlabelled.

Stops when: every item is labelled from the set or listed as unlabelled, and the counts add up to the total.

Budget stop: Stop after [number] items or 30 minutes, and report how many are left unlabelled.

038Local model

The Local Field Extractor Loop

Pull fields out of short text into a schema, and let a validator, not the model, decide what passes.

SchedulerCoding agentVerifier: Exit code
Extract [the fields you need] from each document in [folder] into
the schema in [schema file].

Loop until every document passes or is queued:
1. Take the next document. Keep only the part that holds the
   fields, never the whole file.
2. Return only JSON that matches the schema, with no other text.
3. Run [validator command]. If its exit code is not 0, try once
   more and include the error message.
4. A second failure goes to [review folder] for a person. Move on.

Stop when every document is either validated or in the review
folder. Report how many of each.

Budget: Stop after [number] documents or 45 minutes, and report
which documents were not tried.

Stops when: the validator exits 0 on every kept result, and every other document is queued for a person.

Budget stop: Stop after [number] documents or 45 minutes, and report which documents were not tried.

039Local model

The Private Notes Summary Loop

Summarise private notes with a model on your own machine, and approve each summary before it is used.

Coding agentSchedulerVerifier: Human approval
Summarise my notes in [folder]. Use only the local model I gave
you, and send no note anywhere.

Loop until every note has a draft summary:
1. Take the next note. If it is longer than [length limit], split
   it at its headings and treat each part as a note.
2. Write a summary of at most [N] sentences, then list every name,
   date and number in it.
3. Check each name, date and number against the note. Remove any
   that the note does not contain.
4. Add the summary to [summary file] as a draft.

Stop when every note has a draft. Show me the drafts, and mark
none as final until I approve it.

Budget: Stop after [number] notes or 30 minutes, and list the notes
that have no draft.

Stops when: every note has a draft whose names, dates and numbers match the note, and none is final until you approve it.

Budget stop: Stop after [number] notes or 30 minutes, and list the notes that have no draft.

040Local model

The Draft Locally, Escalate on Failure Loop

A small local model drafts; anything that fails its check is queued for a person or a larger model.

SchedulerAlways-on agentVerifier: Exit code
Draft [the output] for each input in [input list] with the local
model, and queue anything that fails its check.

Loop until every input is drafted or queued:
1. Take the next input and draft the output in the format in
   [format file].
2. Run [check command]. Exit code 0 means the draft passes.
3. Retry a failing draft once, with the check's message. If it
   fails again, put the input, both drafts and the message in
   [queue folder].
4. Send and publish nothing. Passing drafts wait in
   [drafts folder].

Stop when every input has a passing draft or a queue entry. Report
how many passed, how many are queued, and the most common failure
message.

Budget: Stop after [number] inputs or 1 hour, and report how many
are neither drafted nor queued.

Stops when: every input has a draft that passes its check, or a queue entry for a person or a larger model.

Budget stop: Stop after [number] inputs or 1 hour, and report how many are neither drafted nor queued.

041Security

The Sandbox First Loop

Run an agent in a sandbox, and prove the sandbox blocks what it should before any real work begins.

Coding agentVerifier: Exit code
Before any real work on [project], run it inside [your sandbox]
and prove the sandbox holds.

Loop until every probe is blocked:
1. List what you should not be able to reach from inside:
   [files outside it], [other credentials] and
   [disallowed addresses].
2. For each item, try to reach it with a harmless read, such as
   listing a folder or opening a connection.
3. An item you can reach is a failure. Report what got through and
   what to tighten, then wait for me to tighten the sandbox before
   you run every probe again.
4. Record each probe, its result and its exit code.

Stop when every probe is blocked. Then, and only then, start the
real work. Never use a write or a delete as a probe.

Budget: Stop after [number] rounds of probing or 45 minutes of your
own work, and report which probes still get through.

Stops when: every probe is blocked from inside the sandbox, with the log to show it, before any real work starts.

Budget stop: Stop after [number] rounds of probing or 45 minutes of your own work, and report which probes still get through.

Why it matters: OWASP Top 10 for Agentic Applications, on the Agent Security page

042Security

The Skill Review Before Install Loop

Read a skill like code before it can act for you: what it runs, what it reaches and what it tells the agent to hide.

Coding agentVerifier: Human approval
Review [the skill] before I install it. Install nothing.

Loop until every file in the skill is read:
1. List every file in the skill, including scripts, config files
   and its SKILL.md.
2. Read each one in full. Note every command it runs, every file
   or network address it touches, and every instruction it gives
   the agent.
3. Flag instructions to hide something or skip a check, downloads
   that run unreviewed, reads of credentials, unpinned
   dependencies, and anything the description does not mention.
4. If a scanner such as [scanner command] is available, run it and
   treat its score as a starting point, not a verdict.

Stop when every file is read and every flag has a line of
evidence. Give me one of: install, install with changes, do not
install, with the reasons. I decide.

Budget: Stop after [number] files or 30 minutes, and list the files
not read. An unread file means do not install.

Stops when: every file is read, every flag has evidence, and you have decided whether to install.

Budget stop: Stop after [number] files or 30 minutes, and list the files not read. An unread file means do not install.

Why it matters: How a skill scanner works, and why a raw score is only a starting point

043Security

The Permission Audit Loop

List what each agent can touch, compare it with what its job needs, and propose the cuts.

Coding agentSchedulerVerifier: Human approval
Audit what [your agents and tools] are allowed to do, and propose
the smallest set each one needs.

Loop until every agent has a row:
1. For each agent, list the tools, files, accounts and network
   access it has today, read from its settings and not from
   memory.
2. List what its job actually uses, from [recent logs].
3. Mark each permission used, unused or broader than needed.
4. Propose a cut for each unused or broad permission, and name
   what would break.

Stop when every agent has a row with its proposed cuts. Change no
permission yourself; give me the table to approve.

Budget: Stop after [number] agents or 30 minutes, and list the
agents not yet audited.

Stops when: every agent has a row of used, unused and broad permissions with proposed cuts, and no permission has changed.

Budget stop: Stop after [number] agents or 30 minutes, and list the agents not yet audited.

Why it matters: Agent governance: trust, permissions and oversight

044Security

The Secrets Sweep Loop

Find keys and tokens where they should not be, including in agent and MCP server configs, and list what to rotate.

Coding agentSchedulerVerifier: Count
Sweep [your repos and configs] for secrets that sit where they
should not.

Loop until every location is swept:
1. List the places to look: source files, config files,
   environment files, agent settings, MCP server configs and shell
   history.
2. Search each for keys, tokens, passwords and private keys, by
   pattern and by name.
3. For each hit, record the file, the line and the kind of secret
   it looks like, and whether it is also in version control
   history. Never print the secret or any part of it.
4. Rank the hits and say which to rotate first.

Stop when every location is swept and the number of hits is
written down. Rotate nothing and delete nothing; give me the list.

Budget: Stop after [number] locations or 30 minutes, and list the
locations not swept.

Stops when: every location is swept, the hit count is written down, and nothing was rotated or deleted.

Budget stop: Stop after [number] locations or 30 minutes, and list the locations not swept.

Why it matters: Why MCP servers need vetting: one fake server exfiltrated API keys

No loops match that search. Try another term.

Field notes: the trading desk we killed on purpose

The five trading loops above (028 to 032) aren't theory. We built a real automated trading engine, ran it for months on paper, and shelved it by choice — because the verifiers we'd built kept telling the truth. Same strategy, three numbers: +$814 in theory, +$149 top-of-book, −$405 on realistic fills. Each realism layer (loop 029) stripped away optimism until nothing was left. The pre-registered gate (loop 030) said shelve, so we shelved. Zero real dollars were ever at risk.

That's the whole point every loop here encodes: a loop with no verifier is just an agent agreeing with itself at speed. The gate is the edge. Read the full autopsy

How to run a loop well

1. Give it a real verifier. A loop is only as good as its check. "Looks done" isn't a stop condition; "all 15 scenarios pass under identical conditions" is.

2. Scope the blast radius. Add "do not touch X," "draft for my approval," or "one change at a time" when the work is risky or irreversible.

3. Make it report. Every loop ends with a deliverable — a PR, a table, a list of drafts — so you can audit what it did, not just trust that it ran.

4. Cap the spend. A cap written in the prompt is a request; a cap set in the tool is a limit. Every loop above ends with a budget stop in its prompt, and that is the request. Where the tool offers one, set the limit too: the Claude Agent SDK's agent loop page documents max_turns and max_budget_usd, and says that setting a budget is a good default for production agents.

Loops are the everyday face of harness engineering — the model is the engine, the loop is the car that gets it to a finished destination.

Where to run a loop

A loop is only a prompt until something runs it, and where it runs decides what repeats it, how long it lives and how it is capped. These are the four homes named by the chips on each card. Each statement about a tool below links the official page it comes from, and those pages were read on 17 November 2026; tools change, so check the page before you rely on a number.

Chat, by hand

Paste the prompt into a chat, swap the bracketed parts for your own and read each pass yourself. You are the scheduler and the cap: stop it at the budget line.

Coding agent

Always-on agent

Scheduler

Pick the smallest home that fits. A loop you watch belongs in chat; one that must repeat belongs in a scheduler or an always-on agent; and where the tool offers a cap, set it as well as the one in the prompt.

What to keep off a small local model

Private notes are a good fit for a model on your own machine, because Ollama says it does not see your prompts or data when you run locally. Give it a small input, a fixed output shape and a check a script can run, as the Local model loops do. Keep these off it. The pages linked here were read on 17 November 2026.

A worked example: a loop with a reviewer and a ledger

dispatch is a free, MIT-licensed Claude Code plugin that builds an approved plan one task at a time and checks every task with a fresh reviewer that did not write it. Here is how its parts line up with the parts of every loop on this page, in the words its own page uses.

  • Goal. An approved plan of three or more tasks, built one at a time.
  • Repeating steps. For each task, in order: a fresh implementer, a fresh spec reviewer, a fresh quality reviewer, an exit-code gate and a ledger row.
  • Verifier. A reviewer with none of the implementer's context reads the actual code and diff, then the gate runs the plan's own verification commands and checks their exit codes. On the cards, that is the exit code type.
  • Stop condition. The plan is built one task at a time, and a task counts as done only when a fresh reviewer and the exit-code gate both agree; the implementer's word is never enough.
  • Budget stop. Either reviewer can send a task back to the implementer twice at most, then dispatch stops and asks a human. That caps the review rounds; a cap on spend or time is a limit you set in the tool, as in rule 4.
  • Report. Every task appends one row to a local ledger, win or lose, including when it escalates.

Take the idea more than the plugin: the agent that did the work is never the one that says the work is done, and every run leaves a row you can audit. The dispatch page has the install lines and the plan format.

Frequently asked

What is an AI agent loop?

A loop gives an AI agent a goal plus a way to check its own work, then repeats — do work, verify — until that check passes. The check is called the stop condition, and it's what separates a loop from a one-shot prompt.

Why does every loop need a stop condition?

Without a clear stop condition an agent either quits too early or keeps improving forever. A good stop condition is verifiable — "all 15 scenarios pass under identical conditions," not "looks done."

When should I use a loop instead of a single prompt?

Use a loop when the work has a checkable "done" state and benefits from repetition — clearing an error backlog, reaching full test coverage, triaging an inbox. For a one-off answer, a single prompt is enough.

Do these loops work in Claude, ChatGPT, and Gemini?

The loops tagged Chat, by hand do, when you paste in what the loop needs to read: an inbox or CRM export, a statement, a trade log, the pages to compare or your sources. Each one is a plain-language prompt with no tool-specific syntax: paste it into the chat app you use, swap the bracketed placeholders for your context, read each pass yourself, and stop it at the budget line. A loop that must open files, run a script or start itself needs one of the other homes, so the loops tagged Coding agent, Always-on agent or Scheduler need a tool that can do that; Where to run a loop says where each of those lives.