A rule profile is a named set of rule values an owner assigns to a tenant. Every validate and publish of a face lens or a screen effect also checks it against the profiles that apply to it, and the editor shows the same issues live. Profiles are data: the platform defines the rules below; which values a tenant uses is configuration, never code.
Implementation: packages/profiles (@ingevora-mirage/profiles). Designs: docs/superpowers/specs/2026-09-29-mirage-editor-rule-profiles-design.md (face lenses) and 2026-10-01-mirage-screen-effect-rules-design.md (screen effects), and 2026-10-11-mirage-rule-checks-design.md (pixel flashes, reference screens). Numbers in brackets refer to rendering-v1.md, E-numbers to effect-rendering-v1.md.
packages/profiles
@ingevora-mirage/profiles
docs/superpowers/specs/2026-09-29-mirage-editor-rule-profiles-design.md
2026-10-01-mirage-screen-effect-rules-design.md
2026-10-11-mirage-rule-checks-design.md
rendering-v1.md
effect-rendering-v1.md
Face lenses and screen effects are separate products with their own manifests. Each rule applies to one product: face lenses are checked against keepOutZones (§2, §3), screen effects against the flashing limit, the screen-coverage cap (§5) and the pixel flash limits (§6), on the profile's reference screens. A face lens ignores the screen-effect rules, and a screen effect ignores keepOutZones.
keepOutZones
A strict JSON object (ruleProfileSchema); unknown keys are rejected. Every rule is optional, and an absent rule is not checked. Values are INTEGER enums.
ruleProfileSchema
1
2
placement.mode
maxFlashesPerSecond
screenCoverage
{ maxShare, maxMs }
maxShare
maxMs
maxGeneralFlashesPerSecond
maxRedFlashesPerSecond
maxFlashingMs
frameCoverage
referenceScreens
{ width, height }
{ "keepOutZones": [1, 2], "maxFlashesPerSecond": 3, "screenCoverage": { "maxShare": 0.6, "maxMs": 500 }, "maxGeneralFlashesPerSecond": 3, "maxRedFlashesPerSecond": 3, "referenceScreens": [{ "width": 390, "height": 845 }, { "width": 834, "height": 1194 }] }
The last three rules were added to v1 additively (2026-10-11): every earlier profile is still valid and is checked exactly as before. maxFlashesPerSecond keeps counting flash-motion cycles only.
Frame overlays (type 3), colour looks (type 1) and full-frame sprites (type 4, placement.mode 2) are exempt from keep-out: they are full-frame by design, and v1 checks geometry, not pixels (a transparent-centre frame is legitimate).
Keep-out is checked statically on one reference face (referenceFace()), in a 1000 × 1000 frame (REFERENCE_FRAME):
referenceFace()
1000 × 1000
REFERENCE_FRAME
M = (500, 500)
W = 400
±200 / 2.2 = ±90.909…
M
packages/render/test/helpers.ts
W = 44
400 / 44
0.10 W
0.30 ×
+109.09
+409.09
+227.27
0.36 W = 144
Zones follow the face's own landmarks (keepOutZones(face, frame), ZONE_GEOMETRY), so the same definition draws correctly on a live face:
keepOutZones(face, frame)
ZONE_GEOMETRY
u
v
W
(500, 727.27)
(86.4, 40)
(590.91, 500)
(409.09, 500)
48
keepOutZones returns image-pixel shapes — { id, kind: 'ellipse', center, radii, rotationDeg } or { id, kind: 'circle', center, radius, rotationDeg }, rotationDeg = the face roll — in the order mouth, the subject's left eye, the subject's right eye.
{ id, kind: 'ellipse', center, radii, rotationDeg }
{ id, kind: 'circle', center, radius, rotationDeg }
rotationDeg
Overlap.
followRoll
offset
CLIP_SAMPLE_MS
durationMs
placeOnFace(faceTransformAt(…))
format-v1.1.0
LANE_COMBINATION_SAMPLES
Profile issues join the format's { path, code, message } issue list (ManifestIssue), after the format's own. Paths are JSON Pointers into the manifest. Messages are English and name the profile.
{ path, code, message }
ManifestIssue
profile.keep_out
/layers/<i>
i
/animations/<i>
profile.flashing
profile.screen_coverage
profile.general_flash
profile.red_flash
profile.long_flashing
profile.frame_coverage
profile.asset_unreadable
/layers/<i>/asset
Example messages: Rule profile "Studio One": layer "mask" overlaps the mouth and eyes keep-out zones on the reference face. · Rule profile "Studio One": clip "drop" moves layer "badge" into the mouth keep-out zone at 240 ms on the reference face. · for particles, … clip "rise" moves the particle spawn point of layer "sparks" into the eyes keep-out zone at 610 ms ….
Rule profile "Studio One": layer "mask" overlaps the mouth and eyes keep-out zones on the reference face.
Rule profile "Studio One": clip "drop" moves layer "badge" into the mouth keep-out zone at 240 ms on the reference face.
… clip "rise" moves the particle spawn point of layer "sparks" into the eyes keep-out zone at 610 ms …
Screen effects (times in seconds to two decimals, measured shares to a tenth of a percent): Rule profile "Studio One": 6 flashes within one second from 0.40 s (flash motions "strobe", "boom"); at most 3 are allowed. · Rule profile "Studio One": the effect paints 82.4 % of the screen for 1.20 s from 0.30 s (layers "sky", "badge"); at most 60 % for 500 ms is allowed. — a run that reaches the end reads … for 1.20 s from 0.30 s, to the end … · Rule profile "Studio One": the image "a_00000000.png" could not be decoded, so screen coverage was not checked. (with a pixel flash limit set too: … so screen coverage and pixel flashes were not checked.; with only a pixel flash limit: … so pixel flashes were not checked.) · Rule profile "Studio One": 5 general flashes within one second from 0.40 s over 12.3 % of the screen on a dark backdrop (layers "blink", "sky"); at most 3 are allowed. — red flashes for the red limit, light backdrop for white. One flash, motion or layer reads in the singular (1 flash, flash motion "strobe", layer "sky"); a limit of 0 reads no flash is allowed (no general flash is allowed, no red flash is allowed). When the profile lists referenceScreens, every coverage and pixel flash message names its screen: Rule profile "Studio One" (834 × 1194 screen): …. A screen effect's flashing issue comes first, then its unreadable images, then per screen in order its general flash, red flash and coverage issues.
Rule profile "Studio One": 6 flashes within one second from 0.40 s (flash motions "strobe", "boom"); at most 3 are allowed.
Rule profile "Studio One": the effect paints 82.4 % of the screen for 1.20 s from 0.30 s (layers "sky", "badge"); at most 60 % for 500 ms is allowed.
… for 1.20 s from 0.30 s, to the end …
Rule profile "Studio One": the image "a_00000000.png" could not be decoded, so screen coverage was not checked.
… so screen coverage and pixel flashes were not checked.
… so pixel flashes were not checked.
Rule profile "Studio One": 5 general flashes within one second from 0.40 s over 12.3 % of the screen on a dark backdrop (layers "blink", "sky"); at most 3 are allowed.
red flashes
light backdrop
1 flash
flash motion "strobe"
layer "sky"
no flash is allowed
no general flash is allowed
no red flash is allowed
Rule profile "Studio One" (834 × 1194 screen): …
The same for both products:
tenantId
checkProfile(manifest, assets, profile) checks one profile against a face lens, and checkEffectProfile(manifest, assets, profile) against a screen effect (§5); the caller (API, editor) runs it for every profile that applies. Both expect a schema-valid manifest; assets maps each asset name to its pixel size (sprite sheets: the whole sheet) — for a screen effect, with its decoded alpha when the coverage cap is checked (§5) and its decoded RGBA when a pixel flash limit is (§6; needsPixels, needsColour).
checkProfile(manifest, assets, profile)
checkEffectProfile(manifest, assets, profile)
assets
needsPixels
needsColour
The flashing limit and the screen-coverage cap are worked out by playing the effect through the render package's own effect instance (effect-rendering-v1), so they see exactly what the SDKs draw: triggers, sprite frames, clips, particles, shake and pulse. Not yet the 3D pass (engine 4, E12): a pass3d command is not rasterised by the coverage cap, the pixel flash limits or long flashing, so 3D models and copies count as transparent for now; the checks still tell frames with different 3D apart. Rasterising the 3D pass needs a GPU-free renderer and is owed with the 3D work. The same holds for face paint (a face lens's mesh command, engine 6, rendering-v1 §13): not rasterised yet, keyed apart.
pass3d
mesh
The play-through.
REFERENCE_SCREEN
S
⌊width / pt⌋ × ⌊height / pt⌋
pt
√(area ÷ (390 × 845))
gridPitch
EFFECT_STEP_MS
effect.started
Flashes (maxFlashesPerSecond).
alpha(t − 1) ≥ alpha(t) < alpha(t + 1)
1 / frequencyHz
run motion
intensity
[s, s + 1000)
s
Coverage (screenCoverage).
COVERAGE_SAMPLE_MS
COVERAGE_GRID_PT
(u, v)
(src.x + ⌊u · src.width⌋, src.y + ⌊v · src.height⌋)
a = opacity × alpha / 255
1 − Π(1 − a)
PAINTED_ALPHA
n
n × 10
{ "maxShare": 0.6, "maxMs": 500 }
a > 0
Pixels. The coverage cap needs each asset's alpha. decodePngAlpha decodes a PNG to one byte of alpha per pixel, row-major, expanded as E4.4 says: a palette entry takes its tRNS alpha (entries past the chunk's are opaque); grey and RGB pixels are opaque except those equal to the tRNS key colour; 16-bit samples keep their high byte. An interlaced PNG below 8 bits per sample cannot be decoded — export it without interlacing. The cap is checked only once every asset a layer uses has its alpha; an image that could not be decoded is reported (profile.asset_unreadable) and the cap is not checked further. The flashing limit needs no pixels.
decodePngAlpha
tRNS
Cost. At most 10 000 renderer steps and 1 000 sampled frames; a sample drawing the same quads as the one before it (static content) is not composited again. Deterministic: the API and the editor run the same code on the same bytes, so they report the same issues. Each listed reference screen is one more play-through.
maxGeneralFlashesPerSecond and maxRedFlashesPerSecond apply WCAG 2.3.1's general and red flash thresholds to what the effect actually draws, so a flash made by sprite frames, by an image's opacity clip, by several layers together, by the flash motion's fill (at its intensity) or by a colour wash (its colour at each point of the grid, at its alpha — an opacity clip on a wash can flash) is measured the same way. A colour wash is not a flash motion: the flashing limit (§5) does not count it. They run in the same play-through as the coverage cap (§5), on each reference screen.
Compositing. At every coverage sample (every 10 ms), the frame's draw list is composited on a grid of points every 10 points (FLASH_GRID_PT, grown on larger screens as §5 says; 39 × 84 on 390 × 845), each at the centre of its cell; a point stands for pt² square points of area. A quad contributes its source pixel (the same lookup as coverage) at a = opacity × alpha / 255, a fill its colour at its alpha everywhere; in command order, source-over, on sRGB-encoded values (8-bit samples scaled to [0, 1], composited unquantised): premultiplied colour P ← c · a + P · (1 − a), coverage A ← a + A · (1 − a). The host app behind the effect is unknown, so every point is measured over two backdrops: dark (black: P) and light (white: P + (1 − A)).
FLASH_GRID_PT
pt²
P ← c · a + P · (1 − a)
A ← a + A · (1 − a)
P
P + (1 − A)
Values. From the linearised R, G, B of the point (sRGB decoding through a 4096-entry table): relative luminance Y = 0.2126 R + 0.7152 G + 0.0722 B; red Q = max(0, R − G − B) × 320; saturated red when R + G + B > 0 and R / (R + G + B) ≥ 0.8.
Y = 0.2126 R + 0.7152 G + 0.0722 B
Q = max(0, R − G − B) × 320
R + G + B > 0
R / (R + G + B) ≥ 0.8
Transitions. Per point and backdrop, one tracker per kind holds the extreme value since its last transition and the direction of that transition; before the first, the lowest and highest values so far. A value beyond the extreme in the current direction becomes the extreme; a value the other way that qualifies is a transition at that sample and becomes the new extreme, the direction flipping. Qualifying, from WCAG 2.2's definitions:
Windows and area. A flash is a pair of opposing transitions; n transitions in a window count as ⌈n / 2⌉ flashes. A 1000 ms window [s, s + 1000) starts at every sample time; a point fails a window when its flashes there exceed the limit (n ≥ 2 · limit + 1) — so with a limit of 0 a single transition over more than the flash area fails (one bright image appearing once is a started flash). For each kind, the window and backdrop with the most failing points (the earliest window of equals, dark before light) is the worst; it is an issue when its failing points cover more than FLASH_AREA_PT2, 25 % of a 10° visual field — a square of FLASH_FIELD_PT = 337 points (10° at 30 cm on a 163-points-per-inch screen): 28 392.25 pt², more than 283 grid points on the 10-point grid. The area is summed over the whole screen (a phone screen is not much wider than the field).
⌈n / 2⌉
n ≥ 2 · limit + 1
FLASH_AREA_PT2
FLASH_FIELD_PT
The issue reports the worst window's start, the most flashes any failing point makes in it, the failing points' share of the screen, the backdrop, and the layers drawing at failing points (contributing a > 0 at a sample where the point made a transition in the window), most points first, equals in layer order; the first is the path.
Pixels. The limits need every used asset's RGBA (decodePngPixels: E4.4's expansion as for alpha, palette colours, greys repeated into R, G and B and scaled to 8 bits; its alpha byte for byte decodePngAlpha's). An asset whose RGBA has not loaded skips the limits (the editor while it loads); one that could not be decoded is reported (profile.asset_unreadable) and the limits are not checked. A sample drawing exactly the commands of the one before it is not composited again.
decodePngPixels
alpha
This is an automated screen of the effect against WCAG 2.3.1's thresholds, not a certified photosensitive-epilepsy test.
Face lenses (2026-10-12). The pixel flash limits apply to face lenses too (checkLensScreens, run by checkProfile when the assets carry decoded pixels). A lens has no end of its own, so it is played for LENS_PLAY_MS (10 s) at 1 ms steps on each reference screen, as the camera frame, with the reference face (§2) scaled into it — the same proportions, its width 0.4 × the frame's shorter side, its origin at the frame's centre (referenceFaceIn). On the second frame every host event a trigger listens to arrives, and every face signal rises to 1 and stays (face-signal triggers fire; driven clips sit at their end). The camera is a steady dark or light backdrop: a colour look (lut) grades the backdrop and everything drawn below it as it grades the camera (rendering-v1 4.3), so a flickering look flashes. Messages say "of the frame".
checkLensScreens
checkProfile
LENS_PLAY_MS
referenceFaceIn
lut
maxFlashingMs limits how long flashing goes on, whatever its rate (broadcast guidance — Ofcom's, ITU-R BT.1702 — limits the duration of flashing sequences, not only their frequency). It uses the general and red transitions of §6 on both backdrops, measured as §6 measures them (both kinds are traced whenever this rule is set). A one-second window [s, s + 1000) is flashing when, in any one series, the points with at least one transition in it cover more than the flash area (FLASH_AREA_PT2) — a flash a limit of 0 would refuse. Overlapping flashing windows form a run from the first window's start to the last one's end (cut at the end of the play-through). The longest run, the earliest of equals, fails when it lasts longer than maxFlashingMs: Rule profile "Studio One": flashing goes on for 6.20 s from 0.40 s (layer "strobe"); at most 5.00 s is allowed. The layers named are those drawing at transitions in the run, most first. Values: 1 000 (MIN_FLASHING_MS) to 60 000 (MAX_FLASHING_MS).
Rule profile "Studio One": flashing goes on for 6.20 s from 0.40 s (layer "strobe"); at most 5.00 s is allowed.
MIN_FLASHING_MS
MAX_FLASHING_MS
frameCoverage is §5's screen-coverage cap for face lenses, on the camera frame: the lens plays as in §6 (10 s on the reference face in each reference screen), every 10 ms its quads are composited on the 5-point grid, a point is painted at 50 % alpha or more, and a run of samples above maxShare longer than maxMs fails (profile.frame_coverage: Rule profile "Studio One": the lens paints 100.0 % of the camera frame for 10.00 s from 0.00 s, to the end (layer "border"); at most 60 % for 500 ms is allowed.). A colour look paints nothing; a frame overlay, full-frame sprite or large sticker does.
Rule profile "Studio One": the lens paints 100.0 % of the camera frame for 10.00 s from 0.00 s, to the end (layer "border"); at most 60 % for 500 ms is allowed.