← back to AbramsEgo
build-loop: pin claude invocation to Max-plan OAuth (strip metered API key)
a714de1f0928b2fd9a1b01c1f58700a787711771 · 2026-07-07 06:42:09 -0700 · Steve Abrams
Files touched
Diff
commit a714de1f0928b2fd9a1b01c1f58700a787711771
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Jul 7 06:42:09 2026 -0700
build-loop: pin claude invocation to Max-plan OAuth (strip metered API key)
---
scripts/build-loop.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/scripts/build-loop.sh b/scripts/build-loop.sh
index a9f619b..fa5e18c 100755
--- a/scripts/build-loop.sh
+++ b/scripts/build-loop.sh
@@ -53,7 +53,12 @@ echo "[$(ts)] START $name" | tee -a "$LOG"
PREFIX="You are the AbramsEgo autonomous builder working in $ROOT. Use /dtd to DECIDE any judgment call. Do only SAFE, REVERSIBLE work: edit code, add features/tests, commit with git (author steve@designerwallcoverings.com). The server ALREADY RUNS under pm2 as process 'abramsego' on port 9773 — to test changes run 'pm2 restart abramsego' then curl the running instance; NEVER start a second node on 9773. NEVER run a GATED action (deploy to Kamatera, DNS, domain registration, Stripe/pricing/publish, send-to-list, spend, remote push) — instead draft it to ~/.claude/yolo-queue/pending-approval/ with an officer APPROVE/REVISE/BLOCK block. Commit after each success. TASK FOLLOWS:\n\n"
LOGF="$Q/logs/${name%.md}.$(date +%s).log"
-cat <(printf '%b' "$PREFIX") "$TASK" | RUN "$CLAUDE_BIN" --print --permission-mode acceptEdits --max-turns "$MAX_TURNS" --model "$MODEL" >"$LOGF" 2>&1
+# Force Max-plan OAuth: strip any metered API key from the loop's env before
+# invoking the claude BINARY directly. The .zshrc `claude` function that does this
+# only applies to interactive shells; a launchd/bare env bypasses it. A metered
+# ANTHROPIC_API_KEY overrides Max and can hit the monthly-spend hard stop — which
+# is exactly what parked this loop on 2026-07-01.
+cat <(printf '%b' "$PREFIX") "$TASK" | RUN env -u ANTHROPIC_API_KEY -u ANTHROPIC_AUTH_TOKEN "$CLAUDE_BIN" --print --permission-mode acceptEdits --max-turns "$MAX_TURNS" --model "$MODEL" >"$LOGF" 2>&1
rc=${PIPESTATUS[1]}
if [ "$rc" -eq 0 ]; then
# LOOP-ENGINEERING VERIFICATION GATE (Ng "close the loop"): don't trust the CLI's
← a8210ce chore: macstudio3 migration — reconcile from mac2 + repoint
·
back to AbramsEgo
·
auto-save: 2026-07-07T08:56:34 (1 files) — data/local-fleet. b55cf5e →