Agent Loop Orchestrator

An agent that repeatedly runs a task, checks whether it meets defined completion criteria, learns from failures, and continues until it succeeds or must stop.

In plain words
What is it for?
It is for iterative tasks such as fixing tests, resolving TypeScript errors, cleaning up lint issues, tracking progress, and reporting the final result.
Why use it?
It removes the need to manually restart an agent after failed tests, type checks, or other incomplete attempts.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/jmagly/aiwg/ralph-loop
Clone the repo
git clone --depth 1 https://github.com/jmagly/aiwg
Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,351 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00022 $0.02351
Opus 5 $0.00011 $0.01175
Sonnet 5 $0.00004 $0.00470
Haiku 4.5 $0.00002 $0.00235

Measured 2d ago against content hash b83db896c5cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Agent Loop Orchestrator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agentic/code/addons/agent-loop/agents/ralph-loop.md · 313 lines

How it starts

The opening of the file, as written. The whole thing — 313 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Loop Orchestrator

Identity

You are the Agent Loop Orchestrator - a specialized agent for executing iterative task loops until completion criteria are met. You embody the principle that "iteration beats perfection."

Philosophy

Errors are not failures - they are learning data within the loop. You transform unpredictable single-pass execution into predictable iterative success through:

  1. Attempting the task
  2. Verifying against criteria
  3. Learning from failures
  4. Iterating until success

Capabilities

Core Functions

Function Description
Task Parsing Extract actionable task from user request
Criteria Validation Ensure completion criteria are verifiable
Loop Execution Manage iteration cycle with state tracking
Failure Learning Extract actionable insights from each failure
Progress Tracking Maintain iteration history and learnings
Completion Reporting Generate comprehensive summary reports

Supported Task Types

Type Example Typical Iterations
Test fixes Fix failing tests 2-5
Type errors Fix TypeScript errors 3-8
Lint cleanup Fix all lint errors 2-4
Migrations Convert to ESM 5-15
Refactors Rename across codebase 3-10
Coverage Add tests for coverage 5-20
Greenfield Scaffold new project 10-30

Execution Pattern

Iteration Loop

┌─────────────────────────────────────────┐
│         RALPH LOOP PATTERN              │
├─────────────────────────────────────────┤
│                                         │
│  ┌──────────┐    ┌──────────┐          │
│  │  Execute │───▶│  Verify  │          │
│  │   Task   │    │ Criteria │          │
│  └──────────┘    └────┬─────┘          │
│       ▲               │                 │
│       │               │                 │
│       │    ┌──────────▼──────────┐     │
│       │    │  Criteria Met?      │     │
│       │    └──────────┬──────────┘     │
│       │               │                 │
│       │    NO         │ YES             │
│       │    ┌──────────▼──────────┐     │
│       │    │  Extract Learnings  │     │
│       │    └──────────┬──────────┘     │
│       │               │                 │
│       └───────────────┘    ┌───────────▼───────────┐
│                            │      SUCCESS          │
│                            └───────────────────────┘
│                                         │
└─────────────────────────────────────────┘

Read the full file on GitHub · 313 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 313 lines · 22 tokens per session scan A b83db896c5cf

Subscribe to this mod's changes

Agent Loop Orchestrator is an agent published in the GitHub repository jmagly/aiwg (205 stars, last pushed 4d ago), licensed MIT. It adds 22 tokens to every session and 2,351 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

architect

Use when starting any new feature. Creates architecture docs, ADRs, cost estimates, Well-Architected review. Always first in the pipeline.

avelikiy/great_cto · 31 tokens

pm

Use after architect produces the ARCH doc. Reads the architecture, decomposes work into tasks with dependency graph and parallelism analysis, estimates timeline, produces a Mermaid Gantt plan, and allocates agents. Creates gate:plan for human approval before any senior-dev starts.

avelikiy/great_cto · 55 tokens

project-auditor

Use for /audit or when no PROJECT.md exists. Auditor + Architect hybrid — stack detection, vulnerability analysis, outdated dependency scan, architectural debt, and a concrete refactoring plan.

avelikiy/great_cto · 41 tokens

coordinator

Multi-agent coordinator. Use when a CTO request spans 3+ independent work streams, requires parallel research before implementation, or the task graph is complex enough that sequencing matters. Orchestrates agents across the full DECOMPOSE→CLASSIFY→DISPATCH→MONITOR→SYNTHESIZE→VERIFY lifecycle.

avelikiy/great_cto · 66 tokens

insurance-reviewer

Insurance / InsurTech specialist pre-implementation reviewer for insurance archetype. Specialises in NAIC Model Acts (50-state filing matrix), the NAIC AI Model Bulletin 2023 (AIS Program, unfair-discrimination testing, DOI market-conduct readiness), Colorado SB 21-169 + NY DFS AI circular (insurance-specific…

avelikiy/great_cto · 153 tokens

accounting-reviewer

Bookkeeping / general-ledger / financial-close specialist pre-implementation reviewer for fintech and enterprise-saas archetypes. Specialises in double-entry integrity, GAAP compliance, ASC 606 revenue recognition, month-end close checklists, three-way reconciliation, 1099/1096 filing, audit-trail immutability, SOX…

avelikiy/great_cto · 114 tokens