fix(hooks): detect_plan no longer calls the claude CLI (fork bomb)

`claude config get planType` started a full session whose SessionStart
hook called detect_plan again: unbounded recursion, OOM, reboot
(BLK-043). detect_plan now reads ~/.claude.json only and defaults to
pro; the hook gets an env recursion guard.
This commit is contained in:
bchanot committed 2026-11-06 11:38:13 +01:00
1 parent 4093cca4f4
commit 49aa2fff78
3 files changed
+84 -12

No files matched your search

+5 -1
View File
@@ -5,6 +5,11 @@
# git fetch for the version/update check near the end.
# ============================================================
# Recursion guard (BLK-043): defense-in-depth, no live caller. Relies on
# Claude Code passing the env to hooks.
[ -n "${SESSION_START_RUNNING:-}" ] && exit 0
export SESSION_START_RUNNING=1
# ── Quick health check (filesystem only, no subprocesses) ──
BROKEN=()
for f in CLAUDE.md settings.json agents skills; do
@@ -118,7 +123,6 @@ PLAN=$(detect_plan 2>/dev/null || echo "pro")
case "$PLAN" in
max) _budget=20000; PLAN_LABEL="Max" ;;
pro) _budget=11000; PLAN_LABEL="Pro" ;;
free) _budget=5000; PLAN_LABEL="Free" ;;
*) _budget=11000; PLAN_LABEL="Pro" ;;
esac