Логотип Agent Loop Ext

Agent Loop Ext

Спільнота
jmagly
agent-loop-ext

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

Огляд

Видавецьjmagly
Репозиторійaiwg
Назва навичкиagent-loop-ext
Зірки
225
Форки
34
Файли в пакеті
Лише інструкції
ЛіцензіяMIT
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Усе необхідне — в інструкціях

    Усе потрібне моделі міститься в інструкціях — жодних додаткових файлів для синхронізації.

  • Відкритий вихідний код

    Опубліковано на GitHub користувачем jmagly. Перегляньте вихідний вміст перед установленням.

Встановлення

Установіть навичку ШІ Agent Loop Ext у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до Плагіни → Навички.
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/agent-loop-ext
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Нова навичка → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

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
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Agent Loop Ext в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Agent Loop Ext, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції Markdown, а не код для певного постачальника, тому навичка Agent Loop Ext не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож невикористана навичка нічого не коштує.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

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

Поширені запитання

Що робить навичка ШІ Agent Loop Ext?

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

Навіщо використовувати Agent Loop Ext у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Agent Loop Ext — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Agent Loop Ext у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/agent-loop-ext. TypingMind прочитає файл SKILL.md і встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Agent Loop Ext?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Agent Loop Ext?

Зі скількома забажаєте. Якщо модель підтримує навички, ви можете використовувати з нею Agent Loop Ext — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama та інші — усе в TypingMind із власними ключами API.

Чи безкоштовна навичка ШІ Agent Loop Ext?

Так. Навичку опубліковано на GitHub: jmagly, за ліцензією MIT. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це багаторазовий набір інструкцій, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти для виклику — код, який десь виконується й повертає результат. Натомість навичка ШІ надає моделі знання та порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний ШІ-простір уже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇