designing-loops

Select agent loop primitives and define stop conditions for recurring automated work.

2|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/tommylower/cortex --skill designing-loops-tommylower
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: designing-loops
Source: https://github.com/tommylower/cortex/tree/main/agent-workflows/designing-loops
Command: npx skills add https://github.com/tommylower/cortex --skill designing-loops-tommylower

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing how to automate recurring or iterative agent work is confusing: should you use a plain prompt, a goal-based loop, a scheduled trigger, or a fully proactive routine? This Skill provides a decision framework that matches each task to the simplest loop primitive and ensures every loop has an explicit stop condition and usage bound. ## Core Features & Use Cases - Loop Selection Table: Routes tasks across four primitives — turn-based, goal-based (/goal), time-based (/loop, /schedule), and proactive compositions — based on what you hand off to the agent. - Stop Condition Design: Guides you to define deterministic completion criteria, turn caps, and token budgets so loops never run unbounded. - Quality and Cost Management: Covers verification skills, second-agent review, model routing, and usage inspection via /usage, /goal, and /workflows. - Use Case: You want an agent to keep fixing CI failures on your PR until it passes. The Skill routes you to a goal-based loop with a turn cap, e.g. "/goal get CI green, stop after 5 tries." ## Quick Start Ask the agent to help you pick the right loop primitive for your recurring task and define its stop condition and turn cap.

Frequently Asked Questions about designing-loops

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make an AI agent keep iterating until a task is done?▼

Use a goal-based loop with /goal, which re-prompts the agent each time it tries to stop until your condition is met. Always name a turn cap, such as "stop after 5 tries", and prefer deterministic criteria like tests passing or a score threshold.

What is the difference between /goal, /loop, and /schedule?▼

/goal hands off a stop condition so the agent iterates until done or hits a turn cap. /loop re-runs a prompt on an interval on your machine, while /schedule moves that recurring routine to the cloud so it survives your session.

When should I use a scheduled agent loop instead of a plain prompt?▼

Use a time-based loop when the work happens outside the session or you can only poll an external system, like a PR receiving reviews or a CI queue. For one-off exploratory tasks, a plain prompt with verification is the simpler primitive.

How do I stop an agent loop from burning too many tokens?▼

Bound usage by always setting a turn cap on /goal, matching /loop intervals to how often the watched system changes, and routing routine steps to smaller models. Inspect running loops with /usage, /goal with no arguments, or /workflows.

Why does my goal-based loop settle for low-quality results?▼

Vague stop criteria let the agent accept its own idea of good enough. Use deterministic, self-checkable bars like test suites or score thresholds, and review output with a second agent in fresh context to avoid anchoring.