Variables:
<TargetPath>: output path for the Ralph prompt. Default: eng/ralph.md
<BaseTemplatePath>: optional seed prompt template to adapt
<RequirementsPath>: optional primary requirements path if known
<BacklogPath>: optional backlog path if known
<ScaffoldRuntime>: whether to also create the reusable Ralph runtime files. Default: false
<RuntimePath>: output directory for runtime helpers. Default: eng/
<BaseRuntimePath>: optional directory containing seed runtime files such as ralph.mjs and ralph-logger.mjs
Create or update <TargetPath> as a project-specific prompt for the Ralph technique.
You are generating a Ralph prompt tailored to the current repository. Optionally, when requested, also scaffold reusable Ralph runtime helpers.
Objectives
- Inspect the repository and discover the actual execution environment.
- Generate a Ralph-style prompt grounded in the repo's real structure, docs, tooling, and validation surface.
- Preserve the useful parts of any provided base template, but replace stale assumptions with repo-grounded instructions.
- If
<ScaffoldRuntime> is enabled, scaffold the standard Ralph runtime helpers under <RuntimePath>.
- Keep the result concise, opinionated, and directly usable.
Ralph principles to preserve
- One backlog task per loop.
- The primary context should behave as a scheduler.
- Expensive exploration, search, and summarization should be delegated to subagents when appropriate.
- Validation is back pressure and should match the repo's actual capabilities.
- Do not assume something is missing before searching for it.
- The context stack loaded every loop should be deterministic and minimal.
- Prefer the narrowest validation relevant to the changed unit before broader validation.
Repository grounding rules
- Inspect actual repo files before writing the prompt.
- Detect real requirements docs, backlog paths, task file conventions, and status vocabulary.
- Detect the actual package manager, workspace model, scripts, and validation commands.
- Detect engineering utilities under
eng/, CI workflows, and test/lint/build/typecheck setup.
- Do not invent commands, paths, or repo conventions that do not exist unless the prompt is explicitly establishing a new convention and the repo clearly supports that direction.
- If the repo is greenfield or partially scaffolded, reflect that honestly in the prompt.
Runtime scaffolding rules
Apply this section only when <ScaffoldRuntime> is true.
- Treat runtime files as reusable seed assets, not as fresh authored artifacts.
- Prefer copying from
<BaseRuntimePath> when provided.
- If no
<BaseRuntimePath> is provided, use the standard trusted Ralph runtime templates available to the skill.
- Only make minimal edits needed to fit the current repo.
- Do not rewrite the runtime architecture unless the current repo clearly requires it.
- If the repo is not compatible with the standard runtime assumptions, skip scaffolding and explain why.
Runtime compatibility checks
Before scaffolding runtime files, verify whether the repo is compatible with the standard Ralph runtime assumptions, including as applicable:
- Node.js is an acceptable runtime for engineering utilities
eng/ is a suitable location for helper scripts
- the repository can support local log and progress artifacts
- the expected agent CLI invocation model is compatible with the environment
If these assumptions do not hold, generate the prompt only and report the mismatch.
What to inspect
- root manifests and lockfiles
- README and docs
- requirements/spec/design docs
- backlog files and index
eng/ utilities
- CI/workflow files
- lint/build/test/typecheck/format configs
- any existing Ralph or Copilot instruction files
Output requirements
Always generate or update:
When <ScaffoldRuntime> is true and the repo is compatible, also generate or update:
<RuntimePath>/ralph.mjs
<RuntimePath>/ralph-logger.mjs
The Ralph prompt should include only the sections justified by the repo, but typically should cover:
- one-task-per-loop rule
- available tooling beyond subagents
- deterministic context stack
- task orientation/selection
- study/search expectations
- design-before-code expectations
- implementation rules
- validation/back-pressure rules
- progress/backlog recording
- commit/push expectations
- stuck/blocker handling
- never-violate rules
Authoring rules
- Prefer repository-specific instructions over generic advice.
- Preserve greenfield-safe behavior where automation is incomplete.
- Use the repo's real terminology, paths, and commands.
- If
<BaseTemplatePath> is provided, treat it as a style and operating seed, not as source truth.
- Remove copied assumptions that do not match the current project.
- If scaffolding runtime helpers, preserve the seed implementation unless a small grounded adaptation is necessary.
- Keep the final prompt lean while preserving the key Ralph behaviors.
Suggested process
- Inspect the repository.
- Infer the current Ralph-relevant operating environment.
- Draft the prompt.
- Cross-check every prescribed path and command against repo evidence.
- If
<ScaffoldRuntime> is enabled, assess runtime compatibility.
- If compatible, scaffold runtime helpers with minimal changes.
- Remove stale or unjustified instructions.
- Write the final files.
Definition of done
Do not finish until:
<TargetPath> reflects the Ralph technique
- the prompt is grounded in the current repository
- paths and commands are supported by repo evidence
- validation instructions match the real project state
- when runtime scaffolding is enabled, runtime files are either created compatibly or explicitly skipped with justification
- the resulting output is concise, coherent, and directly usable
At the end, provide a short summary of:
- what repo facts were inferred
- what was created or updated
- what was preserved from
<BaseTemplatePath> and <BaseRuntimePath>, if any
- what was changed because it did not fit the current project
- whether runtime scaffolding was performed or skipped
1---2name: init-ralph3description: Generates or updates a project-specific Ralph prompt grounded in the current repository's actual docs, backlog, tooling, validation surface, and engineering workflow. Optionally scaffolds reusable Ralph runtime files.4---56Variables:7- `<TargetPath>`: output path for the Ralph prompt. Default: `eng/ralph.md`8- `<BaseTemplatePath>`: optional seed prompt template to adapt9- `<RequirementsPath>`: optional primary requirements path if known10- `<BacklogPath>`: optional backlog path if known11- `<ScaffoldRuntime>`: whether to also create the reusable Ralph runtime files. Default: `false`12- `<RuntimePath>`: output directory for runtime helpers. Default: `eng/`13- `<BaseRuntimePath>`: optional directory containing seed runtime files such as `ralph.mjs` and `ralph-logger.mjs`1415Create or update `<TargetPath>` as a project-specific prompt for the Ralph technique.1617You are generating a Ralph prompt tailored to the current repository. Optionally, when requested, also scaffold reusable Ralph runtime helpers.1819## Objectives20211. Inspect the repository and discover the actual execution environment.222. Generate a Ralph-style prompt grounded in the repo's real structure, docs, tooling, and validation surface.233. Preserve the useful parts of any provided base template, but replace stale assumptions with repo-grounded instructions.244. If `<ScaffoldRuntime>` is enabled, scaffold the standard Ralph runtime helpers under `<RuntimePath>`.255. Keep the result concise, opinionated, and directly usable.2627## Ralph principles to preserve28291. One backlog task per loop.302. The primary context should behave as a scheduler.313. Expensive exploration, search, and summarization should be delegated to subagents when appropriate.324. Validation is back pressure and should match the repo's actual capabilities.335. Do not assume something is missing before searching for it.346. The context stack loaded every loop should be deterministic and minimal.357. Prefer the narrowest validation relevant to the changed unit before broader validation.3637## Repository grounding rules38391. Inspect actual repo files before writing the prompt.402. Detect real requirements docs, backlog paths, task file conventions, and status vocabulary.413. Detect the actual package manager, workspace model, scripts, and validation commands.424. Detect engineering utilities under `eng/`, CI workflows, and test/lint/build/typecheck setup.435. Do not invent commands, paths, or repo conventions that do not exist unless the prompt is explicitly establishing a new convention and the repo clearly supports that direction.446. If the repo is greenfield or partially scaffolded, reflect that honestly in the prompt.4546## Runtime scaffolding rules4748Apply this section only when `<ScaffoldRuntime>` is `true`.49501. Treat runtime files as reusable seed assets, not as fresh authored artifacts.512. Prefer copying from `<BaseRuntimePath>` when provided.523. If no `<BaseRuntimePath>` is provided, use the standard trusted Ralph runtime templates available to the skill.534. Only make minimal edits needed to fit the current repo.545. Do not rewrite the runtime architecture unless the current repo clearly requires it.556. If the repo is not compatible with the standard runtime assumptions, skip scaffolding and explain why.5657## Runtime compatibility checks5859Before scaffolding runtime files, verify whether the repo is compatible with the standard Ralph runtime assumptions, including as applicable:60- Node.js is an acceptable runtime for engineering utilities61- `eng/` is a suitable location for helper scripts62- the repository can support local log and progress artifacts63- the expected agent CLI invocation model is compatible with the environment6465If these assumptions do not hold, generate the prompt only and report the mismatch.6667## What to inspect6869- root manifests and lockfiles70- README and docs71- requirements/spec/design docs72- backlog files and index73- `eng/` utilities74- CI/workflow files75- lint/build/test/typecheck/format configs76- any existing Ralph or Copilot instruction files7778## Output requirements7980Always generate or update:81- `<TargetPath>`8283When `<ScaffoldRuntime>` is `true` and the repo is compatible, also generate or update:84- `<RuntimePath>/ralph.mjs`85- `<RuntimePath>/ralph-logger.mjs`8687The Ralph prompt should include only the sections justified by the repo, but typically should cover:88- one-task-per-loop rule89- available tooling beyond subagents90- deterministic context stack91- task orientation/selection92- study/search expectations93- design-before-code expectations94- implementation rules95- validation/back-pressure rules96- progress/backlog recording97- commit/push expectations98- stuck/blocker handling99- never-violate rules100101## Authoring rules1021031. Prefer repository-specific instructions over generic advice.1042. Preserve greenfield-safe behavior where automation is incomplete.1053. Use the repo's real terminology, paths, and commands.1064. If `<BaseTemplatePath>` is provided, treat it as a style and operating seed, not as source truth.1075. Remove copied assumptions that do not match the current project.1086. If scaffolding runtime helpers, preserve the seed implementation unless a small grounded adaptation is necessary.1097. Keep the final prompt lean while preserving the key Ralph behaviors.110111## Suggested process1121131. Inspect the repository.1142. Infer the current Ralph-relevant operating environment.1153. Draft the prompt.1164. Cross-check every prescribed path and command against repo evidence.1175. If `<ScaffoldRuntime>` is enabled, assess runtime compatibility.1186. If compatible, scaffold runtime helpers with minimal changes.1197. Remove stale or unjustified instructions.1208. Write the final files.121122## Definition of done123124Do not finish until:125- `<TargetPath>` reflects the Ralph technique126- the prompt is grounded in the current repository127- paths and commands are supported by repo evidence128- validation instructions match the real project state129- when runtime scaffolding is enabled, runtime files are either created compatibly or explicitly skipped with justification130- the resulting output is concise, coherent, and directly usable131132At the end, provide a short summary of:133- what repo facts were inferred134- what was created or updated135- what was preserved from `<BaseTemplatePath>` and `<BaseRuntimePath>`, if any136- what was changed because it did not fit the current project137- whether runtime scaffolding was performed or skipped