Get the FREE Ultimate OpenClaw Setup Guide →

ralph-reset

npx machina-cli add skill stavarengo/ralph-wiggum-loop/ralph-reset --openclaw
Files (1)
SKILL.md
2.0 KB

ralph-reset

Hard resets the repository to the last committed state, discarding all uncommitted changes and untracked files.

Overview

This skill is used when Ralph gets stuck or the codebase is in an inconsistent state. It provides a way to return to the last clean checkpoint.

WARNING

This is a destructive operation! It will:

  • Discard all uncommitted changes in tracked files
  • Remove all untracked files and directories
  • Reset the repository to the last commit (HEAD)

You cannot undo this operation! Make sure you want to lose all uncommitted work before proceeding.

Implementation

# Step 1: Confirm destructive action with user
Use AskUserQuestion to confirm:
"⚠️  WARNING: This will discard ALL uncommitted changes and untracked files.
This cannot be undone. Are you sure you want to proceed? (yes/no)"

# Step 2: If user confirms (response == "yes")
# Execute git reset and clean
git reset --hard HEAD
git clean -fd

# Step 3: Update status.json
Read docs/ai/ralph/status.json
Update the 'status' field to 'reset'
Update the 'lastReset' timestamp to current ISO 8601 time
Write back to docs/ai/ralph/status.json

# Step 4: Report results to user
echo "✅ Repository reset complete"
echo "- All uncommitted changes discarded"
echo "- All untracked files removed"
echo "- Repository at: $(git rev-parse --short HEAD)"
echo "- Status updated to: reset"

# Step 5: If user does not confirm
echo "❌ Reset cancelled by user"
exit 0

Usage

Invoke this skill when:

  • Ralph is stuck in an iteration loop
  • The codebase is in an inconsistent state
  • You want to return to the last committed checkpoint
  • Tests are failing due to leftover artifacts

Related

  • Use git tag (from Step 8 of Ralph iterations) to create clean checkpoints
  • Use /ralph:stop before reset to cleanly end the current iteration
  • After reset, use /ralph:start to begin fresh iterations

Source

git clone https://github.com/stavarengo/ralph-wiggum-loop/blob/main/skills/ralph-reset/SKILL.mdView on GitHub

Overview

Hard resets the repository to the last committed state, discarding all uncommitted changes and untracked files. It is used when Ralph gets stuck or the codebase is inconsistent, providing a clean checkpoint at HEAD. This is a destructive operation, so confirm before proceeding.

How This Skill Works

The skill prompts the user for confirmation via AskUserQuestion with a clear WARNING. If the user confirms, it executes git reset --hard HEAD and git clean -fd to discard changes and remove untracked files. It then updates docs/ai/ralph/status.json by setting status to 'reset' and updating lastReset to the current ISO 8601 time, and reports the results to the user; if the user declines, it cancels the operation.

When to Use It

  • Ralph is stuck in an iteration loop
  • The codebase is in an inconsistent state
  • You want to return to the last committed checkpoint
  • Tests are failing due to leftover artifacts
  • You are preparing for a clean restart before a new iteration

Quick Start

  1. Step 1: Confirm the destructive action with the user using AskUserQuestion and the provided warning
  2. Step 2: If confirmed, run git reset --hard HEAD and git clean -fd
  3. Step 3: Update docs/ai/ralph/status.json with status 'reset' and the current ISO timestamp; report results

Best Practices

  • Always confirm the destructive action with the user before proceeding
  • Ensure you understand you will lose uncommitted work
  • Back up any important changes before performing the reset
  • Verify HEAD state and update status.json after reset
  • Coordinate with Ralph flow (e.g., use /ralph:stop and /ralph:start) after the reset

Example Use Cases

  • Ralph is stuck in a loop; reset to last commit to resume progress
  • Codebase contaminated by transient artifacts; reset to a clean state
  • Before starting a fresh iteration, reset to a known clean HEAD
  • Post-test run artifacts causing failures; perform a hard reset
  • Need a reproducible, clean checkpoint at HEAD for documentation

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers