一键导入
ralph-loop-wrapper
Infrastructure skill: wraps task execution in autonomous ralph loop. Not directly invocable — injected by orchestrator.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Infrastructure skill: wraps task execution in autonomous ralph loop. Not directly invocable — injected by orchestrator.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Review existing Architecture Decision Records. Flag ADRs whose aging signals may have triggered given current state. Categorizes each as valid / aged / superseded and suggests follow-up actions.
Author an Architecture Decision Record (ADR). Captures decisions with implications beyond the current change — lasts months, affects multiple files, hard to reverse. Records context, alternatives considered, consequences, and aging signals so the decision can be revisited when conditions change.
4-phase loop-detection and recovery protocol. Fires when an agent detects it is stuck or repeating the same tool call with no progress — before tool-loop-detection circuit-breaks at 30 calls.
Socratic exploration of requirements before implementation. Refines spec through targeted questions. Use when user asks to 'explore options', 'refine requirements', or mentions 'unclear requirements'.
Generate structured changelog from git history. Groups commits by type, filters noise, produces Keep a Changelog format. Single source of truth — no /commands wrapper.
Generate pipe-delimited commits: Tipo|IdTarea|YYYYMMDD|Descripción. Single source of truth — no /commands wrapper.
基于 SOC 职业分类
| name | ralph-loop-wrapper |
| description | Infrastructure skill: wraps task execution in autonomous ralph loop. Not directly invocable — injected by orchestrator. |
| disable-model-invocation | true |
| version | 1.0.0 |
Type: Infrastructure (not directly invocable) Auto-inject: Via session orchestrator Invokable: No (used internally by orchestrator)
Transforms any skill into a self-correcting iterative execution loop. Agent attempts → verifies → reads failure → retries → until machine-verifiable success criteria met (or hard limit hits).
Real implementation (replaces aspirational spec):
context-engine.py + state-sync.py — completion detection + state.claude/commands/ralph-loop.md — activates loop with args.claude/ralph-state.json (gitignored).claude/ralph-complete.txt (Claude writes when done)ralph → keyword auto-detection in .claude/CLAUDE.mdmaxIterations REQUIRED — no default. User MUST set explicitly.maxCostUSD REQUIRED — no default. Kill switch.absoluteMaxIterations: 50, absoluteMaxCostUSD: 10.00, dailyCostBudget: 50.00.<promise>COMPLETE</promise> (or skill-specific tag like <promise>BUG_FIXED</promise>). The exact tag must match config.completionPromise.src/auth/, src/payments/, migrations/, .env. If git diff shows any → ABORT(PROHIBITED_PATH).Exit condition is NOT "did the test pass?" — it is "is there pending work?"
pending_work = TRUE if:
- <promise>COMPLETE</promise> NOT in output
- test output contains failures
- reflected_message generated (prior iteration error)
pending_work = FALSE if:
- <promise>COMPLETE</promise> detected → SUCCESS (clean exit)
- maxIterations reached → ABORT(MAX_ITERATIONS)
- same error 5x → ABORT(SAME_ERROR_5X)
- cost > maxCostUSD → ABORT(COST_LIMIT)
- 5 iterations with zero file changes → ABORT(STALL)
- prohibited path modified → ABORT(PROHIBITED_PATH)
Prevents two failures: infinite loop (sentinel detects stall) AND premature exit (only stops when no pending work, not when agent "thinks" it's done).
Iter 1: generate → npm test → 3 failures
→ reflected_message = "[output]\nRoot cause: X\nFix: Y"
→ pending_work = TRUE → continue
Iter 2: generate (with reflected_message) → npm test → 0 failures
→ outputs <promise>COMPLETE</promise>
→ pending_work = FALSE → SUCCESS
ALL conditions must be true:
hasVerificationCommand = true (e.g. npm test, npm run lint, npm run build).taskType ∈ {feature, bug, refactor} AND scope is specific (not "improve architecture").riskLevel ∈ {low, medium}. NEVER high/critical.skill.supportsRalph = true (currently: tdd, systematic-debugging, code-cleanup).// Stall = 5 consecutive iterations with zero file changes
isStalled = fileChangesHistory.slice(-5).every(count => count === 0);
if (stalled && config.escalateToDeepDebug) {
return escalateToDeepDebug(); // inject systematic-debugging template
} else {
return abort('STALL_DETECTED');
}
// Same error 5x → abort
if (errorRepeatCount >= 5) abort('SAME_ERROR_5X', { error: lastError });
Before each iteration, check .sdlc/state/context-budget.json. If percent ≥ 60% → run /compact BEFORE continuing the iteration. Persist state to .sdlc/state/session.md so it survives compaction.
Last Updated: 2026-05-29 (removed vestigial references/ pointers — those files described the superseded aspirational spec and were never created; this skill is self-contained)