Agent skill · research science · aiskillstore

control-loop-extraction

Extract and analyze agent reasoning loops, step functions, and termination conditions. Use when needing to (1) understand how an agent framework implements reasoning (ReAct, Plan-and-Solve, Reflection, etc.), (2) locate the core decision-making logic, (3) analyze loop mechanics and termination conditions, (4) document the step-by-step execution flow of an agent, or (5) compare reasoning patterns across frameworks.

Why this skill is useful

Provides detailed extraction patterns and termination conditions for agent reasoning loops that the AI wouldn't reliably generate on its own.

What it needs

About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Control Loop Extraction Extracts and documents the core agent reasoning loop from framework source code. Process 1. Locate the loop - Find the main agent execution loop 2. Classify the pattern - Identify ReAct, Plan-and-Solve, Reflection, or Tree-of-Thoughts 3. Extract the step function - Document the LLM → Parse → Decide flow 4. Map termination - Catalog all loop exit conditions Reasoning Pattern Identification Pattern Signatures ReAct (Reason + Act) Plan-and-Solve Reflection Tree-of-Thoughts Step Function Analysis The "step function" is the atomic unit of agent execution. Extract: 1. Input Assembly - How context is constructed for the LLM 2. LLM Invocation - The actual model call 3. Output Parsing - How raw output becomes structured actions 4. Action Dispatch - Tool execution vs. final response routing Key Code Patterns Termination Condition Catalog Common Termination Patterns Condition Implementation Risk ----------- ---------------- ------ Step limit if stepcount >= maxsteps May cut off valid execution Token limit if totaltokens >= maxtokens May truncate mid-thought Explicit finish if action.type == "finish" Relies on LLM cooperation Timeout if elapsed > timeout Wall-clock unpredictable Loop detection if state in seenstates Requires state hashing Error threshold if errorcount >= maxerrors May exit on recoverable errors Anti-Pattern: No Termination Guard Fix: Always include a step counter: Output Template Integration Points Prerequisite: codebase-mapping to identify agent files Feeds into: comparative-matrix for pattern comparison Feeds into: architecture-synthesis for new loop design

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/control-loop-extraction

View the source on GitHub

Browse the @skills marketplace