# "I was building loops wrong..."
<!--
ref: @content/youtube/ai-jason/i-was-building-loops-wrong
tags: [loop engineering, agent loops, triggers, verifiers, loop contract, self-improvement]
version: 2
updated_at: 2026-11-22T13:41:38.194Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=JQ_We_ztxrI)**

# I was building loops wrong...

*Synthesized from AI Jason, 2026-07-13.*

AI Jason presents solo, describing loops his team has run for months to maintain their codebase and customer operations.

## Core Thesis
AI Jason argues that putting an agent in a loop is only about 5% of the work; the real work is designing safeguards so you can step away. He describes a structure of loop contract, trigger and agent that has driven his company's loops for months, including bug-fix PRs every 30 minutes, support triage and a CRM lifecycle process.

## Key Insights
- **Loop contract.** One markdown file per loop (in a loops folder) holding goal and finish line, boundaries on what the agent may do alone versus delegate to a human, SOPs, a small long-term state section and an append-only journal so the loop does not reopen the same noise daily. Small loops can keep all of it in one file.
- **Example loops.** A daily React Doctor scan that picks the most critical issue and fixes it in an isolated subagent, with a dashboard tracking PRs and health score; a daily CRM loop segmenting users (small influencers, disappointed users, engaged free users) that sends messages or drafts them depending on risk.
- **Four trigger types.** Goal-style while loops until a condition or limit; scheduled wake-ups; event-based triggers via a local daemon with a webhook URL (for example, a crash event from Render); and a combined trigger where a script such as an Intercom fetch for the last 30 minutes only wakes the agent if there is real work, which he found cheapest.
- **Agent roles.** Collect and prioritize, execute, then verify. For serious work an orchestrator plans, executors work in parallel branches, and a verifier adds evidence to the PR, for example via Playwright CLI recordings and CrabBox remote sandboxes. He packaged this as a Verifier Setup toolkit.
- **Evolution loop.** Every five to ten runs an evolution session reviews config, logs and history to refine the contract, prune state and script repetitive steps; it was in such a session that a software trigger to wake the agent only when needed was set up.
- **Documentation maintenance starter loop.** Daily, compare the last 24 hours of changes with the readme, setup guide and examples, fix discrepancies and open a PR. One contract rule forbids rewriting documentation for no reason, since agents tend to act even when unneeded.
- **Tooling.** An open-source tool (Loopnney in the transcript) manages triggers, logs, dashboards and the evolution trigger, with templates such as documentation upkeep and React Doctor.

## Actionable Takeaways
1. Create a loop folder per loop with a contract, state and journal in one markdown file.
2. Pick the trigger by cost: use a pre-check script so the agent runs only when new work exists.
3. Add a verifier that attaches evidence to every PR for work touching code or customers.
4. Run an evolution session every five to ten runs, and add explicit do-not-touch rules to the contract.

## Notable Quotes
> "The real work is how to design safeguards that allow you to step away from the process." — AI Jason

---

*Related: `@content/youtube/yifan-bth/i-reverse-engineered-claude-code-learn-these-agent-tricks` · `@content/youtube/cole-medin/the-creators-of-claude-code-and-openclaw-don-t-prompt-their-agents-anymore` · `@content/youtube/david-ondrej/my-1-000-fable-5-2-workflow-just-copy-me` · `@content/youtube/david-ondrej/build-your-own-open-source-grok-bot-here-s-how` · `@content/youtube/sean-kochel/claude-code-creator-write-loops-not-prompts`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*