generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathralph-loop.sh
More file actions
executable file
Β·47 lines (38 loc) Β· 1.88 KB
/
ralph-loop.sh
File metadata and controls
executable file
Β·47 lines (38 loc) Β· 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Ralph Loop runner for openclaw-on-agentcore
# Runs Claude Code iteratively until STATUS: COMPLETE
PROJECT="/home/ec2-user/projects/openclaw-on-agentcore"
MAX_ITERATIONS=15
ITERATION=0
cd "$PROJECT"
echo "π΄ Ralph Loop starting β max $MAX_ITERATIONS iterations"
echo "π Plan: $PROJECT/IMPLEMENTATION_PLAN.md"
echo ""
while [ $ITERATION -lt $MAX_ITERATIONS ]; do
ITERATION=$((ITERATION + 1))
echo ""
echo "ββββββββββββββββββββββββββββββββββββββββ"
echo "π ITERATION $ITERATION / $MAX_ITERATIONS β $(date -u '+%Y-%m-%d %H:%M UTC')"
echo "ββββββββββββββββββββββββββββββββββββββββ"
# Check completion before running
if grep -qE "^STATUS: COMPLETE$" IMPLEMENTATION_PLAN.md 2>/dev/null; then
echo "β
STATUS: COMPLETE detected β loop finished!"
openclaw system event --text "β
Ralph Loop COMPLETE: Bedrock Guardrails + redteam/ fully implemented after $ITERATION iterations" --mode now
exit 0
fi
echo "π€ Running Claude Code..."
claude --permission-mode bypassPermissions --print "$(cat PROMPT.md)"
EXIT_CODE=$?
echo ""
echo "Claude Code exited with code: $EXIT_CODE"
# Check completion after run
if grep -qE "^STATUS: COMPLETE$" IMPLEMENTATION_PLAN.md 2>/dev/null; then
echo "β
STATUS: COMPLETE β all tasks done!"
openclaw system event --text "β
Ralph Loop COMPLETE: Bedrock Guardrails + redteam/ fully implemented after $ITERATION iterations" --mode now
exit 0
fi
echo "β³ Iteration $ITERATION done. Restarting..."
sleep 3
done
echo "β οΈ Max iterations ($MAX_ITERATIONS) reached without STATUS: COMPLETE"
openclaw system event --text "β οΈ Ralph Loop hit max iterations ($MAX_ITERATIONS) β check IMPLEMENTATION_PLAN.md for remaining tasks" --mode now