TEMPLE4 — COMBINED BUILD (engine-corrected)
===========================================
Merge of:
  - sidecar-bot-for-temple3.zip    (Phase-2 verified sidecar + HDGL night build)
  - trailblaze-smoke-test-fix1.zip (Q4_K byte-exact test correction)
  - Trailblaze 0.7 / 0.8b / 0.9    (inference engine source; Q4_K corrected)

ENGINE SELECTION
----------------
Temple4's inference engine is CORRECTED Trailblaze 0.8b (see
engine-corrections/ENGINE_VERSION_SELECTION.txt for the full evidence).
Summary: all three trees got the identical byte-exact Q4_K fix and all pass;
0.8b's inference core is a superset of 0.9's (adds telemetry-coupled adaptive
routing + /api/strand/control and /api/strand/state), while the "0.9" bundle is
an audit workspace on the 0.7 base. 0.8b-corrected is therefore the optimal
engine. It ships as engine/.

Q4_K ENGINE CORRECTION (applied to all three trees; 0.8b is the shipped one)
----------------------------------------------------------------------------
The smoke-test note established the shipped BINARY's decoder was canonical, but
the tb_gguf.c SOURCE was not — binary and source had diverged. Three defects
fixed in the source decoder:
  1. Wrong nibble->sub-block mapping ((2*i)/32 per-byte instead of the canonical
     64-wide low-then-high grouping) — the decisive bug, invisible to a smoke
     test using uniform data.
  2. Non-canonical 6-bit scale/min unpack for sub-blocks 4..7 — replaced with
     canonical get_scale_min_k4 (also fixes Q5_K, which reuses it).
  3. Wrong layout comment claiming a nibble-8 offset (that is Q4_0, not Q4_K).
Also upgraded the in-file -DTB_GGUF_TEST self-test from "PASS (smoke)" to
byte-exact assertions.

VERIFICATION (0.8b-corrected, this session, clean container)
------------------------------------------------------------
  cross-check: patched engine decoder == byte-exact reference on all vectors
  in-file self-test: [Q4_K] w=0.5*8=4.0000, min-sub 3.5000 PASS (byte-exact)
  standalone q4k_verify_test.c: 5/5 PASS (exit 0)
  full CPU build from inside this tree: built bin/tb_infer_cpu, clean
  runtime self-test: [generate] 8 tokens PASS; wuwei ALL PASS;
                     === TRAILBLAZE Inference Runtime PASS ===

CONTENTS
--------
  TEMPLE4_MANIFEST.txt          this file
  engine/                       CORRECTED Trailblaze 0.8b (full source + bin)
      layer4/tb_gguf.c              Q4_K byte-exact (fixed); .orig kept
      layer4/tb_infer.c            adaptive routing + strand endpoints
      bin/tb_infer_cpu_verified   rebuilt from corrected source
      build_cpu_verified.sh        one-shot CPU build (verified working)
      README.md, Makefile, src/, layer0..5/, include/ ...
  engine-corrections/           provenance
      ENGINE_VERSION_SELECTION.txt  why 0.8b
      Q4K_ENGINE_CORRECTION.txt     full defect writeup
      Q4K_FIX_0.7.diff / Q4K_FIX_0.8b.diff / Q4K_ENGINE_FIX.diff (0.9)
      q4k_verify_test.c             byte-exact test
      Q4K_SMOKE_CORRECTION.txt      original correction note
  tb_infer_cpu_verified         corrected engine binary (top-level convenience)
  q4k_verify_test.c             byte-exact Q4_K test (top-level)
  Q4K_SMOKE_CORRECTION.txt      correction rationale
  PHASE2_VERIFIED.txt           phase-2 verification (line 47 corrected)
  UNIFIED_ARCH.txt              unified attractor architecture
  README_NIGHT_BUILD.md         night build notes
  HOLYC_STATIC_CHECK.txt        HolyC static check
  PRE_DREAM_ASSESSMENT.md       pre-dream assessment
  EXPANSION.txt / SWAP_MANIFEST.txt
  HDGLAgent.HC / PaneBus.HC     HolyC agent + pane bus
  emerge-sidecar.sh build_cpu_verified.sh glove-train.sh run-expanded.sh
  init.expanded / init.sidecar
  critic_learn_test.c           critic TD-learning test
  hdgl-substrate-boot-merged.zip  nested substrate boot artifact
                                  (kjv_oracle.c, hdgl.hdgl, boot transcript ...)

BUILD/VERIFY
------------
  # engine
  cd engine && bash build_cpu_verified.sh && ./bin/tb_infer_cpu
  # Q4_K byte-exact test
  gcc -O2 -std=c11 q4k_verify_test.c -lm -o q4k_verify_test && ./q4k_verify_test

HONEST STATUS
-------------
  - Correct tokens require a real Qwen3 GGUF (not bundled, ~2 GB). The Q4_K math
    is proven exact independently of any model file.
  - The top-level tb_infer_cpu_verified was REPLACED: the original Temple4 shipped
    a binary built from pre-fix 0.8b source; this is the corrected-source rebuild.
  - 0.7 and 0.9 corrected trees are NOT bundled here (only their fix diffs are, in
    engine-corrections/). 0.8b is the shipped engine. Re-derive the others from the
    diffs if needed.
