diff --git a/docs/specs/ENV_VARS.md b/docs/specs/ENV_VARS.md index 73ce6a6a..dc0288f2 100644 --- a/docs/specs/ENV_VARS.md +++ b/docs/specs/ENV_VARS.md @@ -336,7 +336,32 @@ ENV Statistics (from ENV_VARIABLE_SURVEY.md): - Free Path Optimization: 15 (7%) - Other: 23 (10%) -Future Work (Phase 4b+): -- HAKMEM_DEBUG unified variable (consolidate 35 debug vars) +Phase 4b: Master Debug Control (COMPLETED) +------------------------------------------ +New in 2025-11: Centralized debug control that works alongside individual module ENVs. + +- `HAKMEM_DEBUG_ALL=1` + - Enable ALL debug modules at once (convenient for troubleshooting) + - Individual module ENVs (e.g., HAKMEM_SFC_DEBUG=0) can still override + +- `HAKMEM_DEBUG_LEVEL=N` + - Set debug level: 0=off, 1=critical, 2=normal, 3=verbose + - When set to 2+, enables debug output for modules that don't have explicit ENV + +- `HAKMEM_QUIET=1` + - Suppress ALL debug output (highest priority, overrides DEBUG_ALL/LEVEL) + +Priority order: +1. HAKMEM_QUIET=1 → suppress all +2. Specific module ENV (e.g., HAKMEM_SFC_DEBUG=1) → use that value +3. HAKMEM_DEBUG_ALL=1 → enable all +4. HAKMEM_DEBUG_LEVEL >= threshold → enable +5. Default → disabled + +Implementation: core/hakmem_debug_master.h +- hak_debug_check("HAKMEM_FOO_DEBUG") - Check if module should enable debug +- hak_is_quiet() - Quick check for quiet mode + +Future Work (Phase 4c+): - HAKMEM_TRACE unified variable (consolidate 15 trace vars) - HAKMEM_STATS unified variable (consolidate 15 dump vars)