Package katman is the composition logic of Katman, Sinopia's open PFP tool engine: an artist uploads trait layers (SVG parts with rarity weights) to a sealed assets/v1 store, and every revealed token is one part per layer, drawn from the token's final seed by weight and stacked bottom-up into one SVG. Parts may paint with currentColor; the collection's palette then gives every layer its own ink, shuffled per token, over a paper backdrop.
This package is pure: it never reads a store. The adapter realm (r/…/sinopia/engines/katman) reads the drawn parts from assets/v1 and hands their bytes to ComposeParts. The demo kit in demo.gno (params store 0) is the engine's own sample: the jug characters of the engine gallery, redrawn. frontend/src/engines/katman.ts is a byte-identical TypeScript twin; katman_test.gno and katman.test.ts pin the same golden vectors.
Why composition can never break the SVG allowlist: every part is a whole document that passed safe.AssertSVG when its last byte was stored (assets/v1 AppendBytes → media.CheckImage). Its root tag is exactly Root(w, h) and the document ends with the closing tag of that root (AssertSVG refuses content after the root), so the bytes between them are a balanced run of allowlisted elements, attributes and text. ComposeParts only concatenates such runs inside <g> elements under one Root(w, h); every rule of the allowlist is local to an element, an attribute value or a text run, so the result passes too. Core re-checks every render anyway.
Pure integer maths: no floats, no time, no block data.