iterating-to-completion

Prevent premature exit and infinite loops in multi-step AI task execution.

11|2|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/porcupine-md/jonggrang --skill iterating-to-completion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: iterating-to-completion
Source: https://github.com/porcupine-md/jonggrang/tree/main/skills/core/iterating-to-completion
Command: npx skills add https://github.com/porcupine-md/jonggrang --skill iterating-to-completion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill prevents two failure modes: premature exit and infinite loops in AI task execution, ensuring progress and guardrails.

Core Features & Use Cases

  • Completion Promises: explicit completion signals per role to mark success. The agent outputs this string ONLY when criteria are truly met, e.g., architecture plan completion, implementation completion, review completion, test plan completion, and all tests passing.
  • Scratchpad Protocol: maintain a per-task scratchpad at .jonggrang/.ephemeral/scratchpad-{task_id}.md with sections for Completed Steps, Current Focus, Failures & Learnings, and Next Step.
  • Loop Detection: monitor the last outputs to detect stagnation or repetition; trigger strategy changes or escalation when similarity exceeds thresholds.

Quick Start

Guide the agent to iterate tasks until all completion signals are observed, using the completion tokens and the scratchpad to manage progress.

Frequently Asked Questions about iterating-to-completion

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

FAQPage Schema
How do I prevent AI agents from premature exits and infinite loops during multi-step task execution?

To prevent premature exits and infinite loops, you can use completion promises and loop detection to monitor agent outputs across planning, implementation, testing, and review phases. This ensures progress until success criteria are met.

How does scratchpad protocol work for managing multi-step AI task progress?

The scratchpad protocol maintains a per-task markdown file tracking Completed Steps, Current Focus, Failures & Learnings, and Next Step. This structured logging guides the agent to iterate tasks until all completion signals are observed.

What is the best way to detect repetitive stagnation in AI task orchestration workflows?

The best way to detect repetitive stagnation is monitoring recent agent outputs to detect repetition, triggering strategy changes or escalation when similarity exceeds predefined thresholds to break the loop.

How do I enforce explicit completion signals across different phases of an AI agent workflow?

You enforce explicit completion signals by having agents output specific completion tokens ONLY when criteria are truly met, covering architecture planning, implementation, review, and test passing phases.

Do I need workflow guardrails for multi-step agent tasks?

Yes, workflow guardrails like iteration caps and explicit orchestrator signals are needed for multi-step agent tasks to prevent uncontrolled looping and ensure successful task completion.