loop

Drives unattended autonomous work sessions by selecting queue items, enforcing stop conditions, and journaling checkpoints.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/serhii-baksheiev/create-agent-rig --skill loop-serhii-baksheiev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: loop
Source: https://github.com/serhii-baksheiev/create-agent-rig/tree/main/.agents/skills/loop
Command: npx skills add https://github.com/serhii-baksheiev/create-agent-rig --skill loop-serhii-baksheiev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Running an AI agent unattended over a backlog of work is risky: the agent may pick stale or blocked items, invent work, lose track of stop conditions after context compaction, or silently edit its own rulebook. This Skill provides a disciplined driver loop that selects work only through a queue adapter, enforces mechanical stop conditions stored on disk, and journals every decision so long autonomous runs stay auditable and bounded. ## Core Features & Use Cases - Adapter-based queue selection: Picks the next work item through a neutral queue core with pluggable adapters (plan-md, github-issues, jira), applying blocker, trigger, owner, and lifecycle filters in order. - Run-level stop conditions: Stops the session on queue unreadability, runtime regression, kill switch, revalidation holds, consecutive escalations, budget exhaustion, or an empty queue — with state persisted in a run directory, not in memory. - Safety gating: Arms an unattended flag with an explicit allow-list before touching rulebook paths, verifies the flag after arming, and runs premise checks both before implementing an item and before shipping its prose. - Use Case: You have a PLAN.md backlog and want Claude Code to work through it overnight. Invoke this Skill at session start: it runs preflight checks, declares a run directory, selects items one at a time, escalates failures, and stops cleanly on a named condition with a full journal. ## Quick Start Start an autonomous run by asking the agent to use the loop skill to pick the next queue item and work through the backlog under the autonomy rules.

Frequently Asked Questions about loop

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

FAQPage Schema
How do I run an autonomous agent loop over a task backlog?

Invoke the loop skill at session start. It runs preflight checks, declares a RIG_RUN_DIR for state, then repeatedly selects the next item through the queue adapter, implements it with failing-test-first discipline, and stops on a named run-level condition.

Which queue backends does the loop skill support?

Three adapters are supported: plan-md (the default, reading an Agent queue in PLAN.md), github-issues (with dependencies written as 'Blocked by #N'), and jira (using native issue links and environment-provided credentials). Selection logic lives in a shared core so adapters only map tracker records.

What stop conditions end an unattended agent run?

Run-level stops are checked in severity order: queue unreadable, runtime regression, kill switch, revalidation hold, two escalations in a row, budget exhaustion, nothing selectable, and queue empty. Inputs like escalation counts live in the run directory's state.json, not in session memory.

Why must RIG_RUN_DIR be declared before the first task?

The run directory holds the stop-condition state (escalation streak, deploy verdict, budget flag) and the machine trace. Without it, escalations are recorded nowhere, so the run's main brake is silently off while the session looks healthy.

Can the loop modify its own rules or queue configuration?

No. An unattended flag with an explicit allow-list gates edits to rulebook paths, and the board selector is always refused. Items marked re-scope or obsolete are held for a human; the loop never rewrites queue items or infers lifecycle states.

What happens when a queue item's premise is false?

The check-premises gate runs before implementation; on PREMISE FALSE the item is escalated rather than repaired in place, because silently re-aiming a task means the agent authored its own work. Per-task failures escalate and the loop takes the next item.