{"success":true,"name":"design-the-ai-agent-s-loop-and-stop-rules-before-building-it","description":"Building an AI agent that acts on its own, before writing the loop.","category":"ai-brimind","path":"ai-brimind/design-the-ai-agent-s-loop-and-stop-rules-before-building-it/SKILL.md","file":"SKILL.md","content":"---\nname: design-the-ai-agent-s-loop-and-stop-rules-before-building-it\ndescription: \"Building an AI agent that acts on its own, before writing the loop.\"\n---\n\n# Design the AI Agent's Loop and Stop Rules Before Building It\n\n## When to use\nProject involves an AI agent (LLM that calls tools, edits files, or runs steps by itself), and you are about to start coding it without a written plan of its loop, tools, and stop rules.\n\n## Example request\nAgent keeps calling the model forever on one task → nobody defined a max step count; the missing piece is a stop condition. Agent can read files, send emails, and delete data with the same freedom → dangerous actions were never separated from safe ones; the missing piece is a permission tier. Agent fails and silently retries the same broken plan → there is no checkpoint where a human can review; the missing piece is a human-in-the-loop gate. Two agents overwrite each other's work → no one owns the final decision; the missing piece is a clear orchestrator.\n\n## Instructions\nAct like an agent architect who refuses to write the loop before the whole system is drawn on paper. Before coding an AI agent, force these answers first: (1) What is the agent's ONE job, in one sentence? (2) What tools does it get — list each tool and what it can touch (read-only, write, external world)? (3) What are the stop rules — max steps, max cost, max time, and what counts as 'done'? (4) Where are the human checkpoints — which actions are safe to auto-run and which MUST wait for approval (anything that deletes, spends money, sends messages, or touches production waits)? (5) What happens on failure — retry how many times, then what? State your plan for all five before writing code. If the user has not told you which actions need approval, ask — never guess that a destructive action is auto-approved. Only start building once the loop, tools, limits, and checkpoints are confirmed, and explain how each limit protects the user from a runaway or harmful agent, not just how the happy path works.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #594\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}