Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.
JavaScript 3d3d-assets3d-modelingagent-skillsagent-toolsai-agentsasset-pipelinecligame-assetsglbgltfmcpmcp-servermodel-context-protocolprocedural-generationprocedural-modelingtext-to-3dthreejstypescript
feat: remove the triangle budget and raise the asset quality bar
Matt Kissinger8ad78c410590
diff --git a/README.md b/README.mdindex 2d6555fc..a57449d8 100644--- a/README.md+++ b/README.md@@ -6,11 +6,12 @@ Kiln turns a sentence into a game-ready GLB by having a model *write a program*,rendered, and fix it — not by sampling a mesh. The output is a small program with named parts, notan opaque blob: editable, diffable, parametric, and readable by the next agent that touches it.-+-*The contact sheet the model looks at — `examples/well.kiln.js`, 472 triangles, three PBR materials-with bound albedo/normal/ARM maps:*-`bun run kiln render examples/well.kiln.js --views sheet.png`+*The contact sheet the model looks at — `examples/field-gun.kiln.js`, 15,544 triangles: a revolved+bronze barrel bored with a boolean, a stepped oak carriage carrying strapwork and bolt heads, and+twelve-spoke wheels with iron tyres:*+`bun run kiln render examples/field-gun.kiln.js --views sheet.png`## What this is@@ -26,8 +27,8 @@ The interesting parts are architectural, and they generalize past 3D:single source of truth. The in-process Strands skin and the MCP server both iterate it, so toolnames and schemas cannot drift apart.- **Deterministic gates, kept separate from model judgment.** Self-intersection, part connectivity,- triangle budget, and AST validation all fail closed with no model call. `QaContext` is- deliberately image-free so a QA rule *structurally cannot* read a render buffer.+ and AST validation all fail closed with no model call. `QaContext` is deliberately image-free so a+ QA rule *structurally cannot* read a render buffer.- **A render port with a fail-closed degrade.** `captureViewsViaPort` owns the deadline, PNGvalidation, grid composition, and a never-throw fallback. Renderers are swappable; correctnessdoes not depend on which one ran.@@ -80,17 +81,21 @@ repository; none requires a cloud account.### What the difference actually looks like-The same program — the well above — rendered both ways:+The same program — the field gun above — rendered both ways:| CPU rasterizer | GPU PBR ||---|---|-|  |  |+|  |  |-Geometry is equally legible in both: silhouette, proportion, orientation, part contact. But on the-CPU the brick curb is **flat grey** and the roof is **flat orange**. Not dimmer — *absent*. The-albedo, normal, and ARM maps that make one stone and the other weathered planks simply do not exist-in a flat-shaded render. Every material cue an artist would judge is gone, while every geometric one-survives.+Geometry is equally legible in both. On the CPU sheet you can still count the twelve spokes, see the+bolt heads on the cheek straps, and read the stepped carriage — silhouette, proportion, orientation+and part contact all survive intact.++What does not survive is every material cue in the asset. The oak carriage, the iron tyres, and the+bronze barrel render as **the same white plastic**. Not dimmer — *absent*. The procedural albedo and+the derived normal maps that separate weathered wood from gun-metal simply do not exist in a+flat-shaded render, so an agent looking at the left-hand sheet has no way to tell that this asset has+three materials at all.**If your assets have textures or metal, use the GPU.** That is most real assets, and it is why`auto` reaches for a GPU first. The CPU rasterizer is the floor that guarantees the loop runs@@ -158,7 +163,7 @@ maintained is collapsed. That is a deliberate trade for portability.| Tool | What it does ||---|---|| `kiln_list_primitives` | the primitive/helper catalog with signatures |-| `kiln_validate` | AST validation — syntax, structure, infinite loops, recursion, triangle budget |+| `kiln_validate` | AST validation — syntax, structure, infinite loops, recursion || `kiln_render` | build the scene, return metrics **and** the six-view sheet, in one call || `kiln_screenshot_animation` | frames of an `animate()` program, so motion is visible too || `kiln_view_interior` | interior camera, for anything enterable |diff --git a/examples/field-gun.kiln.js b/examples/field-gun.kiln.jsnew file mode 100644index 00000000..b88f81be--- /dev/null+++ b/examples/field-gun.kiln.js@@ -0,0 +1,249 @@+// A 6-pounder field gun: the kind of asset a studio artist would build.+//+// This is the repository's hero, and it exists to show what the loop produces+// when the author actually spends geometry. Roughly 15k triangles across a+// turned bronze barrel, an oak carriage with real stepped cheeks, ironwork with+// bolt heads, and two twelve-spoke wheels. Kiln has no triangle budget, and this+// is what that is for.+//+// Every surface carries a procedural albedo plus a derived normal map, so the+// difference between the CPU rasterizer and a GPU PBR render is the whole story+// the contact sheet tells.+const meta = { name: 'FieldGun', category: 'prop', role: 'poi' };++async function build() {+ const root = createRoot('FieldGun');+ const uv = (g) => autoUnwrap(g, { resolution: 512 });++ // ---------- Materials ----------+ // Three materials, each albedo + derived normal, reused across every part. The+ // draw-call cost tracks distinct materials, not triangles, so detail is free+ // and material sprawl is not.+ const oakAlbedo = proceduralTexture({+ schemaVersion: 2, size: 512, usage: 'albedo', name: 'Oak',+ layers: [+ // Weathered oak, and the saturation is the load-bearing part. Two earlier+ // passes raised the VALUE to fix a dark render and both came back bright+ // orange, because a 30%-saturation mid-brown reads as painted plastic once+ // it is bright enough to see. Wood needs the grey kept in it: this sits+ // near 15% saturation, so it can be light without turning into a carrot.+ { op: 'solid', color: 0x87715b },+ { op: 'noise', colorA: 0x695641, colorB: 0xa38b70, scale: 14, octaves: 4, seed: 7, blend: 'overlay', opacity: 0.55 },+ { op: 'noise', colorA: 0x574734, colorB: 0x87715b, scale: 3, octaves: 3, seed: 21, blend: 'multiply', opacity: 0.22 },+ ],+ });+ const oak = pbrMaterial({+ albedo: oakAlbedo, normal: normalMapFromHeight(oakAlbedo, { strength: 4 }),+ roughness: 0.85, metalness: 0,+ });++ const ironAlbedo = proceduralTexture({+ schemaVersion: 2, size: 256, usage: 'albedo', name: 'Iron',+ layers: [+ { op: 'solid', color: 0x5d626b },+ { op: 'noise', colorA: 0x3b3f46, colorB: 0x828892, scale: 9, octaves: 4, seed: 3, blend: 'overlay', opacity: 0.7 },+ ],+ });+ const iron = pbrMaterial({+ albedo: ironAlbedo, normal: normalMapFromHeight(ironAlbedo, { strength: 3 }),+ roughness: 0.55, metalness: 0.9,+ });++ // Gun-metal bronze, not gold. At metalness 1 and roughness 0.34 this read as+ // polished brass on the first pass; a real barrel is darker, greener and much+ // less mirror-like.+ const bronzeAlbedo = proceduralTexture({+ schemaVersion: 2, size: 256, usage: 'albedo', name: 'Bronze',+ layers: [+ { op: 'solid', color: 0x8a7040 },+ { op: 'noise', colorA: 0x66532e, colorB: 0xa98a4f, scale: 7, octaves: 3, seed: 11, blend: 'overlay', opacity: 0.55 },+ { op: 'noise', colorA: 0x565c40, colorB: 0x8a7040, scale: 2, octaves: 2, seed: 31, blend: 'multiply', opacity: 0.22 },+ ],+ });+ const bronze = pbrMaterial({+ albedo: bronzeAlbedo, normal: normalMapFromHeight(bronzeAlbedo, { strength: 1.8 }),+ roughness: 0.42, metalness: 0.82,+ });++ // ---------- Carriage cheeks ----------+ // A stepped bracket, extruded and bevelled. The steps are what a real carriage+ // has so the breech can drop between them; a plain tapered plank reads as a+ // blockout immediately.+ // The trail runs back to -2.50. An earlier pass stopped it at -1.50 and the+ // whole gun read as a squat toy: on a real field piece the trail is roughly+ // twice the wheel diameter, and that length is most of the silhouette.+ const cheek = [+ [-2.50, 0.16], [-1.90, 0.30], [-1.30, 0.46], [-0.75, 0.62], [-0.32, 0.74],+ [-0.32, 0.90], [0.06, 0.94], [0.06, 1.06], [0.50, 1.08], [0.66, 1.08],+ [0.66, 0.66], [0.28, 0.52], [-0.30, 0.36], [-1.10, 0.20], [-1.90, 0.08], [-2.50, 0.02],+ ];+ const CHEEK_Z = 0.235;+ const CHEEK_T = 0.085;++ // Upper and lower envelopes of that outline, so ironwork and transoms can be+ // placed ON the cheek rather than at a guessed height. Straps that ignored+ // this are why an earlier pass left one hanging below ground.+ const topEdge = [[-2.50, 0.16], [-1.90, 0.30], [-1.30, 0.46], [-0.75, 0.62], [-0.32, 0.90], [0.06, 1.06], [0.50, 1.08], [0.66, 1.08]];+ const botEdge = [[-2.50, 0.02], [-1.90, 0.08], [-1.10, 0.20], [-0.30, 0.36], [0.28, 0.52], [0.66, 0.66]];+ const edgeAt = (edge, x) => {+ if (x <= edge[0][0]) return edge[0][1];+ if (x >= edge[edge.length - 1][0]) return edge[edge.length - 1][1];+ for (let i = 0; i < edge.length - 1; i++) {+ const [x0, y0] = edge[i];+ const [x1, y1] = edge[i + 1];+ if (x >= x0 && x <= x1) return y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);+ }+ return edge[edge.length - 1][1];+ };++ const cheekGeo = await uv(await extrudeProfile(cheek, { depth: CHEEK_T, bevel: 0.012, axis: 'z', segments: 8 }));+ for (const sz of [-1, 1]) {+ createPart(`Cheek_${sz > 0 ? 'R' : 'L'}`, cheekGeo, oak, { position: [0, 0, sz * CHEEK_Z], parent: root });+ }++ // ---------- Barrel ----------+ // One revolved profile: breech ring, first reinforce, chase taper, astragal,+ // muzzle swell. A stack of cylinders cannot produce this silhouette.+ // Just under 2 m, and slim. An earlier pass sized this to a real 6-pounder+ // (1.70 m against a 1.26 m wheel) and it still read stubby, because the 4.15 m+ // carriage dominates the frame. Matching the reference measurement is not the+ // same as matching how the reference reads, and the picture is what ships.+ const barrelProfile = [+ [0.000, -0.68], [0.145, -0.68], [0.145, -0.50], [0.124, -0.48],+ [0.124, -0.28], [0.136, -0.26], [0.136, -0.20], [0.104, -0.18],+ [0.092, 0.55], [0.082, 1.02], [0.096, 1.06], [0.096, 1.105],+ [0.111, 1.145], [0.111, 1.30], [0.000, 1.30],+ ];+ const barrelSolid = new THREE.Mesh(+ await revolveProfile(barrelProfile, { segments: 48, axis: 'x', smooth: true }), bronze,+ );+ const bore = new THREE.Mesh(cylinderXGeo(0.054, 0.054, 1.85, 24), bronze);+ bore.position.set(0.40, 0, 0);+ const barrel = await boolDiff('Barrel', barrelSolid, bore);+ barrel.name = 'Barrel';+ barrel.geometry = await uv(barrel.geometry);++ // Trunnions sit on the cheek tops and the muzzle oversails the wheels. Both are+ // load-bearing proportions: a muzzle that stops short of the wheel rim reads as+ // a stubby toy no matter how much detail sits on it.+ const GUN_X = 0.41;+ const GUN_Y = 1.09;+ const gun = createPivot('GunAssembly', [GUN_X, GUN_Y, 0], root);+ gun.rotation.z = (3 * Math.PI) / 180;+ gun.add(barrel);++ createPart('CascabelNeck', cylinderXGeo(0.045, 0.055, 0.09, 16), bronze, { position: [-0.725, 0, 0], parent: gun });+ createPart('CascabelKnob', sphereGeo(0.072, 20, 14), bronze, { position: [-0.795, 0, 0], parent: gun });++ for (const sz of [-1, 1]) {+ const side = sz > 0 ? 'R' : 'L';+ createPart(`Trunnion_${side}`, cylinderZGeo(0.058, 0.058, 0.14, 20), bronze, { position: [-0.06, -0.04, sz * 0.19], parent: gun });+ createPart(`TrunnionCap_${side}`, cylinderZGeo(0.070, 0.070, 0.022, 20), bronze, { position: [-0.06, -0.04, sz * 0.26], parent: gun });+ // Capsquare: the iron strap that actually holds a trunnion down.+ createPart(`Capsquare_${side}`, boxUnwrap(boxGeo(0.10, 0.13, 0.016)), iron, { position: [-0.06, -0.10, sz * 0.285], parent: gun });+ }++ // Dolphins: the cast lifting handles on top of a real barrel.+ for (const sx of [-1, 1]) {+ const arc = bezierCurve([+ [sx * 0.10, 0.10, 0], [sx * 0.16, 0.23, 0], [sx * -0.02, 0.24, 0], [sx * -0.07, 0.11, 0],+ ], 18);+ createPart(`Dolphin_${sx > 0 ? 'F' : 'R'}`, curveToMesh(arc, 0.022, 20, 8), bronze, {+ position: [sx * 0.10 - 0.02, 0.03, 0], parent: gun,+ });+ }++ // ---------- Transoms and ironwork ----------+ // Transoms are placed at the mid-height of the cheek at their own x, so they+ // land inside the bracket instead of at a height guessed once and reused.+ const transomX = [0.52, -0.15, -1.20, -2.35];+ const transomGeo = await uv(await roundedBoxGeo(0.16, 0.13, 0.40, 0.014));+ for (let i = 0; i < transomX.length; i++) {+ const x = transomX[i];+ createPart(`Transom_${i}`, transomGeo, oak, {+ position: [x, (edgeAt(topEdge, x) + edgeAt(botEdge, x)) / 2, 0], parent: root,+ });+ }++ // Straps sized to the cheek at their own x, so each one lies on the bracket.+ const boltGeo = cylinderZGeo(0.017, 0.017, 0.022, 8);+ const strapX = [0.56, 0.10, -0.60, -1.50, -2.30];+ for (const sz of [-1, 1]) {+ const side = sz > 0 ? 'R' : 'L';+ for (let i = 0; i < strapX.length; i++) {+ const x = strapX[i];+ const top = edgeAt(topEdge, x) - 0.02;+ const bot = edgeAt(botEdge, x) + 0.02;+ const h = top - bot;+ const cy = (top + bot) / 2;+ createPart(`Strap_${side}${i}`, boxUnwrap(boxGeo(0.06, h, 0.014)), iron, {+ position: [x, cy, sz * (CHEEK_Z + CHEEK_T / 2 + 0.007)], parent: root,+ });+ for (const t of [0.22, 0.78]) {+ createPart(`Bolt_${side}${i}${t > 0.5 ? 'a' : 'b'}`, boltGeo, iron, {+ position: [x, bot + h * t, sz * (CHEEK_Z + CHEEK_T / 2 + 0.019)], parent: root,+ });+ }+ }+ }++ // Quoin: the wedge that sets elevation, seated under the breech.+ // The breech drops into the channel between the cheeks and rests on this. It+ // spans the full channel width, as the real wedge does.+ createPart('Quoin', await uv(await extrudeProfile([[0, 0], [0.55, 0], [0.55, 0.24]], { depth: 0.34, axis: 'z', bevel: 0.012 })), oak, {+ position: [-0.20, 0.78, 0], parent: root,+ });++ // ---------- Axle ----------+ const AXLE_X = 0.35;+ const AXLE_Y = 0.62;+ createPart('Axle', cylinderZGeo(0.075, 0.075, 1.20, 20), oak, { position: [AXLE_X, AXLE_Y, 0], parent: root });+ for (const sz of [-1, 1]) {+ createPart(`AxleArm_${sz > 0 ? 'R' : 'L'}`, cylinderZGeo(0.055, 0.048, 0.22, 16), iron, { position: [AXLE_X, AXLE_Y, sz * 0.66], parent: root });+ }++ // ---------- Wheels: hub, twelve spokes, felloe, iron tyre, nails ----------+ const hubGeo = await uv(await revolveProfile(+ [[0.045, -0.13], [0.115, -0.13], [0.155, -0.07], [0.155, 0.07], [0.115, 0.13], [0.045, 0.13]],+ { segments: 24, axis: 'z', bevel: 0.008 },+ ));+ const hubBandGeo = cylinderZGeo(0.162, 0.162, 0.035, 24);+ const spokeGeo = cylinderGeo(0.028, 0.042, 0.38, 8);+ const felloeGeo = await uv(await revolveProfile(+ [[0.495, -0.058], [0.600, -0.058], [0.600, 0.058], [0.495, 0.058]], { segments: 48, axis: 'z', bevel: 0.012 },+ ));+ const tyreGeo = await uv(await revolveProfile(+ [[0.598, -0.064], [0.632, -0.064], [0.632, 0.064], [0.598, 0.064]], { segments: 48, axis: 'z', bevel: 0.006 },+ ));+ const nailGeo = cylinderGeo(0.016, 0.016, 0.02, 6);++ for (const sz of [-1, 1]) {+ const side = sz > 0 ? 'R' : 'L';+ const wheel = createPivot(`Wheel_${side}`, [AXLE_X, AXLE_Y, sz * 0.60], root);+ createPart(`Hub_${side}`, hubGeo, oak, { parent: wheel });+ createPart(`HubBandOut_${side}`, hubBandGeo, iron, { position: [0, 0, 0.09], parent: wheel });+ createPart(`HubBandIn_${side}`, hubBandGeo, iron, { position: [0, 0, -0.09], parent: wheel });+ const spoke = createPart(`Spoke_${side}0`, spokeGeo, oak, { position: [0, 0.33, 0], parent: wheel });+ arrayRadial(`Spoke_${side}`, spoke, 12, 'z', wheel);+ createPart(`Felloe_${side}`, felloeGeo, oak, { parent: wheel });+ createPart(`Tyre_${side}`, tyreGeo, iron, { parent: wheel });+ const nail = createPart(`Nail_${side}0`, nailGeo, iron, { position: [0, 0.636, 0], parent: wheel });+ arrayRadial(`Nail_${side}`, nail, 16, 'z', wheel);+ }++ // ---------- Trail furniture ----------+ createPart('Lunette', await uv(await extrudeProfile(circleProfile(0.10, 20), {+ depth: 0.032, axis: 'y', holes: [circleProfile(0.062, 20)], bevel: 0.008,+ })), iron, { position: [-2.62, 0.09, 0], parent: root });++ createPart('TrailShoe', await uv(await roundedBoxGeo(0.22, 0.10, 0.40, 0.016)), iron, {+ position: [-2.44, 0.05, 0], parent: root,+ });++ // Handspike seated against the outer face of the right cheek.+ createPart('Handspike', cylinderXGeo(0.032, 0.046, 0.90, 12), oak, {+ position: [-1.70, 0.34, CHEEK_Z + CHEEK_T / 2 + 0.05], rotation: [0, 0, 12], parent: root,+ });++ return root;+}diff --git a/examples/gun-cpu.png b/examples/gun-cpu.pngnew file mode 100644index 00000000..62e14a2dBinary files /dev/null and b/examples/gun-cpu.png differdiff --git a/examples/gun-gpu.png b/examples/gun-gpu.pngnew file mode 100644index 00000000..14dcd7feBinary files /dev/null and b/examples/gun-gpu.png differdiff --git a/examples/hero-sheet.png b/examples/hero-sheet.pngindex ad78f031..14dcd7fe 100644Binary files a/examples/hero-sheet.png and b/examples/hero-sheet.png differdiff --git a/examples/well-cpu.png b/examples/well-cpu.pngdeleted file mode 100644index 7c0db1cb..00000000Binary files a/examples/well-cpu.png and /dev/null differdiff --git a/examples/well-gpu.png b/examples/well-gpu.pngdeleted file mode 100644index ad78f031..00000000Binary files a/examples/well-gpu.png and /dev/null differdiff --git a/skills/kiln-author-asset/SKILL.md b/skills/kiln-author-asset/SKILL.mdindex 2fe27b86..9f68c841 100644--- a/skills/kiln-author-asset/SKILL.md+++ b/skills/kiln-author-asset/SKILL.md@@ -46,15 +46,106 @@ Check, in this order:Use **`kiln_inspect`** for a close-up orbit on a named part when a cell is too small to judge, and**`kiln_screenshot_animation`** when the program has an `animate()`.+## The quality bar++**Build it as though it ships in a AAA title.** Not "a recognizable X" — the version of X a studio+artist would put in front of a camera. Every asset you author should survive being placed next to a+real production asset without looking like the cheap one.++That bar is not rhetoric; it is the actual standard you check against in the critic loop below. An+asset that validates, renders, and is recognizable has cleared the *floor*, not the bar. Most+programs stop at the floor. Do not.++### There is no triangle budget++Kiln does not have one. Not a soft one, not an advisory, not a number you should feel is generous.+`kiln_validate` will not warn you for density and `validateAsset` will not either — those advisories+existed and were deliberately deleted, because every number they printed read as a target to stay+under, and the result was assets that stopped at the blockout stage.++Triangles are not a runtime cost driver. Draw calls are, and those track distinct **materials**, not+geometry. So:++- **Detail is free. Spend it.** Ten thousand triangles on a hero prop is normal, not extravagant.+- If a render comes back at a few hundred triangles and nobody asked for low-poly, you built a+ blockout and stopped. Go back.+- The only real limits are the ones you were explicitly given in the request.++Reuse materials where surfaces genuinely match — that is the number worth economizing. Never trade+away geometry to protect a grade.++### Work in three passes++Most failures are stopping after pass one.++1. **Silhouette.** Primary masses only. Get proportion and orientation right — detail on a wrong+ shape is wasted work, and this is what the contact sheet judges hardest.+2. **Structure.** Break the masses into the parts the real object actually has: individual planks+ rather than one slab, staves rather than a cylinder, panels, frames, joints, trim, thickness.+ **Count the parts on the real thing and match that count.**+3. **Detail.** Bolts, hinges, brackets, rivets, straps, chamfers, seams, wear, overhangs, sag,+ asymmetry. Small repeated elements are what read as *made* rather than *generated*, and they cost+ nothing you have to save.++### Reach for the tools that make detail cheap++Boxes and cylinders alone produce blockouts. The catalog exists to get past that:++- `roundedBoxGeo` instead of `boxGeo` on anything manufactured — a chamfer catches light and reads as+ a real object instead of a primitive. This is the single highest-value substitution available.+- `subdivide` for organic or worn forms. Each iteration is roughly 4x the triangles; that is the+ point.+- `boolDiff` / `boolUnion` / `boolIntersect` for openings, sockets, recesses, and cut joinery — real+ joinery instead of parts parked against each other.+- `revolveProfile` / `extrudeProfile` for anything turned or extruded: posts, rims, mouldings,+ finials. A revolved profile looks crafted in a way a stack of cylinders never does.+- `hull` for organic bulk from a few control points.+- Arrays for repeated structure: staves, planks, rivets, palings, tiles, links.++Run `kiln_list_primitives` filtered to `csg`, `mesh-ops`, `curves`, and `arrays` before concluding a+shape is "as good as primitives allow". It usually is not.++## The critic loop++This is the part that produces quality, and it is the part that gets skipped.++After a render that builds and looks broadly right, **stop being the author and become a hostile art+director reviewing someone else's work.** Not a light polish pass — an adversarial one. If your+harness can hand the render to a fresh agent or a separate reviewing pass with no memory of writing+the program, do that; a fresh reader is much harder to fool than the author. If it cannot, run the+pass explicitly and in writing anyway.++The critic's job:++1. **Name a real reference.** Say out loud what real object or production asset this is competing+ with. "A weathered oak barrel from a period drama set." Vague targets produce vague assets.+2. **Compare side by side, and be specific.** For each of silhouette, proportion, part count,+ joinery, surface detail, and wear: does the render hold up against that reference, or does it+ read as the cheap version? Name the gap in words. "The staves are too uniform and there are no+ hoops" is actionable; "needs more detail" is not.+3. **Answer one question honestly: if these two were shown blind, which is obviously the generated+ one — and what gave it away?** The giveaway is your next task.+4. **Be harsh.** "Good enough" from the author is the default state of every asset and it is what+ ceilings quality. If the critic pass produces no findings, the pass was not run properly — look+ again at the cell you skimmed.++Then go fix the findings and render again. **Loop.** Keep looping until the critic pass genuinely+cannot name a gap that matters, not until you are tired of looping or the program stops erroring.++Two things that end the loop legitimately: the critic has no substantive finding left, or you have+hit a real limit of the primitives and can say concretely what it is. "It builds" is not one of them.+## Rules that save renders-- Build the silhouette first, then subdivide. Detail on a wrong shape is wasted work.+- Build the silhouette first, then add detail. See the three passes above.- Name parts for what they are. The names survive into the GLB and are how the next agent, and thegame engine, address them.-- Reuse materials. The instanceability grade is driven by distinct-material count, and fewer shared- materials grade higher.-- Prefer a few well-placed primitives over many small ones. Triangle budget is a soft warning, not a- wall, but a 40k-triangle crate is a mistake.+- **Proportion errors are more damaging than missing detail.** A roof that does not oversail the+ walls it covers, posts too thin for what they carry, or a part that floats reads as broken no+ matter how much detail sits on it. Check the orthographic cells against how the real object is+ actually built and loaded.+- Reuse materials where surfaces genuinely match. The instanceability grade rewards fewer distinct+ materials, but grade is informational — a B that looks right beats an A that looks like a toy.- If two consecutive renders look the same, you are not changing what you think you are changing.Re-read the program instead of rendering a third time.diff --git a/skills/kiln-qa-asset/SKILL.md b/skills/kiln-qa-asset/SKILL.mdindex a9609d5f..d64731df 100644--- a/skills/kiln-qa-asset/SKILL.md+++ b/skills/kiln-qa-asset/SKILL.md@@ -53,6 +53,23 @@ Nothing upstream has looked at the asset in its real scene. You are the first th- **Occlusion and collision.** Geometry that blocks the camera or traps the player.- **Draw calls.** A visually fine asset that costs 400 draws is a performance bug, not a win.+## The visual bar++`visualQa: not_assessed` means you own the aesthetic verdict, and a functional pass is not one.+Once the asset loads correctly in the real scene, judge it the way an art director would:++- **Name what it is competing with.** The real object, or a production asset from a comparable+ title. Write it down.+- **Ask which one is obviously the generated one, and what gives it away.** Uniformity, missing+ secondary structure, absent wear, parts parked against each other instead of joined, edges with no+ chamfer catching no light. Name the specific giveaway.+- **Report it as a finding, not a footnote.** "Loads correctly; reads as a blockout next to the+ surrounding set dressing" is the useful sentence. An asset that works and looks cheap is a real+ defect, and it is the one nothing upstream can catch.++Detail is not a cost here — Kiln has no triangle budget and draw calls track materials, not+geometry. If the fix is "author more of it", that fix is available.+## Boundaries- A successful load is not a QA result. Neither is a passing type check.diff --git a/src/__tests__/__snapshots__/prompt-api.test.ts.snap b/src/__tests__/__snapshots__/prompt-api.test.ts.snapindex 80909f56..b23f3672 100644--- a/src/__tests__/__snapshots__/prompt-api.test.ts.snap+++ b/src/__tests__/__snapshots__/prompt-api.test.ts.snap@@ -361,7 +361,7 @@ countTriangles(root: Object3D) // Sums triangle count across every mesh in thecountMaterials(root: Object3D) // Unique material count (by reference) across the subtree.getJointNames(root: Object3D) // All node names beginning with \`Joint_\`. Use to sanity-check animation targets.validateAsset(root: Object3D, category: 'character' | 'prop' | 'vfx' | 'environment' | 'architecture' | 'vegetation' | 'vehicle')- // Warns on category-appropriate triangle / material budgets."+ // Warns on high distinct-material count (draw calls). No triangle limit; detail is free."`;exports[`unified api surface (examples folded in) unified api snapshot (review folded examples in this diff) 1`] = `@@ -883,6 +883,6 @@ countMaterials(root: Object3D) // Unique material count (by reference) across tgetJointNames(root: Object3D) // All node names beginning with \`Joint_\`. Use to sanity-check animation targets.// e.g. const joints = getJointNames(root);validateAsset(root: Object3D, category: 'character' | 'prop' | 'vfx' | 'environment' | 'architecture' | 'vegetation' | 'vehicle')- // Warns on category-appropriate triangle / material budgets.+ // Warns on high distinct-material count (draw calls). No triangle limit; detail is free.// e.g. const v = validateAsset(root, 'prop');"`;diff --git a/src/__tests__/geometry-gains.test.ts b/src/__tests__/geometry-gains.test.tsindex 8d169335..9e705ebe 100644--- a/src/__tests__/geometry-gains.test.ts+++ b/src/__tests__/geometry-gains.test.ts@@ -158,6 +158,10 @@ describe('settleContacts', () => {});describe('tri estimate upgrades', () => {+ // These used to observe the estimator through the TRI_BUDGET_EXCEEDED advisory,+ // which no longer exists — Kiln has no triangle budget on purpose. The estimate+ // itself is still computed and is now surfaced directly on the result as+ // information, so these assert on the number rather than on a verdict about it.const wrap = (body: string) => `const meta = { name: 'est', category: 'prop' };function build() {@@ -173,28 +177,37 @@ describe('tri estimate upgrades', () => {wrap(`for (let i = 0; i < 8; i++) {createPart('P' + i, cylinderGeo(0.1, 0.1, 1, 16), gameMaterial('#999999'), { parent: root });}`),- { category: 'vfx' }, // 2000 budget — single counting stays silent+ { category: 'vfx' },);expect(r.valid).toBe(true);- // 50 spheres at 32x16 → 50 * 1024 = 51200 > prop budget (25000) * 1.5 → advisory fires.+ expect(r.estimatedTris).toBe(512);++ // 50 spheres at 32x16 -> 50 * 1024 = 51200. Dense, and entirely unremarkable:+ // it validates clean and draws no advisory of any kind.const heavy = validate(wrap(`for (let i = 0; i < 50; i++) {createPart('S' + i, sphereGeo(0.5, 32, 16), gameMaterial('#999999'), { parent: root });}`),{ category: 'prop' },);- expect(heavy.warnings.some((w) => w.message.includes('tris'))).toBe(true);+ expect(heavy.valid).toBe(true);+ expect(heavy.estimatedTris).toBe(51200);+ expect(heavy.warnings.some((w) => /triangle|budget/i.test(w.message))).toBe(false);});test('gearGeo and subdivide contribute estimates', () => {const r = validate(wrap(`createPart('Gear', gearGeo({ teeth: 64 }), gameMaterial('#999999'), { parent: root }); // ~2048- const blob = subdivide(sphereGeo(1, 16, 12), 3); // 384 base * 64 → ~24576+ const blob = subdivide(sphereGeo(1, 16, 12), 3); // 384 base * 64 -> ~24576createPart('Blob', blob, gameMaterial('#999999'), { parent: root });`),- { category: 'vfx' }, // budget 15000 * 1.5 = 22500 → combined ~26600 trips the advisory+ { category: 'vfx' },);- expect(r.warnings.some((w) => w.message.includes('tris'))).toBe(true);+ expect(r.valid).toBe(true);+ // Both call sites contribute: the gear's teeth-driven estimate and the+ // subdivision's 4^n multiplier.+ expect(r.estimatedTris).toBeGreaterThan(22500);+ expect(r.warnings.some((w) => /triangle|budget/i.test(w.message))).toBe(false);});});diff --git a/src/__tests__/primitives.test.ts b/src/__tests__/primitives.test.tsindex 36e61f40..bed4c646 100644--- a/src/__tests__/primitives.test.ts+++ b/src/__tests__/primitives.test.ts@@ -849,15 +849,25 @@ describe('validateAsset advisories', () => {expect(r.errors).toEqual([]);});- test('warns when triangle budget is exceeded for the category', () => {+ test('never warns on triangle count, however dense', () => {+ // A sphere(2, 64, 64) is ~8192 tris. Under the old `suggestedTris` table a+ // prop was scolded at 3,001 — and a model iterating with this function in+ // hand reads that as an instruction to delete detail. Triangles are not a+ // draw-call cost, so the advisory was removed. Do not reinstate it.const root = createRoot('Heavy');- // A sphere(2, 64, 64) is ~8192 tris, blows the prop budget (3000).createPart('Big', sphereGeo(2, 64, 64), gameMaterial(0x00ff00), {parent: root,});const r = validateAsset(root, 'prop');expect(r.valid).toBe(true);- expect(r.warnings.some((w) => w.startsWith('High triangle count'))).toBe(true);+ expect(r.warnings).toEqual([]);+ });++ test('triangle count stays measurable even though nothing judges it', () => {+ const root = createRoot('Heavy');+ createPart('Big', sphereGeo(2, 64, 64), gameMaterial(0x00ff00), { parent: root });+ expect(countTriangles(root)).toBeGreaterThan(3000);+ expect(validateAsset(root, 'prop').warnings).toEqual([]);});test('warns when material budget is exceeded', () => {@@ -870,7 +880,7 @@ describe('validateAsset advisories', () => {expect(r.warnings.some((w) => w.startsWith('High material count'))).toBe(true);});- test('character / environment categories use their own budgets', () => {+ test('character / environment categories use their own material limits', () => {// Drive both branches of the guidelines lookup.const root = createRoot('R');expect(validateAsset(root, 'character').valid).toBe(true);diff --git a/src/__tests__/validation-hardened.test.ts b/src/__tests__/validation-hardened.test.tsindex c201627f..543905fd 100644--- a/src/__tests__/validation-hardened.test.ts+++ b/src/__tests__/validation-hardened.test.ts@@ -217,41 +217,49 @@ function build() {});});-describe('kiln validation — tri budget advisory', () => {- test('warns when a prop exceeds its tri budget', () => {- // 20x sphereGeo(1, 32, 32) -> 20 * 2048 = 40960 tris, dwarfs prop 3000.- const geo = Array.from({ length: 20 })- .map(- () =>- " createPart('S' + Math.random(), sphereGeo(1, 32, 32), gameMaterial(0xff0000), { parent: root });",- )- .join('\n');- const r = validate(- `+describe('kiln validation — no triangle budget', () => {+ // Kiln deliberately has no triangle advisory. It used to, and the measured+ // effect was models that stopped at the blockout stage to stay under a number+ // that never gated anything. These tests exist so it does not come back.+ //+ // 20 x sphereGeo(1, 32, 32) is ~40,960 estimated triangles, which comfortably+ // cleared every soft reference point the old table held.+ const HEAVY = `const meta = { name: 'Heavy' };function build() {const root = createRoot('Heavy');-${geo}+ for (let i = 0; i < 20; i++) {+ createPart('S' + i, sphereGeo(1, 32, 32), gameMaterial(0xff0000), { parent: root });+ }return root;}-`,- { category: 'prop' },- );+`;++ test('a 40k-triangle prop validates clean, with no size advisory', () => {+ const r = validate(HEAVY, { category: 'prop' });expect(r.valid).toBe(true);- expect(r.warnings.some((w) => w.code === 'TRI_BUDGET_EXCEEDED')).toBe(true);+ expect(r.warnings.some((w) => w.code === 'TRI_BUDGET_EXCEEDED')).toBe(false);+ expect(r.warnings.some((w) => /triangle|budget/i.test(w.message))).toBe(false);});- test('does not warn without a category hint', () => {- // Same heavy scene, but no category → we don't have a budget to compare.- const r = validate(`-const meta = { name: 'Heavy' };-function build() {- const root = createRoot('Heavy');- createPart('S', sphereGeo(1, 32, 32), gameMaterial(0xff0000), { parent: root });- return root;-}-`);- expect(r.warnings.some((w) => w.code === 'TRI_BUDGET_EXCEEDED')).toBe(false);+ test('no category produces a size advisory', () => {+ const categories = ['prop', 'character', 'vfx', 'environment', 'vehicle'];+ for (const category of categories) {+ const r = validate(HEAVY, { category });+ expect(r.valid).toBe(true);+ expect(r.warnings.some((w) => /triangle|budget/i.test(w.message))).toBe(false);+ }+ const neutral = validate(HEAVY);+ expect(neutral.valid).toBe(true);+ expect(neutral.warnings.some((w) => /triangle|budget/i.test(w.message))).toBe(false);+ });++ test('triangles are still estimated, just never judged', () => {+ // The estimate stays available to callers as information; nothing compares+ // it to a limit.+ const r = validate(HEAVY, { category: 'prop' });+ expect(r.valid).toBe(true);+ expect(r.warnings.every((w) => w.code !== 'TRI_BUDGET_EXCEEDED')).toBe(true);});});diff --git a/src/cli.ts b/src/cli.tsindex 7e0e91e7..95bfe526 100644--- a/src/cli.ts+++ b/src/cli.ts@@ -106,7 +106,8 @@ export function parseArgs(argv: readonly string[]): Args {break;case '--max-steps': {const n = Number(next());- if (!Number.isInteger(n) || n <= 0) throw new Error('--max-steps must be a positive integer');+ if (!Number.isInteger(n) || n <= 0)+ throw new Error('--max-steps must be a positive integer');args.maxSteps = n;break;}diff --git a/src/list-primitives.ts b/src/list-primitives.tsindex 23152c95..bc1d9541 100644--- a/src/list-primitives.ts+++ b/src/list-primitives.ts@@ -1036,7 +1036,8 @@ const PRIMITIVES: PrimitiveSpec[] = ["validateAsset(root: Object3D, category: 'character' | 'prop' | 'vfx' | 'environment' | 'architecture' | 'vegetation' | 'vehicle')",returns: '{ valid, errors, warnings }',category: 'utility',- description: 'Warns on category-appropriate triangle / material budgets.',+ description:+ 'Warns on high distinct-material count (draw calls). No triangle limit; detail is free.',example: "const v = validateAsset(root, 'prop');",},];diff --git a/src/mcp-parity.test.ts b/src/mcp-parity.test.tsindex 46af3caf..de97bddc 100644--- a/src/mcp-parity.test.ts+++ b/src/mcp-parity.test.ts@@ -28,7 +28,9 @@ import { runTool, kilnMcpToolDefs, createKilnMcpServer } from './mcp-server';* making is against what the SDK actually puts on the wire. A test against our own* converter would have been a test of the converter, not of the surface.*/-async function listToolsOverMcp(): Promise<{ name: string; description?: string; inputSchema: unknown }[]> {+async function listToolsOverMcp(): Promise<+ { name: string; description?: string; inputSchema: unknown }[]+> {const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();const server = createKilnMcpServer();const client = new Client({ name: 'kiln-parity', version: '0' });@@ -112,7 +114,7 @@ describe('tool surface parity across transports', () => {}});- it("the in-process generate surface keeps the baseline plus a terminal submit", () => {+ it('the in-process generate surface keeps the baseline plus a terminal submit', () => {// Unchanged by the MCP recomposition: the engine's own loop still runs the// frozen baseline, and still needs an unambiguous stopping action.const baseline = new Set(createKilnToolRegistry().map((d) => d.name));diff --git a/src/primitives.ts b/src/primitives.tsindex 46fa6a15..94f8ac7f 100644--- a/src/primitives.ts+++ b/src/primitives.ts@@ -1486,6 +1486,16 @@ export function getJointNames(root: THREE.Object3D): string[] {/*** Validates asset against category guidelines.* Returns warnings for guidance but doesn't block on limits.+ *+ * There is no triangle advisory here, deliberately. This function used to warn+ * above a per-category `suggestedTris` (a prop was scolded at 3,001 triangles),+ * and a model that calls it while iterating reads that warning as an instruction+ * to remove detail. Triangle count is not a runtime cost driver — draw calls+ * are, which is what the material advisory below actually measures — so the+ * triangle line cost real asset quality and bought nothing.+ *+ * `countTriangles` is still exported and still reported in render metrics. It is+ * information, not a verdict.*/export function validateAsset(root: THREE.Object3D,@@ -1494,26 +1504,23 @@ export function validateAsset(const errors: string[] = [];const warnings: string[] = [];- const guidelines = {- character: { suggestedTris: 5000, suggestedMats: 8 },- prop: { suggestedTris: 3000, suggestedMats: 6 },- vfx: { suggestedTris: 2000, suggestedMats: 4 },- environment: { suggestedTris: 15000, suggestedMats: 12 },- architecture: { suggestedTris: 15000, suggestedMats: 12 },- vegetation: { suggestedTris: 12000, suggestedMats: 8 },- vehicle: { suggestedTris: 20000, suggestedMats: 10 },+ // Distinct-material count drives draw calls and the instanceability grade,+ // which is a real cost. Unlike triangles, this one is worth saying out loud.+ const suggestedMats: Record<AssetCategory, number> = {+ character: 8,+ prop: 6,+ vfx: 4,+ environment: 12,+ architecture: 12,+ vegetation: 8,+ vehicle: 10,};- const limits = guidelines[category];- const tris = countTriangles(root);const mats = countMaterials(root);+ const matLimit = suggestedMats[category];- if (tris > limits.suggestedTris) {- warnings.push(`High triangle count: ${tris} (suggested: ${limits.suggestedTris})`);- }-- if (mats > limits.suggestedMats) {- warnings.push(`High material count: ${mats} (suggested: ${limits.suggestedMats})`);+ if (mats > matLimit) {+ warnings.push(`High material count: ${mats} (suggested: ${matLimit})`);}return { valid: true, errors, warnings };diff --git a/src/prompt.ts b/src/prompt.tsindex febb673d..011fe5da 100644--- a/src/prompt.ts+++ b/src/prompt.ts@@ -79,7 +79,7 @@ Generate assets with realistic proportions and detail:- Multiple materials with PBR properties (metalness, roughness)- Include fine details (seams, edges, bevels)- Subtle color gradients-- Higher triangle budgets allowed`,+- Spend geometry freely; there is no triangle limit`,};// =============================================================================diff --git a/src/tools/__tests__/registry-context.test.ts b/src/tools/__tests__/registry-context.test.tsindex 94b1649f..7670653d 100644--- a/src/tools/__tests__/registry-context.test.ts+++ b/src/tools/__tests__/registry-context.test.ts@@ -60,18 +60,23 @@ const warningStrings = (output: unknown): string[] =>((output as { warnings?: string[] }).warnings ?? []).map(String);describe('trusted tool context', () => {- test('validation uses requested vehicle and ignores false model meta.category', async () => {- const vehicleValidate = find(createKilnToolRegistry({ category: 'vehicle' }), 'kiln_validate');- const propValidate = find(createKilnToolRegistry({ category: 'prop' }), 'kiln_validate');- const neutralValidate = find(createKilnToolRegistry(), 'kiln_validate');+ test('a dense asset draws no size advisory under any trusted category', async () => {+ // This used to assert that a trusted `prop` context produced a triangle+ // advisory the model's own false `meta.category` could not dodge. The+ // advisory is gone on purpose — it taught models to stop at the blockout+ // stage — so what is worth pinning now is the inverse: no category, trusted+ // or claimed, turns a heavy asset into a warning.+ const contexts = [+ find(createKilnToolRegistry({ category: 'vehicle' }), 'kiln_validate'),+ find(createKilnToolRegistry({ category: 'prop' }), 'kiln_validate'),+ find(createKilnToolRegistry(), 'kiln_validate'),+ ];- const vehicle = await vehicleValidate.run({ code: FALSE_PROP_BUDGET_CODE });- const prop = await propValidate.run({ code: FALSE_PROP_BUDGET_CODE });- const neutral = await neutralValidate.run({ code: FALSE_PROP_BUDGET_CODE });-- expect(warningStrings(vehicle).some((warning) => warning.includes('TRI_BUDGET'))).toBe(false);- expect(warningStrings(prop).some((warning) => warning.includes('Estimated'))).toBe(true);- expect(warningStrings(neutral).some((warning) => warning.includes('Estimated'))).toBe(false);+ for (const def of contexts) {+ const warnings = warningStrings(await def.run({ code: FALSE_PROP_BUDGET_CODE }));+ expect(warnings.some((warning) => warning.includes('TRI_BUDGET'))).toBe(false);+ expect(warnings.some((warning) => /triangle/i.test(warning))).toBe(false);+ }});test('intent is authoritative and render/screenshot paths receive vehicle context', async () => {diff --git a/src/tools/registry.ts b/src/tools/registry.tsindex 6d921a4f..59ba929f 100644--- a/src/tools/registry.ts+++ b/src/tools/registry.ts@@ -1521,7 +1521,7 @@ export function createKilnToolRegistry(context: KilnToolContext = {}): KilnToolD{name: 'kiln_validate',description:- 'Statically validate Kiln source code before rendering. Checks for the required `meta` const and `build()` function, `value:` keyframe typos, infinite loops, recursive build() calls, and syntax errors. Returns { valid, errors, warnings }. Warnings are advisory only (they never make code invalid), including a soft, generous triangle-count nudge. Run this to catch mistakes cheaply before kiln_render.',+ 'Statically validate Kiln source code before rendering. Checks for the required `meta` const and `build()` function, `value:` keyframe typos, infinite loops, recursive build() calls, and syntax errors. Returns { valid, errors, warnings }. Warnings are advisory only (they never make code invalid). There is NO triangle budget: density is never warned about, so build as much detail as the asset deserves. Run this to catch mistakes cheaply before kiln_render.',inputSchema: validateInput,run: async (input) => runValidate(validateInput.parse(input), context),},diff --git a/src/validation.ts b/src/validation.tsindex 96725985..ca16f57c 100644--- a/src/validation.ts+++ b/src/validation.ts@@ -53,20 +53,34 @@ export interface ValidationResult {*/issues: ValidationIssue[];/**- * Non-fatal advisories (tri budget, style suggestions). Never block+ * Non-fatal advisories (style and unit suggestions). Never block* execution, always worth surfacing to agents.*/warnings: ValidationIssue[];+ /**+ * Static triangle estimate for `build()`, summed from primitive call sites and+ * scaled by literal loop bounds. Present only when the body parsed.+ *+ * This is information and nothing else. No advisory, warning, or gate reads+ * it, and none should: Kiln has no triangle budget by design, because every+ * number it used to print read to a model as a target to stay under. Surface+ * it to a caller who asked how big something is; never compare it to a limit.+ */+ estimatedTris?: number;}// =============================================================================-// Budget table+// Triangle estimation// =============================================================================/**- * Rough static triangle estimates for every geometry primitive. Used to add a- * "your asset is likely to blow the category budget" warning before a render- * is attempted. Exact numbers come from Three.js's own primitive builders.+ * Rough static triangle estimates for every geometry primitive. Exact numbers+ * come from Three.js's own primitive builders.+ *+ * Reported, never judged: `analyzeBody` sums these into `estimatedTris` so a+ * caller can SEE the scale of what a program will build. Nothing compares the+ * result to a limit — see the note above `validate` on why the budget advisory+ * was removed.*/function estimateGeometryTris(name: string, args: readonly acorn.Expression[]): number | null {function asNum(node: acorn.Expression | undefined): number | null {@@ -154,27 +168,19 @@ function estimateGeometryTris(name: string, args: readonly acorn.Expression[]):}}-// Advisory-only soft reference points, NOT limits. Raised substantially in the-// 2026-06 instanceability cycle: the old values (character 5000 / prop 3000 /-// vfx 2000 / environment 15000) predated the More-detail toggle and the finding-// that triangles are not a cost driver (input tokens dominate generation cost,-// and runtime cost is draw-calls-not-tris). These exist only so a wildly over--// budget asset gets a gentle informational nudge; they never gate. See-// docs/kiln-instanceability-and-runtime-instancing-cycle.md.-const CATEGORY_TRI_BUDGETS: Record<string, number> = {- character: 40000,- prop: 25000,- vfx: 15000,- environment: 120000,- vegetation: 40000,- vehicle: 40000,- weapon: 20000,- building: 60000,- architecture: 60000,-};-// Fallback when a category has no specific entry, so the advisory still has a-// reference point instead of silently never firing.-const DEFAULT_TRI_BUDGET = 40000;+// There is deliberately no triangle budget here.+//+// Kiln used to emit a TRI_BUDGET_EXCEEDED advisory against per-category soft+// reference points. It was removed because it was actively harmful: triangles+// are not a cost driver (input tokens dominate generation cost, and runtime cost+// is draw-calls-not-triangles), and every number the advisory printed read to a+// model as a target to stay under. The measured effect was assets that stopped+// at the blockout stage — a few hundred triangles for something that wanted tens+// of thousands. `analyzeBody` still estimates triangles, and the render path+// still reports the real count; nothing judges either against a limit.+//+// If you want a cap, pass one explicitly through `request.budget.maxTriangles`.+// That is a caller's deliberate constraint, not a default the validator invents.// =============================================================================// Core validator@@ -184,9 +190,14 @@ const DEFAULT_TRI_BUDGET = 40000;* Validate Kiln code before rendering.** @param code raw JS string as returned by the LLM- * @param opts optional hints the validator can use for richer checks+ * @param _opts accepted and currently unread. Every category-dependent+ * advisory this validator had was the triangle budget, and that+ * is gone. The option stays in the signature because callers+ * pass it and because category-aware STRUCTURAL advisories are+ * the natural place for it to come back. It must not come back+ * as a size limit.*/-export function validate(code: string, opts: { category?: string } = {}): ValidationResult {+export function validate(code: string, _opts: { category?: string } = {}): ValidationResult {const issues: ValidationIssue[] = [];const warnings: ValidationIssue[] = [];@@ -291,7 +302,7 @@ export function validate(code: string, opts: { category?: string } = {}): Valida});}- // --- Body analysis — infinite loops, recursion, tri budget --------------+ // --- Body analysis — infinite loops, recursion ---------------------------const analysis = analyzeBody(ast);@@ -315,22 +326,6 @@ export function validate(code: string, opts: { category?: string } = {}): Valida});}- // Tri-count advisory — INFORMATIONAL ONLY, never a gate (it is a warning, so- // it never sets valid:false). LLMs over- and under-estimate both ways, tris- // are not a cost driver, and the More-detail toggle deliberately pushes tris- // up — so this only nudges on assets well past a generous soft reference.- if (analysis.estimatedTris > 0 && opts.category) {- const budget = CATEGORY_TRI_BUDGETS[opts.category] ?? DEFAULT_TRI_BUDGET;- if (analysis.estimatedTris > budget * 1.5) {- warnings.push({- code: 'TRI_BUDGET_EXCEEDED',- message: `Estimated ${analysis.estimatedTris} tris (informational; "${opts.category}" assets typically land under ~${budget}). This is not a limit — keep the detail if the silhouette needs it.`,- fixHint:- 'Only if the asset feels over-dense: reduce segments on cylinderGeo/sphereGeo, or drop hidden interior parts.',- });- }- }-// Rotation-units advisory: createPart/createInstance rotation is DEGREES,// but models steeped in raw THREE habitually write radians — which silently// flatten to ~0°. Caught live 2026-06-11 (AC-47 prop blades all vertical).@@ -344,7 +339,7 @@ export function validate(code: string, opts: { category?: string } = {}): Valida});}- return toResult(issues, warnings);+ return toResult(issues, warnings, analysis.estimatedTris);}// Backward-compat alias.@@ -695,12 +690,17 @@ function collectStaticStringBindings(ast: acorn.Program): ReadonlyMap<string, streturn values;}-function toResult(issues: ValidationIssue[], warnings: ValidationIssue[]): ValidationResult {+function toResult(+ issues: ValidationIssue[],+ warnings: ValidationIssue[],+ estimatedTris?: number,+): ValidationResult {return {valid: issues.length === 0,errors: issues.map((i) => i.message),issues,warnings,+ ...(estimatedTris === undefined ? {} : { estimatedTris }),};}