flow-next-opencode-ralph-init
Ralph init
Scaffold repo-local Ralph harness. Opt-in only.
Rules
- Only create/update
scripts/ralph/in the current repo. - If
scripts/ralph/already exists, offer to update (preserves config.env). - Copy templates from
.opencode/skill/flow-next-opencode-ralph-init/templates/intoscripts/ralph/. - Copy
flowctlandflowctl.pyfrom$OPENCODE_DIR/bin/intoscripts/ralph/. - Set executable bit on
scripts/ralph/ralph.sh,scripts/ralph/ralph_once.sh, andscripts/ralph/flowctl.
Workflow
-
Resolve repo root and OpenCode dir:
ROOT="$(git rev-parse --show-toplevel)" OPENCODE_DIR="$ROOT/.opencode" TEMPLATE_DIR="$ROOT/.opencode/skill/flow-next-opencode-ralph-init/templates" -
Check if
scripts/ralph/exists:- If exists: ask "Update existing Ralph setup? (preserves config.env and runs/) [y/n]"
- If no: stop
- If yes: set UPDATE_MODE=1
- If not exists: set UPDATE_MODE=0
- If exists: ask "Update existing Ralph setup? (preserves config.env and runs/) [y/n]"
-
Detect available review backends (skip if UPDATE_MODE=1):
HAVE_RP=0; if command -v rp-cli >/dev/null 2>&1; then HAVE_RP=1; elif [[ -x /opt/homebrew/bin/rp-cli || -x /usr/local/bin/rp-cli ]]; then HAVE_RP=1; fi
4. Determine review backend (skip if UPDATE_MODE=1):
- If rp-cli available, ask user:
```
Which review backend?
a) OpenCode (GPT‑5.2 High)
b) RepoPrompt (macOS, visual builder)
(Reply: "a", "opencode", "b", "rp", or just tell me)
```
Wait for response. Default if empty/ambiguous: `opencode`
- If only rp-cli available and user chooses rp: use `rp`
- Otherwise: use `opencode`
- If neither available and user requests none: use `none`
5. Copy files using bash (MUST use cp, NOT Write tool):
**If UPDATE_MODE=1 (updating):**
```bash
# Backup config.env
cp scripts/ralph/config.env /tmp/ralph-config-backup.env
# Update templates (preserves runs/)
cp "$TEMPLATE_DIR/ralph.sh" scripts/ralph/
cp "$TEMPLATE_DIR/ralph_once.sh" scripts/ralph/
cp "$TEMPLATE_DIR/prompt_plan.md" scripts/ralph/
cp "$TEMPLATE_DIR/prompt_work.md" scripts/ralph/
cp "$TEMPLATE_DIR/watch-filter.py" scripts/ralph/
cp "$OPENCODE_DIR/bin/flowctl" "$OPENCODE_DIR/bin/flowctl.py" scripts/ralph/
chmod +x scripts/ralph/ralph.sh scripts/ralph/ralph_once.sh scripts/ralph/flowctl
# Restore config.env
cp /tmp/ralph-config-backup.env scripts/ralph/config.env
If UPDATE_MODE=0 (fresh install):
mkdir -p scripts/ralph/runs
cp -R "$TEMPLATE_DIR/." scripts/ralph/
cp "$OPENCODE_DIR/bin/flowctl" "$OPENCODE_DIR/bin/flowctl.py" scripts/ralph/
chmod +x scripts/ralph/ralph.sh scripts/ralph/ralph_once.sh scripts/ralph/flowctl
Note: cp -R templates/. copies all files including dotfiles (.gitignore).
-
Edit
scripts/ralph/config.envto set the chosen review backend (skip if UPDATE_MODE=1):- Replace
{{PLAN_REVIEW}}with<chosen> - Replace
{{WORK_REVIEW}}with<chosen>
- Replace
-
Print next steps (run from terminal, NOT inside OpenCode):
If UPDATE_MODE=1:
Ralph updated! Your config.env was preserved. Run from terminal: - ./scripts/ralph/ralph_once.sh (one iteration, observe) - ./scripts/ralph/ralph.sh (full loop, AFK)If UPDATE_MODE=0:
Ralph initialized! Next steps (run from terminal, NOT inside OpenCode): - Edit scripts/ralph/config.env to customize settings - ./scripts/ralph/ralph_once.sh (one iteration, observe) - ./scripts/ralph/ralph.sh (full loop, AFK) - Uninstall: rm -rf scripts/ralph/
More from gmickel/flow-next-opencode
browser
Browser automation via agent-browser CLI. Use when you need to navigate websites, verify deployed UI, test web apps, read online documentation, scrape data, fill forms, capture baseline screenshots before design work, or inspect current page state. Triggers on "check the page", "verify UI", "test the site", "read docs at", "look up API", "visit URL", "browse", "screenshot", "scrape", "e2e test", "login flow", "capture baseline", "see how it looks", "inspect current", "before redesign".
1flow-next-opencode-plan
Create structured build plans from feature requests or Flow IDs. Use when planning features or designing implementation. Triggers on /flow-next:plan with text descriptions or Flow IDs (fn-1, fn-1.2).
1flow-next-opencode-sync
Manually trigger plan-sync to update downstream task specs after implementation drift. Use when code changes outpace specs.
1flow-next-opencode-work
Execute a Flow epic or task systematically with git setup, task tracking, quality checks, and commit workflow. Use when implementing a plan or working through a spec. Triggers on /flow-next:work with Flow IDs (fn-1, fn-1.2).
1flow-next-opencode
Manage .flow/ tasks and epics. Triggers: 'show me my tasks', 'list epics', 'what tasks are there', 'add a task', 'create task', 'what's ready', 'task status', 'show fn-1'. NOT for /flow-next:plan or /flow-next:work.
1flow-next-opencode-prime
Comprehensive codebase assessment for agent and production readiness. Scans 8 pillars (48 criteria), verifies commands work, checks GitHub settings. Reports everything, fixes agent readiness only. Triggers on /flow-next:prime.
1