fix: Autopilot fest auf nordmann-Konto (Bernd 2026-07-06) – Review (aa): private E-Mail vor Publikation entfernt, *.bak-* gitignored

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernd Steckmeister
2026-07-06 11:58:32 +02:00
parent 4d16d49012
commit cead62ccb2
4 changed files with 99 additions and 38 deletions
+14 -38
View File
@@ -1,40 +1,23 @@
#!/bin/bash
# Pyramid-Autopilot (Pi/Linux): startet Claude-Sessions in Endlosschleife.
# Läuft eine Session ins 5h-Limit, wird alle 20 Minuten neu versucht.
# Laeuft eine Session ins Limit, wird alle 20 Minuten neu versucht.
# Start (am besten in tmux): tmux new -d -s pyramid ./autopilot.sh
# Wieder reinschauen: tmux attach -t pyramid (verlassen: Strg+B, dann D)
# PAUSIEREN: touch ~/pyramid/PAUSE (greift vor der nächsten Session)
# PAUSIEREN: touch ~/pyramid/PAUSE (greift vor der naechsten Session)
# FORTSETZEN: rm ~/pyramid/PAUSE
# GANZ STOPPEN: tmux kill-session -t pyramid
cd "$(dirname "$0")"
export PATH="$HOME/.local/bin:$HOME/flutter/bin:$PATH"
# --- Zwei Claude-Konten mit automatischem Wechsel bei 5h-Limit ---
# Konto "pyramid" = Profil ~/.claude-pyramid (Standard fuer diese Arbeit),
# Konto "haupt" = Profil ~/.claude (springt ein, wenn pyramid am Limit ist).
ACCOUNT_FILE="$HOME/.claude-accounts/active"
get_account() { cat "$ACCOUNT_FILE" 2>/dev/null || echo pyramid; }
apply_account() {
if [ "$(get_account)" = "haupt" ]; then
# Hauptkonto = Standard-Profil -> Variable NICHT setzen
# (sonst sucht Claude die Config unter ~/.claude/.claude.json statt ~/.claude.json)
unset CLAUDE_CONFIG_DIR
else
export CLAUDE_CONFIG_DIR="$HOME/.claude-pyramid"
fi
}
switch_account() {
local cur next
cur=$(get_account)
if [ "$cur" = "pyramid" ]; then next=haupt; else next=pyramid; fi
mkdir -p "$HOME/.claude-accounts"
echo "$next" > "$ACCOUNT_FILE"
notify_matrix "🔺 Autopilot: 5h-Limit auf Konto '$cur' erreicht wechsle auf Konto '$next' und arbeite direkt weiter."
}
JUST_SWITCHED=0
# --- NUR EIN Konto: das nordmann-Konto (Profil ~/.claude = Standard-Profil) ---
# Bewusst KEINE Konto-Rotation (Bernd, 2026-07-06): der Pyramid-Autopilot arbeitet
# ausschliesslich mit dem nordmann-Konto. Das Standard-Profil liegt unter
# ~/.claude / ~/.claude.json -> CLAUDE_CONFIG_DIR NICHT setzen (sonst sucht Claude
# die Config faelschlich unter ~/.claude/.claude.json).
# (Die E-Mail-Adresse des Kontos steht absichtlich NICHT hier: das Gitea-Repo
# ist oeffentlich, PII gehoert nicht hinein.)
apply_account() { unset CLAUDE_CONFIG_DIR; }
ACCOUNT_NAME="nordmann"
# --- Matrix-Statusberichte (Raum "🔺 Pyramid Autopilot", Token vom Gatus-Bot) ---
MATRIX_URL="http://127.0.0.1:6167"
@@ -60,7 +43,7 @@ while true; do
continue
fi
apply_account
echo "===== $(date '+%F %T') Neue Claude-Session (Konto $(get_account)) =====" | tee -a autopilot.log
echo "===== $(date '+%F %T') Neue Claude-Session (Konto $ACCOUNT_NAME) =====" | tee -a autopilot.log
BEFORE=$(git rev-parse HEAD 2>/dev/null)
SESSION_OUT=$(mktemp)
claude -p "$PROMPT" --model claude-fable-5 --dangerously-skip-permissions 2>&1 | tee -a autopilot.log "$SESSION_OUT"
@@ -75,21 +58,14 @@ $COMMITS
$NEXT"
fi
# 5h-Limit erkannt? -> sofort aufs andere Konto wechseln statt zu warten
# Limit erkannt? -> 20 Minuten warten (KEINE Konto-Rotation mehr)
if grep -qiE "hit your.*limit|usage limit|session limit" "$SESSION_OUT"; then
rm -f "$SESSION_OUT"
if [ "$JUST_SWITCHED" != "1" ]; then
switch_account
JUST_SWITCHED=1
continue
fi
JUST_SWITCHED=0
echo "===== $(date '+%F %T') Beide Konten am Limit - naechster Versuch in 20 Minuten =====" | tee -a autopilot.log
echo "===== $(date '+%F %T') nordmann-Konto am Limit - naechster Versuch in 20 Minuten =====" | tee -a autopilot.log
sleep 1200
continue
fi
rm -f "$SESSION_OUT"
JUST_SWITCHED=0
echo "===== $(date '+%F %T') Session beendet - Neustart in 20 Minuten (Strg+C zum Stoppen) =====" | tee -a autopilot.log
sleep 1200