Agent skill · Testing & QA

agentsop-bounded-loop

Universal discipline for any LM-driven loop — agent retries, plan-act-observe, multi-agent handoffs, optimiser passes, test-fix cycles. Encodes the one rule every framework documents quietly and every team relearns expensively: the LM in the loop is NEVER a reliable terminator. Termination must be provided by an explicit counter + exit predicate + stagnation signal + escalation path that live OUTSIDE the LM's control. This is a tool- level, framework-agnostic skill. It maps onto LangGraph (recursion_limit + state counter + interrupt), CrewAI (max_iter + max_rpm + human_input), Claude / OpenAI

agentsopegithub.com/agentsopeGitHub ↗
claude-codeMIT
Install
npx skills add agentsope/SkillAlchemy --skill agentsop-bounded-loop --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 4
SKILL.md size: 28 KB
Bundled scripts: none
Version: 0.1.0
Path: skills/agentsop-bounded-loop/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 255
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# bounded-loop · O7 > Source posture: every load-bearing claim is cited inline with a short tag > resolved against `references/R1-source-evidence.md` and > `references/R2-cross-framework.md`. Examples cite the real GitHub issues > they're distilled from. --- ## 1. 何时激活 (Activation Rules) Activate this skill when **any** of the following is true: - The task involves a workflow that contains a **cycle** — tool-call → reflect → retry, plan → act → observe → re-plan, draft → critique → revise, test → fix → re-test. - The user is hitting a framework's "loop too deep" error: `GRAPH_RECURSION_LIMIT` (LangGraph), `MaxIterationsExceeded` (LangChain `AgentExecutor`), "agent exceeded max_iter" (CrewAI), `max_turns reached` (OpenAI Agents SDK), `stop_reason="max_tokens"` mid-tool-use (Anthropic). - The user proposes "let's just raise the limit" / "set max_iter to 100" / `recursion_limit=200` — this is the canonical anti-pattern this skill exists to prevent. - The user is building a **multi-agent** system with delegation, handoff, or supervisor patterns — these are exposure-multipliers for unbounded loops (see `[gh/crewai-330]`). - The user is building an **optimiser / evaluator loop** (DSPy, A

What's inside
Steps it walks through
  1. 1. 何时激活 (Activation Rules)
  2. 2. 核心心智模型 (Core Mental Model)
  3. Why the framework's default safety net is not enough
  4. The three-axis termination model
  5. 3. SOP 工作流 (Standard Operating Procedure)
  6. Step 1 · Identify the loop body and the cycle invariant
  7. Step 2 · Add the iteration counter
  8. Step 3 · Add the stagnation detector
  9. Step 4 · Pick the LM's view of the loop state
  10. Step 5 · Build the escalation branch before you remove the safety net
  11. Step 6 · Layer the outer safety bound
  12. Step 7 · Test the bound
  13. 4. 操作模型 (Operation Models)
  14. OP-1 · Retry counter in state (the foundational operation)
Ships with 3 files
  • intermediate/operation_candidates.json
  • references/R1-source-evidence.md
  • references/R2-cross-framework.md
More from SkillAlchemy
All skills →
About this skill
What does the agentsop-bounded-loop skill do?

Universal discipline for any LM-driven loop — agent retries, plan-act-observe, multi-agent handoffs, optimiser passes, test-fix cycles. Encodes the one rule every framework documents quietly and every team relearns expensively: the LM in the loop is NEVER a reliable terminator. Termination must be provided by an explicit counter + exit predicate + stagnation signal + escalation path that live OUTSIDE the LM's control. This is a tool- level, framework-agnostic skill. It maps onto LangGraph (recursion_limit + state counter + interrupt), CrewAI (max_iter + max_rpm + human_input), Claude / OpenAI

How do I install it?

Run `npx skills add agentsope/SkillAlchemy --skill agentsop-bounded-loop --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From agentsope/SkillAlchemy, a repository with 255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going