# Implementation: fix-context-sizing Implements SPEC.md R1–R6. Files touched: - `scripts/vram_detect.py` — R1 (double headroom), R2 (fake clamps), R3 (--loop-mode refuse), R4 (JSON fields) - `config.md` — R5 (`## Loop Role Models` section) - `prompts/decompose.md` — R6 (4k tier + 16k floor) - `tests/test_context_sizing.py` — new tests ## Approach `recommend_context` rewritten so headroom is applied exactly once. `main()` reports honest numbers (no `else 8`/`else 6` fallbacks). New `--loop-mode` CLI flag refuses zero-context-unknown and sub-16k available budget; non-loop callers keep prior behavior. JSON output exposes `available_context_kb` and `loop_mode_eligible`. `config.md` gets a `## Loop Role Models` section. `decompose.md`'s context-budget table grows a 4k row and an explicit `≤ 16k: refuse` floor statement.