一键导入
ralph-plan-writer
Write a Ralph loop-compatible plan.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Write a Ralph loop-compatible plan.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | ralph-plan-writer |
| description | Write a Ralph loop-compatible plan. |
| disable-model-invocation | true |
Write a Ralph Wiggum loop-compatible plan, but do not execute it.
When this skill is invoked, loaded, pasted, or appears immediately before a user request, treat the user's next concrete request as the goal for a Ralph bundle.
Imperatives like "build X", "fix Y", or "create Z" define the goal. They are not permission to execute the work.
Do not install dependencies, scaffold projects, edit app code, start services, or implement the goal. Only inspect enough repo state and docs to write the Ralph bundle.
Never execute the generated plan or goal in this conversation. The bundle is meant to run in a separate Pi session with fresh context through /ralph-loop.
If the user explicitly asks to execute instead of plan, say this skill only writes the bundle and the work should run separately.
Geoffrey Huntley created the Ralph Wiggum loop technique. Treat Huntley's Ralph philosophy as the primary source: Ralph is a loop you program. Keep it monolithic: one repository, one bundle prompt, one runtime agent, one verified item per iteration. Do not turn the loop into agent microservices, a long chat, or a compaction-dependent session.
The supporting long-running-agent material documents the same harness failure modes: agents one-shot too much work, lose handoff context, declare the project done early, or mark work passing without end-to-end proof. Ralph counters those failures with durable files, git checkpoints, verification gates, and promise tags.
The plan writer acts as the initializer. It distills the user's goal, source docs, repo state, verification path, and system preflight into a small runtime protocol. The runtime agent starts fresh each iteration, reads durable state, chooses one unfinished item, proves it, appends progress, commits, and exits.
Exit after one verified item because live context decays. A session starts in a hot context zone where the agent knows its local move; after enough edits, tool output, failed attempts, and stale reasoning, that same context becomes a dumb context zone. A fresh iteration drops the live noise and forces the next agent to reload durable facts from files, git history, progress, and item state.
When you can predict a failure mode, tune the loop before launch. Add a smaller item, verification gate, startup check, assumption, or blocker. Do not spend loop iterations discovering preventable host, permission, scope, or test failures.
Generate exactly four files:
.ralph/plan.md.ralph/items.json.ralph/prompt.md.ralph/progress.mdThe exact prompt reference in the final response enables bundle mode. Bundle mode validates the four files, snapshots item/progress/source-doc/git state before each iteration, rejects invalid NEXT/COMPLETE promises, and starts the next fresh session only after the contract passes. Do not offer to start implementing the plan in the current session.
A concrete imperative request counts as a goal. Example: "Build a todo app" means write a Ralph bundle for building it, not build it now.
If the user did not provide a concrete goal, ask exactly:
What should I plan for the Ralph loop?
Do not generate a Ralph bundle from vague context. If the goal, PRD, SPEC, repo state, Ralph workspace root, or verification path is unclear, gather more information before writing the four files.
Use the tools and skills available in the current session: inspect the codebase, read related docs, check package scripts and tests, inspect recent git history, research third-party APIs or platform behavior when needed, and ask the user when ambiguity affects scope or correctness. Iterating on assumptions and plan shape before writing .ralph/ files is good; the final bundle must be self-contained and stable.
Choose one path before writing files.
Ask the user when the target path is not explicit:
Where should the Ralph plan be created?
1. Current workspace
2. Another path
The chosen path is the Ralph workspace root. Write .ralph/ there. Read package metadata, docs, source files, git history, and verification commands there. The runtime agent works there. Ralph counts required commits there. The user runs /ralph-loop "@.ralph/prompt.md" there.
If the user chooses another path, resolve it to an absolute path and write [RALPH_WORKSPACE_ROOT]/.ralph/*. Do not write .ralph/ in the invocation directory unless the user chose that directory.
Ignore the invocation directory when it differs from [RALPH_WORKSPACE_ROOT]. Name the target project only from files under [RALPH_WORKSPACE_ROOT]. If those files do not prove a package or app name, describe the work by path and outcome.
Do not add another path field for commits, work, or bundle location.
Treat PRD/SPEC documents as immutable source planning docs unless the user asks you to edit them.
Read every user-provided PRD/SPEC path before generating files. Follow linked in-repo planning files that affect implementation. Classify by content, not filename: PRD-like content gives product intent; SPEC-like content gives implementation constraints; mixed docs can give both.
Use source docs to create a new AFK Ralph bundle. .ralph/plan.md and .ralph/items.json own execution. Prefer the user's requested outcome over planning-tool boilerplate. Do not inline source document contents into the Ralph files.
Default to distilled-only bundles: read PRD/SPEC files while writing the bundle, then leave runtime_contract.source_docs empty. Use source_docs only when the user asks for provenance/protection mode.
When translating source docs into a Ralph-compatible plan:
steps..ralph/plan.md only when they affect AFK safety or item scope. Ask the user when a conflict would change scope.Read platform/topology references only when the plan touches system-level setup, permissions, host/runtime boundaries, packaging, services, installers, devices, GUI automation, or cross-OS execution. Do not read them for ordinary app-code plans.
| Reference | Use when |
|---|---|
references/platforms/windows.md | Windows host/runtime, PowerShell/cmd, UAC/admin, Win32 apps, WebView2, tray/hotkeys, services, installers, or Windows packaging |
references/platforms/linux.md | Linux host/runtime setup, distro packages, services, daemons, devices, display/audio, containers, sudo, root, or Linux packaging |
references/platforms/macos.md | macOS host/runtime setup, Homebrew, Xcode tools, codesign/notarization, GUI permissions, launchd, app bundles, or Apple runtime constraints |
references/topologies/windows-wsl-interop.md | WSL, UNC paths, wsl.exe, wslpath, Windows tools launched from WSL, Windows↔WSL localhost behavior, inherited elevation, or mixed Windows/WSL execution |
When you need Ralph Wiggum loop background, feel uncertain about the technique, want deeper source grounding, are revising this skill, or are auditing Ralph doctrine, read philosophy/ files in numbered order:
philosophy/001-intro-to-ralph-loop-by-geoffrey-huntley.mdphilosophy/002-ralph-as-engineer-by-geoffrey-huntley.mdphilosophy/003-long-running-agents-by-anthropic.mdphilosophy/004-tips-for-ralph-loops-by-matt-pocock.mdphilosophy/005-anthropic-plugin-sucks-by-matt-pocock.mdphilosophy/006-ralph-biggest-name-in-ai-by-venturebeat.mdSystem-level Ralph loops must not discover basic host, permission, or runtime blockers after the loop starts. Before writing the bundle, resolve:
sudo, root, forbidden, or pre-provisioned outside the loopRun only safe preflight checks during planning. Do not install packages, mutate services, start privileged workflows, or trigger interactive permission prompts unless the user explicitly approves that planning action.
If unresolved system uncertainty could make the Ralph loop spin, do not write the four .ralph/ files. Inspect more, research more, or ask the user. If every useful acceptance path depends on unavailable credentials, accounts, paid services, hardware, admin permissions, destructive approval, or verification dependencies with no safe local substitute, do not write the bundle. Encode confirmed constraints in .ralph/plan.md; add startup checks to .ralph/prompt.md only for facts the runtime agent must revalidate.
Each item must describe one behavior-visible outcome with concrete verification steps. Keep it small enough for one clean commit and one full verification pass.
Build items from acceptance criteria and technical constraints, not source-document task order. Convert source checklist entries into the smallest verifiable behavior slices. Omit workflow metadata.
Do not hard-code item order. The runtime agent chooses one unfinished item after reading the plan, item list, progress, git history, and repo state.
Prefer items that reduce architectural risk, integration risk, blocked work, unverified assumptions, or regressions.
.ralph/plan.mdUse this header skeleton:
# Execution Plan: [GOAL]
## Source Inputs
## Objective
## Scope In
## Scope Out
## Constraints
## Prioritization Strategy
## Completion Definition
Include source input type, assumptions, platform/topology constraints when relevant, and completion criteria. Reference .ralph/items.json as the source of truth for item status.
Write this file as an execution note. Use short factual sentences with paths, commands, constraints, and acceptance criteria. Do not write marketing copy, rhetorical setups, formulaic contrasts, em dashes, or vague project claims. Name the project only from files under the Ralph workspace root. Do not invent license, install, API, or package-manager facts that files under the Ralph workspace root do not prove.
.ralph/items.jsonGenerate valid JSON with this shape:
{
"version": 1,
"runtime_contract": {
"source_docs": [],
"verification_gates": [
{ "name": "[gate name]", "command": "[repo verification command]" }
],
"require_progress_append": true,
"require_one_item_per_iteration": true,
"require_commit": true
},
"items": [
{
"category": "functional",
"description": "[feature description]",
"steps": ["[end-to-end user step 1]", "[end-to-end user step 2]"],
"passes": false,
"regression_notes": ""
}
]
}
Rules:
runtime_contract.source_docs empty for distilled-only bundles.source_docs only for provenance/protection mode.verification_gates.|| true, output suppression, skipped checks, or commands that mask failures.verification_gates. Bad examples: npm run dev, vite --host, next dev, astro dev, wrangler dev, rails server, python -m http.server, docker compose up, tail -f, and watcher commands such as npm run test -- --watch. Use build/test commands, or a bounded smoke script that starts the service, probes it, cleans it up, and exits with the probe status.verification_gates only when the repo has no executable verification command. Record that limit in .ralph/plan.md and .ralph/prompt.md.require_progress_append and require_one_item_per_iteration to true.require_clean_source_docs by default.require_clean_source_docs to true only for explicit provenance/protection mode with non-empty source_docs.require_commit to true for normal implementation loops.require_commit: false for read-only, audit, reporting loops, or any bundle where commits would be wrong or no git repo should be required.commit_policy or git_root. Ralph checks whether git HEAD changed in the Ralph workspace root. It does not count commits.require_commit: true, tell the runtime agent to initialize git in the Ralph workspace root during the first iteration.description or steps after creation.passes to true only after end-to-end verification..ralph/progress.md, and keep moving.passes as false only for hard blockers: missing credentials, external accounts, paid services, hardware, admin permissions, destructive approval, or an unavailable verification dependency with no safe local substitute.regression_notes for hard blockers discovered after bundle creation. Do not add new item fields.passes back to false and explain in regression_notes..ralph/progress.mdCreate this file empty. The runtime agent will append one handoff entry per iteration.
.ralph/prompt.mdMake the prompt self-contained for a fresh context window. Do not assume the runtime model knows Ralph by name.
Instruct the runtime agent to:
.ralph/plan.md, .ralph/items.json, and .ralph/progress.md firstruntime_contract.source_docs lists pathssource_docs lists paths, treat them as protected secondary evidence; read them only when the selected item needs clarification.ralph/plan.md prioritization.ralph/items.json as the only authoritative Ralph item list.ralph/plan.md and .ralph/items.json when source docs conflict with the generated bundle.ralph/progress.md; do not ask the userruntime_contract.verification_gates.ralph/progress.md; do not claim real external integration was verifiedpasses to true after using a substitute only when the substitute fully satisfies the item's stated steps; if the item genuinely requires the unavailable external dependency, keep passes as false.ralph/progress.md, keep that item's passes value false, add a concise regression_notes blocker if useful, and choose a different unfinished item that can proceed without human input.ralph/progress.md once, leave all passes values unchanged, and end without emitting NEXT or COMPLETE<promise>WAIT</promise> instead of a progress update; do not poll or spend turns restating that you are waiting.ralph/items.json by changing passes and regression_notes only.ralph/progress.md entry with the item, decision rationale, changed files, verification results, and next-iteration notesruntime_contract.source_docs unless the user allowed editsruntime_contract.require_commit; initialize git in the Ralph workspace root during the first iteration when commits are required and no git repo exists.ralph/items.json / .ralph/progress.md state updates; do not stage .ralph/loop.mdPromise rules:
<promise>WAIT</promise> only when the current iteration is blocked on an async helper, background command, review, process alert, or future tool result that is expected to arrive later. WAIT does not mark an item passing and does not start a fresh iteration.<promise>NEXT</promise> only after one item passes, all required checks pass, progress was appended, listed source docs stayed clean when source_docs is non-empty, and the commit requirement was satisfied.<promise>COMPLETE</promise> only after every item passes and all required checks pass. If COMPLETE only verifies an already-finished bundle, it does not need to append progress.Terminal boundary rules:
.ralph/items.json, append .ralph/progress.md, satisfy runtime_contract.require_commit, verify the commit state when commits are required, and emit the required promise tag.<promise>WAIT</promise> on the last non-empty line.Boundary example:
Wrong: Item 1 passed. Next I will work on Item 2.
Right: <promise>NEXT</promise>
Ban bypasses in the runtime prompt: no skipped checks, weakened tests, --no-verify, || true, suppressed failures, deleted tests, or success claims without command evidence.
The extension rejects NEXT if zero or multiple items move from passes:false to passes:true, immutable item fields change, progress append checks fail, listed source docs change when source_docs is non-empty, or require_commit: true is set and git HEAD did not change in the Ralph workspace root.
The extension rejects COMPLETE if any item has passes:false, immutable item fields change, progress checks fail, listed source docs change when source_docs is non-empty, or require_commit: true is set and git HEAD did not change in the Ralph workspace root.
The extension does NOT run verification_gates at promise emission. They are instructions surfaced to the runtime agent, which must run them during its iteration before emitting a promise. Re-running gates in the harness froze the loop on heavy suites and duplicated the agent's own run, so gate execution is the agent's responsibility, not an enforced runtime check.
Rejected promises continue in the same session with a corrective prompt. Accepted WAIT parks the same iteration until another result arrives or the wait timeout asks the agent to re-check. Accepted NEXT starts the next fresh session. The current runtime agent must not start the next item itself. Accepted COMPLETE ends the loop.
Choose n for --max-iterations as the maximum number of Ralph loop iterations to allow. Base it on the number of unfinished items plus expected retry risk.
If the Ralph workspace root is the current workspace, respond with exactly this shape and no extra commentary:
/ralph-loop "@.ralph/prompt.md" --max-iterations=n
If the Ralph workspace root is a different path, respond with exactly this shape and no extra commentary:
Run this from `[RALPH_WORKSPACE_ROOT]`:
/ralph-loop "@.ralph/prompt.md" --max-iterations=n
Do not write status text such as All four files are written or One item, one iteration needed. Do not summarize the files you wrote. Do not include a table, bullet list, explanation, or fenced command block in the final response. Do not add any extra text before or after the required response shape.