Skip to content

Instantly share code, notes, and snippets.

@TikiCat7
Last active January 8, 2026 14:36
Show Gist options
  • Select an option

  • Save TikiCat7/2447f80fb31602e3f72dbbb7878e7dcb to your computer and use it in GitHub Desktop.

Select an option

Save TikiCat7/2447f80fb31602e3f72dbbb7878e7dcb to your computer and use it in GitHub Desktop.
Ralph Wiggums Bash Script (time taken + telegram notification)
#!/bin/bash
set -e
start_time=$(date +%s)
if [ -z "$1" ]; then
echo "Usage: $0 <iterations>"
exit 1
fi
for ((i = 1; i <= $1; i++)); do
echo "Iteration $i"
echo "------------------------------"
result=$(claude --permission-mode acceptEdits -p "@plans/prd.json @progress.txt \
1. Find the highest-priority feature to work on and work only on that feature. \
This should be the one YOU decide has the highest priority - not necessarily the first in the list. \
2. Check that the types check via bun run typecheck and that the tests (unit and e2e) pass via bun run test and bun run test:e2e. \
3. Update the PRD with the work that was done. \
4. Append your progress to the progress.txt file. \
Use this to leave a note for the next person working in the codebase. \
5. Make a git commit of that feature. \
ONLY WORK ON A SINGLE FEATURE. \
If, while implementing the feature, you notice the PRD is complete, output <promise>COMPLETE</promise>")
echo "$result"
if [[ "$result" == *"<promise>COMPLETE</promise>"* ]]; then
echo "PRD complete, exiting."
end_time=$(date +%s)
duration=$((end_time - start_time))
mins=$((duration / 60))
secs=$((duration % 60))
echo "PRD complete after $i iterations in ${mins}m ${secs}s" | notify -p telegram
exit 0
fi
done
end_time=$(date +%s)
duration=$((end_time - start_time))
mins=$((duration / 60))
secs=$((duration % 60))
echo "Ralph finished $1 iterations in ${mins}m ${secs}s" | notify -p telegram
@TikiCat7
Copy link
Author

TikiCat7 commented Jan 6, 2026

prd.json example

[
  {
      "category": "ui",
      "description": "Hint system for challenges",
      "steps": [
        "Add hint button to challenge toolbar",
        "Store showHint state in URL via nuqs",
        "Display hints progressively (one at a time)",
        "Style hints with distinct visual treatment",
        "Verify hints toggle correctly"
      ],
      "passes": false
  }
],

@TikiCat7
Copy link
Author

TikiCat7 commented Jan 6, 2026

ralph-once.sh - タスクを一つだけprd.jsonから選んで実行する

#!/bin/bash
set -e

start_time=$(date +%s)
result=""

cleanup() {
  exit_code=$?
  end_time=$(date +%s)
  duration=$((end_time - start_time))
  mins=$((duration / 60))
  secs=$((duration % 60))

  if [ -n "$result" ]; then
    summary=$(echo "$result" | claude -p "Summarize in plain text for Telegram (no markdown, no headers, no bullets). Format:
Feature: [name]
Changes: [1-2 sentences]
Files: [comma-separated list]
Keep under 300 chars. Output ONLY the summary, nothing else.")
  else
    summary="No output captured"
  fi

  if [ $exit_code -eq 0 ]; then
    printf "✅ Ralph complete in %dm %ds\n\n%s" "$mins" "$secs" "$summary" | notify -p telegram
  else
    printf "❌ Ralph FAILED in %dm %ds\n\n%s" "$mins" "$secs" "$summary" | notify -p telegram
  fi
}
trap cleanup EXIT

result=$(claude --permission-mode acceptEdits -p "@prd.json @progress.txt \
1. Find the highest-priority feature to work on and work only on that feature. \
This should be the one YOU decide has the highest priority - not necessarily the first in the list. \
2. Check that the types check via bun run typecheck and that the tests pass via bun run test. \
3. Update the PRD with the work that was done. \
4. Append your progress to the progress.txt file. \
Use this to leave a note for the next person working in the codebase. \
5. Make a git commit of that feature. \
ONLY WORK ON A SINGLE FEATURE. \
If, while implementing the feature, you notice the PRD is complete, output <promise>COMPLETE</promise>" | tee /dev/tty)

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