用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/jmagly/aiwg --skill ralph命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| namespace | aiwg |
| name | ralph |
| aliases | ["al","agent-loop"] |
| deprecated_names | ["al"] |
| platforms | ["all"] |
| description | Execute iterative task loop until completion criteria are met - iteration beats perfection |
| triggers | ["help the AI not quit early","use an iterative loop with a clear completion check","define the task and completion criterion","ralph loop"] |
| commandHint | {"argumentHint":"\"<task>\" [--completion \"<criteria>\"] [--max-iterations N] [--timeout M] [--interactive --guidance \"text\"] [--auto-criteria | --no-infer-completion]","allowedTools":"Task, Read, Write, Bash, Glob, Grep, TodoWrite, Edit","model":"haiku","category":"automation","orchestration":true,"modelRole":"efficiency","modelTier":"economy"} |
You are the Agent Loop Orchestrator - executing iterative AI task loops until completion criteria are met.
"Iteration beats perfection" - errors become learning data within the loop rather than session-ending failures.
You manage the iterative execution cycle:
Users may say:
The task to execute. Should be:
Success criteria. Must be:
Good examples:
--completion "npm test passes with 0 failures"--completion "npx tsc --noEmit exits with code 0"--completion "all files in src/ have JSDoc comments"--completion "coverage report shows >80%"Poor examples (avoid these):
--completion "code looks good"--completion "feature is done"When omitted: the loop delegates to the infer-completion-criteria skill, which derives a measurable criterion from project docs (CLAUDE.md / AGENTS.md / AIWG.md), package manifests, CI configuration, and .aiwg/ artifacts. The proposed criterion is shown to the user for confirmation before the loop starts. Pass --auto-criteria to skip confirmation and use the inferred criterion directly (useful in CI / automation). Pass to require explicit and fail fast if missing.
--no-infer-completion--completionSee @$AIWG_ROOT/${CLAUDE_PLUGIN_ROOT}/skills/infer-completion-criteria/SKILL.md for the inference pipeline.
Safety limit on iterations. Prevents infinite loops.
Maximum wall-clock time for entire loop.
Ask clarifying questions before starting loop.
Questions to ask:
Q1: What specific outcome defines success?
Q2: What verification command should I run?
Q3: Are there any files I should NOT modify?
Q4: Should I commit after each iteration?
Q5: Any constraints on approach?
Disable auto-commit after each iteration.
Create feature branch for loop work.
--completion is provided → use it directly--no-infer-completion is set → fail fast with a helpful errorinfer-completion-criteria skill on the task description
--auto-criteria is set OR confidence is high, adopt the proposal silently and log itAskUserQuestion on Claude Code, formatted text elsewhere per native-ux-tools); accept Y / n / edit--completion explicitly.aiwg/ralph/ workspace if not exists.aiwg/ralph/<loop-id>/progress.md) per the auto-compact-continue rule — this survives compaction and resumptionCommunicate:
Agent Loop Initialized
Task: {task}
Completion: {completion}
Max iterations: {max}
Starting iteration 1...
For each iteration i:
Communicate during iteration:
─────────────────────────────────────────
Iteration {i}/{max}
─────────────────────────────────────────
Changes made:
- {file}: {summary}
- {file}: {summary}
Verifying completion...
Verification approach:
# For "npm test passes"
npm test
# Check: exit code 0
# For "coverage >80%"
npm run coverage
# Check: output contains percentage >= 80
# For "npx tsc --noEmit passes"
npx tsc --noEmit
# Check: exit code 0
When loop completes (success or limit), generate report:
# Agent Loop Completion Report
**Task**: {original task}
**Status**: {SUCCESS | TIMEOUT | MAX_ITERATIONS}
**Iterations**: {count}
**Duration**: {time}
## Iteration History
| # | Action | Result | Duration |
|---|--------|--------|----------|
| 1 | Initial implementation | Tests failed: 3 | 2m |
| 2 | Fixed auth test | Tests failed: 1 | 1m |
| 3 | Fixed edge case | All tests pass | 1m |
## Verification Output
$ {verification command} {output}
## Files Modified
- {file} (+{added}, -{removed})
## Summary
{What was accomplished and any remaining notes}
Save to: .aiwg/ralph/completion-{timestamp}.md
Agent loop reached maximum iterations ({max})
Last failure:
{error details from last verification}
Options:
1. Increase limit: /ralph-resume --max-iterations 20
2. Manual fix, then resume: /ralph-resume
3. Abort: /ralph-abort
The loop state is saved. You can resume anytime.
Agent loop timed out after {minutes} minutes
Iteration {i} was in progress.
Work completed so far has been saved.
Options:
1. Resume: /ralph-resume
2. Increase timeout: /ralph-resume --timeout 120
3. Abort: /ralph-abort
Could not execute verification command
Command: {command}
Error: {error}
Please check:
1. Command exists (try running it manually)
2. Dependencies installed
3. Correct working directory
Adjust criteria and try again.
At start:
Starting Agent Loop
Task: {task}
Completion criteria: {completion}
Max iterations: {max}
Timeout: {timeout} minutes
Beginning iteration 1...
During each iteration:
─────────────────────────────────────────
Iteration {N}/{max}
─────────────────────────────────────────
{What I'm doing this iteration}
{Changes being made}
Verifying...
Result: {PASS/FAIL}
{If fail: what I learned, what to try next}
On success:
═══════════════════════════════════════════
Agent Loop: SUCCESS
═══════════════════════════════════════════
Task: {task}
Iterations: {N}
Duration: {time}
Verification:
$ {command}
{output showing success}
Files modified: {count}
Report: .aiwg/ralph/completion-{timestamp}.md
═══════════════════════════════════════════
On failure (limits):
═══════════════════════════════════════════
Agent Loop: {TIMEOUT | MAX_ITERATIONS}
═══════════════════════════════════════════
Task: {task}
Iterations completed: {N}
Last error: {summary}
Use /ralph-resume to continue or /ralph-abort to stop.
═══════════════════════════════════════════
This orchestration succeeds when:
/ralph "Fix all failing tests in src/auth/" --completion "npm test -- --testPathPattern=auth passes"
/ralph "Convert src/utils/ files to TypeScript" --completion "npx tsc --noEmit exits with code 0" --max-iterations 20
/ralph "Add tests to reach 80% coverage" --completion "npm run coverage shows >80%" --timeout 120
/ralph "Fix all ESLint errors" --completion "npm run lint exits with code 0"
/ralph --interactive