Last active
January 10, 2026 07:45
-
-
Save MarcoWorms/e891bf5371a19375c4f92e55594ff82f to your computer and use it in GitHub Desktop.
ralph wiggum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| emulate -L zsh | |
| setopt pipefail | |
| RW() { | |
| emulate -L zsh | |
| setopt pipefail | |
| local prompt="$1" | |
| local stop="$2" | |
| local log_txt="$PWD/ralph_wiggum_logs.txt" # human-ish stderr progress + headers + final msg | |
| local log_jsonl="$PWD/ralph_wiggum_logs.jsonl" # full JSONL event stream from --json | |
| local last_msg="$PWD/ralph_wiggum_last_message.txt" # final assistant message only (for STOP) | |
| { | |
| print -r -- "===== RW $(date) =====" | |
| print -r -- "STOP: $stop" | |
| print -r -- "PROMPT: $prompt" | |
| print -r -- "" | |
| } >> "$log_txt" | |
| eval "${aliases[do]} codex --full-auto --search exec --json -o ${(q)last_msg} ${(q)prompt}" \ | |
| 2> >(tee -a "$log_txt" >&2) \ | |
| | tee -a "$log_jsonl" >/dev/null | |
| print -r -- "\n----- FINAL_ASSISTANT_MESSAGE -----" | tee -a "$log_txt" | |
| cat "$last_msg" | tee -a "$log_txt" | |
| # STOP check: require the stop token to appear as its OWN LINE | |
| # (more reliable than substring search) | |
| if grep -Fxq -- "$stop" "$last_msg"; then | |
| return 0 # stop found | |
| else | |
| return 1 # stop not found | |
| fi | |
| } | |
| # ---- runner: LOOP UNTIL STOP IS FOUND ---- | |
| prompt='search README and UI markdowns for any inconsistency comparing with the codebase, fix any inconsistencies found, if none are found then you must say this in your answer: NO_INCONSISTENCIES_FOUND' | |
| stop='NO_INCONSISTENCIES_FOUND' | |
| # Use `until` because RW returns 0 when STOP is found. | |
| until RW "$prompt" "$stop"; do | |
| : | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment