Commit Graph

188 Commits

Author SHA1 Message Date
Drew T 7bd3fa2ee9 docs(phase-21): backlog snapshot at reboot stopping point 2026-06-21 13:30:01 -06:00
Drew T 1b3fc8b20a docs(phase-21): trip hand-off — grinder running, worker staged for remote drive
- automation manager built + validated (fleet 58.82->58.98%, 136/136 byte-identical, 3 real
  matches banked x134). Grinder running autonomous/token-free; worker /loop = Drew remote-driven.
- runbook docs/automation-runbook.md; CURRENT_PHASE hand-off; formal PhaseEnd awaits gate-2.
2026-06-21 13:13:17 -06:00
Drew T 66d1af0e09 docs(phase-21): automation runbook + status tool (grinder running; worker = remote-driven)
- docs/automation-runbook.md: launch/monitor/stop for the grinder (live) + worker /loop;
  safety invariants (byte-gate sole arbiter, git crash-safe, auto_stop kill switch);
  remote-management note (Drew can remote in -> no bulletproof keep-alive needed).
- auto_status.sh: show grinder + worker heartbeats, backlog, phase-21 checkpoints, daemons.
2026-06-21 13:12:04 -06:00
Drew T 8de18e617d feat(phase-21): T4/T5/T6 — worker validated (func_80164530 x134), grinder, orchestrator
- T4 worker Workflow validated: 3-target wave, all self-MATCH; whole-binary gate banked
  func_80164530 x134 (5 register-pins + offset-fold + scheduling). fleet 58.90->58.98%.
  §20 holds (1/3 survived the whole-binary gate); the 2 near/failed -> backlog.
- T5 grinder: token-free permuter of backlog near-misses -> gate_stage; gate correctly
  rejected a permuter over-prediction (integrity intact). auto_supervisor DRIVER-param.
- T6 orchestrator.py: ROI pool rotation (prep/finish/status); gate_stage flock serializes
  grinder+orchestrator builds. Sandbox: detached daemons build fine, foreground needs override.
2026-06-21 13:06:34 -06:00
Drew T bee543722d feat(phase-21): worker gate — +1 fns x1 propagated (fleet 58.98%) 2026-06-21 13:04:40 -06:00
Drew T 76c5feb116 feat(phase-21): worker gate — +1 fns x1 propagated (fleet 58.94%) 2026-06-21 12:50:16 -06:00
Drew T 2d7926e9f6 feat(phase-21): T4/T5 tooling — worker Workflow + wave selector + permuter grinder
- tools/workflows/worker_wave.js: parallel toolkit-aware drafter agents (xHigh) per target,
  each writes its best matching C to the drafts dir (gate run by the orchestrator after).
  args parsed robustly (harness may serialize to a JSON string — §20 gotcha).
- tools/wave_targets.py: select a wave batch from the fuel manifest (pool/region/N, skips
  backlog walls). tools/grinder.py: token-free permuter grinder — permute backlog near-misses
  -> gate_stage -> bank; STOP/heartbeat, idles for new worker near-misses, supervisor-friendly.
2026-06-21 12:41:14 -06:00
Drew T c2e93e50cd feat(phase-21): T3 — backlog ledger + shared gate stage (validated, +0.08%)
- tools/backlog.py: near-miss ledger (.run/backlog.jsonl + docs/backlog.md ranked by
  reach->closeness->size; drop-now-matched filter, P9). tools/gate_stage.py: the shared
  deterministic spine both worker+grinder call (canon_resident_calls -> cast_call_sites ->
  sig_unify -> harvest_verify --chunk 1 -> dedup_propagate --auto-from -> backlog -> summary).
- validated end-to-end on a real 30-draft m2c sample: banked func_801710DC + propagated x134
  (dedup 1506->1508), 29 near-misses logged+ranked. make check-all 136/136 byte-identical
  (R22); fleet 58.82%->58.90%; dedup-check 1508 validated/0 failed (G3/P9).
- capped-fns reframe (R14): they're matched-inline (propagation-blocked), not draftable ->
  deferred to the worker; not claiming the unbanked +0.3% (P9).
2026-06-21 12:32:21 -06:00
Drew T 5674587bcb feat(phase-21): T2 — fuel prefetch, Ghidra-C cache complete for the ROI pool
- headless DecompileFunctions over 263 uncached ROI-pool fns (MCP stopped, R23):
  263 ok / 0 fail / 0 no-func. cache 300 -> 563. ROI-pool fuel now 325/325 cached
  (28/28 giants, 310/310 reach-134, 7/7 capped) -> the unattended run never needs MCP.
- FIX DecompileFunctions.java: key output by entry address func_<UPPERHEX>.c (Ghidra's
  raw-import default is FUN_<lowerhex>, which every consumer + the existing 300 files
  miss). Renamed the 263; the tool fix makes re-prefetch reproducible.
- build_fuel_manifest.py --emit-prefetch: reproducible uncached-ROI-pool addr-list
  (for the T7 runbook). 349 reach-1 x1-leverage fns intentionally excluded (P9).
- ghidra/ db churn is the MCP-stop no-op save (R23 restart-noise, not staged).
2026-06-21 12:00:47 -06:00
Drew T 971f95f7c8 feat(phase-21): T1 — fuel manifest + R14 giants byte-verification
- tools/build_fuel_manifest.py -> .run/fuel_manifest.json: the automation target
  pool. reach RECOMPUTED from the current 134 overlay sigs (distinct-overlay
  h_exact), not trusted from cached fields (R14). Classes GIANT/WAVE/STRUCT/PINS/
  STUB/O0/O1 + the CAPPED recovery pool; cached? flags Ghidra-C gaps for T2.
- 803 live func_ stubs; 310 reach-134, 486 reach-1. R14: 28/28 giants verified
  genuinely byte-identical x134 (label honest, unlike the -O0 cluster). -O0
  nuance: 8/9 overlay-local but func_8013C08C is reach-134 (real exception).
- T2 workload scoped: 253 reach-134 uncached; 171/223 tractable reach-134 uncached.
- CURRENT_PHASE.md: T1 logged. No MCP, no build mutation.
2026-06-21 11:50:31 -06:00
Drew T e803651f0c feat(phase-20): close — cap tool + T3a %lo crack + 3 byte-proven findings; fleet 58.00%->58.82% (v1.19.0)
- THE CAP TOOL tools/cast_call_sites.py (§17a-1 callee-cast): per draft, callee whose canonical
  TU sig != draft's intended sig -> decl->canonical + call-site cast ((ret(*)(args))func_X)(args)
  (codegen-neutral; gcc folds the cast of a known symbol -> direct jal). Recovered 6 of T6 batch-1's
  33 gate-fails byte-identical (5 x134 + 1 local). Pipeline canon_resident_calls -> cast_call_sites
  -> sig_unify -> harvest_verify --chunk 1.
- T3a CRACKED (not cited): the %lo-folding indexed-global -O0 residual falls to the array-of-STRUCT
  idiom (extern Struct base[], sizeof==stride, base[i].field; NOT *(T*)(&sym+i*stride) which
  materializes &sym). func_8013B7AC banked. Reusable idiom fleet-wide. cookbook §18/§20.
- THREE byte-proven findings (R14): (1) the wave cap is the DEF-side loose-typing wall, not
  callee-conflicts (the §20 "~33" projection was wrong); (2) the -O0 cluster is OVERLAY-LOCAL,
  not reach-134 -> the ×134 rollout is INVALID; (3) data-cast is MOOT (0 real data conflicts).
- T1 typedef type-lift (+0.35%, 9 fns x134); T2 exemplar_miner router; T4 codegen map (cookbook §20);
  T6 batch-1 (+0.28%, 8). dedup 1485->1513/0 failed. check-all 136/136 BYTE-IDENTICAL (R22);
  0 NON_MATCHING (G4). fleet 58.00% -> 58.82%.
- rule R30 (capture context-dependent knowledge before a fresh session). worklog -> logs/Phase20.md.
- bumps 1.18.0 -> 1.19.0
2026-06-21 10:26:34 -06:00
Drew T f1a7e518f5 feat(phase-20): T3a CRACKED — %lo-folding -O0 falls to the array-of-struct idiom
- the %lo-folding indexed-global -O0 residual (§18, long "irreducible") is CRACKED: declare
  the global as "extern Struct base[]" (sizeof == stride) and access "base[i].field" -> gcc
  keeps sym a symbol_ref and folds %lo(sym+off) into the store, byte-matching. The failing
  forms "*(T*)(&sym + i*stride)" materialize &sym as a value first, blocking the fold.
- func_8013B7AC byte-gated + banked (x1 — the -O0 cluster is overlay-local, R14 finding above);
  the idiom is reusable fleet-wide for ANY indexed-global access (-O0 or -O2).
- cookbook §18 ("%lo-folding indexed global — CRACKED") + §20 placeholder closed.
- the other 9 -O0 stubs: idiom applies but need per-fn -O0 drafting (3 quick ones tried, failed
  on -O0 codegen detail; 4 are large) -> backlog/autonomy fuel. clean rebuild d19c9580 (R22).
2026-06-21 09:58:01 -06:00
Drew T d5ddbc587d docs(phase-20): log consolidated state — cached ≤90-ins tail byte-exhausted; T5 is the lever 2026-06-21 09:31:20 -06:00
Drew T a978081b2d docs(phase-20): data-cast is moot (R14) — 0 data-type conflicts on the tail
- byte-proven: 0 drafts declare an extern struct/union data conflict; the lone apparent
  DATA-conflict (func_8016A8FC/D_800AE620) was a typedef-REDEFINITION (Blk20 inline vs
  engine_types.h, same type) masking the def-sig loose-typing wall. Stripping the inline
  typedef compiles but still byte-mismatches. data-cast = code for 0 cases -> not built.
- cookbook §20 DATA-conflict note corrected; fleet unchanged 58.82%.
2026-06-21 09:30:22 -06:00
Drew T 7f2f314896 docs(phase-20): -O0 ×134 rollout is INVALID — cluster is overlay-local, not reach-134 (R14)
- byte-proven: only 1/134 overlays shares ov_SC01_077's -O0 cluster bytes; the 6 matched
  -O0 fns reference per-overlay data addresses (func_8013B568 -> D_80187270 in ov_SC01_077
  but 0x80182B04 in ov_SC01_005), so they're overlay-LOCAL, not ×134-shareable. The
  Phase-18/19 'reach-134' label conflated function-present with byte-identical (R14).
- the §18 split infra (rollout tool + Makefile %_o0.o pattern + PROVIDE .ld) was built and
  byte-validated to compile/link a 2nd overlay; the whole-binary gate then exposed the
  per-overlay-data wall -> reverted (the finding is the deliverable, P9).
- -O0 rollout = ×1 per-overlay-unique re-matching (~0.2-0.3%), NOT +0.6% free -> SKIP.
  cookbook §18 corrected; fleet unchanged 58.82%, 136/136 byte-identical.
2026-06-21 09:26:44 -06:00
Drew T 6c5bd1c4a9 feat(phase-20): cast_call_sites.py — the §17a-1 callee-cast cap tool; 6 recovered, fleet 58.63%->58.82%
- tools/cast_call_sites.py: per draft, callee whose canonical TU sig != draft's
  intended sig -> decl->canonical (kills in-TU conflicting types, keeps symbol in
  scope) + call-site cast ((ret(*)(args))func_X)(args) (codegen-neutral: gcc folds
  the cast of a known symbol -> direct jal). Pure --in/--out; whole-binary gate is
  the arbiter (G3/P9). Pipeline: canon_resident_calls -> cast_call_sites ->
  sig_unify -> harvest_verify --chunk 1
- recovered 6 of T6 batch-1's 33 gate-fails byte-identical (func_80153C44/8015CF58/
  801711FC/80161BE0/801683D8/8015F948); 5 propagated x134 + 1 local; check-all 136/136
- R14 CORRECTION of cookbook §20's '~33' projection (byte-proven): the batch is NOT
  mostly callee-conflicts — ~6 callee (cast-recovered), ~18 DEF-side loose-typing wall
  (def's matchable sig conflicts with the unchangeable caller-canonical; caller-side
  fix BLOCKED because INCLUDE_ASM declares no symbol -> a shared macro's internal
  extern is load-bearing in the 133 stub overlays), + a small DATA tail. The def-side
  needs re-drafting under the caller-canonical sig (future wave), not a text transform
- cookbook §20 RESOLUTION + SETUP tool inventory (R16/R21/R30); CURRENT_PHASE log (R28)
- fleet 58.63% -> 58.82%, dedup 1501 -> 1508, 0 NON_MATCHING (G4)
2026-06-21 02:04:39 -06:00
Drew T ea3ef7fb80 docs(phase-20): record candidate R30 — capture context-dependent knowledge before a fresh session
- Drew (2026-06-21): cookbook entries / byte-verified findings / distillations / doc corrections
  must be written DURING the producing session (fresh sessions get only summaries, lose the detail).
  Defer only mechanical/continuable work. Extends R16. Memory: capture-knowledge-before-fresh-session.
2026-06-21 01:25:46 -06:00
Drew T 2070cdb000 docs(phase-20): T4 — distill the codegen map (cookbook §20) + R14 loop-guard correction
- cookbook §20: the wave-at-scale GATE CAP (match_one over-predicts; the in-TU loose-typing
  call-graph wall; all recovery levers fail; the only fix is automating §17a-1 call-site casts =
  Phase-21 cap lever) + the stale-.o diagnostic lesson
- CONFIRMED-irreducible classes w/ byte-evidence: §10 store-vs-load (8014F2E0/80150528), §10
  hoist-vs-remat (80149374/801493D0); NEW classes: IV-combine combine_givs (80177AD4),
  hoisted-invariant prologue order (80177F84), the -O1 build-infra class (80161A90)
- operational gotchas: Workflow args-as-array, harvest_verify --chunk 1
- R14 correction to §17a: loop-guard (8012C2D0) is STRENGTH-REDUCTION/IV-final-value addressing,
  NOT operand-order
- SETUP §tooling: exemplar_miner.py (T2) + build_engine_types.py typedef-lift (T1) (R21)
- T3c cited (written up), T4 done; CURRENT_PHASE handoff refreshed
2026-06-21 01:24:01 -06:00
Drew T 187f7200d4 docs(phase-20): multi-session handoff — resume point for T3a/T4/T5 + the cap-recovery (Drew: continue, don't close)
- phase NOT closing; CURRENT_PHASE.md is the fresh-session resume (plan approved -> resume autonomously)
- remaining prioritized: (1) the SS17a auto-call-site-cast recovery tool (the diagnosed cap;
  recovers T6 batch-1's 33 reach-134 ~+1% + lifts every wave), (2) T4 distill, (3) T3a %lo,
  (4) T5 Ghidra-C regen + more waves, (5) -O1/-O0 split-file build-infra
- drafts preserved under .run/drafts-t6-cn/; reusable wave recipe recorded (incl. the args-as-array
  + harvest_verify --chunk 1 gotchas)
2026-06-21 01:17:48 -06:00
Drew T dab6ccb96f docs(phase-20): T6 batch-1 recovery — diagnose the loose-typing call-graph wall (gate cap)
- byte-verified: the 33 wave drafts that match_one-MATCH but fail the whole-binary gate are the
  loose-typing wall in the CALL GRAPH (a callee declared with conflicting types across overlay
  sites -> draft extern hits in-TU 'conflicting types'); match_one over-predicts (standalone +
  masks jal/hi/lo). All recovery levers fail (sig_unify/canon_draft_decls/fix_arity/no-proto/
  strip-externs); the only fix is per-site fn-ptr casts (SS17a) = Phase-21 recovery tooling
- diagnostic lesson: a failed in-TU build leaves a STALE .o (trust the whole-binary SHA, not objdump)
2026-06-21 01:12:18 -06:00
Drew T 9991e4d6be feat(phase-20): T6 batch-1 — harvest wave 41/48 match_one, 8 banked (7 x134), fleet 58.35->58.63%
- Ultracode wave on 48 cached reach-134 <=90-ins targets: 41/48 match_one MATCH (85%)
- whole-binary byte-gate: 8/41 banked (canon 3 + sig_unify 5); 7 propagated x134 + 1 local;
  dedup 1494->1501, check-all 136/136, +0.28%
- FINDING (R14/P9): match_one->gate gap ~80% this batch = EXTERN-CODEGEN-COUPLING (a callee's
  declared sig changes the call codegen; match_one uses the draft externs, the gate uses the
  overlay decls). The 33 lost are byte-correct vs the wrong externs -> need a callee-extern-
  canonicalize pass (NOT sig_unify, which rewrites the def-sig and regresses byte-correct drafts)
- the 7 DIFFs = gcc-class diagnoses: T3c store-vs-load (8014F2E0/80150528) CONFIRMED unsteerable
  (sched.c); SS10 hoist-vs-remat (80149374/801493D0); IV-combine (80177AD4); hoisted-invariant
  order (80177F84); 80161A90 = -O1 (build-infra)
2026-06-21 00:57:04 -06:00
Drew T ba6cb87d30 feat(phase-20): T2 — exemplar_miner routes 835 residuals (WAVE 472 / PINS 45 reach-134 / STUB 90)
- tools/exemplar_miner.py: consume wall_taxonomy.json + per-overlay reach (dedup_propagate's
  computation) -> route each residual to a lever (WAVE/STRUCT/PINS/STUB); emit
  docs/exemplar_curriculum.md + .run/exemplar_routing.json (wave-gen input)
- routing: WAVE 472 (218 reach-134, T6 fuel) / STRUCT 159 / PINS 114 (45 reach-134) / STUB 90
  (74 ARITY_WALL loose-typing + 16 NONFAITHFUL, honest P9)
- KEY T3 input: 17 reach-134 fns at m2c-mismatch=1 = cleanest regalloc/schedule isolates
  (likely SS17-pins wins + the genuine class residuals); 3 named exemplars confirmed reach-134
- note: census is the Jun-19 snapshot (pre-Phase-19 waves); T5/T6 regen = authoritative WAVE list
2026-06-20 23:55:51 -06:00
Drew T 4f5f73c480 feat(phase-20): T1 — typedef lift closes the type-blocked propagation cap (9 fns ×134)
- build_engine_types.py: add find_typedefs() (brace-aware) + typedef_name() (anon-struct,
  fn-ptr, alias) + same-name/overlap collision guards; lift 14 typedefs to engine_types.h
  in source order after the named structs (A801593E4 -> S801593E4 dep preserved)
- engine_types.h: 48 named types + 14 typedefs; ov_SC01_077 byte-neutral (still d19c9580)
- dedup_propagate --auto-from: 9 reach-134 fns propagated x134 (8013E4B4 80148C9C 8014A238
  8014C118 80153978 801593E4 80168664 8016B964 8017AD0C); engine_core.h +9 DEFINE macros
- FINDING (R14/P9): cap was 16; only 9 were TYPE-blocked (all freed). The other 7 fail on
  undeclared callees/data (80142B2C 801535F4 80155E30 80157580 801576A8 80168F40 80170B48)
  -> the SS19 declaration-plumbing class, a recovery-tooling lever, NOT the type-lift
- check-all 136/136 byte-identical; fleet 58.00%% -> 58.35%%; dedup 1485 -> 1494 / 0 failed; 0 NON_MATCHING (G4)
2026-06-20 23:49:58 -06:00
Drew T de35505a63 feat(phase-19): scale the toolkit — 2 waves (88%/92%), fleet 56.64%->58.00%, propagation is the cap (v1.18.0)
- T1 (prior session, commit:0158/commit:0159): per-file -O0 split infra + 6 -O0 matches; deferred the
  10 %lo-folding-quirk fns + the ×134 rollout (R14 corrected "free ×134")
- T2 (commit:0161): recovery tooling. R14: the 3 Phase-18 "implicit-int" near-misses are NOT
  implicit-int -> resident-callee link-miss (NEW canon_resident_calls.py) + shared-caller arity
  (no-proto caller-extern fix). 3 matches; cookbook §17a-3 corrected
- T3 (commit:0162/commit:0163/commit:0164): 2 Ultracode waves over reach-134 tractable residuals. batch-1
  44/50 match_one (30 banked, 25 propagated ×134); batch-2 35/38 (25 banked, 10 propagated).
  NEW fix_arity_callers.py (no-proto, ALL 18 batch-2 failures were the arity class); canon-first
  2-stage gate (sig_unify REGRESSES canonical drafts); gen_harvest_targets garbled-sig fix
  (0/749, 88%->92%); build_engine_types --strip lift (+4 propagated)
- FINDING: propagation (not matching) caps the fleet-% yield — typedef/local-type bodies can't
  auto-propagate (-> Phase-20 type-lift lever). decomp.dev-comparable byte-weighted est ~30%
- check-all 136/136 BYTE-IDENTICAL (R22); dedup 1450->1485/0 failed; 0 NON_MATCHING (G4);
  fleet 56.64% -> 58.00% (+1.36%). worklog -> phase-ends/logs/Phase19.md (R19)
- bumps 1.17.0 -> 1.18.0
2026-06-20 20:33:00 -06:00
Drew T c43b6d0830 feat(phase-19): T3 struct-lift + propagation top-up — fleet 57.93%->58.00%
- build_engine_types.py --strip: lifted 48 named types -> src/shared/engine_types.h
  (byte-neutral, ov_SC01_077 d19c9580); unblocked +4 struct-using matches -> propagated ×134
  (incl. func_80147514, a T2 match freed by the lift)
- check-all 136/136 BYTE-IDENTICAL (R22); fleet 57.93% -> 58.00%; phase total 56.64% -> 58.00%
- KEY FINDING: propagation (not matching) now caps the fleet-% yield — ~16 banked matches stay
  ov_SC01_077-local because their bodies use typedef'd/anonymous/sibling local types that the
  named-struct-only build_engine_types can't lift (dedup_propagate compiles_standalone rejects).
  Phase-20 lever: extend the type-lift to typedefs -> recovers those ×134 for ~0 agent tokens
2026-06-20 19:57:34 -06:00
Drew T 3e99d2836d feat(phase-19): T3 batch-2 wave — 25 matched, 8 propagated ×134, fleet 57.62%->57.93%
- Ultracode wave (38 targets, clean hints after the gen_harvest_targets fix): 35/38 match_one
  MATCH (92%, up from 88%); 2 of 3 garble-retries now match; 3 DIFF = genuine (delay-slot
  schedule, call-crossing hoist-vs-remat, narrow-param STOP)
- gen_harvest_targets.py: fixed INLINE_DEF_RE (was matching indented `if(func_X(...)){`
  call-exprs as defs -> garbled callee hints agents pasted as externs); 0 garbled of 749
- whole-binary gate: 25 banked. ALL 18 stage failures were the shared-caller ARITY class ->
  NEW tools/fix_arity_callers.py automates the no-proto caller-extern recovery (+8); 10 remain
  = genuine loose-typing conflicts (caller sig != def sig), Phase-16 documented wall
- pipeline finding folded in: gate canon-only FIRST, sig_unify FALLBACK (.run/t3_gate2.sh)
- propagated 8 ×134 (17 stayed ov_SC01_077-local: inline named structs need engine_types lifting)
- check-all 136/136 BYTE-IDENTICAL (R22); dedup 1475->1483 validated/0 failed; 0 NON_MATCHING (G4)
- fleet byte-identical 57.62% -> 57.93% (+0.31%)
2026-06-20 19:51:50 -06:00
Drew T 2f9b0d9906 feat(phase-19): T3 batch-1 wave — 30 matched, 25 propagated ×134, fleet 56.64%->57.62%
- Ultracode wave (50 agents, §17 toolkit): 44/50 match_one MATCH (88%); 6 DIFF = genuine
  gcc-quirk tail (fold-const constant-last, GCSE/reload, loop-IV combine, reg time-sharing,
  narrow-param), correctly stubbed (no false matches)
- whole-binary gate (the sole arbiter, G3/P9): 30 banked. Two pipeline findings (R14):
  - sig_unify REGRESSES already-canonical agent drafts -> gate canon-only FIRST, sig_unify
    FALLBACK (.run/t3_gate2.sh) recovered +5 vs unconditional sig_unify
  - 2 arity conflicts recovered via the T2 no-proto caller-extern fix (func_8014AB7C/AC10)
- propagated 25 ×134 (dedup_propagate --auto-from; incl. the T2-deferred func_8017209C);
  ~5 stayed ov_SC01_077-local (inline named structs, need engine_types lifting)
- check-all 136/136 BYTE-IDENTICAL (R22); dedup 1450->1475 validated/0 failed;
  fleet byte-identical 56.64% -> 57.62% (+0.98%); 0 NON_MATCHING (G4)
- 14 still-failing (3 agent-garble from a gen_harvest_targets garbled-sig bug, 1 struct,
  10 genuine codegen near-miss) -> batch-2 retry candidates
2026-06-20 19:27:53 -06:00
Drew T 85afa0dc81 feat(phase-19): T2 recovery tooling — canon_resident_calls + no-proto caller fix (3 matches)
- R14 finding: the 3 Phase-18 "implicit-int / propagate-first" near-misses are NOT
  implicit-int (reproduced each through the byte-gate). Real classes:
  (a) resident-callee LINK-miss: draft calls func_<ADDR> but the addr has a curated
      name (0x8004CFEC = ratan2) -> "undefined reference to func_8004CFEC". NEW
      tools/canon_resident_calls.py rewrites func_<ADDR> -> curated name (pure draft
      text, body bytes unchanged) -> run FIRST in the recovery pipeline.
  (b) shared-caller ARITY conflict: an engine_core.h caller macro declares the callee
      file-scope `extern void func_X(void)` then calls func_X(); the real def takes an
      arg -> "conflicting types". FIX = caller extern -> no-proto `extern void func_X();`
      (byte-neutral for the caller; compatible with promotion-safe params int/long/ptr).
- 3 matches banked in ov_SC01_077: func_8017209C (ratan2 rewrite), func_80147514 (s32),
  func_80168F40 (void*); 2 no-proto lines in src/shared/engine_core.h
- recovery pipeline: draft -> canon_resident_calls -> sig_unify -> harvest_verify --chunk 1
- make check-all 136/136 BYTE-IDENTICAL (full extract, R22); dedup 1450 validated/0 failed;
  0 NON_MATCHING in any default build (G4); fleet 56.64% (the 3 are ov_SC01_077-local,
  x134 propagation rides T3/Phase-20)
- cookbook §17a-3 corrected (R14/R16); SETUP tool inventory (R21); CURRENT_PHASE T2 done
2026-06-20 17:12:00 -06:00
Drew T dce768a269 docs(phase-19): CURRENT_PHASE — T2 scoping finding + session checkpoint/resume pointer 2026-06-20 16:37:27 -06:00
Drew T c8e9258426 docs(phase-19): cookbook §18 — per-file -O0 split mechanism + the %lo-folding residual (T1 flywheel) 2026-06-20 16:35:29 -06:00
Drew T be33b887fe feat(phase-19): T1 -O0 split lever — infra proven + 6 -O0 fns matched (ov_SC01_077)
- config/splat.ov_SC01_077.yaml: 3-object code split (ov_SC01_077_a before /
  ov_SC01_077_o0 -O0 cluster / ov_SC01_077 after). A single object's .text cannot be
  split around a middle object, so before/after are distinct objects; the after-region
  keeps the ov_SC01_077 name (bulk matched C + asm paths unchanged).
- Makefile: target-specific CC1FLAGS:=-O0 for ov_SC01_077_o0.o (src/boot.c precedent).
- src/ov_SC01_077/ov_SC01_077_a.c (new before-region) + ov_SC01_077.c (after-region) +
  ov_SC01_077_o0.c (new -O0 cluster): 6/16 -O0 fns matched byte-perfect
  (func_8013B568/B7F4/BD34/C360/C938/C964).
- DEFERRED to Phase 20 (Drew, on the discovered difficulty): the 10 remaining -O0 fns hit
  an indexed-global %lo-folding codegen quirk (gcc-source research, R17) + the x134
  per-overlay rollout (engine_core.h compiles -O2, cannot carry -O0 fns). Corrects the
  Phase-18 backlog premise (afternoon/free-x134) per R14. Documented in ov_SC01_077_o0.c.
- verified clean: main 143dbb89, resident 8e17e02f, ov_SC01_077 d19c9580 + 2 overlays.
2026-06-20 16:30:39 -06:00
Drew T a741d2b6b5 feat(phase-18): compiler-quirk research -> the matching TOOLKIT, taught to waves (v1.17.0)
- RESEARCH (T0-T7): read gcc-2.7.2 source (gcc-papermario) + mined Xenogears (our exact
  compiler) -> per-class byte-gated verdicts. VERDICT REVERSAL (Drew "hand-match everything"):
  the call-crossing register-ORDER class is STEERABLE via `register __asm__` pins + a scheduling
  barrier (func_8012B8E4, the flagship "unsteerable" fn, byte-gated) -- not unsteerable.
- TOOLKIT (cookbook §17): pins+barrier (register swap), array-decay (hoist-vs-remat),
  for-loop/statement-order (structural), sig_unify-mandatory; narrow-param = honest stub.
  §16 reconciled (§10-vs-§16).
- TAUGHT TO WAVES (§17a): calibration 9/16=56% whole-binary (vs 33%); Step-1 (embedded
  canonical callee sigs + call-site-cast/re-validate) 28/31=90% match_one, 22 verified.
  ~31 reach-134 matches banked, each propagated x134. fleet 55.51 -> 56.64% (+1.13%).
- FINDING: the match_one->gate gap is declaration plumbing (call-site casts not redeclaration;
  stale M2C_UNK sibling-decl reconcile; implicit-int caller class) -- recovered deterministically.
- NEW residual classes: per-file -O0 (~18 fns, needs an -O0 split file like src/boot.c -> high
  ROI) + gcc loop-guard operand-order (irreducible). W1: build-divergence ruled out by proxy.
- make check-all 136/136 byte-identical (R22); dedup 1450 validated/0 failed; 0 NON_MATCHING (G4).
- worklog -> phase-ends/logs/Phase18.md (R19); bumps 1.16.0 -> 1.17.0
2026-06-20 15:05:52 -06:00
Drew T 151da542ab docs(phase-18): cookbook §17a (toolkit at wave scale + pipeline-integration recovery) + CURRENT_PHASE Step-1 done
- §17a: measured wave close-rates (calibration 56%, Step-1 90% match_one); the match_one->gate gap
  is declaration plumbing (call-site casts not redeclaration + re-validate; stale sibling M2C_UNK decl
  reconcile; implicit-int caller class); two NEW residual classes (per-file -O0 + gcc loop-guard order)
- CURRENT_PHASE: Step 1 done, session arc 55.58->56.64%, Phase-19 deferrals listed
2026-06-20 14:41:46 -06:00
Drew T 6d9cd213a2 feat(phase-18): Step-1 recovery — +2 matches (func_8012F68C parse-fix x134, func_8012A418 sibling-decl reconcile)
- func_8012F68C: agent left a malformed 'extern if(...)' line -> fixed to a proper extern; gated x134.
- func_8012A418: reconciled a stale 'M2C_UNK func_8012A418()' sibling forward-decl to the real
  'void func_8012A418(void)' sig; byte-gated, banked REAL in ov_SC01_077 (local-type body, not shared-macro).
- Step-1 total: 22 reach-134 matches (18 propagated x134 + 4 local REAL); deferred to Phase 19:
  3 TU-integration cases (func_80147514/8017209C/80168F40, standalone-MATCH) + 3 codegen DIFFs
  (func_80131CA8/80150528/8014E5B4) + the per-file -O0 class (func_8013C360 +17 siblings) + 2 genuine
  residuals (func_8014F2E0 §10 sched, func_8012C2D0 loop-guard order).
- make check-all 136/136 byte-identical (R22); 0 NON_MATCHING (G4).
2026-06-20 14:39:51 -06:00
Drew T fa0d4a3f62 feat(phase-18): Step-1 wave banks 20 reach-134 matches (55.94->56.60%)
- bounded Step-1 wave (.run/harvest_wave_p18s1.js): 31 tractable reach-134 targets, agents
  taught §17 toolkit + embedded canonical callee sigs + call-site-cast/re-validate fix.
- match_one MATCH 28/31 (90%, vs calibration 12/16); whole-binary gate 20 verified:
  7 pins, 5 barrier, 1 array-decay, 2 call-site-cast, 12 reconstruct, 1 other. 17 propagated
  x134 (3 have h_exact membership <134 -> banked REAL in ov_SC01_077 only).
- fleet 55.94 -> 56.60%; make check-all 136/136 byte-identical (R22); 0 NON_MATCHING (G4).
- 3 DIFFs well-characterized: func_8013C360 = per-FILE -O0 class (18 scattered -O0 fns;
  agent's C byte-exact at -O0, needs an -O0 split file like src/boot.c -> Phase 19);
  func_8014F2E0 = §10 store-vs-load scheduler tie-break; func_8012C2D0 = NEW gcc loop-guard
  operand-order class (irreducible). 8 gate-fails are recoverable sibling-decl/parse cases.
2026-06-20 14:30:36 -06:00
Drew T ab5ccf726a docs(phase-18): CURRENT_PHASE — Step 3b done (calibration 56% close-rate, fleet 55.94%); paused for Step-1 scale-up 2026-06-20 13:41:07 -06:00
Drew T d593ee20fe feat(phase-18): Step-3b calibration — §17-toolkit wave banks 9 reach-134 matches (55.58->55.94%)
- upgraded harvest wave (.run/harvest_wave_3b.js) teaches the §17 TOOLKIT: triage the
  match_one diff -> reconstruct / array-decay / register-pins+barrier (instead of stubbing
  the regalloc tail). Calibration: 16 fresh tractable reach-134 targets.
- whole-binary close-rate 9/16 = 56% (vs Phase-17 baseline 33%): 2 via register pins
  (func_8012CB64, func_801468C8), 2 via array-decay (func_80149544, func_80149584),
  5 via clean reconstruction. Each reach-134 -> propagated x134 (config/dedup.us.yaml +9).
- FINDING (R16 flywheel): the match_one->gate gap (12->6 then ->9) is the §3a call-site
  CASTS the agents skipped + sig_unify narrowing the extern to canonical -> conflict.
  Recovered 3 by call-site arity-cast / void-return cast (codegen-neutral). Step-1 prompt
  must teach call-site casts + re-validate after sig_unify.
- make check-all 136/136 byte-identical (R22); dedup-check 1432 validated, 0 failed;
  0 NON_MATCHING in any default build (G4).
2026-06-20 13:40:11 -06:00
Drew T f28a435815 docs(phase-18): CURRENT_PHASE — full Step-3b runbook + new-session banner
- 🚨 top banner: T0-T5 'unsteerable' framing SUPERSEDED; resume 3->1->2 at Step 3b
  with /effort ultracode ON; read cookbook §17 (the corrected TOOLKIT) first
- ▶ STEP-3b RUNBOOK: the §17 toolkit summary (reconstruct/array-decay/PINS/barrier +
  the MANDATORY canonical-retype gate gotcha + stub-only narrow-param), the exact gate
  pipeline + commands (match_one/harvest_verify/dedup_propagate, ov_SC01_077 good-sha
  d19c9580), the durable worked examples (engine_core.h DEFINE_func_8012B8E4/801399A8),
  the staged assets (harvest_wave_s4.js, probe_targets_s4.json, .run/ghidra_c/), fleet
  baseline 55.58%/136-of-136, and the Step 1->2 close path
- everything a fresh full-context session needs to author the upgraded wave + run it
2026-06-20 12:56:15 -06:00
Drew T 23666cb284 docs(phase-18): CURRENT_PHASE — verdict reversal + the 3->1->2 plan; step 3a done 2026-06-20 12:33:33 -06:00
Drew T 667504a4ba docs(phase-18): correct §17/§8e — register-order class is STEERABLE via pins (not unsteerable)
- §17 rewritten: the call-crossing register-ORDER class is MATCHABLE with register
  __asm__ pins + a scheduling barrier (byte-proven func_8012B8E4), not unsteerable.
  The wall was a missing lever (the pins), not an impossibility. Recipe documented as
  a TOOLKIT: triage with match_one -> reconstruct / array-decay / PINS / barrier.
- §16 cross-refs + hand-matching §8e corrected to match. The ONLY genuine stub-and-skip
  left is the narrow-param loose-typing conflict (func_80146A6C).
- self-correction (P9/R14): I concluded 'unsteerable' before trying the pins; Drew's
  hand-match-everything directive exposed the gap. Recorded honestly.
2026-06-20 12:33:08 -06:00
Drew T f1bbcd241f feat(phase-18): VERDICT REVERSED — func_8012B8E4 hand-matched via register pinning
The 'unsteerable' regalloc-order class is NOT unsteerable. Drew's directive (hand-match
everything) exposed the lever I'd skipped: explicit register pinning.

- func_8012B8E4 (the flagship circular reach-134 'unsteerable' fn): 21 -> MATCH via
  * register pins: register s32 d __asm__("$16"); register s32 s1ang __asm__("$17")
    -> FORCES the $s0/$s1 global allocation gcc otherwise density-orders the other way
  * branch-polarity invert (§3-T4): 24->21
  * explicit clamp temps (t=u6+0x1000; iVar4=u5-t): fixes the reassociation, 7->3
  * scheduling barrier __asm__ __volatile__("" : : "r"(u5)): anchors the last sll, 3->MATCH
- byte-gated (harvest_verify, G3/P9) + propagated x134 (per-overlay gate); 134 byte-identical
- recipe = §10-family hand technique (pins + barriers); labor-intensive (per-fn register map
  from the asm) but it WORKS -> the circular tail IS hand-matchable, not asm-only
- supersedes the T1-T5 'unsteerable' verdict; cookbook §17 + PhaseEnd to be revised accordingly
2026-06-20 12:17:54 -06:00
Drew T bd9ee97854 docs(phase-18): W1 — build-divergence ruled out by proxy (Wine install dropped)
- the build-divergence escape is closed without the heavy Wine/CC1PSX run:
  * gcc-2.7.2-psx byte-matches ~700 fns (incl. call-crossing callee-saved values)
    -> its global allocation IS faithful to the original compiler -> real CC1PSX
    would emit the SAME unsteerable swap
  * cdk cc1 tested directly: diverges but WORSE (32 vs 21) -> cc1-switch doesn't crack it
  * Xenogears (real-era toolchain) ships the class as asm
- Wine is a heavy install here (106 pkgs + i386 + wineprefix); low marginal value ->
  deferred per the plan escape clause; binaries staged at tools/psyq/psyq4.0/ if wanted
- R22: clean-rebuild of ov_SC01_077 with the match = d19c9580 BYTE-IDENTICAL
- all Phase-18 tasks complete; ready for gate-2 milestone confirmation
2026-06-20 11:56:30 -06:00
Drew T ceecaeb235 docs(phase-18): T5 — cookbook §17 (steerable-vs-not) + reconcile §10-vs-§16
- cookbook §17 (NEW): the compiler-quirk wall, gcc-2.7.2-source + Xenogears confirmed:
  * UNSTEERABLE: call-crossing $s0/$s1 allocation ORDER (global.c allocno_compare density;
    exhaustive C/flag/cc1 sweep + Xenogears ships-as-asm corroboration) -> stub it (G4)
  * STEERABLE idioms: array-decay-forces-remat (NEW), for-loop-vs-do-while delay-slot
    scheduling (NEW), statement-order (§2-T2 ext); + reconfirmed branch-polarity/mask-local
  * pipeline gotcha: match_one masks relocs -> sig_unify/canonical-retype is MANDATORY
    before harvest_verify (the conflicting-types gate failure)
  * loose-typing narrow-param wall is REAL (func_80146A6C lhu/s16 vs canonical s32/lw)
- §16 reconciled: the 'not source-steerable' line cross-refs §17; §10-vs-§16 tension
  resolved by naming the residual class precisely (both right about different residuals)
- hand-matching-process.md §8e: Phase-18 outcome re-scopes the Phase-19 wave
  (triage-and-stub the unsteerable; spend on non-walled STRUCTURAL_MISS)
2026-06-20 11:54:07 -06:00
Drew T 92a0ab4a9a docs(phase-18): T4+T6 record — idioms byte-validated; STRUCTURAL_MISS is mixed
- T6 2nd attempt (func_80146A6C): 18=18 ins, 8 mismatched, blocked by the Phase-16
  LOOSE-TYPING wall (target loads a4 as s16/lhu; canonical engine_core.h sig declares
  a4 s32/lw -> no consistent type). So STRUCTURAL_MISS is mixed: some close, some walled.
- T4: per-class idiom verdicts set (for-loop+statement-order+sig_unify byte-gated to a
  full match; branch-polarity + array-decay-remat = real codegen fixes via match_one;
  regalloc-order byte-proven unsteerable)
- CURRENT_PHASE updated (crash-recovery log)
2026-06-20 11:51:30 -06:00
Drew T 52cfc22972 feat(phase-18): T6 — func_801399A8 matched + propagated x134 (fleet 55.51->55.55%)
- reach-134 STRUCTURAL_MISS target closed by the research idioms:
  * for-loop structure (vs do-while) -> correct beqz delay-slot scheduling
  * statement-order in the for-update (cookbook §2-T2) -> final 2 increments
  * sig_unify canonical retype (s32 return + s32 data, integer address arithmetic)
    -> resolves the TU-level conflicting-types gate failure that match_one masked
- byte-gated (harvest_verify, G3/P9): ov_SC01_077 stays d19c9580 BYTE-IDENTICAL
- propagated to all 134 overlays via dedup_propagate (per-overlay gate, fail-closed)
- make check-all: 136 passed / 0 failed; fleet 190,949 -> 191,083 / 344,010 = 55.55%
- KEY reframe: the STRUCTURAL_MISS bucket IS matchable (idioms work); distinct from
  the PERMUTER_CLASS/circular regalloc-order tail which is unsteerable (T1-T3 verdict)
2026-06-20 11:48:12 -06:00
Drew T eb90cacd72 feat(phase-18): T2+T3 — regalloc-order UNSTEERABLE (corroborated); array-decay-remat idiom
- T2 (Xenogears mine, 2 bg agents): independent decomp on IDENTICAL gcc-2.7.2-psx -O2
  has NO C lever for the call-crossing $s0/$s1 ORDER class; ships it as INCLUDE_ASM
  (1174 nonmatch). Their idioms: variable-split, width/cast, per-file compiler-switch.
- flag/cc1 sweep (func_8012B8E4): -funsigned-char/-fpcc-struct-return/-fpeephole/
  -fcaller-saves all 21 (no change); cdk worse (32); -fno-schedule-insns worse (71)
- T3 verdict: regalloc-ORDER class = UNSTEERABLE from C (global.c density ordering;
  exhaustive empirics + independent corroboration)
- NEW IDIOM found on func_8012B4B8 (remat class): array-decay forces rematerialization
  (s32 mtx[8] passed as decay -> remat not hoist; fixes 88->52 incl. the hard regalloc).
  &struct/.w/*(M8*) all hoist. Bankable; this fn has a struct-copy conflict so partial.
- synthesis: .run/p18/T2_T3_synthesis.md; reconciles §10-vs-§16 for T5
- strategic redirect: high-reach circular tail largely unmatchable from C -> match-%
  lever is the tractable-247 wave (Phase 19) + accept the tail as asm (Xenogears policy)
2026-06-20 11:35:33 -06:00
Drew T c5fc6789bf feat(phase-18): T1 gate — branch-polarity §10 win; regalloc residue is global.c ordering
- replayed §10 levers on func_8012B8E4 under match_one (the floor-free oracle):
  - §3-T4 branch-polarity invert: 24 -> 21 mismatched (a real §10-family win the
    permuter's floor-polluted score could not measure in Phase 17)
  - statement-order: no effect; coupling s1ang+u6: regressed to 71; -O3: identical alloc
- ROOT pinned via the cloned gcc-2.7.2 source: the residual $s0<->$s1 swap is two
  ratan2-call-crossing pseudos allocated by global.c:allocno_compare (density =
  log2(n_refs)*n_refs/live_length), NOT local-alloc; short-lived s1ang wins $s0
- GATE = NO branch (§10 helps but doesn't close) -> T3 sharply scoped + mechanism-pinned;
  func_8012B4B8 (hoist-remat+struct) baselined (88 mismatched), deferred to T3/T4
- CURRENT_PHASE updated; findings in .run/p18/ (gitignored scratch)
2026-06-20 11:21:40 -06:00
Drew T d20b20c64b feat(phase-18): T0 — setup + exemplar set; match_one validated as the §10 oracle
- clone gcc-papermario (a6afc2af) + xenogears-decomp (f27c0768) -> tools/reference/
  (gitignored research refs; SHAs pinned in docs/SETUP.md §5.6, R20/R21)
- apparatus byte-validated: match_one cleanly measures the §10 residual on both quirk
  exemplars (the floor-free oracle Phase 17 failed to use; permuter score was polluted):
  - func_8012B8E4: 75=75 ins, 24 mismatched -> $s0/$s1 regalloc swap + reassociation (§10 A)
  - func_8012B4B8: 94 vs 84 ins, 88 mismatched -> extra-reg spill + struct-copy/reload (§10 B)
- CURRENT_PHASE.md crash-recovery log; harness task list (R28); no build-affecting change
2026-06-20 11:08:21 -06:00
Drew T c4b0cef86a feat(phase-17): close — canonical-sig layer built; the wall is the compiler, not sigs; pivot to gcc research (v1.16.0)
- canonical-sig layer (session 4): tools/census_conflict_callees.py + derive_canonical_sigs.py
  -> a 20-extern byte-neutral block atop ov_SC01_077.c (LOCAL, not engine_core.h); census
  conflict callees 20->0, blocked targets 24->0; gate pipeline now draft -> sig_unify (MANDATORY)
  -> harvest_verify --chunk 1; fleet 136/136 byte-identical (R22), 55.51% (no regression)
- FINDING (R14/P9): the conflict wall is 7%-reach not ~2x; the 4 reach-134 circular targets are
  ALL gcc-quirk/regalloc/layout-bound (0 banked); the high-reach core IS the quirk tail; struct
  types are byte-neutral for matching (the wall is gcc codegen, not knowledge)
- leverage analysis: fleet % is function-count-weighted (size adds no %); "unblock many" = the
  layer (declaration, not matching); reach is the lever (already reach-sorted); 247 tractable
  reach-134 stubs ~ +3-4% projected
- GO/NO-GO: NO-GO on brute waves at the current ceiling; GO on a compiler-quirk research phase
  (read gcc-2.7.2 source + Xenogears + the §10/regalloc classes, R17) -> then resume the wave
- docs: cookbook §16 corrected + hand-matching-process.md §8 (the layer + the finding + handoff)
- worklog archived -> phase-ends/logs/Phase17.md (R19); bumps 1.15.0 -> 1.16.0
2026-06-20 09:35:18 -06:00
Drew T f0dd9351e4 docs(phase-17): flywheel + handoff up to date — canonical-sig wall is the scaling lever
- CURRENT_PHASE.md: new session-4 START HERE (build the canonical-sig layer, then
  scale the wave); old demo-protocol START HERE marked superseded
- hand-matching-process.md S7: the Ultracode harvest wave (pipeline, calibration
  result 60% match_one / 33% whole-binary / +0.47%) + THE CANONICAL-SIG WALL (the
  60->33 gap is 100% sig conflicts; surgical per-callee canonicalization = ~2x lever)
- matching-cookbook.md S16: guided-hand-matching breakthrough + new idioms (mask-local,
  shared-ret0 goto, v0/v1 coalescing) + the wave/canonical-sig finding (R16 flywheel)
- SETUP.md: DecompileFunctions.java (headless batch Ghidra-C pre-pass) in the inventory (R21)
2026-06-19 21:16:41 -06:00