2026-04-21 16:15:05 +01:00
# Repixelizer Implementation Plan
2026-04-24 00:03:05 +01:00
## Current machine
2026-04-23 17:54:46 +01:00
2026-04-24 03:20:47 +01:00
Repixelizer now has one live reconstruction engine:
2026-04-23 23:09:35 +01:00
2026-04-24 00:03:05 +01:00
- `phase-field` : the default optimizer in `src/repixelizer/phase_field.py`
2026-04-23 23:09:35 +01:00
2026-04-24 00:03:05 +01:00
The live pipeline is:
2026-04-23 23:09:35 +01:00
2026-04-24 03:20:47 +01:00
`source image -> lattice inference -> edge analysis -> phase-field reconstruction -> cleanup -> optional palette fit -> diagnostics`
2026-04-23 23:09:35 +01:00
2026-04-24 00:03:05 +01:00
## What is working
2026-04-23 23:09:35 +01:00
2026-04-24 00:03:05 +01:00
- lattice size and phase inference are still shared and still CUDA-capable
- `phase-field` is now the main optimizer path and produces the best-looking badge result in the repo so far
- compare mode, benchmark mode, diagnostics writing, and tuning all still work after the optimizer cutover
- the repo now reports both:
- `source_fidelity` : agreement with the inferred lattice portrait
- `source_structure` : visible structural agreement at source size
2026-04-23 23:24:28 +01:00
2026-04-24 00:03:05 +01:00
That second metric exists because the first one was happily slandering the better-looking output.
2026-04-23 23:24:28 +01:00
2026-04-24 00:03:05 +01:00
## Current evidence
2026-04-23 23:24:28 +01:00
2026-04-24 00:03:05 +01:00
### Phase-field
2026-04-23 23:24:28 +01:00
2026-04-24 00:03:05 +01:00
Pinned badge case:
2026-04-23 23:24:28 +01:00
2026-04-24 00:03:05 +01:00
- fixture: `tests/fixtures/real/ai-badge-cleaned.png`
- lattice: `126x126`
- phase: `(0.0, -0.2)`
- steps: `48`
2026-04-23 23:09:35 +01:00
2026-04-24 00:03:05 +01:00
Useful artifacts:
2026-04-23 23:31:58 +01:00
2026-04-24 00:03:05 +01:00
- first pinned badge run: `artifacts/phase-field-v1-badge-126/`
- tip-focused follow-up: `artifacts/phase-field-v2-badge-126/`
- structure-metric sanity check: `artifacts/phase-field-metric-check/`
2026-04-23 23:31:58 +01:00
2026-04-24 00:03:05 +01:00
What we know:
2026-04-23 23:45:52 +01:00
2026-04-24 00:03:05 +01:00
- the output preserves the important badge structure better than the deleted optimizer did
- the tracked blemish is now narrow and specific: the sword-tip stroke widens too much in one local region
- the tracked focus fixture is `tests/fixtures/real/ai-badge-tip-focus.json`
2026-04-23 23:45:52 +01:00
2026-04-24 00:03:05 +01:00
## Maps
2026-04-21 16:15:05 +01:00
2026-04-24 03:20:47 +01:00
The repo now keeps the living map:
2026-04-24 00:03:05 +01:00
- `docs/lean-optimizer-algorithm-map.md`
2026-04-24 03:20:47 +01:00
If a future pass cannot be explained cleanly against that map, it should not land.
2026-04-24 00:03:05 +01:00
## Current priorities
### 1. Fix the phase-field sword-tip blemish
Goal:
- keep the current structural win
- stop widening the dark contour near the tapered sword tip
Current hypothesis:
- scalar weight nudges are not enough
- the field needs better anisotropic behavior near sharp tapered contours
- it likely needs to distinguish motion along a stroke from motion across a stroke
2026-04-24 00:13:48 +01:00
What we just learned:
- the later `d9fa411` phase-field tuning pass was a real regression, not paranoia
- that pass strengthened the local edge penalty, added a spacing loss plus upper-spacing clamp, and made edge gating more aggressive
- on the pinned badge case, it removed internal linework and changed `2433 / 15876` output cells relative to the original good `phase-field` run
- reverting that tuning pass restores the original good badge result exactly; the fresh fixed run under `artifacts/phase-field-regression-fix-badge-126/` is byte-identical to the original `artifacts/phase-field-v1-recheck-badge-126/`
2026-04-24 00:03:05 +01:00
Tracked fixture:
- `tests/fixtures/real/ai-badge-tip-focus.json`
### 2. Keep phase-field honest
Rules:
- do not reintroduce portrait layers, candidate trays, or solver-stage religions
- if a new term lands, it must belong cleanly in the one-field objective
- if a result looks better and the metrics disagree, fix the metrics rather than worshipping them
## Guardrails
- prefer one clear hypothesis per pass
- show the output after every real reconstruction run
- keep the maps updated
- revert or delete machinery that does not visibly earn its keep
This repo already spent enough time as a Jenga tower of maybe-useful cleverness. The machine has to deserve every part.