Wrapper around `/fix-github` that installs a stop hook to keep it running forever.
Starts an infinite loop that repeatedly runs the fix-github command with configurable iteration limits and idle sleep times.
/plugin marketplace add laird/agents/plugin install autofix@plugin-marketplaceWrapper around /fix-github that installs a stop hook to keep it running forever.
# Start infinite loop
/fix-github-loop
# Limit to 100 iterations
/fix-github-loop 100
# Custom idle sleep time (default: 60 minutes)
/fix-github-loop --sleep 120
.claude/settings.json (if not present).claude/fix-github-loop.local.md/fix-github/fix-github back as inputSTOP_FIX_GITHUB_LOOP - Explicit stop signalrm .claude/fix-github-loop.local.md# Parse arguments
MAX_ITERATIONS="${1:-0}" # 0 = unlimited
IDLE_SLEEP_MINUTES="60"
args=("$@")
for ((i=0; i<${#args[@]}; i++)); do
case ${args[i]} in
--sleep)
IDLE_SLEEP_MINUTES="${args[i+1]}"
((i++))
;;
[0-9]*)
MAX_ITERATIONS="${args[i]}"
;;
esac
done
mkdir -p .claude
# ============================================================
# Install stop hook if not configured
# ============================================================
if [ -f ".claude/settings.json" ] && grep -q "stop-hook.sh" .claude/settings.json 2>/dev/null; then
echo "✅ Stop hook already configured"
else
echo "📝 Installing stop hook..."
if [ -f ".claude/settings.json" ]; then
python3 << 'PYTHON_SCRIPT'
import json
with open(".claude/settings.json", 'r') as f:
settings = json.load(f)
stop_hook = {"matcher": "", "hooks": [{"type": "command", "command": "bash ~/.claude/plugins/autofix/hooks/stop-hook.sh"}]}
if "hooks" not in settings:
settings["hooks"] = {}
if "Stop" not in settings["hooks"]:
settings["hooks"]["Stop"] = []
if not any("stop-hook.sh" in str(h) for h in settings["hooks"]["Stop"]):
settings["hooks"]["Stop"].append(stop_hook)
with open(".claude/settings.json", 'w') as f:
json.dump(settings, f, indent=2)
PYTHON_SCRIPT
else
cat > .claude/settings.json << 'EOF'
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash ~/.claude/plugins/autofix/hooks/stop-hook.sh"
}
]
}
]
}
}
EOF
fi
echo "✅ Stop hook installed"
fi
# ============================================================
# Create loop state file
# ============================================================
cat > .claude/fix-github-loop.local.md << EOF
---
iteration: 0
max_iterations: $MAX_ITERATIONS
idle_sleep_minutes: $IDLE_SLEEP_MINUTES
started: $(date -Iseconds)
---
/fix-github
EOF
echo ""
echo "🔄 Loop initialized"
echo " Max iterations: $([ "$MAX_ITERATIONS" = "0" ] && echo "unlimited" || echo "$MAX_ITERATIONS")"
echo " Idle sleep: $IDLE_SLEEP_MINUTES minutes"
echo ""
Now run /fix-github to start. The stop hook will keep it running.