| name | repeatable-agent-loops |
| description | Use when designing, running, auditing, or reviewing repeatable agent loops for recurring audits, iterative fixes, maintenance sweeps, monitors, documentation checks, quality passes, test reliability sweeps, post-deploy checks, or any bounded workflow where an agent observes state, takes one action, records evidence, decides whether to continue, and stops safely under APIVR. |
| activation | Activate when the description trigger applies to the current task. |
| required_inputs | Task request, relevant repository context, constraints, and authority dependencies. |
| required_outputs | Skill-specific artifact, verification evidence, canonical verdict, and next action. |
| authority_dependencies | 00_start_here/SOURCE_OF_TRUTH.md; 10_governance/APIVR_EXECUTION_LIFECYCLE.md; 10_governance/source_of_truth/Elite_Build_Goals_v3.md. |
| evidence_requirements | Executed checks or an honest Unknown, Not Run, or Blocked state for every material claim. |
Repeatable Agent Loops
Use this skill when work should repeat until a measurable condition is met, safely exhausted, or blocked.
A loop is not permission for open-ended autonomy. Every loop must have a bounded scope, a single-step action rule, evidence checks, stop conditions, and APIVR ownership.
Required Files
Load these when designing or running a loop:
40_knowledge/REPEATABLE_AGENT_LOOP_PATTERNS.md
60_templates/LOOP_DESIGN_TEMPLATE.md
60_templates/LOOP_RUN_RECEIPT_TEMPLATE.md
APIVR Routing
- Phase 1 Audit: inspect current state, authority, target condition, risks, permissions, and evidence sources.
- Phase 2 Plan: define the loop design, iteration limit, stop conditions, rollback path, and receipt format.
- Phase 3 Implement: run one bounded action per iteration.
- Phase 4 Audit Implementation: check whether the action changed only the intended scope and whether evidence supports the result.
- Phase 5 Verify Implementation: record receipt evidence and decide continue, stop, escalate, or block.
- Phase 6 Re-Audit: review the full run for drift, missed risks, repeated failures, and future automation suitability.
Loop Decision Flow
flowchart TD
A["Task appears repeatable or iterative"] --> B["Load APIVR tier and loop skill"]
B --> C{"Is the objective measurable?"}
C -- "No" --> D["Stop: write clearer objective or use normal APIVR plan"]
C -- "Yes" --> E{"Can one safe action be defined?"}
E -- "No" --> D
E -- "Yes" --> F{"Are permissions and stop limits explicit?"}
F -- "No" --> G["Stop: request authority or narrow scope"]
F -- "Yes" --> H["Run one iteration"]
H --> I["Record loop receipt"]
I --> J{"Target met?"}
J -- "Yes" --> K["Stop: PASS or CONDITIONAL PASS"]
J -- "No" --> L{"Blocked, unsafe, or no progress?"}
L -- "Yes" --> M["Stop: BLOCKED / PARTIAL / FAIL"]
L -- "No" --> N{"Iteration budget remains?"}
N -- "No" --> O["Stop: exhausted with evidence"]
N -- "Yes" --> H
Loop Contract
Every loop must define:
- Objective: the exact condition the loop is trying to reach.
- Scope: files, systems, users, data, environments, and actions allowed.
- Non-scope: forbidden files, systems, changes, or irreversible actions.
- One-step action: the largest action allowed in a single iteration.
- Evidence check: command, observation, test, log, screenshot, report, or human approval used to judge the step.
- Continue condition: what justifies another iteration.
- Stop conditions: success, clean no-op, blocked, unsafe, approval-required, exhausted, or no measurable progress.
Run up to 5 iterations. Each iteration fixes one broken internal link, runs the link checker, records the changed file and command output, then stops when all links pass or a missing source cannot be resolved.
Keep cleaning the docs until they look better.