# loop selector

> A task router that selects the optimal iterative pattern and generates the required loop configuration.

loop selector is a free AI agent skill on Agensi by kktestdev, in Agents & Orchestration. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [kktestdev](https://www.agensi.io/creators/supakit-kitjanabumrungsak)
- Category: [Agents & Orchestration](https://www.agensi.io/skills/agents-orchestration)
- Uses: 1
- Version: 1.0
- Last updated: 2026-10-20
- Security: scan passed (2026-10-20); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/loop-selector
- Tags: ai-agents, prompt-engineering, automation, workflow-design

## About this skill

Stop wasting tokens on loops that never converge or tasks that shouldn't be loops at all. This agent skill acts as a high-level router for iterative tasks, ensuring you select the right architectural pattern before writing a single line of logic. It evaluates tasks against a strict "loop-shaped" gate and then maps them to a specialized category—Quality, Memory, Planning, Exploration, or System Optimization.

### What it does
- **Pre-loop validation** ensures a task has a clear progress signal, requires multiple passes, and possesses a natural stopping point before proceeding.
- **Pattern routing** maps ambiguous user requests like "optimize this" or "fix this" to one of twenty specific iterative patterns.
- **Config generation** produces immediate `loop_start` parameters including `exit_mode`, `target_value`, and `max_iterations` tailored to the specific pattern.
- **Composite detection** identifies when a task requires a sequence of different loop types rather than forcing a single, ill-fitting pattern.
- **Budget enforcement** recommends appropriate iteration limits to prevent infinite loops and manage compute costs.

### How it works
1. **Validation**: Run the Step 0 check to confirm the task is actually loop-shaped based on signal availability and necessity.
2. **Classification**: Use the decision tree to match the task against five core categories: quality, memory, planning, exploration, or system optimization.
3. **Pattern Selection**: Identify the specific sub-pattern (e.g., Adversarial Critique vs. Judge Ensemble) within the chosen category.
4. **Configuration**: Generate the concrete `loop_start` JSON config with the correct exit modes and progress directions.

### Frameworks & tools
This skill is designed for agents using iterative ledger patterns or loop-based architectures. It integrates with `bantamkit` for memory-related workflows and utilizes standard iteration controllers like `critique-gate` and `prompt-evolve`.

### Why this beats prompting it yourself
Prompting an agent to "loop until finished" often leads to hallucinated stopping conditions or inefficient iteration. This skill provides a structured decision framework that enforces architectural best practices, ensuring you use the most efficient pattern for the specific problem domain.

### Use cases
- **Quality Control**: Routing a content generation task to a Multi-Critic or Adversarial loop.
- **Bug Fixing**: Mapping a failing test suite to a Plan-Execute-Replan planning loop.
- **Prompt Engineering**: Configuring a System Optimization loop to tune templates against a metric.
- **Design Research**: Setting up an Exploration loop to branch and compare multiple UI candidates.

### Known limitations
This skill is a router and does not contain the full implementation logic for every pattern. Users must refer to the specific category skills for deep wiring rationale and failure-mode notes.

## Requires

- Optional: loop-ledger MCP

It enforces the loop brake.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the loop selector skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does the Loop Selector improve the efficiency of my AI agents?

The Loop Selector acts as a pre-processor for complex workflows, preventing token waste by validating if a task actually requires a loop and then selecting the most efficient architectural pattern (like Adversarial Critique or Plan-Execute-Replan) to handle it.

### What exactly is included in the purchase of this skill?

You will receive the routing engine, the decision tree logic for all five core categories, and the configuration generator that produces ready-to-use JSON for loop parameters.

### Which AI agent frameworks or tools are compatible with this skill?

This skill is framework-agnostic but is optimized for agents using iterative ledger patterns; it features native integration with `bantamkit` and standard controllers like `critique-gate`.

### Does the Loop Selector perform the actual task execution within the loops it creates?

No, this skill functions as a high-level architect that generates the configuration and routing logic; you will still need the specific category skills or custom logic to execute the internal steps of the loop.

### How does this skill help me manage API costs and token usage?

The skill includes a 'Budget Enforcement' feature that calculates and generates strict `max_iterations` and `exit_mode` parameters based on your specific task to prevent infinite loops and runaway compute costs.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
