Commit Graph

461 Commits

Author SHA1 Message Date
Drew T bbd8a6c8e4 feat(phase-31): pregate_check sees brace-bodied externs (the D_80072780 clash that cost a rebuild); §183 addendum 2026-08-16 22:41:01 -06:00
Drew T 192759f732 fix(phase-31): pregate_check FAILs any return-type disagreement (G4P* under G3P* was rejected by gcc, cost a rebuild) 2026-08-16 22:23:10 -06:00
Drew T 1ebca23c87 feat(phase-31): gate_main hoists TU typedefs above the include block (§181 class 2); +3 recovered drafts banked 2026-08-16 22:20:56 -06:00
Drew T adfa7185c9 docs+tools(phase-31): cookbook §180d/§181/§182; fragment_check gains the mirror test (5.7% of main stubs); pregate_check scans masked text 2026-08-16 21:07:03 -06:00
Drew T 472ff5806a feat(phase-31): tools/scan_leftovers.py — re-verify unbanked drafts (found 37 free MATCHes / 3,240 ins); cookbook §180 2026-08-16 18:11:32 -06:00
Drew T 6bc8bb6894 feat(phase-31): wave Q — 40 main functions banked; + fragment_check.py and bisect_slate.py
Wave Q (90 cards / 6,249 ins) was stopped mid-flight, then a repair-only pass recovered 12 of its
39 unfinished drafts (+579 ins, 51 -> 64 verified MATCH). Banking took two new tools, because the
gate failed three times on causes no C-level check can see.

tools/fragment_check.py (NEW) — the enclosing-function trap, both halves, in milliseconds:
  * a draft whose [addr, addr+4*nins) SUBSUMES another symbol. splat labels addresses that are not
    functions (a bare epilogue tail, a jump-only branch target, an interior label); convert the
    enclosing function and a neighbour's `jal .L80050F24` loses its target.
  * a draft that DEFINES another stub's symbol in inline asm. MoveImage's repair agent correctly
    worked out that a trailing epilogue belongs to MoveImage (splat attributes those bytes to the
    NEXT symbol) and emitted `.globl SYS_OBJ_8F4` itself -- right bytes, match_one passes, and the
    assembler then sees the symbol defined twice because the fragment still has its own .s.
  My first hypothesis was the subsumption case; the tool REFUTED it (clean) and the redefinition
  case was the real one. Recording that order, because I built the tool before verifying the
  premise -- R35 inverted.

tools/bisect_slate.py (NEW) — gate_main's built-in bisect ran THREE HOURS on a 45-draft slate and
printed nothing. Three defects: it never checked whether the BASELINE builds (if no subset can
pass, the search is doomed from step 1), it logs only when it isolates a single draft, and its
re-split rule degrades toward one rebuild per draft. The replacement runs the NULL CONTROL first
(the same control that refuted this phase's "main is link-blocked" misdiagnosis), logs every step,
and does a true binary search: it found the culprit (SYS_OBJ_1790) in 7 steps and 176 SECONDS.

Result: 40 banked, main stubs 1,803 -> 1,763.
2026-08-16 17:21:10 -06:00
Drew T b021812c17 docs(phase-31): cookbook §176i/§176j — the pre-gate check's real boundary, and the cost of stopping a wave
§176i — WHAT A STATIC PRE-GATE CHECK CAN AND CANNOT PROVE. pregate_check validated wave Q's slate
as clean in 0.7s (the first slate all session to reach the gate pre-validated) and the build then
failed twice, both times outside what any text-only check can see:
  1. LINK-time undefined reference: `.L80050F24` lives INSIDE gfx2D_BG0_OBJ_698 and another
     function's .s branches to it -- converting a function to C deletes the local labels its
     neighbours jump to. Statically checkable, but from the .s files, not the .c: scan every other
     .s for label references landing inside a candidate's address range. Worth building.
  2. BYTE mismatch: with the link fixed the binary BUILT and the SHA differed -- the §174 law 1c
     class, which reloc_identity had already named six suspects for.
The division of labour to rely on: text checker for SHAPE, reloc oracle for IDENTITY, gate for
TRUTH. A clean pre-gate is a licence to build, not a prediction of success -- and when the binary
builds but the hash differs, BISECT, because it costs wall-clock and zero tokens.

§176j — STOPPING A WAVE MID-FLIGHT COSTS THE IN-FLIGHT TAIL. Wave Q stopped early: 51/90 verified
(3,631 of 6,249 ins) versus the 96-97% the same pipeline yields when allowed to finish. The loss is
SUSPENDED, not destroyed -- every draft persists on disk, 15 of the 39 unfinished sit at closeness
<=10. Do NOT resume the workflow to recover it (resume re-runs unfinished agents from scratch at
full cost); use a REPAIR-ONLY pass over the <=30 band instead. Decision rule: before killing a long
agent run, price the tail -- stopping converts near-matches into "needs a cheaper second pass",
which is a deferral, not a saving.
2026-08-16 10:02:22 -06:00
Drew T df7bca2e65 feat(phase-31): tools/reconcile_slate.py — drive a slate to 0-dropped BEFORE the first rebuild
The 68%->95% lever from §176h.C2, mechanized. Reconciliation belongs INSIDE the wave: a banked
draft's declarations become the TU's, so a sibling clash hardens into a file clash and post-bank
recovery is measurably worse (18 parked drafts still MATCH, only 1 survived after their wave banked
vs 5 before).

AUTO-FIXES, each re-verified with match_one and REVERTED if a byte moves (a declaration change is
a codegen change, §176f):
  * COSMETIC-TYPEDEF  two names for a structurally identical struct -> adopt the other. Compared by
    BODY, never by name (OtBlk_80015498 == OtBlk_80016450; Elem12 != B12). This body comparison is
    also the answer to §176h.C's spelled-name limit.
  * SIGNEDNESS / ALIAS / ARRAY-VS-SCALAR -> adopt the TU's spelling, fixing the use site.
  * DEFPARAMS (NEW LEVER) -> adopt the TU's parameter types on the DEFINITION and re-narrow with a
    shadowing local: `void f(s32 a0_p) { s16 a0 = (s16)a0_p; <body unchanged> }`. One textual
    insertion instead of rewriting every use site, and the cast emits the same sll/sra pair.
    Byte-identical on both cases tried.

REFUSES, with named reasons, because these are decisions and not edits: DIFFERENT-STRUCT (two real
layouts for one symbol), IMMOVABLE-TU-DECL (gate_main reverts src/, so it needs its own commit +
rebuild + R22), DEF-SIDE-RETURN (adopting the TU's return type usually costs the match -- measured
on func_8001ABBC), and BROKE-MATCH for anything its own verification rejects.

Measured on wave P's leftover slate: 6 -> 9 compatible, 3 auto-reconciled, 2 repairs reverted by
the tool's own byte check, 7 named for a human.

build_wave_atlas: --rank mass (main's gate cost is per SLATE, so ranking groups by member count
silently collapses a wide band to the smallest functions -- measured 60 cards/2,604 ins where 46
cards/4,829 ins were available), and the selector no longer counts ITS OWN OUTPUT as already-waved
(re-running with identical filters had been shrinking the pool 60 -> 46).
2026-08-16 08:36:36 -06:00
Drew T 74a95af4c1 docs+fix(phase-31): reconcile BEFORE the first gate (§176h.C2); pregate duplicate-typedef fix
MEASURED, and it inverts the obvious plan. "Bank the clean drafts now, recover the conflicted ones
later" is backwards: of 18 wave-O/P drafts parked and re-verified still MATCH, only 1 survived
resolve_conflicts once their wave had banked -- versus 5 before it.

The mechanism: a banked draft's declarations BECOME the TU's, so every parked draft that merely
disagreed with a SIBLING now disagrees with the FILE, which is the stricter arbiter (a sibling
clash can be settled by editing either side; a file clash only by editing the draft, and some
cannot be settled at all because gate_main reverts src/ before every build). Worse, the auto-rename
that reconciles a cosmetic clash pre-bank becomes a DUPLICATE TYPEDEF post-bank, because the name
it renames to is now defined in the file.

So iterate the dry run to `N -> N compatible, 0 dropped` BEFORE spending the first rebuild, and
budget reconciliation into the wave rather than after it.

pregate_check: DUPLICATE-TYPEDEF now fires on ANY redefinition, not only differing bodies. C89 has
no compatible-redefinition allowance for typedefs, and my first version missed exactly the case the
tool exists for -- two identical `OtBlk_80016450` definitions, which the compiler rejected on the
next rebuild. Measured, not reasoned.

Also banks the auto-reconciler's rule: tell a COSMETIC clash from a REAL one by comparing struct
BODIES, not names. OtBlk_80015498 vs OtBlk_80016450 are the same {s32 a; s32 b[4];} and rename
byte-identically (both re-verified MATCH); Elem12 vs B12 genuinely differ and were refused.
2026-08-15 22:11:06 -06:00
Drew T 207559daad feat(phase-31): tools/pregate_check.py — validate a main slate in 0.7s instead of a 5-min rebuild
Wave P drafted at 97% and cost A DOZEN clean rebuilds to bank, and not one of those rebuilds
failed on a matching problem -- every one failed on a TEXTUAL property of the substituted file
that a grep could have reported instantly. This is that grep.

gate_main's resolve_conflicts cannot answer it, and not from carelessness: it inspects the DRAFTS
while the compiler sees the FILE THEY LAND IN -- after typedef stripping and renaming, at each
draft's own insertion offset, interleaved with declarations the file already had. Those
transformations run AFTER the conflict check passes. So substitute() gained write=False and this
tool checks the artifact itself.

Five checks, each earned by a rebuild lost this session (§176h): typedef used above its
definition; type never defined anywhere; duplicate typedef with different bodies; one symbol
declared two incompatible ways; definition contradicting a visible prototype.

CALIBRATED AGAINST THE COMPILER, NOT AGAINST C89 PEDANTRY -- and this mattered. The first version
reported 4 hard FAILUREs on the slate that had just built BYTE-IDENTICAL:
- it ignored SCOPE, but the project deliberately uses block-scope extern blocks, and a declaration
  inside one function cannot conflict with a definition elsewhere. Now brace-depth aware.
- it split `void f()` from `void f(void)`, which gcc-2.7.2 accepts. Normalized.
- it called every def-vs-decl mismatch fatal, but gcc-2.7.2 accepted `void f(void*,s32)` against a
  `void f(s8*,s32)` definition and even `G3P *f(...)` against `G4P *f(...)`. What it REJECTED was
  a void/non-void RETURN split (func_8001ABBC). That split alone is FAIL; the rest are WARN.
Comments are masked via cdecl before any use-site scan (an unmasked scan reported 7 phantom hits).

R39 controls: the slate that banked is FAIL-free (exit 0, 3 informative warnings); four synthetic
defects each reported at FAIL; a clean text reports nothing; a block-scope extern does not
conflict; `short` vs `s16` does not conflict; array-vs-scalar does.
2026-08-15 22:03:42 -06:00
Drew T ad2aa6173f feat(phase-31): wave P — 32 main functions banked, main byte-identical (S52)
Wave P was the first full run of the 6k-ins doctrine: 60 cards / 6,589 ins in 2 gate groups,
59/60 claimed and 58/60 independently re-verified MATCH (6,372 ins), reloc_identity 58/58 AGREE
with ZERO symbol errors -- the second consecutive clean wave on symbol identity.

Banking cost a dozen rebuilds and exposed four more gate_main defects plus three regressions of
my own. The tool fixes, all NC'd:
- resolve_conflicts never read a draft's OWN DEFINITION, so the DEF-side wall (a draft defining
  s32 func_X against a TU prototyping void func_X) reached the compiler. Now definition-aware:
  it caught 13 conflicts up front where the build had been finding them one rebuild at a time.
- DECL and both typedef patterns anchored on end-of-line, so a TRAILING COMMENT hid a declaration
  or typedef entirely -- and agents comment nearly everything they declare. Seventh instance of
  one root cause: a scanner that looks green while reading less than it claims (R32).
- typedef handling is now BODY-AWARE and POSITION-AWARE, in a single pass:
    * identical definition visible ABOVE the insertion point -> strip and reuse;
    * same name, different shape -> rename (private to the draft);
    * definition below the insertion point -> never reuse (it is not in scope there).
  Three wrong strategies preceded this, each costing a rebuild: blanket strip (the file's copy can
  sit BELOW the draft -> implicit-int, then a collision), blanket rename (breaks drafts that share
  an IDENTICAL typedef, because their externs stop agreeing -- my regression, three drafts at
  once), and a rescan loop that found the definition it had just renamed and stripped it as a
  self-duplicate -> 'parse error before *'.

KNOWN LIMIT, recorded not fixed: the conflict check compares spelled type NAMES, so three drafts
each defining their own Slot54 with different layouts all declared func_80032A74(Slot54*) and
looked compatible. Comparing struct LAYOUTS for locally-defined types is the real fix.

13 + 4 verified-correct drafts are parked in two named buckets (competing local type models;
immovable TU declarations that gate_main reverts before every build).
2026-08-15 21:55:38 -06:00
Drew T 0753641d4b feat(phase-31): adopt the 6k-instruction wave doctrine + --target-ins (Drew, 2026-08-15)
A wave is now sized by INSTRUCTION MASS, not card count. The metric is instruction-weighted, so a
wave is worth what its instructions are worth: the 12-42-ins card lanes carried ~1,400 ins/wave
(~0.011pp, ~440 waves to finish) while wave O carried 6,266 ins at the same gate cost and the same
draft rate.

build_wave_atlas --target-ins draws cards until the instruction budget is met (still capped by n)
and refuses to under-fill silently. Standard recipe: --target-ins 6500 --min-ins 60 --max-ins 200
--max-bins 4, levers now including UNKNOWN.

THE MEASUREMENT BEHIND IT: draft rate barely decays with size -- wave M 98% at avg 51 ins, wave N
92% at avg 65, wave O 96% at avg 128. Mass is nearly free.

THE UNKNOWN UNLOCK: UNKNOWN is not a difficulty label, it means the atlas could not name a lever,
and it had been routed as needing its own bespoke lane. Wave O's 22-card R37 probe drafted it like
any other lane -- reclassifying ~138k ins (a quarter of everything open) as ordinary wave fuel.
With UNKNOWN in, 9,224 fns / 417,325 ins = 70% of all open instructions are agent-draftable; the
60-200-ins mass band alone is 164,357 ins ~= 27 waves, and is the band to work first.

Also banks the five-step PRE-GATE PROTOCOL (independent re-verify -> reloc_identity -> dry-run to
0-dropped -> reconcile declarations toward the form the match needs -> gate), cookbook §176g.
2026-08-15 14:05:15 -06:00
Drew T 110570e3fc feat(phase-31): wave O — 46 main functions banked, main EXE byte-identical (S52)
36 fresh wave-O cracks + 10 recovered wave-J/K/L drafts, verified in ONE clean rebuild:
143dbb89f34491258bbc27810d0a12ec8b43a8dd BYTE-IDENTICAL. main stubs 1881 -> 1835.

Wave O was a 3-arm 49-card wave (6,266 ins): main head-crack, main UNKNOWN, overlay UNKNOWN.
47/49 standalone MATCH, independently re-verified by me (R14) at 47/49 -- exact agreement --
and reloc_identity reported 46 AGREE / 0 MISMATCH, the first wave of the campaign with zero
symbol errors. THE UNKNOWN LEVER DRAFTS LIKE ANY OTHER LANE, which matters strategically: it is
~138k ins fleet-wide (a quarter of everything open) and was routed as "needs its own lane".

FOUR gate_main defects fixed here, each of which had been silently costing prior waves drafts:
- typedef stripping walked drafts in SLATE order while substitution happens at ADDRESS order, so
  the surviving typedef could land BELOW a draft using it -> "syntax error before D_800A651C".
  Verified the two orders genuinely diverge for both destination files in this slate.
- a BUILD failure (sha None) fell through to a silent bisect -- a full clean rebuild per step to
  rediscover what the compiler had already printed and discarded. Now the error lines are shown
  and the offending drafts named for undefined-reference/redefinition/conflicting-types.
  (My first version of that printer TAILED a stderr+stdout concatenation and faithfully showed 25
  lines of make progress chatter instead of the error -- selecting by position, not by content.)
- typesig treated "short" and "s16" as different types (R39 over-refusal). Aliases now normalize;
  11/11 NC cases pass, with signedness, volatile and array-vs-scalar still conflicting correctly.
- conflict detection ignored shared headers: engine_core.h's DEFINE_ macros declare symbols in
  their own bodies, so a draft's file-scope array decl of D_800A651C was illegal. Block-scoping
  the draft's extern fixes it byte-identically.

DECLARATION RECONCILIATION took the slate from 5 dropped to 0, and three of the four conflicts
were load-bearing CODEGEN, not style: the array form of D_80078D88 blocks a sched1 hoist (scalar
users adopt [0] for free); "volatile" on D_800B9A02 is required by one draft and fatal to two
others (plain u16 loses 1 bank, volatile loses 2); D_800A651C needs block scope. Cookbook §176f.
2026-08-15 14:01:19 -06:00
Drew T 965ae3902e measure(phase-31): the AGREE re-gate lane is a 5% null — symbol verification does not rescue stored drafts (S52-12)
R37 probe: 20 shape-verified AND symbol-verified stored drafts, 5 gate groups -> 1 banked (5%),
statistically the same as the project's A10 stored-verdict law (~0-8%; T1 measured 0/23 on the same
kind of pile earlier this phase). The null is the finding: a stored draft's rejection is almost
never symbol identity, it is TU plumbing (§176d) or staleness. reloc_identity's real home is a
PRE-GATE check on FRESH drafts, not a backlog resurrection tool. The remaining 30 groups are not
worth 30 rebuilds -- lane closed rather than pursued because the tooling was new and interesting.

Also names the SYMBOL-COLLAPSE class in the fixer's refusal (one draft extern standing in for N
distinct globals; a textual rename moves every occurrence together, so it needs one extern per
site) and records the R38 self-note: the 0/23 prior was already in the phase log.
2026-08-15 09:50:48 -06:00
Drew T 0487c0c627 docs(phase-31): cookbook §176e — symbol identity is COMPUTABLE offline, plus reloc_identity --fix (S52)
§174 law 1c recorded match_one's relocation blindness as a caution to the reader ('check every
symbol by hand after MATCH'). It is a computation, not a human's job. Banks the arithmetic, the two
failure shapes it separates (uniform-delta stale seed symbols vs wrong field offset), the four
traps that bit me building it (splat-derived names absent from the symbol files; MIPS o32 REL keeps
the addend in the instruction; index alignment is a precondition; a nearest-symbol label needs a
tight window), and the honest limit measured the same session: symbol-verified + shape-verified is
still NOT sufficient for a bank -- the first re-gate group of five such drafts banked 0/5, because
what remains is TU plumbing (§176d), not identity.

--fix rewrites only unambiguously-wrong symbols (every mismatch naming a symbol must imply the SAME
corrected base) and refuses otherwise: 10 of 12 repaired, 2 correctly refused.
2026-08-15 09:46:10 -06:00
Drew T 594a87e173 feat(phase-31): reloc_identity.py — the oracle that disagrees with match_one about SYMBOL IDENTITY (S52)
match_one masks relocations (26-bit jal field, HI16/LO16 immediates), so it verifies instruction
SHAPE and is structurally blind to WHICH symbol each relocation names: a draft calling the wrong
function or touching the wrong global reports a clean MATCH (§174 law 1c; wave K burned 5 gate
attempts on two swapped globals). Until now only the whole-binary gate caught it, and it reports a
hash, not a cause.

But the target .s comment column carries the FINAL LINKED WORD, so the true address behind every
masked field is recoverable arithmetically, and config/symbols*.txt maps it back to a name. This
tool resolves what the DRAFT names, computes what the TARGET references, and compares -- /bin/bash, no
rebuild, and it names the fix instead of reporting a mismatch.

match_one --emit-streams additionally carries mine_relocs (kind/operand per index); existing
consumers read mine/tgt only.

THREE INSTRUMENT BUGS FOUND BY ITS OWN NEGATIVE CONTROLS, each fixed before any verdict was
believed (R35/R39):
- splat-derived func_/D_/jtbl_ names are not in the symbol FILES (their address IS their name), so
  the first run checked ZERO relocations on a draft whose every callee was correct -- a checker
  that looks clean while checking nothing (R32).
- the nearest-symbol fallback used a 0x4000 window and labelled func_8001C9D0 as 'SsGetMute+0xC50';
  a wrong label is worse than none. Tightened to 0x200 with an explicit splat-derived fallback.
- MIPS o32 uses REL relocations: THE ADDEND IS IN THE INSTRUCTION, not the reloc entry. Reading it
  off the operand string reported 0 for every struct-field/array access and fabricated mismatches
  (the +1/+2/+3 signature on func_801F0734 was a byte-array walk, not three symbol errors).
Also refuses to answer confidently when the streams are not index-aligned (shape differs), since a
single inserted instruction shifts every later index -- my own NC produced exactly that phantom.

NC: known-good drafts AGREE (3 and 5 relocs actually checked); a synthetic callee 4 bytes off is
caught while match_one still says MATCH; a misaligned mutant is downgraded to advisory.
2026-08-15 09:42:58 -06:00
Drew T 02edb37265 fix(phase-31): gate_main conflict check reads the destination TU + is per-file (S52-7)
resolve_conflicts() had two defects, both found by the wave-J/K/L draft recovery:

(a) THE SYMBOL TABLE STARTED EMPTY -- only draft-vs-draft was compared, so a draft contradicting
    a declaration ALREADY IN the .c reached the rebuild and surfaced only as a compile error and
    a bisect. src/800.c carries 'extern void func_8001C9D0(void);' (from banked func_8001C2C4)
    while three wave-J drafts declared it (s32)/(void *). The TU now seeds the table, and the
    drop report names whether the clash is with the TU itself or an earlier draft.
(b) ONE NAMESPACE FOR ALL FILES -- 'seen' was global across the slate, so two drafts landing in
    DIFFERENT .c files could not legally disagree about a symbol. Separate TUs are separate
    namespaces; the table is now keyed per destination file (R39: over-refusal discards good work).

On the 11 recovered drafts the new check named 7 real TU conflicts that the old one missed
entirely. All 7 were repaired by adopting the TU's declaration verbatim and casting at the use
site -- including a NEW variant: when the TU's prototype takes no argument and the call must pass
one, cast through a function pointer, ((void (*)(s32))func_8001C9D0)(a0). All 11 re-verified
MATCH afterwards, so the cast is byte-identical in every case.

R39 NC: a synthetic draft re-contradicting the TU is still dropped; the repaired slate is 11/11.
2026-08-15 09:35:26 -06:00
Drew T fb4c1f03a1 fix(phase-31): wave-selector coverage + gate_lane crash-vs-empty (S52-1, S52-8)
build_wave_atlas.py:
- taken-set was a hardcoded 'abcdefghijkl' wave-letter literal -> glob('.run/wave_*_cards.json')
  (R33 derive, don't re-derive). NC: 634 -> 726 taken, strict superset, +92 cards from waves m/n
  that the literal would have silently re-issued.
- --exclude-bins defaulted to 'main' on the REFUTED link-defect rationale; default now empty and
  the help states the real reason (main cannot be gated incrementally; use tools/gate_main.py).
- new --only-bins allow-list: main waves need it, since gate_main rebuilds once per SLATE.

gate_lane.py: an unhandled gate_stage exception produced no JSON line -> v={} -> '0 banked',
indistinguishable from an honest empty gate (cost 2 cycles in P31). Now a non-zero rc or a missing
JSON line is labelled CRASH with the stderr tail, recorded in the results JSON, listed in the
summary as NEVER GATED, and exits non-zero. R39 NC both directions.
2026-08-15 09:31:10 -06:00
Drew T 093a05ab36 feat(phase-31): gate_main strips duplicate typedefs on substitution (the wave-L loss)
- each draft compiles STANDALONE so it carries its own 'typedef struct {...} SVECTOR;'. Once
  one such function banks, that typedef lives in src/800.c forever and every later draft
  defining its own collides — a C89 duplicate-typedef error, not a byte miss. harvest_verify
  already handles this; gate_main did not, and wave L lost a verified-correct draft to it.
- strip_dup_typedefs() drops typedefs the destination file (or an earlier body in the same
  batch) already defines, and keeps novel ones.
- R39 NC: drops the duplicate, keeps the novel one, leaves the function body untouched, and is
  a strict no-op when there are no duplicates.
2026-08-15 06:32:30 -06:00
Drew T 219fbd7e04 fix(phase-31): gate_main FALSE PASS — sha() read a stale binary when the build failed
- clean_build() ran 'make build' and then sha()'d build/us/SLUS_007.26 off disk. If the build
  FAILED (compile error), the PREVIOUS successful binary was still there, so sha() returned the
  good hash and the tool reported BYTE-IDENTICAL for a build that never ran.
- that is exactly how it claimed '43 banked' for wave K on a TU that did not compile; the
  clean-fleet R22 caught it ([FAIL] main). A verifier that can pass without building is worse
  than no verifier.
- fix: rm the output before building, and treat a non-zero make return as no-hash/never-pass.
- also: unbuffered print (a 16-min run looked hung with an empty log) and read the compile
  error to name the culprit instead of bisecting at a full clean rebuild per step.
2026-08-15 05:10:11 -06:00
Drew T e05f3e3e83 fix(phase-31): gate_main typesig kept only the prefix — u8 D_x and u8 D_x[] compared EQUAL
- gate_main reported wave K BYTE-IDENTICAL; the clean fleet R22 then failed [FAIL] main.
  Three drafts declared D_80078D98 inconsistently (1 scalar, 2 array) and my conflict checker
  could not see the difference: typesig() split on the symbol and kept only the prefix.
- fixed to retain the declarator suffix ('' vs '[]'); NC'd both directions — the wave-K
  conflict is now caught, wave J's known answer (34/5) is unchanged.
- BOTH failure modes now documented in the tool: v1 too STRICT (compared parameter names,
  discarded 2 good drafts), v2 too COARSE (ignored [], passed a real conflict). R22 caught
  what the tool missed, which is exactly why the clean-rebuild rule exists.
- phase log: recorded the night's methodological lesson — every serious stall was an
  instrument trusted without a control, never the compiler.
2026-08-15 04:32:23 -06:00
Drew T c4dd60363d feat(phase-31): tools/gate_main.py — batch clean-rebuild gate for the main EXE
- main CANNOT be gated incrementally: its extract runs the EXE-only psyq_integrate +
  ld_interleave steps that REWRITE the .ld, so gate_lane/gate_stage's incremental build
  re-runs that on an already-rewritten script and yields a FALSE diff (R22's own rationale).
  That cost a night: 4 byte-correct drafts gated 0/4 and I wrote up a nonexistent linker
  defect before the null-draft control refuted it.
- gate_main substitutes the whole batch -> make extract BINARY=main -> make build -> compare
  SHA. ONE clean build verifies the WHOLE batch (34 banked in one rebuild); bisects on failure
  so a single bad draft can't sink the rest.
- handles both main-specific hazards: (1) in-TU cross-draft decl conflicts, resolved greedily
  on TYPE SIGNATURES ONLY (comparing parameter names wrongly discards good drafts, R39 — my
  own first version did exactly that); (2) stale .s after a revert (extract before resolving).
- NC'd against wave J's known answer: 34 compatible / 5 dropped, matching the hand result.
2026-08-15 04:10:37 -06:00
Drew T e64a803609 fix(phase-31): aprop_symfix survives curated (non-hex) symbol names
- deltas[int(new[-8:],16) - int(old[-8:],16)] assumed every symbol is func_XXXXXXXX/D_XXXXXXXX.
  A draft whose target calls a PsyQ symbol by name (Square0, RotMatrixY) raised
  ValueError and aborted the WHOLE audit — in wave F one such callee took down a 55-draft
  batch, and the rename itself (re.subn) had already succeeded.
- a curated pair is a plain 1:1 rename with no address delta: count it as 'named-1:1' and
  carry on (R32 — one unparseable pair must never answer for the batch). Delta print made
  mixed-key safe.
- verified on the literal incident values: old aborts on 'Square0'; new completes, counting
  2 named renames + still bucketing the hex pair by its 0x484c delta
2026-08-15 01:32:34 -06:00
Drew T dde7a35ca3 feat(phase-31): wave D banked 45/48 + main link-blocker diagnosed; selector packs by gate group
- wave D (48 adapt cards): 47/48 standalone, 45 BANKED across two gates (40 + 5 late-repair).
  Operational lesson: build the gate slate AFTER the repair stage lands — the first slate was
  built early and 5 rescued drafts needed a second gate.
- wave C (35: 11 tell + 24 weak): 32 banked, 91% gate. Weak lane proven 24/24 on haiku.
- MAIN BLOCKER DIAGNOSED (the night's most valuable finding): main drafts are byte-correct yet
  gate 0/4. Byte-diff of the built EXE = exactly 2 bytes in 413,696, NOT in the drafted fn: a
  jal at 0x80060E74 retargets func_80061FA8 (game code, 800c2.o) -> firstfile (PsyQ libapi
  A66.o). Adding one C fn perturbs symbol resolution between game code and the LINKED PsyQ
  archives. main is an INTEGRATION wall, not a matching wall -> its own lane; excluded from
  build_wave_atlas by default.
- build_wave_atlas.py now packs by (binary, TU) — the REAL gate-group key, since each group is
  one whole-binary rebuild (wave D: 42 drafts / 23 groups = the throughput ceiling).
- 3 NEARs enqueued as grinder fuel incl. func_80183578 at close=1 DELAY-SLOT (§60a precedent).
2026-08-15 00:32:03 -06:00
Drew T dc23ff3626 fix(phase-31): gate_lane resolves a stub's home .c from corpus (R33) — it was blind to main
- the old glob('src/<binary>/*.c') found nothing for main (sources live at src/*.c), so every
  main draft grouped under src=None: an R36 consumer-blindness, latent because main has never
  been wave-gated (main is 0.5% matched, the largest coherent mass left)
- derive from corpus.stubs()[..].path instead; NC'd 3 ways: still-open wave-C drafts 3/3 agree,
  overlay sample 96/96 agree (no regression), main now resolves None -> src/800.c
- tools/build_wave_atlas.py: wave selection off the frontier atlas, optimized for GATE
  THROUGHPUT (gate cost scales with (binary,TU) groups, not drafts: wave C was 1.3 drafts per
  rebuild; atlas selection concentrates to ~96) and weighted toward instruction mass
2026-08-14 23:47:18 -06:00
Drew T 540d2cefaa feat(phase-31): wave C banked 32 (R22 213/213) + tools/build_wave.py; 3 instrument defects fixed
- wave C: 35 cards (11 tell + 24 weak) -> 35/35 standalone (re-verified independently, R14)
  -> 32 banked / 3 near, 91% gate, 0 symbol failures (Law 4 prevention worked)
- weak lane proven for the first time: 24/24 on haiku; 890 candidates remain
- reach measured: 32 exemplars, 8 with sharers, x2 each => ~1.25x effective (the x134
  era ended in P25/29/30) -> throughput, not leverage, is now the lever
- tools/build_wave.py (pool=adapt|weak, corpus-derived open-stub filter, R35 gate guard)
- 3 self-inflicted instrument defects found+fixed+NC'd (P9, recorded not buried):
  pgrep self-match via shell=True; corpus.stubs() is addr->Stub not names (nearly
  declared both card pools spent); a wave fired on hand-typed placeholder cards (stopped)
- STRATEGIC: card lanes are ~0.23% of open ins/wave; the Atlas's head-crack bucket is
  1,276 groups / 186k ins with high-reach groups up to 265 instances -> retarget waves
  at atlas groups next
2026-08-14 23:44:03 -06:00
Drew T 6cd81173cd feat(phase-31 T9): warmstart feeder + weak-cards — the campaign lanes are armed
- tools/warmstart.py: --from-banked walks a banked exemplar's family's open
  members, builds remapped proven-body drafts (symbol_map + build_draft), and
  STREAM-classifies member-vs-seed with zero compiles; enqueues ONLY permuter-
  shaped work (bucket==permuter or LENGTH-DRIFT |delta|<=2) as backlog records;
  --lenmiss ingests T8's 49-route. Armed live: 59 enqueued, 120 refused by the
  stream filter (the anti-92%-wasted-CPU discipline)
- grinder patch NOT needed: candidates() deliberately keeps unclassified
  records ('unknown is not a reason to skip'), so pre-filtered enqueues flow
  as-is — documented in the feeder docstring (YAGNI honored)
- family_cousins --weak-cards: 954 seeded-crack cards from the never-consumed
  0.70-0.85 band, ins-ranked, §168 laws embedded, model-routed haiku 804 /
  v3 43 / sonnet 86 / opus 21 (cheap tiers dominate), 0 unresolved .s
2026-08-14 19:59:21 -06:00
Drew T 0840eda5bb feat(phase-31 T8): LEN+N lane — 587 near-misses routed; 345 wrong-drafts reclassified; detectors live
- match_one --emit-streams (additive; stdout-identity NC'd): word streams for the
  len lane
- family_align.addr_true_rel: reloc-vs-constant range discriminator — FULL
  conservative set kept for pair semantics (NC-1 157/157 regression), address-
  true subset for indel eligibility only (a constant li-cluster must not read as
  reloc-in-indel); synthetic probes green both directions
- tools/len_tells.py: aligned classification + §172b tell tagging (EXTPAIR/
  SELECT/NOP) on target-side indels; detectors imported from atlas_features
  (R33); cookbook text embedded in cards
- tools/lenmiss_route.py: pool-parallel (A8) — 587 audit LEN rows re-verified
  live + routed in 24s: redraft 345 (frac>0.35, APPEND-ONLY backlog
  reclassification — near-miss metrics stop lying) / permuter-length 49 (grinder
  fuel) / cards 192 incl 14 tell-tagged (the audit's own detectors had emitted
  ZERO) / mechanical 0 — an HONEST NULL: stored drafts rarely get constants
  wrong; LEN drift is shape, family_align's value here is classifier/detector
- R32 accounting 587/587
2026-08-14 19:54:57 -06:00
Drew T 682d0fa1fd feat(phase-31 T7): family_align — aligned classifier + imm engine, NC'd; mechanical-cousin lane refuted by probe
- tools/family_align.py (NEW module — classify_member's return contract untouched,
  the remap_hseq silent-pass trap avoided by design): SequenceMatcher alignment
  over FC.tok streams; li-cluster reconstructor (lui/lui+addiu/lui+ori/li-from-$0
  chains, split-cluster absorb for the rs-changed addiu partner); verdicts
  LEN-LI/LEN-NOP/LEN-JTBL/LEN-STRUCT/STRUCT-ALIGNED/PURE/IMM; aligned imm engine
  mirroring imm_map_tier1 (ordinal deliberately out in v1)
- NC-1 verdict-equivalence 157/157 banked pairs — the NC caught two real gaps:
  R-type non-shift sa diffs are STRUCT; registers tested BEFORE the reloc skip
  (a reloc-slot word with a different register is STRUCT). NC-2 parity 21/21
- R37 PROBE REFUTED the planned mechanical driver before it was built: 0/26
  LI-ONLY cards classify mechanically (regfields x19) — cousins are 0.85-similar
  DIFFERENT functions; §168 law 1 re-derived by measurement; no driver written
- family_align re-scoped: its consumer is T8's LEN+N near-miss pile (draft vs
  its OWN target = same function); reloc-vs-constant range discriminator parked
  for T8. decision-log entry (R31)
2026-08-14 19:49:22 -06:00
Drew T 1a8cda6c54 feat(phase-31 T6): PLUMBING campaign — +9 banked (64% probe); recipe + 3 laws (§173)
- tools/plumbing_groups.py: derives the honest still-open pool from the classified
  ledgers (R38) — '1,217 PLUMBING' collapsed to 237 (SELF 109 / CALLEE 48 / OTHER
  48 / DATA 32)
- recover_integration: PER-GROUP ISOLATION (git-checkout binary TUs between groups
  — one TU-stage edit was poisoning every other group's whole-binary gate with a
  phantom shared error; per-group banked_from_source capture) + new stages
  'macro-externs' (§121 draft-tier, via family_sweep.macro_def_sig_map, R33) and
  'tu-scope' (§103 STU binary-tier, the sweep-only lever)
- the probe (ov_SC03_107): raw 0/14 -> root-caused (poisoning + stale seed
  symbols; rtu_match MATCHes them — blind to reloc names, R34) -> symfix-first
  -> 9/14 BANKED (64%)
- sweep finding (Law 3): the no-draft majority (ov_SC02_037 44/44, most of
  ov_MAIN_012) had verdicts from transient sweep remaps never persisted — family-
  lane fuel, not recovery fuel; the stored-draft class is consumed
- cookbook §173 (symfix-first / per-group isolation / verdicts-without-drafts);
  index 518 green; R22 clean fleet 213/213; phase total 17 banked @ 0 agent tokens
2026-08-14 19:42:55 -06:00
Drew T e18738c48e feat(phase-31 T5): THE FRONTIER ATLAS — 5,139 lever-labeled crack groups over all 12,058 open fns
- tools/atlas.py: cousin units baseline + T1.5 h_seqn merges + CALIBRATED warm
  tier (measured: li-norm metric holds ~99% recall to 0.55; rule = smallest t
  with neg-accept<=0.2% AND recall>=95% -> THRESH_WARM=0.70 @ 99.1%/0.18% —
  false merges waste exemplar cracks, misses only route cheaper) + seed sweep
  (65% of open skeletons carry a >=0.55 matched seed) + kNN graph + tiny-direct
  + evidence joins (audit/backlog/ledgers/cards; unparsable=fatal) + lever
  labels with confidence measured>ledger>tell>default>UNKNOWN
- partition ASSERTED: 12,058 = progress stubs 12,051 + NM 7 EXACTLY (chased the
  +1: data blobs now excluded, reconciled against classify() buckets; T1 banks
  confirmed absent); every instance in exactly one group; main joins at the
  atlas layer only (family maps stay non-main — 4 silent-skip hazards)
- warm tier merged 1,019; top group unifies 268 drifted per-location skeletons
- lever table: head-crack 186.9k ins / UNKNOWN 138.6k (honest) / extend-tell
  76.7k / redraft 46.8k / jtbl-carve 45.7k / integration 23.4k / seeded 23.4k /
  len-vein 16.8k / swaprepeat 9.2k / plumbing 8.1k / o0 6.6k / cc1 6.4k
- atlas_features: li_norm_toks exported (shared with atlas, R33; hash-stable);
  mid_jr verifier fixed (compared ZERO rows — R32 silent no-op; now 6,444/6,444)
- make atlas = full regen chain (~10-15 min, zero tokens); --targets emits
  crack slates (12/12 .s resolved); survey 92 s
- SETUP rows (R21); docs/frontier-atlas.md committed
2026-08-14 18:06:46 -06:00
Drew T 636809714d feat(phase-31 T4): atlas_features.py — per-fn feature layer for the Frontier Atlas
- one deterministic feature record per function across all 213 registry binaries:
  memoized per distinct h_exact (.run/feat_memo.json, 92,855 bodies), fanned out
  1:1 with sigs to .run/feat.<bin>.jsonl (363,525 rows) in 21s
- features: nins/band, o0 prologue tell, frame/saves/fp, CFG skeleton (branch-scan;
  jal=call never edge — position-independent, argued in docstring), mid_jr/jalr,
  stable-call-seq hash (fixed main+resident ranges), reloc-kind-seq hash, 16-bucket
  ophist, §172b tells as SHARED importable detectors (extpair/dupselect/sign_mix/
  magic_div — len_tells will import, R33), li-normalized skeleton h_seqn
- verifies: R32 (addr,h_exact) join per binary; determinism 0/200; mid_jr vs
  family_hseq independent oracle 6,444/6,444 exemplars agree (verifier's first
  draft compared ZERO rows — string/int addr mismatch, R32 silent-no-op class,
  fixed + fails loud on compared==0)
- o0 cross-check finding: 94 open fns carry the -O0 prologue inside -O2 TUs —
  §116-class carve candidates (campaign fuel)
2026-08-14 17:54:18 -06:00
Drew T 22eed7d78a feat(phase-31 T3): main enablement — sig-main at splat-true lengths + main streams
- sig_image: --seeds accepts '0xADDR NINS' (and jsonl nins); a seeded nins is
  authoritative ([addr, addr+4*nins), bypasses func_end whose heuristic mis-sliced
  3/40 main samples); R32 guard on seeded end > hi
- corpus: s_ins_count() factored from audit() (R33, one counter) + '--seed-ends'
  CLI emitting per-stub splat-true lengths
- make sig-main: 2,002 main stubs signed -> .run/sig.main.jsonl; FULL word
  cross-check 2,002/2,002 EXE slices == .s words (0 SLICE-SUSPECT; .s word field
  is byte-order hex, not LE — first checker draft misread 1,999 false suspects).
  Deliberately splat-SEEDED; main's independent second oracle stays deferred
  (second-oracle.md; sig_is_independent(main) stays False)
- family_remap: vram_of/img_path special-case 'main' derived from splat.us.exe.yaml
  (file0-vram = code-seg vram - start = 0x8000F800; target_path); stream_words
  ('main') verified 25/25 vs .s
- regression: sig-resident re-run byte-identical after the shared read_seeds change
- SETUP §6.3 rows (R21)
2026-08-14 17:48:51 -06:00
Drew T 2a0ac5ab8d feat(phase-31 T1): integration quick-bank sweep — 8 banked, 0 agent tokens; symfix STALE-DELTA
- aprop_symfix: STALE-DELTA class — the S50 1:1 stale-seed-symbol rule generalized
  to n:n (sorted-by-address zip, ONE uniform target-draft delta required; refuses
  count mismatch / non-addressed names / disagreeing deltas). R39 negative controls
  (synthetic + S50-snapshot equality over still-stub rows, zero false positives);
  first live batch 4 rebased -> 4/4 BANKED (func_8016BCC0, func_8017F1C8,
  func_80186BD8, func_80186BF8). The delta test refused func_80186C1C whose deltas
  differ by 4 — a hand-check had wrongly accepted it. cookbook §171-D
- recover_integration demacroize (SELF-decl class): 4/7 banked (func_80139BE0,
  func_8014ED28, func_80161D88, func_801659DC)
- R38-first partition of the MATCH-108 pile: 75 still-stub = 13 never-gated +
  62 verdictted (31 PLUMBING = 7 SELF + 15 CALLEE->T6 + 3 UNDEF-DATA + 6 OTHER;
  14 CC1->T6; 8 md CARVE-REFUSED->ledger; 1 DIFF); immfix pile fully consumed
- stored-draft re-gates 0/23 (the ~8% A10 law held); 9 STALE->clean world-motion
  drafts identified (siblings' banks defined their missing symbols)
- gate_lane: propagate-commit tag derives from GATE_PHASE (was hardcoded)
- R22 clean fleet: extract-all 212/212 + main; check-all 213/213 BYTE-IDENTICAL
2026-08-14 17:40:38 -06:00
Drew T d6ade08f3a feat(phase-31 T0): pivot log + instrument freshness + hygiene
- decision-log: the P31 re-charter entry (organize-before-grind; R37/R38/R39
  ratified at gate-1) per R31
- harvest_verify.py: import guard — a bare import now RAISES loud instead of
  running a full gate (CLI unchanged, verified both directions)
- sig-resident: bootstrap boundary artifacts fixed (fused +0 data word with
  func_800CEDFC; func_800D33E0 dropped past a glued tail) -> ELF-seeded per the
  S45 pattern, exactly 145 fns; true denominator confirmed 145 (progress was
  right); audit-corpus 0 PHANTOM + 0 TRUNCATED; all three oracles agree
- family maps regenerated at HEAD commit:2161: 11,025 open non-main members
  reconciles EXACTLY with 12,059 - main 1,034 (102 stale phantoms cleared);
  adapt cards 704, aprop cards 204 (full emission)
- main fuel-gap finding: 2,001/2,002 main stubs already have cached Ghidra-C
  (only func_80049600 missing) — the roadmap '0/2,096' note was stale
- tools-health OK (dedup 2,063/0; C1 254,521/254,521; audit-digest green)
2026-08-14 16:40:43 -06:00
Drew T d242877065 feat(phase-30 S50): func_8017C294 frame residual decoded to the instruction level (§172) — crack REFUTED across the reachable space, wall documented
- tools/cc1_dumps.sh: run the pinned cc1 with -dr/-ds/-dj/-dc/-dl/-dg and count standalone
  (use (reg)) insns in the .combine dump — each is one 8-byte never-referenced reload slot.
  The NEAR-2 residual = 12 such orphans vs the target's 16, now ENUMERATED pseudo-by-pseudo
  instead of inferred from ablations.
- The orphan mechanism, exact (combine.c:10835 + mips.md force_not_mem): every short-mem read
  is a movhi+shift-pair triple; the fold orphans its ashift temp iff the HI reg carries an
  extra HImode use and the death-note walk hits a label/jump. Single-use loads never orphan;
  the head can never orphan (walk reaches insn 0).
- The zero-code +4 factory is byte-refuted: 18 new probe families x 3 placements (s16
  respellings, cast truncations, <<16>>16 factories, placement sweeps, loop t/n, dossier-file
  re-sweep) all land at vars=224-same-bytes or drift. p_optr reproduces the target's exact
  16-orphan frame at +7 insns — opacity that defeats cse equally blinds num_sign_bit_copies;
  fold-const closes the tree level. Three canonicalizers, one wall.
- Dossier NOTES.md updated with the S50 ledger; backlog klass -> WALL(P32) for both names.
- NOT banked: no 0-closeness draft exists. The dial draft (NEAR 2) remains the floor.
2026-08-14 12:08:50 -06:00
Drew T e7d61e823d feat(phase-30 S50): bank the top-reach families 0x801F1CD8 (41/41) and 0x8017D290 (9/9)
Three carries a mechanical seed-body draft needs beyond the symbol rebase (cookbook §171b),
each found from one compiler verdict:

- DATA DEFINED INSIDE THE MEMBER'S OWN .s must be DEFINED, not externed — it vanishes with
  the stub it lives in. Re-initialised with THIS member's bytes (the 0x801F1CD8 family carries
  4 distinct 8-byte patterns across 42 members). Flat-byte-list initializers only; refuse the
  rest rather than mis-initialise something the gate would reject unexplainably.
- SHARED TYPES the destination cannot see: MATRIX/SVECTOR live in engine_types.h, which md_*
  TUs never include. `parse error before 'm1'` was the only thing between 4 of 9 members and a
  bank. Carried brace-matched, vetoed by the destination.
- A POSITIONAL LITERAL MAP where imm_map_tier1 gives up: it refuses a value that also appears
  at a non-differing slot (0x10 collides with the struct offsets), but the 8 differing slots
  map 1:1 onto the C's call sites in order. Asserted ([C literals] == [seed slot values])
  before substituting — that assert is the whole safety argument. 10/10 refused -> 9/9 banked.

- ROOT-CAUSE FIX: body_text matched `extern void func_X(...);` at column 0 and returned the
  NEXT function's body — silently shipping wrong seed bodies, visible only as "no definition
  after rename" skips. A definition is now confirmed by a `{` with no `;` before it.

R22 clean rebuild: check-all 213 passed, 0 failed of 213. Stubs 12,161 -> 12,111.
Fleet 95.3% instr / 90.0% distinct / 96.66% fn-count.
2026-08-14 11:23:26 -06:00
Drew T e903713b71 feat(phase-30 S50): the mechanical A-prop draft — 256 members banked with no agent in the loop
Final S50 state: 307 instances banked, stubs 12,468 -> 12,161, fleet 95.3% instr / 90.0%
distinct / 96.65% fn-count. R22 clean rebuild 4x, check-all 213/213 every time.

- tools/aprop_autodraft.py + tools/draft_prechecks.py: seed body + symbol_map + a MINIMAL
  synthesized preamble. The seed's decl layer never travels — that layer is family_sweep's
  dominant failure (331 of 458 S49 verdicts). 256 banked at zero agent tokens, against the
  ~20M the same work would have cost as a wave.
- Macro seeds (567 of 1196 members, all 3737 de-macroize) take the DEFINITION only; the block
  stays the decl source. Pasting it whole measured 28% vs inline's 68% — func_8016AB6C's macro
  is 1,891 lines of which 108 are the function.
- IMM is a second engine, not a wall: T2a's imm_map_tier1 resolves a per-location LITERAL like
  symbol_map resolves a per-location SYMBOL. 131 of 275 IMM members resolve.
- draft_prechecks negative-controlled against ALL 205 banked drafts: zero false positives,
  catches 39 of 67 known failures. That control found two bugs in the checks themselves —
  C89 `f()` declares UNSPECIFIED parameters (not zero), and a member's own definition read as
  a call to itself. Conservative by design: a pre-check that discards good drafts is worse
  than one that lets a few builds fail.
- The A-prop pool is now priced exactly: PURE 437/37,376 ins, IMM 275/8,849, STRUCT 238/4,259.
- Cookbook §171a; SETUP rows; CURRENT_PHASE S50 FINAL checkpoint.
2026-08-14 07:42:19 -06:00
Drew T 9a3e438ed9 fix(phase-30 S50): macro seeds carry only the DEFINITION, not the macro's decl layer
Measured on the 489-draft run: inline seeds banked 145/213 (68%), macro seeds 77/276 (28%),
and the macro failures were decl collisions to a fault — 'parse error before *', 'too few
arguments to function'. Cause: a de-macroized DEFINE_ block is decls + definition, and
pasting it wholesale reintroduces the exact decl-agreement failure the minimal-preamble
design exists to avoid. func_8016AB6C's block is 1,891 lines of which 108 are the function.

- seed_body() now returns the DEFINITION as the body and keeps the macro block as the DECL
  SOURCE, so only the externs the definition actually references are emitted.
- aprop_symfix.body_in_text(): text-based sibling of body_text (R33 — one implementation).
  Indented-definition fallback for macro blocks, confirmed by a '{' with no ';' before it,
  so an indented CALL can never be mistaken for a definition.
2026-08-14 05:28:40 -06:00
Drew T f3c509f7e1 feat(phase-30 S50): aprop_autodraft — mechanical A-prop drafts at zero token cost (§171a)
A lane-A member's body IS its matched sibling's body with the per-location symbols rebased.
Two mechanisms had each left that population on the table: family_sweep remaps but CARRIES
the seed's decl layer (decl-agreement = 331 of 458 S49 failures), and the agent wave
re-derives the same body at ~80k tok/fn. This does neither — seed body + symbol_map
(positional reloc zip) + a minimal synthesized preamble.

- Byte-proven before the tool existed: a hand-written draft of exactly this shape banked
  func_801E2858@md_SC03_132, in a family the mechanical sweep had refused. Then 9/9 banked
  on the first generated batch.
- THE SELECTOR, measured: only PURE members (every diff site a RELOC) are drafted. An IMM
  (per-location literal) or STRUCT (register/opcode drift) site cannot be reached by a
  rename — the first 5 gated 0/5, all IMM or STRUCT. classify_member now decides that
  BEFORE a build is spent, not after. --allow-impure to override.
- Macro seeds supported: DEFINE_<fn>() de-macroizes back to a plain self-contained block
  (3737/3737 extract). They were the largest skip bucket — 567 of 1196 members.
- 592 drafts emitted (304 macro / 288 inline) from 1196 members; every skip is named (R32).
- aprop_symfix: asm_syms_ordered() so an n:m card hands over the target's reference ORDER.
- Two defects caught by probes before they scaled: a typedef regex that stopped at the `;`
  INSIDE the struct braces, and a continuation walk that started on the empty pre-newline
  element and returned an empty body.
2026-08-14 00:50:55 -06:00
Drew T 895bb6a239 feat(phase-30 S50): clear the func_801EDC18 carry blocker — 4/4 banked, and re-priced
- The blocker was carried as "one missing file-scope extern gates 83 PURE members". Both
  halves were wrong (R14): corpus.stubs says 4 open members, and D_801ED98C is a DEFINED
  const Blk8 whose rodata lives inside the member's own nonmatchings .s — replacing the stub
  deletes the data with it. gather_externs can carry an extern DECL, never a DEFINITION,
  which is why it reported "no file-scope decl" for a symbol md_SC05_023 defines on line 114.
- Fix: paste typedef + const definition + body per sibling (data bytes verified identical
  across md_SC05_024/025/028/029). 4/4 banked.
- aprop_symfix: new `local-only` class — draft-DEFINED identifiers that merely carry a
  vram-looking suffix (Blk8_…, S8_…, L_call_…) are not stale symbols. Measured: that is every
  non-clean case in the whole wave-7a/7b stored-draft residue, which holds ZERO stale-symbol
  recoveries (a clean negative result — the defect was A-prop-specific).
- cookbook index regenerated (tools-health fails closed on a stale index — it caught §171).
- R22 clean rebuild: check-all 213 passed, 0 failed of 213. Stubs 12,445 -> 12,441.
2026-08-14 00:23:32 -06:00
Drew T 2f7e06564b feat(phase-30 S50): the stale seed symbol — A-prop's 57% was ours, not the lane's (§171)
- REFUTES §170's open hypothesis (batched cards concentrate members into one TU ⇒ §169
  collision): 5-draft groups banked 5/5; 11 of 35 unbanked drafts were already one-per-TU;
  and the two "concentrated" groups banked 12/12 and 10/10 once the real defect was fixed.
- The cause: a per-location data symbol carried out of the seed body unrebased. match_one
  compares instruction ENCODINGS and is blind to a relocation's target NAME, so it scores
  MATCH standalone and dies at link in the host TU. 24 of 24 concentrated failures, all 1:1
  rewritable at one constant vram delta (0x4128).
- tools/aprop_symfix.py: audit + --fix, emits a gate_lane-shaped slate; deterministic and
  build-free, so it runs BEFORE the gate. The R34 second oracle for the class match_one
  cannot see.
- family_cousins.py --aprop-cards: members now carry sym_map, the explicit {seed -> member}
  renames, read from the seed's C BODY (a matched seed has no .s of its own) vs the member's
  .s. Two case-mismatch defects fixed while wiring it (sig lowercase vs splat uppercase).
- 23/24 banked. Stubs 12,468 -> 12,445. Fleet 95.2% instr / 89.9% distinct / 96.57% fn.
  R22 clean rebuild: check-all 213 passed, 0 failed of 213. dedup 2,043/0.
- A-prop's true conversion is 87% (79/91); the 320 batched members are unblocked.
- Cookbook §171 + §170 struck in place; SETUP row; decision-log (R31).
2026-08-13 23:41:36 -06:00
Drew T 0189445b9a chore(phase-30 S49): FINAL session checkpoint — 177 banked, 95.2% instr, R22 213/213
- checkpoint block refreshed for a fresh session (R30/checkpoint-before-pause): the TU-spread
  test is the named FIRST action, the regen chain and gate contract are spelled out, and the
  >=16 head's three open items are listed with their evidence.
- promote gate_lane.py into tools/ (it was scratchpad-only): accepts slate OR confirmed shapes,
  explicit draft paths, R32 coverage assertion (refuses to report 0 as a result), dirty-tree
  abort, no outer timeout, per-function propagation after.
- session: 179 commits, 177 instances banked, 5 R22 clean-fleet gates all 213/213.
2026-08-13 17:58:26 -06:00
Drew T bcc3130eb4 feat(phase-30 S49): the A-prop word-diff card + aprop_wave — 56 banked from the >=16 head (§170)
- NEW family_cousins.py --aprop-cards + tools/wave/aprop_wave.js: lane A (1,700 open fns /
  76,419 ins) had NO card type — cousin diffs are empty for h_seq-identical members, so the card
  is a positional WORD diff vs the matched sibling, grouped BY FAMILY (one agent, N drafts).
  Head cards: 13 families / 433 members, median TWO differing words each.
- calibration 9 batches / 108 members: 98 agent-MATCH (91%, best of any wave) -> 56 BANKED (57%),
  ~80k tok/banked fn vs 157k (cousin card) vs 400k+ (crack wave). R22 213/213 BYTE-IDENTICAL.
- HONEST GAP (R14): 91% agent -> 57% gate is the worst conversion measured; 14 groups banked 0.
  Hypothesis TESTABLE not proven — family batching concentrates members per destination TU, the
  §169 collision. Re-gate unbanked ONE PER TU before scaling the remaining 320.
- >=16 head diagnosed: 3 of 4 blockers are plumbing — the --band substantial default hid 5 of 13
  families from every prior sweep; one missing file-scope extern (D_801ED98C) gates 56 PURE
  members; dedup_extend is macro-only. Only func_8017C294 is a genuine crack.
- fleet 96.56% fn / 95.2% instr / 89.9% distinct; stubs 12,535 -> 12,468; dedup 2,043/0.
- cookbook §170.
2026-08-13 17:44:20 -06:00
Drew T 79b7ff2cbf chore(phase-30 S49): wave 7b — adapt lane scaled, 44 banked (92% MATCH->bank); the TU-spread law
- thresholds relaxed to <=6 blocks/<=16 tokens UNION edit-fraction <=0.20: cards 518 -> 721,
  MIXED 310 -> 50 skeletons; the 753-ins func_8017BEBC (0.987 sim) became reachable.
- 59 cards -> 48 agent-MATCH (81%) -> 44 BANKED (92% MATCH->bank, 75% end-to-end), 6.9M tok.
- FINDING (the actionable one): 7b's bank rate crushed 7a's because it SPREAD 48 drafts over 35
  destination TUs; 7a's failures were per-TU declaration collisions between sibling drafts.
  Cookbook §169 updated with the spread law.
- R22 213/213 BYTE-IDENTICAL from clean; fleet 96.55% fn / 95.2% instr / 89.9% distinct;
  stubs 12,584 -> 12,535; dedup 2,035/0.
- incidents 3 & 4 recorded: an agent wrote a TRACKED header (guard caught it, prose is not
  enforcement); my own gate_lane filtered on the wrong key and printed 'gating 0 drafts' as a
  result (R32 silent skip) — fixed with a coverage assertion that refuses to report 0.
2026-08-13 11:50:04 -06:00
Drew T 432fdf681f fix(phase-30 S49): adapt cards — hex-case-robust .s resolver (R35)
sig_image emits lowercase func_<hex> names; splat writes the .s with UPPERCASE hex, so
corpus.asm_path returned None for every address containing a hex letter — 60% of the cards
would have shipped agents a 'null/func_x.s' path. resolve_asm() tries the sig spelling
(authoritative for CURATED names), then both hex cases; a card with no resolvable .s is
now DROPPED, not emitted (R32). 518 cards, 0 bad paths.
2026-08-12 22:07:32 -06:00
Drew T dcba5d0f4f feat(phase-30 S49): the micro-adapt lane — adapt cards + adapt_wave.js (wave 7a)
- family_cousins.py --adapt-cards: per seeded-unit member, drift classified vs the seed
  (LI-ONLY 27 / SMALL-EDIT 491 / MIXED 310 excluded); cards carry the seed C location + the
  aligned diff blocks with the member's raw words + disasm (the new constant is readable in
  the card). 518 cards / 1,101 instances / 23,820 ins; 514 haiku-band.
- tools/wave/adapt_wave.js: the EDIT-contract wave (crack_wave contracts preserved: per-agent
  dirs, sha1-last, UNVERIFIED != refuted); symbol surface from the TARGET .s; haiku<=60/sonnet.
- regen chain absorbed the 48 lane-A banks (A-prop open ins -6,475 == the report's instr
  delta exactly — two independent derivations agree); pilot slate .run/wave7a_pilot.json (30).
- R37: pilot before scaling to the 518-card pool.
2026-08-12 22:03:04 -06:00
Drew T b3713cc3ca feat(phase-30 S49): the cousin tier — family_cousins.py similarity map + seeded wave-7 slate (§168)
- FINDING (Drew's smell, byte-verified): the '4,513 unique singletons' picture is substantially
  an h_seq exact-hash artifact — 86/120 near-pairs in the 0.85-0.99 band differ by PURE
  insertion/deletion (li-expansion tell in 25). Specimen: ov_SC06_010:0x8017bebc (753 ins,
  'singleton') is 0.987-similar to a MATCHED fn in the same binary.
- NEW tools/family_cousins.py: distinct open skeletons -> shingle index -> >=0.85 union-find ->
  matched-seed attachment -> .run/family_cousins.json + docs/family-cousins.md. R32 BOTH ways
  (independent stub recount fails loud on a stale map — negative-control-proven; partition
  assert). Reproduced the probe within +-1%; totals EXACT (11,627 inst / 584,448 ins).
- Unit table: A-prop 197u/68,729ins · seeded 418u/50,422 · cousin-multi 1,552u/249,799 ·
  cold 3,240u/215,498 — the genuinely-unique tail is 37% of the remainder, not 90%.
  Main's 'structurally barren' HOLDS at the similarity tier (94% mass <0.70).
- --targets wave slate: .run/wave7_targets.json = 40 targets / 33,304 unit ins (+33% vs
  family-ranked), 9 resolved seed C paths, size-routed 2 haiku/20 sonnet/18 opus.
- LAWS (§168): a cousin is a SEEDED CRACK never a remap; rank waves by UNIT weight; discount
  short-fn similarity. Byte-gate stays the sole arbiter (G3/P9).
- docs/family-hseq.md: this session's frontier regen (post-S48 propagations) rides along.
- cookbook §168 + SETUP inventory row (R16/R21/R30); CURRENT_PHASE S49 entry.
2026-08-12 20:53:40 -06:00
Drew T 80f3ee7397 fix(phase-30 S48): §166 — the destination-TU oracle, and stop printing a guess as a finding
gate_stage labelled every "standalone MATCH / whole-binary DIFF" with
"(declaration/TU plumbing)". The tool never checked for a declaration conflict —
that was a GUESS printed as a diagnosis, and func_8017F2D4 carried it through
SEVEN attempts across five waves while every agent hunted codegen. The body was
byte-correct from the first attempt; the notes had simply named the wrong
destination TU (a file holding only a caller + prototype), and splicing there is
a no-op that leaves the INCLUDE_ASM bytes in place.

- gate_stage now says only what is true (the two oracles disagree) and hands
  over the check that resolves it, instead of naming a cause it did not measure.
- §166a banks the oracle: asm/<ov>/nonmatchings/<TU_stem>/<fn>.s => the
  INCLUDE_ASM is in src/<ov>/<TU_stem>.c. The third path component IS the TU
  stem, derived from the split config, and it beats any prose citation — a grep
  for the function name also hits callers and prototypes in OTHER TUs and reads
  exactly like a destination hit.
- Plus the two probe gotchas that cost wave-5/6 agents real time: the wrong
  --aspsx-version fakes ~32 ori-vs-addiu mismatches, and a collateral-drift
  check must filter to sized symbols (nm -S) or the zero-size .NON_MATCHING
  aliases all report false drift.

cookbook_index.py: 506 sections.
2026-08-12 18:14:21 -06:00
Drew T 4162c32d6e fix(phase-30 S48): unescaped backtick in the wave prompt (2nd occurrence) + a guard note
A markdown backtick inside the prompt's template literal terminates the string
and the workflow dies at parse time. Cheap (0 agents, 0 tokens) but it has now
cost two launches, so the file carries a warning at the top: use double quotes
for inline code in prompt prose.
2026-08-12 16:46:51 -06:00