Skip to content

chore: Add Ralph installation script and test utility#94

Open
moneypenny-CHI wants to merge 1 commit intosnarktank:mainfrom
moneypenny-CHI:feature/install-ralph
Open

chore: Add Ralph installation script and test utility#94
moneypenny-CHI wants to merge 1 commit intosnarktank:mainfrom
moneypenny-CHI:feature/install-ralph

Conversation

@moneypenny-CHI
Copy link

This PR adds the 'ralph.sh' script and a 'test-ralph' utility to simplify installation and verification of the Ralph autonomous coding loop system.\n\nChanges include:\n- Installation of 'ralph.sh' and 'CLAUDE.md' to '~/ralph-tools/'.\n- Creation of a 'test-ralph' script.\n- Verification of 'jq' and 'claude' CLI dependencies.

@greptile-apps
Copy link

greptile-apps bot commented Feb 10, 2026

Greptile Overview

Greptile Summary

Adds a self-contained scripts/ralph/ bundle: an agent instruction file (CLAUDE.md), a long-running loop runner (ralph.sh) with tool selection and run archiving, and a test-ralph utility to verify dependencies and kick off a run.

The core flow is test-ralph -> ralph.sh, where ralph.sh loops up to N iterations and runs either amp (reading prompt.md) or claude (currently reading CLAUDE.md), then checks for a <promise>COMPLETE</promise> completion marker and maintains progress.txt/archives based on prd.json branchName.

Confidence Score: 3/5

  • This PR is close, but the shipped scripts have invocation and dependency issues that will break the advertised workflow.
  • Key paths don’t run as intended: test-ralph invokes ralph.sh with an incompatible --tool syntax, ralph.sh uses jq without checking it exists, and the claude-mode input file appears incorrect versus the amp-mode prompt flow. These are fixable but will cause immediate runtime failures/confusion.
  • scripts/ralph/ralph.sh, scripts/ralph/test-ralph

Important Files Changed

Filename Overview
scripts/ralph/CLAUDE.md Adds agent instruction file used by ralph.sh when running in claude mode.
scripts/ralph/ralph.sh Adds long-running loop runner with archiving and tool selection; contains dependency/tooling mismatches and missing jq check in claude path.
scripts/ralph/test-ralph Adds dependency checker and runner; uses hardcoded ~/ralph-tools path and calls ralph.sh with option syntax that doesn't match its parser.

Sequence Diagram

sequenceDiagram
  participant U as User
  participant T as test-ralph
  participant R as ralph.sh
  participant J as jq
  participant C as claude CLI
  participant A as amp CLI

  U->>T: run ./test-ralph
  T->>T: check command -v jq
  T->>T: check command -v claude
  alt missing deps
    T-->>U: exit 1
  else deps ok
    T->>R: invoke ralph.sh
    R->>J: read prd.json branchName
    R->>R: init progress.txt / archive if branch changed
    loop each iteration
      alt TOOL == amp
        R->>A: amp reads prompt.md
        A-->>R: output
      else TOOL == claude
        R->>C: claude reads CLAUDE.md
        C-->>R: output
      end
      R->>R: check for COMPLETE marker
    end
    R-->>U: exit 0 if COMPLETE else exit 1
  end
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

fi

echo "Dependencies verified. Running Ralph..."
cd ~/ralph-tools && ./ralph.sh --tool claude
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken flag syntax
test-ralph calls ./ralph.sh --tool claude, but ralph.sh treats --tool as requiring the next arg to be the tool name. With the current call, $2 is empty and the script errors with “Invalid tool ''”. Use --tool=claude or ./ralph.sh --tool claude <iters>.

Suggested change
cd ~/ralph-tools && ./ralph.sh --tool claude
cd ~/ralph-tools && ./ralph.sh --tool=claude

Comment on lines +34 to +40
shift
;;
*)
# Assume it's max_iterations if it's a number
if [[ "$1" =~ ^[0-9]+$ ]]; then
MAX_ITERATIONS="$1"
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silently ignores args
In the default *) case, non-numeric arguments are ignored (shifted) without error. This means typos like --toool=claude or an accidental positional string will be silently dropped, and the script will run with defaults (e.g., TOOL=amp). That will definitely lead to confusing behavior in real use; unknown flags should error out.

Comment on lines +55 to +60
exit 1
fi

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PRD_FILE="$SCRIPT_DIR/prd.json"
PROGRESS_FILE="$SCRIPT_DIR/progress.txt"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing jq dependency
ralph.sh uses jq to read .branchName but never checks jq is installed. On machines without jq, the archive/branch tracking logic fails and can reset/overwrite progress.txt incorrectly (because CURRENT_BRANCH becomes empty). Add an explicit command -v jq check alongside the tool check.

Comment on lines +114 to +120
OUTPUT=$(cat "$SCRIPT_DIR/prompt.md" | amp --dangerously-allow-all 2>&1 | tee /dev/stderr) || true
else
# Claude Code: use --dangerously-skip-permissions for autonomous operation, --print for output
OUTPUT=$(claude --dangerously-skip-permissions --print < "$SCRIPT_DIR/CLAUDE.md" 2>&1 | tee /dev/stderr) || true
fi

# Check for completion signal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong input file
In --tool claude mode, the script feeds CLAUDE.md to claude --print. But CLAUDE.md instructs the agent to read prd.json and progress.txt and take actions; it is not the “prompt” content itself. This will run without providing a user prompt context (unlike the amp path which uses prompt.md), so the claude mode won’t behave as intended. If the intent is to run the same loop prompt, this should read prompt.md (or a dedicated prompt file) and keep CLAUDE.md as repo guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant