fix(render): glyph surgery so Spleen 5x8 K no longer reads as H (#127)

* fix(render): glyph surgery so Spleen 5x8 K no longer reads as H

The stock Spleen K was H with one crossbar pixel removed (Hamming 1), the
worst confusable pair in the atlas. Because the API downscales images and the
model infers rather than scans, that difference vanishes and K is silently
misread as H - with no signal of uncertainty.

gen-atlas.ts now repaints K with a diagonal-legged bitmap: Hamming 8 from H,
and >=6 from every other ASCII glyph. Scoped to the narrow Spleen 5x8 primary
cell, so the JetBrains-Mono and CJK-fallback atlases are untouched. Zero
token-cost change - the glyph occupies the same 5x8 box.

Guarded by a regression test asserting no alphanumeric pair sits below
Hamming 2. Reproduce with: npx tsx eval/glyph-matrix/demo-glyph.mts

Closes the "optional glyph surgery" item in the 2026-07-01 legibility audit.
This commit is contained in:
dhruvraajeev
2026-07-20 23:31:24 -05:00
committed by GitHub
parent 5e324fba09
commit 41f2ed1d39
8 changed files with 224 additions and 13 deletions
+9 -2
View File
@@ -101,8 +101,15 @@ converts a coin-flip-per-glyph read into a 100% text quote, at ~5% of source cha
model-callable "rehydrate this region as text" tool is the real answer for
**dense** exact-recall (code files, large tables) that no fixed-size sidecar can
hold. This is the "put a glass over it" mechanism, and it's half-built.
5. **Optional — glyph surgery** on `H~K` (d=1 defect) and case-contrast for the S/s
class. Zero token cost, bounded upside; do it in the same eval harness as (3).
5. **Done — glyph surgery on `H~K` (d=1 defect).** `gen-atlas.ts` now repaints
the stock Spleen `K` (which was `H` minus one crossbar pixel) with a
diagonal-legged bitmap; `H~K` is now Hamming 8, and no alphanumeric pair
sits below d=2. Regression-guarded in `tests/render.test.ts`. **Validated at
model level (2026-07-19):** paired `claude-fable-5` A/B on seeded H/K
fixtures — H/K per-char error 47.2% → 18.7%, `K``H` confusions 42 → 1,
McNemar exact p = 2.4e-07, no non-H/K regression (see FINDINGS.md,
"Update (2026-07-19)"). Case-contrast for the S/s class remains open; do it
in the same eval harness as (3).
## Verdict on "is the factsheet the way, or should there be a RAG escape?"