Skip to content

Instantly share code, notes, and snippets.

@Tavernari
Created January 9, 2026 00:35
Show Gist options
  • Select an option

  • Save Tavernari/01d21584f8d4d8ccea8ceca305656ab3 to your computer and use it in GitHub Desktop.

Select an option

Save Tavernari/01d21584f8d4d8ccea8ceca305656ab3 to your computer and use it in GitHub Desktop.
Auggie Wiggum - A Ralph Wiggum Loop for Auggie CLI

Auggie Wiggum πŸ”„

A robust Bash wrapper for the auggie agent that implements the Ralph Wiggum Technique.

Features

  • Autonomous Looping: Runs the agent repeatedly until it outputs "I'm done".
  • Persistent Context: Reads previous iteration logs so the agent can "remember" mistakes and self-correct.
  • Safe Logging: Stores all thought processes in a hidden .auggie_wiggum/{timestamp}/ folder to avoid breaking Git hooks or polluting your commit history.
  • Pure Autonomy: No external test runners required; relies on the agent's own internal verification logic.

Usage

  1. Create a PROMPT.md file with your task.
  2. Run ./auggie_wiggum.sh.
#!/bin/bash
# ==========================================
# RALPH WIGGUM LOOP (Pure Autonomy Mode)
# "The Agent is the boss. The script is the memory."
# ==========================================
# --- CONFIGURATION ---
TASK_FILE="PROMPT.md"
MAX_ITERATIONS=15
ITERATION=0
# Logging Setup (Timestamped)
# Creates a unique folder for this session: .auggie_wiggum/2026-01-09_14-30-00
CURRENT_DATE_AND_TIME=$(date +"%Y-%m-%d_%H-%M-%S")
LOG_DIR="./.auggie_wiggum/$CURRENT_DATE_AND_TIME"
mkdir -p "$LOG_DIR"
# --- PRE-FLIGHT CHECKS ---
if [ ! -f "$TASK_FILE" ]; then
echo "❌ Error: $TASK_FILE not found."
exit 1
fi
echo "πŸš€ Starting Auggie (Autonomous Mode)..."
echo "πŸ“‚ Session saved in: $LOG_DIR"
echo "-----------------------------------"
# --- THE LOOP ---
while [ $ITERATION -lt $MAX_ITERATIONS ]; do
echo "πŸ”„ Iteration $ITERATION"
# 1. BUILD CONTEXT (MEMORY)
# The script reads everything the agent "thought" and "did" in previous iterations.
HISTORY_CONTEXT=""
if [ $ITERATION -gt 0 ]; then
echo " (Reading memory from previous iterations...)"
for (( i=0; i<ITERATION; i++ )); do
PREV_FILE="$LOG_DIR/iteration_$i.txt"
if [ -f "$PREV_FILE" ]; then
STEP_CONTENT=$(cat "$PREV_FILE")
HISTORY_CONTEXT+=$'\n'"--- HISTORY (Iteration #$i) ---"$'\n'"$STEP_CONTENT"$'\n'
fi
done
fi
# 2. CONSTRUCT THE PROMPT
# We instruct the agent to use its own tools to verify the work.
FULL_PROMPT="
$(cat "$TASK_FILE")
====== SHORT-TERM MEMORY (What you already tried) ======
$HISTORY_CONTEXT
========================================================
LOOP INSTRUCTIONS:
1. You are running in an autonomous loop.
2. Analyze the history above. If you tried something and it failed, try a different approach.
3. YOU are responsible for ensuring the code works. Run your own internal checks/tests if possible.
4. If the task is 100% COMPLETE and TESTED, write exactly \"I'm done\" on the very last line.
5. If not finished, briefly describe your progress and what you will do next.
"
# 3. RUN AUGGIE
# --print: captures output to file | --quiet: suppresses system logs
OUTPUT=$(auggie --print --quiet "$FULL_PROMPT")
# 4. SAVE LOG (The "Memory")
CURRENT_LOG_FILE="$LOG_DIR/iteration_$ITERATION.txt"
echo "$OUTPUT" > "$CURRENT_LOG_FILE"
echo "πŸ“ Thought process saved: $CURRENT_LOG_FILE"
# 5. CHECK IF AGENT DECIDED TO STOP
# Looks for "I'm done" on the last line (case insensitive)
LAST_LINE=$(echo "$OUTPUT" | tail -n 1 | xargs | tr '[:upper:]' '[:lower:]')
if [[ "$LAST_LINE" == *"i'm done"* ]]; then
echo "-----------------------------------"
echo "βœ… Agent reported completion."
echo "πŸ“‚ Full history available at: $LOG_DIR"
exit 0
fi
((ITERATION++))
# Safety pause to avoid API rate limits
sleep 2
done
echo "πŸ›‘ Max iterations reached without completion signal."
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment