Files
gh-lerianstudio-ring-ralph-…/commands/cancel-ralph.md
2025-11-30 08:37:22 +08:00

914 B

name, description, allowed-tools, hide-from-slash-command-tool
name description allowed-tools hide-from-slash-command-tool
cancel-ralph Cancel active Ralph Wiggum loop
Bash
true

Cancel Ralph

bash -c '
STATE_FILE=$(find .claude -maxdepth 1 -name "ralph-loop-*.local.md" -type f 2>/dev/null | head -1)
if [[ -n "$STATE_FILE" ]] && [[ -f "$STATE_FILE" ]]; then
  ITERATION=$(grep "^iteration:" "$STATE_FILE" | sed "s/iteration: *//")
  SESSION_ID=$(grep "^session_id:" "$STATE_FILE" | sed "s/session_id: *//" | tr -d "\"")
  echo "FOUND_LOOP=true"
  echo "ITERATION=$ITERATION"
  echo "SESSION_ID=$SESSION_ID"
  echo "STATE_FILE=$STATE_FILE"
else
  echo "FOUND_LOOP=false"
fi
'

Check the output above:

  1. If FOUND_LOOP=false:

    • Say "No active Ralph loop found."
  2. If FOUND_LOOP=true:

    • Use Bash to remove the state file shown in STATE_FILE
    • Report: "Cancelled Ralph loop (session: SESSION_ID, was at iteration ITERATION)"