docs(ralph-work-loop): add validation step before starting loop

This commit is contained in:
dan 2026-01-23 11:18:34 -08:00
parent 89e150789c
commit edc738f5eb
3 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,15 @@
# Ralph Work Loop Skill
Runs the Ralph Wiggum loop on an existing Work document.
## Usage
```
/ralph start docs/work/<work-doc>.md
```
If you don't know the work doc, run:
```bash
./.pi/skills/ralph-work-loop/scripts/find-latest-work.sh
```

View file

@ -0,0 +1,51 @@
---
name: ralph-work-loop
description: Start or resume a Ralph Wiggum loop on an existing Work document (docs/work/*.md). Use when the user asks to "use ralph" on a Work doc or to run iterative Work-phase execution.
---
# Ralph Work Loop
Use this skill to run the Ralph Wiggum loop **after** a Work document exists.
## Requirements
- Ralph extension installed: `.pi/extensions/ralph-wiggum/index.ts`
- Work document already created in `docs/work/`
## Process
1. **Validate the Work doc**:
- Check required sections: Intent link, Approach link, Checklist, Verification commands, Evidence section
- Each checklist item needs a verification command
- See the `work` skill for full validation checklist
- Fix any issues before starting the loop
2. **Locate the Work doc**:
- If user provides a path, use it.
- Otherwise run:
```bash
./.pi/skills/ralph-work-loop/scripts/find-latest-work.sh
```
- If multiple candidates are relevant, list them and ask the user to choose.
3. **Start the loop**:
```
/ralph start <work-doc-path>
```
Optional flags (ask user if they care):
- `--items-per-iteration N`
- `--reflect-every N`
- `--max-iterations N`
4. **Monitor or resume**:
- ` /ralph status` to show active loops
- ` /ralph resume <name>` to continue paused loop
5. **Stop**:
- Press `ESC` to pause
- ` /ralph-stop` when idle to end the loop
## Notes
- The loop enforces the **Intent → Approach → Work** dialect and requires verification evidence for completed items.
- Use `/ralph start <path>` to point directly to an existing Work doc.

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
skill_dir="$(cd "${script_dir}/.." && pwd)"
root_dir="$(cd "${skill_dir}/../../.." && pwd)"
work_dir="${root_dir}/docs/work"
if [[ ! -d "${work_dir}" ]]; then
echo "Error: docs/work not found at ${work_dir}" >&2
exit 1
fi
latest_file=""
if compgen -G "${work_dir}/*.md" > /dev/null; then
latest_file="$(ls -t "${work_dir}"/*.md | head -n 1)"
fi
if [[ -z "${latest_file}" ]]; then
echo "Error: no Work docs found in ${work_dir}" >&2
exit 1
fi
relative_path="${latest_file#"${root_dir}/"}"
echo "${relative_path}"