Logo vun Agent Loop Ext

Agent Loop Ext

Communautéit
jmagly
agent-loop-ext

Crash-resilient external agent loop with state persistence and CI/CD integration

Iwwersiicht

Editeurjmagly
Repositoryaiwg
Skill-Nummagent-loop-ext
Stären
225
Forks
34
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum jmagly op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Agent Loop Ext an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/agent-loop-ext
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jmagly/aiwg.git /tmp/aiwg
mkdir -p .claude/skills
cp -r /tmp/aiwg/agentic/code/addons/agent-loop/skills/agent-loop-ext .claude/skills/agent-loop-ext
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Agent Loop Ext an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Agent Loop Ext automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Agent Loop Ext net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Skill access pattern (post-kernel-pivot, 2026.5+)

Skill names referenced in this document are AIWG skills, not slash commands. Most are not kernel-listed and cannot be invoked as /skill-name by the platform. Reach them via:

bash
aiwg discover "<capability>"
aiwg show skill <name> --body

Only kernel-listed skills (aiwg-doctor, aiwg-refresh, aiwg-status, aiwg-help, use, steward) are directly invokable as slash commands. See skill-discovery rule.

Al External

You are the Al External Orchestrator — launching and managing crash-resilient iterative loops that run outside the AI session for long-running tasks.

Core Difference from ralph

ralph runs the loop inside the current AI session. agent-loop-ext (formerly ralph-external) launches the loop as an external process via tools/ralph-external/run.sh, persisting all state to .aiwg/ralph-external/. If the session dies mid-loop, the loop survives and can be reattached or resumed.

Use agent-loop-ext when:

  • The task will take longer than a single session
  • You need CI/CD pipeline integration
  • You want crash recovery guarantees
  • You need to run multiple loops in parallel

Natural Language Triggers

Users may say:

  • "agent-loop-ext"
  • "external agent loop"
  • "out-of-session loop"
  • "persistent agent loop"
  • "ralph external"
  • "external ralph"
  • "crash-resilient loop"
  • "persistent ralph"
  • "long-running ralph task"
  • "ralph with crash recovery"
  • "start background ralph"

Parameters

Objective (required)

The task the loop should accomplish. Passed as the first positional argument.

--completion (optional — inferred when omitted)

Success criteria as a verifiable command. The loop exits when this command returns exit code 0.

Good examples:

  • --completion "npm test passes with 0 failures"
  • --completion "npx tsc --noEmit exits with code 0"
  • --completion "coverage report shows >80%"

When omitted: the launcher invokes the infer-completion-criteria skill before the external loop starts. The skill derives a measurable criterion from project state (CLAUDE.md / AGENTS.md / AIWG.md, package manifests, CI configuration, .aiwg/ artifacts) and emits a structured proposal with rationale. The proposal is written to .aiwg/ralph-external/<run-id>/inferred-completion.yaml and used as the loop's gate.

Because agent-loop-ext runs externally (potentially headless / in CI), the confirmation flow is:

  • Interactive session (TTY attached): show proposal, accept Y / n / edit like the in-session ralph skill
  • Non-interactive / --auto-criteria / CI environment: use the inferred criterion if confidence is high, otherwise fail fast and print the proposal as a diagnostic so the user can re-launch with --completion explicitly

Pass --no-infer-completion to require explicit --completion and fail before launch if missing. See @$AIWG_ROOT/agentic/code/addons/agent-loop/skills/infer-completion-criteria/SKILL.md.

--max-iterations (default: 10)

Maximum iterations before the loop halts and saves state for manual review.

--timeout (default: 60 minutes)

Maximum wall-clock time. Loop checkpoints state before exiting so it can be resumed.

--provider (default: claude)

AI provider to use for loop iterations. Supported: claude, codex, factory, opencode.

--no-commit

Skip automatic git commits after each iteration.

--branch (optional)

Create and work on a dedicated feature branch. The branch is created before iteration 1.

--quiet

Suppress verbose progress output. Completion banner is always shown.

Behavior

When triggered:

  1. Resolve completion criteria:
    • If --completion is provided → use it directly
    • Else if --no-infer-completion is set → fail fast before launch with a helpful error
    • Else → invoke infer-completion-criteria skill, persist proposal to .aiwg/ralph-external/<run-id>/inferred-completion.yaml, confirm or auto-adopt per session-interactivity rules above
  2. Validate the resolved criterion is verifiable (can be checked via command)
  3. Check for an existing .aiwg/ralph-external/ workspace; create if absent
  4. Generate a unique loop-id (8-character hex) and create the loop state file at .aiwg/ralph-external/loops/<loop-id>.json
  5. Write the initial state: { objective, completionCriteria, maxIterations, timeout, provider, status: "pending", iteration: 0 }
  6. If --branch is specified, create the git branch now
  7. Invoke tools/ralph-external/run.sh with all parsed flags, passing the loop-id
  8. The external process owns execution from this point. Print the loop-id and attach info:
Al External Loop Started

Loop ID: abc123
Objective: {objective}
Completion: {completion}
Max iterations: {max} | Timeout: {timeout}m | Provider: {provider}

Loop is running externally. Follow progress:
  /ralph-attach --loop-id abc123

Check status:
  /ralph-status

State: .aiwg/ralph-external/loops/abc123.json
Log:   .aiwg/ralph-external/logs/abc123.log
  1. If --quiet is NOT set, automatically attach to the loop's output stream (equivalent to running /ralph-attach --loop-id <id>)

State Persistence and Crash Recovery

State is written to disk before each external process action. If the process crashes:

  • The loop state file retains the last known iteration and learnings
  • On restart, tools/ralph-external/run.sh detects the incomplete state and resumes from the last checkpoint
  • Learnings from completed iterations are injected into the next iteration's prompt via the memory layer

State file schema (.aiwg/ralph-external/loops/<id>.json):

json
{
  "loopId": "abc123",
  "objective": "Fix all auth tests",
  "completionCriteria": "npm test passes with 0 failures",
  "maxIterations": 10,
  "timeout": 60,
  "provider": "claude",
  "status": "running",
  "iteration": 3,
  "startedAt": "2026-04-01T10:30:00Z",
  "lastCheckpoint": "2026-04-01T10:38:42Z",
  "logFile": ".aiwg/ralph-external/logs/abc123.log",
  "branch": null,
  "learnings": ["auth mocks must be initialized before describe block"]
}

CI/CD Integration

For use in pipelines, pass --quiet and read the exit code:

  • 0 — loop completed successfully (completion criteria verified)
  • 1 — loop failed (max iterations or timeout reached)
  • 2 — configuration error (bad arguments)

GitHub Actions example:

yaml
- name: Auto-fix tests
  run: |
    aiwg ralph-external "Fix all failing unit tests" \
      --completion "npm test passes" \
      --max-iterations 5 \
      --timeout 30 \
      --quiet

Error Handling

Missing --completion:

Error: --completion is required for /ralph-external.

Provide a verifiable success criterion:
  /ralph-external "Fix tests" --completion "npm test passes"

External process launch failure:

Failed to launch external Al process.

Check:
1. tools/ralph-external/run.sh is executable
2. Node.js >= 18 is available
3. .aiwg/ directory is writable

Run with --verbose for diagnostics.

Loop already active for this objective:

An existing loop may be running for a similar objective.

Active loops:
  abc123 — Fix auth tests (running, iteration 3/10)

Options:
1. Attach to existing:  /ralph-attach --loop-id abc123
2. Start new anyway:    confirm and proceed
3. Abort existing:      /ralph-abort --loop-id abc123

Examples

Example 1: Fix failing tests

/ralph-external "Fix all failing tests in src/auth/" --completion "npm test -- --testPathPattern=auth passes"

Response: Starts external loop, prints loop ID, streams live output.

Example 2: Long-running migration with branch

/ralph-external "Migrate src/ to ESM" --completion "npx tsc --noEmit exits with code 0" --max-iterations 20 --timeout 120 --branch feat/esm-migration

Response: Creates branch feat/esm-migration, starts loop, streams output.

Example 3: CI/CD pipeline usage

aiwg ralph-external "Fix lint errors" --completion "npm run lint exits 0" --max-iterations 5 --quiet
echo "Exit: $?"

Response: Runs silently, exits 0 on success or 1 on failure.

Example 4: Alternative provider

/ralph-external "Refactor payment module" --completion "npm test passes" --provider codex --max-iterations 8

Response: Runs iterations using OpenAI Codex instead of Claude.

Related

  • ralph — In-session iterative loop (no crash recovery)
  • ralph-attach — Attach to a running external loop's output stream
  • ralph-status — Check active and completed loop status
  • ralph-abort — Stop a running loop
  • ralph-resume — Resume a paused or interrupted loop

References

  • @$AIWG_ROOT/src/cli/handlers/ralph.ts — Al CLI handler
  • @$AIWG_ROOT/src/cli/handlers/ralph-launcher.ts — External loop launcher
  • @$AIWG_ROOT/tools/ralph-external/README.md — External loop architecture
  • @$AIWG_ROOT/tools/ralph-external/orchestrator.mjs — Loop orchestration engine
  • @$AIWG_ROOT/tools/ralph-external/state-manager.mjs — State persistence layer
  • @$AIWG_ROOT/tools/ralph-external/session-launcher.mjs — AI session launcher
  • @$AIWG_ROOT/agentic/code/addons/agent-loop/README.md — Al documentation

Heefeg gestallte Froen

Wat mécht de KI-Skill Agent Loop Ext?

Crash-resilient external agent loop with state persistence and CI/CD integration

Firwat Agent Loop Ext op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Agent Loop Ext besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Agent Loop Ext an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/agent-loop-ext an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Agent Loop Ext benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Agent Loop Ext benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Agent Loop Ext domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Agent Loop Ext gratis?

Jo. De Skill gëtt vum jmagly ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇