Skip to content

Instantly share code, notes, and snippets.

@dctanner
Created January 20, 2026 13:11
Show Gist options
  • Select an option

  • Save dctanner/e78b1a29af5d7abea320e868b9410b91 to your computer and use it in GitHub Desktop.

Select an option

Save dctanner/e78b1a29af5d7abea320e868b9410b91 to your computer and use it in GitHub Desktop.
ralph
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 <todo_file> <iterations>"
exit 1
fi
TODO_FILE="$1"
ITERATIONS="$2"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
PROGRESS_FILE="progress_${TIMESTAMP}.txt"
echo "Using input file: $TODO_FILE"
echo "Progress will be logged to: $PROGRESS_FILE"
for ((i=1; i<=$ITERATIONS; i++)); do
echo "=== Starting iteration $i ==="
if ! result=$(docker sandbox run claude --permission-mode acceptEdits -p "@${TODO_FILE} @${PROGRESS_FILE} \
1. Find the next task to do and implement it. \
2. Run your tests and type checks. \
3. Mark done items in ${TODO_FILE}. \
4. Append your progress to ${PROGRESS_FILE}. \
5. Commit your changes. \
ONLY WORK ON A SINGLE TASK. \
If all work in ${TODO_FILE} is complete, output <promise>COMPLETE</promise>." 2>&1); then
echo "Claude command failed with exit code $?"
echo "Output: $result"
exit 1
fi
echo "$result"
if [[ "$result" == *"<promise>COMPLETE</promise>"* ]]; then
echo "All tasks complete after $i iterations."
exit 0
fi
done
@dctanner
Copy link
Author

Inspired by https://www.aihero.dev/getting-started-with-ralph

  • Make sure you have Docker Desktop 4.50+, then run docker sandbox run claude and login.
  • Write a TODO.md or SPEC.md
  • Run sh ./ralph.sh TODO.md 10
  • Take a walk

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