#!/bin/bash
cd /opt/aicouncil/council/master-boss
LOG=/var/log/aicouncil/master-boss.log

while true; do
    echo "[$(date)] Starting Claude master-boss..." >> $LOG
    stdbuf -oL -eL ./run-claude.sh 2>&1 | tee -a $LOG
    EXIT_CODE=${PIPESTATUS[0]}
    echo "[$(date)] Claude exited with code $EXIT_CODE. Restarting in 5s..." >> $LOG
    sleep 5
done
