Prepares .ralph/ runtime state from an approved and reviewed plan bundle. Syncs plan tasks into prd.json and updates prompt.run.md with project-specific context and quality gates. Use after plan approval, decompose-plan review PASS, and ralph init.
Install
npx skillscat add shuymn/dotfiles/setup-ralph Install via the SkillsCat registry.
Path Resolution
<skill-root>means the directory containing thisSKILL.md.- Resolve
scripts/...andreferences/...relative to<skill-root>, not the caller's current working directory. - When executing local helpers, use explicit paths such as
<skill-root>/scripts/....
Setup Ralph
Prepare .ralph/ for the execution loop: fill prd.json from an approved plan bundle and update prompt.run.md with project-specific guidance.
Prerequisite: .ralph/ has already been initialized via ralph init.
Not in Scope
- Running
ralph init—.ralph/must already exist before this skill runs. - Modifying plan.md, design docs, or review reports.
- Selecting or executing tasks — that is
execute-plan's responsibility.
When to Use
- You have an approved plan bundle from
decompose-plan. decompose-plan reviewhas produced.../plan.review.mdwith PASS verdict..ralph/already exists (created byralph init).- Input: a plan.md file path (passed as argument or resolved interactively) and its derived
.../plan.review.md. - Output: updated
.ralph/prd.jsonand.ralph/prompt.run.md.
<HARD-GATE: PLAN APPROVAL>
Do NOT sync a plan that has not been explicitly approved by the user.
- Verify the plan's
Checkpoint Summarypasses full validation (see Step 1.5). - Verify the review report (
.../plan.review.md) exists and has PASS verdicts (see Step 1.6). - If any required key is missing or any verdict is not PASS, stop and ask the user to fix the plan first.
Process
Step 1: Resolve Plan Path
- If
$ARGUMENTSis provided, use it as the plan path directly. - If no argument, search
docs/plans/*/plan.mdfor available plans. - If multiple plans exist, present the list and ask the user to select one.
- If no plans exist, stop and inform the user.
- Validate the resolved path exists and is a
decompose-planplan bundle:- The file contains
## Task Dependency Graph. - The file contains
## Checkpoint Summarywith all required keys:Alignment Verdict: PASSForward Fidelity: PASSReverse Fidelity: PASSNon-Goal Guard: PASSBehavioral Lock Guard: PASSTemporal Completeness Guard: PASSQuality Gate Guard: PASS(orN/A (no quality gates detected))Integration Coverage Guard: PASS(orN/Afor plans with no cross-task deps)Trace PackandCompose Packpaths that match the plan header linksUpdated At
- The file contains
- Validate review report readiness:
- Derive review path by replacing
plan.mdwithplan.review.md. - The review file exists.
- Run gate check:
skit gate-check <review-file> <source-file>. If exit code is non-zero, stop and ask the user to re-rundecompose-plan review. - The review report contains (Review Metadata + Summary):
Overall Verdict: PASS(in## Review Metadata)Forward Fidelity: PASSReverse Fidelity: PASSRound-trip: PASSBehavioral Lock: PASSNegative Path: PASSGranularity: PASSTemporal: PASSTraceability: PASSScope: PASSTestability: PASSExecution Readiness: PASSIntegration Coverage: PASS(orN/A (no cross-task deps))Updated At
- Derive review path by replacing
Step 2: Parse Plan Tasks
Extract tasks from the plan.md by parsing each ### Task N: <title> section:
- Task ID: Extract
Nfrom### Task N:and map totask-N. - Title: Extract the title text after
### Task N:. - Dependencies: Parse
**Dependencies**: T1, T2(ornone), with or without a leading markdown list marker (-).- Map
TNreferences totask-Nstory IDs. nonemaps to an empty array[].
- Map
- Validate the dependency graph:
- All referenced dependency IDs exist as parsed tasks.
- No circular dependencies.
Step 3: Derive Metadata
- project: Identify a short slug for the project. Use any reasonable source: git remote URL, directory name,
AGENTS.mdreferences, or the plan context. There is no strict format — pick what feels natural as a project identifier. - branchName: Read the plan's
**Goal**,**Architecture**,**Tech Stack**, and task titles to understand the overall intent, then generate a branch name that concisely describes the change.- Format:
<type>/<slug>(e.g.,feat/config-schema-sync,refactor/runner-error-handling). <type>is one of:feat,fix,refactor,chore,docs— choose based on the plan's primary intent.<slug>is a short, descriptive kebab-case name (2-4 words) summarizing the plan scope. Use your judgement — do not mechanically extract from the filename or title.- The filename and heading are available as hints, but the branch name should reflect the plan's actual content.
- Format:
- If either value cannot be determined, ask the user.
Step 4: Write prd.json
Overwrite .ralph/prd.json with:
{
"project": "<derived-project-slug>",
"plan": "<relative-path-to-plan.md>",
"branchName": "<derived-branch-name>",
"stories": [
{
"id": "task-1",
"title": "<task title>",
"deps": ["task-0"],
"passes": false
}
]
}Rules:
- All stories start with
"passes": false. - Story order matches task order in the plan.
- The
planfield is the relative path from the project root.
Step 5: Update prompt.run.md
Update the editable sections of .ralph/prompt.run.md with project-specific content derived from AGENTS.md (or CLAUDE.md) and the plan.
Read project guidance sources in order:
AGENTS.mdat project root (if exists).- The resolved plan.md (for tech stack and verification commands).
Update only the following sections (preserve all other sections unchanged):
Context: Add project-specific context.
- Repository structure and key directories from
AGENTS.md. - Tech stack and architecture from the plan header (
**Architecture**,**Tech Stack**). - Key packages and their responsibilities relevant to the plan scope.
- Repository structure and key directories from
Rules: Add project-specific coding rules.
- Coding conventions from
AGENTS.md(error handling, naming, testing style). - Plan-specific constraints (protected paths, file placement rules from task
**Files**sections). - Add a rule directing the agent to use the
execute-planskill for each story during the Turn Procedure.
- Coding conventions from
Quality Gates: Add project-specific verification commands.
- Build/test/lint commands from
AGENTS.md(e.g.,task test,task lint,task fmt). - Plan-specific verification commands from task
**DoD**sections (e.g.,rtk go test ./internal/config/...).
- Build/test/lint commands from
Rules for editing prompt.run.md:
- Never modify sections marked
<!-- do not edit: ... -->. - Never modify Task Selection, Turn Procedure, Progress Format, Codebase Patterns, or Stop Condition sections.
- Keep additions concise; prefer referencing
AGENTS.mdover duplicating its content.
Step 6: Report
- Summarize
prd.jsonupdates without dumping full file content:- project, plan path, branchName
- story count and task ID range (e.g.,
task-1totask-8)
- Summarize
prompt.run.mdupdates without dumping section content:- What changed in Context, Rules, and Quality Gates
- Any commands or constraints added/updated
- Summarize:
- Number of stories synced.
- Dependency chain (e.g.,
T1 -> T2 -> T3 -> T4). - Derived metadata (project, branchName).
- Suggest the user review both files and start the ralph loop.
Stop Conditions
Stop immediately and ask user guidance when:
.ralph/does not exist (user should runralph initfirst)..ralph/prd.jsonor.ralph/prompt.run.mddoes not exist.- Plan path cannot be resolved or does not exist.
- Plan is missing
Checkpoint Summary, missing required keys, or has any verdict that is not PASS. - Review report is missing, malformed, or has any verdict that is not PASS.
- A dependency references a task ID that does not exist in the plan.
- Circular dependency detected.
- branchName cannot be derived and user does not provide it.
- Neither
AGENTS.mdnorCLAUDE.mdexists at the project root (no source for project-specific guidance).
Key Principles
- Deterministic Mapping: The same plan.md always produces the same prd.json stories (task mapping is purely structural).
- Plan Fidelity: prd.json is a direct projection of plan.md tasks; do not add, remove, or reorder stories.
- Minimal Edit: Update only Context, Rules, and Quality Gates in prompt.run.md; never touch ralph runtime machinery sections.
- Fail-Fast Validation: Validate the plan structure and dependencies before writing any files.