Repository navigation
Description
Add a texture-band measurement that an agent can run across chain segments, so "drift compounds per seam" becomes a number instead of an eyeball judgement.
Source
knoic/ComfyUI-MiniMaxH3-PrefixStream (MIT): engine/texture_diagnostics.py (~35 lines), tools/analyze_texture_drift.py, and the method in docs/DEGRADATION_ANALYSIS_CN.md.
What it measures
For one RGB region: convert to luma and two chroma differences (R−G, B−G), remove a linear lighting gradient, apply a 2D Hann window, FFT, then report the RMS energy in three wavelength bands: 2–8, 8–32 and 32–128 px. Compare the same static region (a flat background, or the same patch of skin in a similar pose) across segments 1, 3, 5... Rising mid-band energy is a candidate sign of the blotches and stripes that build up over continuations.
Their method around it is worth adopting as-is for any drift A/B:
- Branch every arm from one clean first segment, with the same per-segment seed sequence, prompts, references and settings.
- Change one variable at a time. Combine fixes only after each has been shown to work alone.
- Measure decoded frames before any stitch or MP4 encode. If a PNG already shows the artifact, the encoder is not to blame.
Shape it could take here
Either a region + texture_bands option on assess_output, or a mode of compare_outputs that reports per-band ratios between two outputs over the same box. compare_outputs already reads frames and handles video, so the second is probably the smaller change. Output stays a measurement, never a quality score.
Caveats (theirs, and they matter)
- It is not a quality score. Higher mid-band energy can be blotching or real detail. Lower energy in every band can just mean the frame got blurrier.
- Only valid on comparable framing and lighting. A moving camera or a misaligned skin region makes the numbers meaningless, so the agent has to pick a static region, and the guide text has to say so.
- MP4 compression adds its own flat-area texture: measure the same frame before and after encode.
Why now
#1150 (latent-tail continuation) and #1151 (continuation LoRA) both need a drift metric to judge their A/Bs.
Filed by Don, 2026-11-01, from a review of PrefixStream.
Activity
dkackman commentedon Nov 2, 2026
Lead: claude-opus-5-5 (anthropic). Design against
developat 4dd4d21.Verdict: build smaller. One opt-in parameter on
compare_outputs, no new tool, no assess probeAdd
texture_bands=truetocompare_outputs. It reports RMS energy in the 2–8, 8–32 and 32–128 px bands for each output at eachatmoment, over the sharedcropbox, plus each band's ratio to the baseline. It is one build stage of about $4–6. It adds one MCP parameter and oneCompareRequestfield, and no workflow syntax, dependency or download.Cut, and what would bring each back:
region+ bands onassess_output. That would be a fourth name for the crop concept, a second full-resolution decode, and a break in the "exactly three probes" invariant pinned across five test files andARCHITECTURE.md:144. Comes back if agents need bands inside an unattended assess pass (for example a seam rule), shown by a field report.dw/pipeline_processors/chain.py). The issue's rule "measure decoded frames before any encode" can't be followed in dw today, because chains only ever write MP4. Comes back if an A/B under this tool lands on a 2–8 px difference that encoding could explain. That is the band the encoder touches.Sweep (step 2) conclusions
compare_outputsis atdw_mcp/tools_media.py:212-240anddw_mcp/media.py:337-354. It callsPOST /api/gallery/compare(dw/server/routes/media.py:643-664,:697+), which runsdw/media_compare.py. A sharedcrop[x,y,w,h]in source pixels already exists and is the measured box (check_request :85,crop_box :116). So doatmoments (resolve_moments :129) and full-resolution PyAV frames (_frames :247,dw/media_readers.py:93). Must change because every metric there is pairwise againstbaseline(_metrics_for :268-303), while bands are measured on each output on its own. The baseline row needs cells too.check_request :89requires 2–8 names. Must change because the issue's main use is one chain's segments 1, 3, 5, which is one output at several moments.dw_mcp/media.py:357-395compare_summaryhard-codes the three metric keys (:375) and readsssim is Noneas "no metrics" (:372). Breaks because a bands-only call (one name) would print as "no metrics".assess_output(dw/server/assess.py:97-149,dw/tasks/assess.py:127) only keeps grey thumbnails, has no region, and runs no probes on stills (:62). Its probe set is pinned to three intests/test_assessment_rules.py:109-117,tests/test_server_assess.py:129-220,tests/test_mcp_twins.py:151-154,tests/test_mcp_media.py:1126-1164anddocs/ARCHITECTURE.md:144. This is why the issue's first shape is cut.tests/test_mcp_server.py:865-887pins the exact compare payload, so the new field must be sent only when true.:1293-1327requires the wrapper and handler defaults to match.tests/test_api_contract.py:132-143: the newCompareRequestfield means regeneratingui/src/lib/generated/openapi.jsonandapi-schema.ts(CIci.yml:82).ComparePage.sveltenever calls the route.tests/test_mcp_server.py:1577): 16,000 tokens. The last measurement was about 15,052 (2026-10-19), leaving about 950. That headroom is inferred, not re-measured. One parameter plus about one sentence fits.look_stats"detail" (dw/tasks/assess.py:165), one broadband number at thumbnail size. Code to reuse: band energy from one rfft (dw/dsp.py:368-485) and imagerfft2(dw/tasks/stabilize.py:30-34). numpy and scipy are already direct dependencies (pyproject.toml:79,92).save_segments(chain.py:694) writes trimmed segment MP4s, deleted unlesskeep_segments(:279-288,:695). Every measurement includes encoder texture, mostly in 2–8 px.docs/WORKFLOW_GUIDE.md:1120-1135"Comparing outputs",docs/MCP.md:248,docs/SERVER.md:642+,plugins/dw/skills/minimax-h3/SKILL.md:57-70,179-183,references/cuts.md:92-127(drift is measured today as lightness, saturation and contrast only).Demand (step 3)
minimax-h3/SKILL.md:68). Its remedies are idea: H3 Anti-Burn LoRA on chain continuation segments only #1151 (Anti-Burn LoRA probe, approved) and idea: H3 chain continuity from the previous segment's latent tail under a denoise mask (no pixel re-encode) #1150 (latent-tail continuity, parked with Don). idea: H3 Anti-Burn LoRA on chain continuation segments only #1151's plan judges by eye under Don's taste verdict (its Q4), says outright that it does not wait for idea: texture-band drift measurement across chain segments (assess/compare_outputs) #1152, and uses this tool if it lands first. So "idea: H3 chain continuity from the previous segment's latent tail under a denoise mask (no pixel re-encode) #1150 and idea: H3 Anti-Burn LoRA on chain continuation segments only #1151 need it" is overstated. Both can proceed without it, but an objective number would back the taste call and catch over-smoothing (every band falling) that the eye reads as "cleaner".h3-qualityworkspace (549 files) is a whole H3 face-quality experiment judged by matrix and assessments. That is the kind of A/B this would add a texture axis to. Theqa-*andregression-*workspaces aren't counted.The axes (step 4)
cuts.mdcan't measure today. It gets used on every H3 drift A/B (idea: H3 Anti-Burn LoRA on chain continuation segments only #1151 now, idea: H3 chain continuity from the previous segment's latent tail under a denoise mask (no pixel re-encode) #1150 if unparked).breaking-changelabel, but with no data or names depending on it.get_output_framesand an external script. Agents can't run numpy on the server's files, so it isn't usable over MCP. (c) Fold one "detail" number intocompare_outputsinstead of three bands. That is cheaper to explain, but it loses the band split that separates blotching (mid) from blur (all bands down), which is the point of the method.Design
Problem: H3 chain texture drift (blotches, stripes, coarsening, or over-smoothing from a fix) has no number, so A/Bs on it rest on eyeballing alone.
Non-goals: a quality score or verdict; an assess probe or seam rule; pre-encode frame export; automatic choice of a static region (the agent picks the box).
Corrections to the proposal:
compare_outputsas the smaller change. The sweep agrees, but its metrics are all pairwise. Bands are per output, so the baseline row gets values too, and the change adds a ratio-to-baseline per band.compare_outputsneeds 2+ names today. The within-chain use (segments 1, 3, 5 of one video) needs one, sotexture_bands=truelowers the minimum to 1. One name withtexture_bandsoff is still refused as now.Surfaces:
compare_outputs(..., texture_bands: bool = False). The docstring gets one added clause, along the lines of "texture_bandsadds per-output FFT band energy overcrop(a measurement, not a score; see the workflows guide, Comparing outputs)".CompareRequest.texture_bands: bool = FalseonPOST /api/gallery/compare. The reply cell gainstexture: {luma: {fine, mid, coarse}, chroma_rg: {...}, chroma_bg: {...}}per output per moment. Non-baseline cells also gettexture_ratiowith the same shape (output / baseline,nullwhere the baseline band is 0). Band keys arefine(2–8 px),mid(8–32) andcoarse(32–128); the px ranges are stated in the reply'stexture_bandsheader.dw/texture_bands.py, called fromdw/media_compare.pyper decoded frame:texture_bands(rgb_uint8_array) -> dict. It computes Y plus R−G and B−G, removes a least-squares plane (linear lighting gradient), applies a 2D Hann window, takesnumpy.fft.rfft2, and reports RMS over the radial frequency annuli matching each wavelength band. Bands longer than the box's short side are reportednull. Credit knoic/ComfyUI-MiniMaxH3-PrefixStream (MIT) indocs/ATTRIBUTIONS.mdfor the method.texture_bandswithout a sharedcropmeasures the full frame (allowed: the guide says to crop). A per-name crop list withtexture_bandsis refused ("texture bands need one shared box"), because per-name boxes are display-only today. A box smaller than 16 px on a side is refused ("too small for the 2–8 px band"). Images are measured too; one moment.Stages
Stage 1: texture bands on
compare_outputsdw/texture_bands.py; themedia_compare.check_requestandcomparechanges; theCompareRequestfield; the MCP wrapper and handler parameter (sent only when true);compare_summaryprinting a bands line per output per moment and no longer reading "no SSIM" as "no metrics"; the regenerated OpenAPI and UI schema.tests/test_texture_bands.py:Extend
tests/test_media_compare.pyandtests/test_compare_route.py(one name allowed only with bands, per-name crops refused, tiny box refused, ratio null on a zero baseline) andtests/test_mcp_server.py(payload omits the field when false, defaults match).docs/WORKFLOW_GUIDE.md"Comparing outputs" subsection, "Texture bands". It covers what each band suggests; the issue's caveats verbatim in substance (not a score, mid up can be detail, all down can be blur, static framing only, encoder texture lives in fine); and the A/B method (branch from one clean first segment, same seeds and prompts, one variable at a time). Alsodocs/MCP.md:248,docs/SERVER.mdcompare body, anddocs/ATTRIBUTIONS.md. Plugin: one line inminimax-h3/references/cuts.mddrift section andSKILL.md:68pointing at the guide subsection.compare_outputswith two H3 chain outputs,atat three moments, one sharedcrop, andtexture_bands=truereturns the grid and, per output per moment, nine numbers (3 bands × luma/R−G/B−G). Each non-baseline output also gets nine ratios.namesof one chain output and threeatmoments returns bands for each moment and no pairwise metrics, with no "no metrics" message.texture_bands, the reply and summary are unchanged from today.texture_bandsis refused as today. A per-name crop list withtexture_bandsis refused, naming the shared-box rule. A crop under 16 px a side is refused.get_guide("workflows", section="Comparing outputs")carries the caveats.Order and dependencies: one stage, no blockers. #1151 can use it once it lands; nothing waits on it.
Risks
Questions
compare_outputsparameter, one stage), cutting theassess_outputregion and the pre-encode PNG hook. Default: build it. If otherwise: "defer" keeps judging idea: H3 Anti-Burn LoRA on chain continuation segments only #1151 by eye and parks this on idea: H3 Anti-Burn LoRA on chain continuation segments only #1151's outcome; "build the assess shape too" adds a second stage touching the three-probe invariant.compare_outputswith one name whentexture_bands=true(for one chain's segments). Default: yes. If otherwise: single-chain drift needs the chain named twice; this changes nothing else.texture_bands, band keysfine/mid/coarse, new moduledw/texture_bands.py. Default: as written.Reply in comments and hand back with
owner:lead. Approve by addingstatus:plan-approvedyourself. No agent may set it.Decision for Don: build
texture_bandsas one opt-incompare_outputsparameter (one stage, about $4–6), cutting the assess and pre-encode shapes?Kind: scope Default: one stage builds the parameter as designed, including one-name calls (Q2)
If otherwise: defer (judge #1151 by eye), or widen to the assess probe as a second stage Reversible: with a breaking-change (removing an MCP parameter)
dkackman commentedon Nov 2, 2026
Rulings on plan v1 (Don, 2026-11-01)
texture_bandsas an opt-incompare_outputsparameter. Theassess_outputregion shape, the pre-encode PNG export and any threshold or verdict on the bands stay cut, each with the trigger the plan names.texture_bands=true; without it, a single name is still refused.texture_bands,fine/mid/coarse,dw/texture_bands.py.Approved as written. If the docstring clause doesn't fit the surface budget once it's re-measured, move it to the guide as the plan says, rather than raising the budget.
6 remaining items
dkackman commentedon Nov 2, 2026
Spec for #1152's plan v1, by tester claude-opus-5-5 (anthropic). Cases were written from the plan alone. Nothing was run or verified; the only MCP calls were read-only (
get_guide,list_tasks, thecompare_outputsschema).#1160, stage 1: texture bands on
compare_outputs. All cases are inregression-suite-complete.mdand markedpending: #1160.texture_bands(left out orfalse) is still refused.baseline=moves the ratios and leaves the band values unchanged.false) the reply is unchanged and has no texture keys. Per-name crops without bands still work.coarsenull. The full frame is accepted. The 9-name cap still holds. A 15 px box without bands is still accepted.fineratio below 1.SKILL.mdandcuts.md.Notes. None of these stops a case from being written.
get_guide("workflows", section="Comparing outputs")is refused today: the workflows guide has no section by that name, and its sections are How the catalog is organised … Type System. The plan's guide target (WORKFLOW_GUIDE.md:1120-1135) may sit under a different heading, or in a guide other thanworkflows. C-F669 requires that the heading resolves once the stage is built.mid(8–32 px) is null or a number in a 16 px box. The other is whether a one-entry per-name crop list counts as the refused list form. A two-entry list must be refused.docs(proposals): #1152 - design record for texture-band drift measure…
Merge docs/1152-complete-texture-bands (#1152)
dkackman commentedon Nov 2, 2026
Close-out of #1152. Lead: claude-opus-5-5 (anthropic).
Closed: stage #1160 (texture bands on
compare_outputs). It was verified ondevelop@768400daafter one bounce (C-F669, theTexture bandsguide heading).Design record:
docs/proposals/complete/texture-bands-complete.md. Thetodo.md"Shipped since the ranking" entry is added. These are docs only, merged todevelop@06f08f37, with no deploy. No partial design doc existed to retire, and the stage's own commits already updated the user-facing docs (guide, MCP.md, SERVER.md, ARCHITECTURE.md, ATTRIBUTIONS.md, the minimax-h3 skill).verify: run every case whose
source:names one of this feature's stages, and close the parent if they all pass.dkackman commentedon Nov 2, 2026
Feature-parent verify of #1152. Tester: claude-opus-5-5 (anthropic), against
develop@06f08f37on lem.I ran all 8 cases whose
source:names stage #1160 (C-F662 to C-F669 inregression-suite-complete.md) over MCP, as written. All 8 pass.[352,144,256,256]. Each output has 9 bands per moment, none null. Only the non-baseline row has ratios, and a spot check matches the division (Y fine 3.7985/10.956 = 0.3467). PSNR/SSIM/MAD are kept. The header gives the px ranges and says "a measurement not a score". No verdict wording. A repeat call matches to every digit.texture_bands(left out, orfalse) is refused: "compare takes 2 to 8 (or 1 withtexture_bands)".1andidenticalPSNR. Frame 123 is measured. Withbaseline=set to shot 2, the ratios move to shot 1 and the frame-60 bands equal C-F662's exactly.texture_bands=falsegive identical replies, with no texture lines. Per-name crops without bands are still accepted (full-frame metrics, display-only crops).finenumeric andcoarsenull;midis also null (recorded, as the case asks). The full frame is accepted with 9 numbers per cell. 9 names are refused ("takes 1 to 8"). A 15 px box without bands is accepted.0and every chroma ratio is null (-), with no inf or NaN. A2's luma ratios are1/1/1. Bl's luma ratios are fine 0.2314 (< 1), mid 0.8524, coarse 0.9706. One name with a still gives one row and one column, with no ratios. The runs were cleaned up withdelete_output(job_id=…).texture_bandsboolean defaults to false. The description says "a measurement, not a score" and points to the guide.get_guide("workflows", section="Comparing outputs")andsection="Texture bands"both resolve, and the text covers each band's meaning, not-a-score, mid rising as possible detail and all bands falling as possible blur, static framing, measurement after encode with encoder texture infine, the A/B method, the shared 16 px box rule and the one-name use. The minimax-h3SKILL.md(chains bullet) andreferences/cuts.md(lines 129-131, the drift section) both point to Comparing outputs, Texture bands.No
pending: #1160lines remain. Closing as completed.