Ralph Stop
npx machina-cli add skill stavarengo/ralph-wiggum-loop/ralph-stop --openclawralph-stop
Stop Ralph's autonomous iteration loop gracefully.
What This Skill Does
This skill stops the autonomous loop started by /ralph:start. It sets a stop signal, allows the current iteration to finish, and updates the status.
Prerequisites
- Ralph must be initialized (
/ralph:inithas been run) docs/ai/ralph/status.jsonmust exist
Implementation
When this skill is invoked:
-
Set the stop flag: Create a stop signal file that
/ralph:startwill checktouch docs/ai/ralph/.ralph_stop -
Inform about current iteration: If an iteration is running, let it finish naturally. The stop signal will be checked before spawning the next iteration.
-
Update status.json: Set the status to 'stopped' and record the timestamp
# Read current status.json jq '.status = "stopped" | .last_updated = now | .stopped_at = now' docs/ai/ralph/status.json > /tmp/status.json.tmp mv /tmp/status.json.tmp docs/ai/ralph/status.json -
Report to user:
Ralph has been signaled to stop. - The current iteration (if running) will finish naturally - No new iterations will be spawned - Status updated to 'stopped' You can resume later with /ralph:start or run a single iteration with /ralph:iterate.
Coordination with /ralph:start
The /ralph:start skill checks for the existence of docs/ai/ralph/.ralph_stop before each iteration. When this file exists:
- The loop stops spawning new ralph-worker subagents
- The current iteration completes normally
- The loop exits gracefully
Notes
- This is a graceful stop, not an emergency abort
- Any work in progress will complete
- To resume, use
/ralph:startagain (it will clear the stop flag) - The stop flag is just a signal file, not a lock file
Source
git clone https://github.com/stavarengo/ralph-wiggum-loop/blob/main/skills/ralph-stop/SKILL.mdView on GitHub Overview
Stops the autonomous Ralph loop started with /ralph:start by signaling a stop, allowing the current iteration to finish, and updating the status. It relies on a stop flag file and a status.json to coordinate a clean shutdown.
How This Skill Works
It creates a stop signal file at docs/ai/ralph/.ralph_stop, which /ralph:start checks before spawning each iteration. If an iteration is running, it finishes naturally and no new iterations will spawn. The skill then updates docs/ai/ralph/status.json to status 'stopped' with a timestamp.
When to Use It
- You need to halt Ralph's autonomous loop before a maintenance window.
- You want to pause processing and resume later with /ralph:start.
- An iteration is running and you want to prevent new ones from starting.
- You're diagnosing issues and prefer a graceful shutdown over an abrupt abort.
- You're preparing to deploy updates and want to stop Ralph cleanly first.
Quick Start
- Step 1: Invoke /ralph:stop to signal a graceful halt.
- Step 2: Wait for the current iteration to complete; no new iterations will spawn.
- Step 3: Resume later with /ralph:start or run a single iteration with /ralph:iterate.
Best Practices
- Ensure Ralph is initialized with /ralph:init before stopping.
- Verify docs/ai/ralph/status.json exists so status can be updated.
- Do not manually delete the stop flag during shutdown; let the stop signal handle it.
- Communicate the impending stop to users with the standard stop notice.
- After stopping, confirm the status.json shows 'stopped' and a timestamp.
Example Use Cases
- Before a server maintenance window, stop Ralph to halt new iterations gracefully.
- Pause processing during data spikes and let the current batch finish before stopping.
- Gracefully stop prior to deploying a new version to avoid partial work.
- Stop Ralph during debugging to inspect state without abruptly aborting work.
- Signal a stop during a lull in activity and resume later with /ralph:start.