HDGLAgent.HC — native self-modifying HolyC agent for a TempleOS pane
====================================================================

WHAT IT IS
  A real self-modifying agent loop that runs INSIDE TempleOS, in its own
  pane (Spawn'd window). Each tick it: observes Delta (RandU64 = LCG^GetTSC),
  AUTHORS HolyC source as a string, JIT-compiles+runs it live via ExePutS
  (no reboot, no separate process, no Linux sidecar), then folds the outcome
  into a running phi_fold hash chain (its memory).

  This is the boot15 premise made native: TempleOS true-random oracle drives
  a substrate agent; integrity is our phi_fold hash — NO SHA, NO XOR in the
  fold path (additive phi-resonance mixing only). Consistent with the
  zero-SHA doctrine you preference.

KERNEL API — ALL SYMBOLS VERIFIED PRESENT in TempleOS-master source:
  RandU64   Kernel/KMathB.HC (LCG ^ GetTSC; TASKf_NONTIMER_RAND gates entropy)
  Seed      Kernel/KMathB.HC  I64 Seed(I64 seed=0,...)   -> Seed(0)=true random
  ExePutS   Compiler/CMain.HC I64 ExePutS(U8*buf,...)     -> the self-mod JIT
  Spawn     Kernel/KTask.HC   CTask*Spawn(fp,...)         -> the pane
  MStrPrint MemCpy Free Sqrt Floor Sleep  -> all present (KDefine/KernelB/KMisc)

VERIFIED HERE (static):
  - Every called kernel symbol exists in the provided TempleOS source.
  - phi_fold logic is a faithful port of phi_fold_hash32 (128-bit-floor):
    additive delta-fold, ROTR8-by-3, phi-keyed S-box, 12 rounds. No SHA/XOR.
  - Lattice seeded from frac((i+1)*phi) — emergent, no stored tables.

NOT YET VERIFIED (requires real TempleOS — no HolyC compiler in this env):
  - That it COMPILES clean under TempleOS's HolyC (syntax quirks: the (I64)
    cast form, F64->U8 truncation, and #define fixed-point may need a tweak
    on real hardware). This is the honest open item — same class as your
    "final slot-population pending on real hardware."
  - Runtime behaviour of ExePutS re-entrancy inside a Spawn'd task.

HONEST SCOPE LINE (stated, not buried):
  - The self-modification is GENUINE HolyC JIT, not simulated.
  - There is NO LLM inside TempleOS. The per-tick "which code to author"
    choice is a small native planner (Delta % skills). That planner is the
    exact seam where a native inference core attaches LATER. Until then the
    agent is driven by Delta + plan, not by a model. Writing native HolyC
    inference is a separate, large effort — not in this deliverable.

RUN (inside TempleOS):
  #include "HDGLAgent.HC"          // auto-Spawns the pane on load
  // or, load without running:  comment the final Spawn(...) line, then
  //   Spawn(&HDGLAgentMain,,"HDGL-Agent");
