A rigorous multi-file software-engineering benchmark. Agents plan, then build complex projects,
scored on a transparent rubric mixing automated tooling (Tier A) with an agent panel (Tier B). The rubric is
public and handed to agents upfront. Click any build to play it inline.
Β· πΌοΈ Backgrounds showcase β (each visualization, full-screen)
Two distinct quadtrees by purpose: a region QuadTree in graph-core for range-query picking (F8) and a separate pooled SoA Barnes-Hut tree in barnes-hut.ts for force aggregation β clean separation rather than overloading one structure.
Barnes-Hut is fully allocation-free per frame: structure-of-arrays Int32/Float64 node pool with iterative stack traversal (reused Int32Array stack), growKeeping() only on pathologically deep inputs β genuinely controls GC (F11).
Render-on-demand decouples idle FPS from active cost: needsRender flag means a settled graph idles near-free, and SELF.md honestly separates the inflated idle 60fps from the real workload() number instead of gaming the metric.
Edge rendering is two-pass batched: one beginPath/stroke for all 10k dim edges, a second path only for highlighted edges β keeps the whole frame to ~1 stroke + ~N_group fills.
Two distinct spatial structures: a clean pure-TS QuadTree in graph-core.ts for the acceptance contract, plus a separate flat typed-array BarnesHutTree (SoA: centerX/massX/firstChild Int32Array) used in the hot sim loop β avoids object-per-node GC churn.
CSR adjacency layout (adjacencyStarts + adjacency Uint32Array built via cursor scatter) gives O(1) neighbor lookup for hover/click focus instead of scanning edges each frame.
Mask-based rendering pipeline: separate visibleMask/searchMask/focusMask Uint8Arrays composed per-frame, with edges dimmed (rgba alpha drop) when focus is active for visual emphasis.
Seeded deterministic graph generation (mulberry32) with clustered communities placed on a ring + intra/inter-group edge mix (~82% local), plus guaranteed ring spanning edges and a fallback filler to always hit the edge target.
Deliberately maintains TWO quadtrees with a documented rationale: the contract-pure QuadTree (range query, for the hidden acceptance suite) vs an internal BHNode tree carrying mass/center-of-mass for Barnes-Hut force approx β avoids contorting the public contract to fit the sim.
neighbors() memoizes adjacency by stashing a __adj Map on the graph object (cast through Graph & {__adj?}), so repeated lookups are O(1) after first build while keeping the function signature pure.
Renderer does cheap edge culling (skip if BOTH endpoints off-screen) and node culling with a 5px margin, plus zoom-dependent radii (3.0/sqrt(zoom)) β keeps draw cost bounded when zoomed in.
zoomAt recomputes cam.cx/cy after clamping zoom so the world point truly stays under the cursor even at the 0.01/200 zoom limits, rather than naive pre-clamp math.
Functions receive UNEVALUATED arg nodes plus a FuncApi (scalar/collect), so IF/AND/OR genuinely short-circuit and untaken branches never evaluate β most agents eagerly evaluate args.
Incremental recalc is correctly scoped: collectAffected() walks only the transitive dependent subgraph from the edited seed, then Kahn topo-sorts just that subgraph (O(V+E)); leftover non-zero in-degree cells become #CIRC! β cycle detection falls out of the topo sort for free, no separate DFS.
Single overlay <input> editor for the whole 100Γ100 grid (not 10,000 inputs) positioned via getBoundingClientRect β keeps the DOM light and is the key to no-jank.
Bijective base-26 column math (colToIndex/indexToCol) handling AA/AB correctly, a common off-by-one trap.
Cycle detection uses a full Tarjan SCC (findCycleNodes) restricted to the affected set, marking every node in a multi-node component as #CIRC! and also catching self-references β more robust than naive DFS-color cycle checks.
Clean split engine architecture (refs/parser/ast/evaluator/graph/engine) with a pure AST type, keeping the public Sheet API thin.
Incremental recalc unions previous AND new transitive dependents before recomputing, so cells that *stop* depending on a precedent are still correctly refreshed when a formula changes.
Deterministic recalc ordering via compareRefs (row-major) everywhere, giving stable lastRecalculatedRefs() β which doubles as the measurement surface for the window.__buildoff workload() perf hook.
Tarjan SCC over the *induced subgraph* of only the affected cells (graph.findSCCs takes an iterable) rather than scanning the whole sheet β cycle detection is O(affected) not O(all cells).
Bidirectional dep graph (fwd + rev edge maps) with reference-counted cleanup: empty Sets are deleted from both maps on edge removal, keeping memory tight on large sheets.
recalc.ts snapshots the PRE-edit reverse closure before mutating the graph, plus re-adds old cycle members that fell out β correctly recomputes cells that stop being circular when a cycle is broken.
Two distinct numeric coercions: toNumber treats ''β0 while toNumericValue treats ''βnull, so SUM/AVG/MIN/MAX skip empty cells instead of counting them as zero β a subtle correctness detail many implementations get wrong.
Inverted index intersects posting lists starting from the RAREST term (lists.sort by size, seed from smallest) so search cost scales with match count, not corpus size β genuinely the 'real index' F10 asks for, not a linear scan.
monotonicNow() clock guarantees `updated` never repeats within the same ms, making all()/recency ordering deterministic and stable β caught a real test-flake edge case others would miss (documented as a PLAN deviation).
XSS-safe markdown renderer parses structure from raw source but escapes every user-text emit point; link hrefs are allowlisted to ^(https?:|mailto:|#|/) and anything else collapses to '#', so javascript: URLs are neutralized.
Inline-code is extracted to private-use-area sentinel placeholders (\uE000) before other inline rules run, so backtick contents never get re-parsed as bold/italic/links β a correctness subtlety most tiny renderers get wrong.
Inverted index intersects AND-terms by seeding from the SHORTEST posting list (sortedPostings sorted by size), so multi-term search cost scales with the rarest term, not total notes (notes-core.ts:251-260).
Monotonic timestamps: nextUpdated() forces strictly-increasing `updated` via max(now, lastUpdated+1, previous+1), so ordering never collides even on same-ms edits (notes-core.ts).
XSS-hardened markdown: safeHref allow-lists protocols, escapeAttribute neutralizes backticks, and the search highlighter escapes every text slice before wrapping matches in <mark> (markdown.ts safeHref, view.ts:228-246).
Inverted-index AND search sorts posting lists by size and intersects starting from the smallest, minimizing comparison work (store SearchIndex.search).
Scoring uses a bounded recency tiebreaker (0..1) that can never outweigh even one extra body hit, so title>body ranking stays correct while newest notes break ties.
Markdown renderer stashes inline `<code>` spans behind a unicode sentinel before applying bold/italic regex, preventing formatting from leaking into code spans β then restores them.
safeHref() whitelists http(s)/mailto/relative/anchor and rejects any other scheme (e.g. javascript:), and all text routes through escapeHTML β XSS-safe preview with no raw-HTML echo.
engine-core.ts is a genuinely reusable, side-effect-free infra layer (ECS + A*) cleanly separated from game logic β the World uses sparse-set Map stores with free-list id recycling and query() iterates the smallest component store for speed.
A* runs on flat typed arrays (Int32Array g/cameFrom, Uint8Array closed) with a hand-rolled binary MinHeap using lazy decrease-key β stale heap entries filtered by closed-set check on pop.
canPlace() does a real wall-off check: temporarily sets the tile blocked, re-runs findPath, and rejects placements that would disconnect spawn from goal β towers can never trap enemies.
Live re-routing re-snaps in-flight ground enemies to the nearest waypoint of the recomputed path on every place/sell (resnapEnemies/nearestWaypoint), and the author honestly flags the cosmetic stutter this can cause in SELF.md.
Binary MinHeap with explicit (priority, tie) comparator gives deterministic A* tie-break biased up-left β most agents use array.sort or no tie-break.
query() sorts component maps by size and iterates the smallest archetype first, minimizing membership checks β a real ECS perf optimization, not just naive intersection.
Keeps both a boolean[][] `blocked` and a parallel Uint8Array `blockedU8` plus a `pathCells` Uint8Array so placement validity (occupied vs on-path) is an O(1) typed-array lookup in the render/hover hot path.
Self-contained perf probe runs engine-core directly, tops up to 200 live enemies each tick, and also spawns projectiles + touches nearestInRange to keep the full API exercised under load.
Strict modelβtopoβview layering: dag.ts is fully DOM-free and the UI re-uses the exact same cycle detector for wire refusal (wouldCreateCycle clones + appends edge + hasCycle) so editor and evaluator can never disagree.
hasCycle uses iterative white/grey/black DFS with an explicit frame stack specifically to avoid stack overflow on deep graphs β and topoSort de-dups inputs so a node wired twice to one source counts as a single edge.
layout.ts is a single source of truth for node/port geometry shared by both renderer and hit-testing, preventing visual/interaction drift.
Renderer emits a wide invisible 'wire-hit' stroke for forgiving wire clicks plus zoom-aware PORT_SNAP with snap highlight β strong legibility polish.
checkConnection rebuilds the graph WITHOUT the target input slot before calling wouldCreateCycle, so re-wiring an already-occupied port is correctly evaluated against the post-replacement graph rather than spuriously refused.
Defense-in-depth on cycles: UI refuses via wouldCreateCycle AND import intentionally allows cyclic JSON through so the evaluator surfaces the cycle instead of silently rewriting user data (evaluateDocument catches the topoSort throw and returns an error string).
graphToNodeDefs maps unconnected input slots to sentinel ids (`__missing_<node>_<idx>`) so positional argument order is preserved for ops like sub/clamp instead of inputs collapsing/shifting.
buildIndexes dedupes repeated input edges (seenInputs) so a node wired twice from the same source doesn't double-count indegree and corrupt Kahn's topo sort.
dag.ts uses an iterative DFS with explicit color map for hasCycle to avoid stack overflow on large graphs, and Kahn's algorithm for topoSort (tested on a 300-node chain).
wouldCreateCycle is reachability-from-`to` instead of a full re-cycle-check, an efficient O(V+E) UI guard against closing loops.
Wire hit-testing samples the cubic bezier (24 segments) and computes point-to-segment distance, giving accurate click targets plus a separate wide invisible hit-path overlay.
Zoom is cursor-anchored: screenToWorld is used to keep the point under the pointer fixed while scaling, and the grid dot pattern rescales with zoom to stay legible.
Dedicated RNG streams per subsystem (seed^0x51ed for wind, seed^0x9e37 for tree, seed for leaves) so a resize rebuilds an identical tree without desyncing the leaf pool β clean separation of determinism (app.ts buildTree).
Quantized + cached leafColor strings (64x64 grid of rgba arrays) so hot frames never allocate color strings β pairs with the typed-array pool to genuinely hit zero per-frame allocation (palette.ts).
Atmospheric perspective done via per-layer desaturation toward a HAZE tone + alpha + size instead of real blur β a deliberate, documented perf trade that still reads as depth (config LAYERS, palette HAZE).
Depth sorting splits the draw into back-layer leaves behind the blitted tree and mid/front leaves over it, giving real occlusion against the tree (renderer.frame drawLeaves with want predicate).
Two-canvas architecture: the sky/tree/vignette backdrop is rasterized once into an offscreen canvas and blitted via drawImage each frame (render()), so only leaves are re-drawn per frame β big per-frame cost savings.
ParticlePool is a true slab allocator: SoA Float32Arrays plus an Int32Array free-stack (free/freeTop) giving O(1) spawn/kill with zero per-frame allocation.
Settled leaves use a fixed-size ring buffer (settledCursor % SETTLED_CAPACITY, capped settledCount) so ground accumulation never grows unbounded.
Fake-3D tumble via ctx.scale(scale*wobble, scale) horizontal wobble combined with rotation+spin, not just rotation.
ParticlePool uses an intrusive free-list (Int16Array freeNext + freeHead, ALIVE=-2 sentinel) so spawn()/kill() are O(1) with zero scanning β more sophisticated than a simple aliveCount cursor.
Per-channel clamp added inside cosinePalette() after discovering autumn coefficients exceeded 1.0 in red at tβ0 (documented as a deviation), preventing rgba() overflow artifacts.
Tree leaves are pre-baked into an offscreen canvas (220 static cluster leaves + tapered branches via per-end lineWidth) so the tree costs one drawImage per frame β true zero per-frame allocation.
speedFactor uses pow(depth,1.5) (0.4^1.5 back, 1.8^1.5 front) for perceptually-tuned non-linear parallax rather than naive linear depth scaling.
Dual-renderer: raw-WebGL1 GLSL lava with a CPU Canvas2D FBM fallback (createGlLavaβcreateCanvasLava) so it never blanks on missing WebGL.
Embers spawn from CPU-sampled HOT regions of the SAME heat() field the shader draws (shared scene-core math), so embers rise out of bright lava rather than at random.
Crust cracks reuse the already-computed slow flow field for the iso-line (no extra FBM evaluation) β perf-aware shader budgeting (2+4 octaves, single-octave shimmer).
Nearest-sample field reconstruction: renderer scatters ~180 samples then rebuilds the coarse pixel grid via per-cell nearest-neighbor reduce over the sample list (renderer.ts) β distinctive, though O(cells Γ samples) and inefficient.
Domain warping done explicitly: detail turbulence is offset by wideFlow (`turbulence(nx*2.4 + wideFlow, ...)`), feeding low-frequency flow into high-frequency detail.
Triangle-wave 'folded river' veins via 1-abs(sin(...)) plus pow shaping create sharp incandescent lava channels rather than blobby noise.
Three hand-tuned palettes (magma/ember/sulfur) wired to a segmented control, plus a live heat-intensity slider and pause toggle with aria labels.
CPU/GPU heat-field parity: lava-ramp.ts deliberately mirrors the GLSL warpedFbm (same 4 octaves, lacunarity 2.0, gain 0.5) so embers spawn exactly where the GPU renders hot regions (sampleHeat -> ember-spawn).
ParticlePool is a true SoA ring buffer (8 parallel Float32Arrays, head index overwrites oldest), with a fixed-substep update (<=1/30s, capped at 1s) so a long/restored frame can't teleport particles.
Two-pass WebGL2 with offscreen FBO -> 5-tap cross-blur bloom program with a highlight mask (max(sum-threshold,0)), giving real additive glow rather than just a per-pixel power curve.
Big Triangle fullscreen trick (FULLSCREEN_TRIANGLE, single draw, no index buffer) plus DPR cap at 2 for a lean GPU path.
RenderTarget interface (narrow CanvasRenderingContext2D subset) lets the entire renderer be unit-tested with a fake ctx β no jsdom; clean separation of sim from DOM.
Strength scalar sampled from a SECOND, slower/decorrelated potential read (0.5x scale, 0.6x time) so color/weight aren't perfectly locked to direction β avoids a mechanical look.
Structure-of-Arrays ParticlePool with explicit free-list stack (Int32Array) ordered so spawn() yields 0,1,2... β GC-quiet, cache-friendly, capacity-validated.
24-step prime before first paint so the autoplay gate sees an already-composed, moving frame instead of an empty canvas.
ParticlePool uses an O(1) free-list stack allocator (Int32Array `free` + `freeTop`) for spawn/kill β real pooling, not just a sized array.
4-fold rotational kaleidoscope via mirroredPoint() with quarter-turn rotation, drawn under 'lighter' (additive) composite for glow β F11 satisfied two ways (curl noise + symmetry).
Fixed-timestep accumulator loop with spiral-of-death guard (steps<4, then accumulator=0) keeps sim stable under frame drops.
Reduced-motion path prewarms 180 frames before the single static render, producing a fully-evolved composition rather than a sparse first frame.
Ribbon trails are faked without per-particle history: each frame draws a short tangent segment along the local angle under additive 'lighter' blend, so silky streaks emerge from the composite instead of storing position arrays β cheap memory, good look.
Kaleidoscope sample point is rotated about center by slowRotation (sin-based, non-accumulating) so the mandala wanders but never spins fully around β deliberate 'ambient not frantic' design (F10).
Center pull force (pull = 6/(1+d*0.012)) keeps particles composed toward the middle with rim respawn, making negative space structural rather than accidental.
ParticlePool is genuine SoA with a ring-buffer spawn index and O(1) aliveCount maintenance; forEachAlive/update are allocation-free, and pre-allocated scratchX/scratchY Float64Arrays sized to sector count avoid per-particle GC in the mirror loop.
Stars stored as orbital params (radius, baseAngle, angularSpeed) and spun entirely GPU-side in STAR_VS from a single u_time clock β zero per-frame CPU buffer churn; differential rotation (orbitalSpeed = 1.6/(r+core)) gives a real flat rotation curve.
Nebula baked once into a 384x384 MIRRORED_REPEAT texture and UV-scrolled, instead of a per-frame fbm fragment shader β deliberate perf pivot documented in SELF.md (~15fps win on software raster).
Comets reuse the exact star attribute layout (STAR_STRIDE) and the star program via packComets() β speed=0 packs them as fixed-position points, no second pipeline.
Real separable bloom chain (bright-pass -> 9-tap Gaussian -> Reinhard-ish tone map + vignette) with a graceful direct-to-screen fallback if FBOs are incomplete (createRenderTarget completeness check) so it can never blank.
True hardware instancing: createCrystalInstances packs a 19-float per-instance record (center, 3 orthonormal basis vectors, scale, color, phase) and resources.ts wires it with vertexAttribDivisor(1) β one mesh, 740 oriented shards in a single draw.
Fibonacci-sphere distribution (golden-angle theta + per-instance jitter) for organic, non-gridded shard placement, with a per-instance orthonormal basis built via cross products so each crystal points outward.
Offscreen framebuffer render target (renderTarget.ts) with depth renderbuffer, then a fullscreen post pass β proper two-stage pipeline, not draw-to-default-buffer.
Renders the post pass with a single oversized triangle (a_position [-1,-1, 3,-1, -1,3]) instead of a quad β classic fullscreen-triangle trick, avoids the diagonal seam.
Build aborted before any code: agent auto-rejected the external_directory permission needed to read shared-configs, so no PLAN.md, src/, or package.json was ever created.
Failure mode is a tooling/permission policy issue, not a coding deficiency β the agent never reached the implementation stage.
Empty source means zero evidence for every checklist item; all 14 features are misses by absence rather than by attempt.
ParticlePool is a real struct-of-arrays typed-array pool with free-list recycling (Int32 stack, Uint8 alive flags) β zero per-frame allocation on the meteor render path, not just a contract stub.
Documented perf deviation for the scored env: resolution cap (<=680px backing, CSS-upscaled) + octaves 5->3 took software WebGL from ~5.5fps to ~50fps with no visible quality loss.
Full-screen triangle generated from gl_VertexID (no vertex buffers / VAO data) β minimal GL state, lean bundle (~7KB gzip).
Canvas2D renderer serves double duty: the prefers-reduced-motion static frame AND the no-WebGL fallback, and it genuinely exercises core noise2D/cosinePalette on a 150px buffer.
Dual OKLCH color pipeline: full oklch->linear->sRGB matrix implemented in BOTH scene-core.ts and GLSL, keeping CPU core and GPU shader in perceptual parity
mixOklch takes the shortest hue path via wrapped hueDelta (mod(b.z-a.z+PI,TAU)-PI) in both TS and shader, avoiding hue-wrap artifacts in the gradient
Below-horizon reflection field: mirrors curtains with rippled UV (rippledUv) and widened bands (width*1.22) gated by a reflectionMask for a water-like emissive reflection
Seed accepts numeric OR string: parseSeed falls back to FNV-1a hashSeed for non-numeric ?seed= values
scene-core.ts ships a full ParticlePool slab allocator (Float32Array data + Uint8Array alive + life array, spawn/release/aliveCount) to avoid per-frame GC churn β far beyond the contract minimum.
Renderer returns null when WebGL2 is unavailable and main.ts degrades to a CSS night-sky fallback while still installing a no-op __buildoff hook so the harness probe never crashes.
TIME_STEP_CLAMP_S (1/30) caps per-frame dt so a backgrounded-then-resumed tab can't jump the animation forward, plus an EMA-smoothed FPS counter.
Per-octave 2x2 rotation matrix in fbm() to hide axis-aligned lattice bias, and pow(noise,2) ribbon sharpening for crisper curtain streaks.
Documented velocity-normalization pivot: differentiates Ο in NOISE space (eps/scale) so gradient is order-1 (~36px/s) instead of microscopic ~0.06px/s β caught via the pixel-based autoplay gate, not just a passing float test.
Ships a divergence() probe used in tests to prove incompressibility (2e-14), turning a visual claim into a verified invariant.
Per-frame rebuilt color LUT (48 entries) keyed by speed avoids per-particle cosinePalette calls; halo bloom gated to depth>0.62 keeps the costly second arc off most particles.
Fixed-timestep accumulator loop (FIXED_DT 1/60, max 4 substeps, MAX_FRAME_DT clamp) decouples simulation from framerate for stable motion after tab-switch stalls.
Cached/quantized palette: updatePalette only rebuilds the 56-step LUT when Math.floor(time*9) ticks, then strokes index into precomputed rgb strings β avoids per-particle color math.
True curl noise: scalarPotential layered at 3 octaves, then central-difference partials give a divergence-free field (no sources/sinks), the correct flow-field formulation many agents fake.
ParticlePool uses a separate free-index stack (Uint32Array + freeTop) for O(1) spawn/kill with no scan, plus capacity-integer validation in the constructor.
Entire scene is one fragment shader analytically ray-tracing spheres over a single fullscreen triangle synthesized from gl_VertexID β no meshes, no buffers, no post passes, one draw call.
Pixel-budget downscale (MAX_PIXELS ~280k) + dynamic octave caps so even SwiftShader/software-GL holds ~60fps; CSS upscales the smooth result invisibly β a perf concern most agents ignore.
Moon is ray-intersected in its own local frame with correct front/occlusion ordering against the planet, and it occludes the atmospheric halo (tMoon checks in the halo pass).
Documented deviation from PLAN.md: dropped a gl_VertexID varying that mis-interpolated on SwiftShader in favor of gl_FragCoord/uResolution β caught and fixed a real backend portability bug.
Day-side ocean specular highlight masked to ocean only via reflect()/pow(92.0) and oceanMask β gives a believable sun-glint on water (planetFragmentShader).
Night side renders procedural city lights: cityMask = smoothstep(cityNoise) * smoothstep(roadNoise), gated to land and away from high latitudes, blended into nightColor β a polish detail most agents skip.
Biome ramp blends 8 named colors (deepOceanβshelfβcoastβforest/moss/dry/rockβice) driven by height, latitude AND a separate moisture fbm channel for varied lowland terrain.
Ridge noise via 1-abs(2*fbm-1) for mountain ridges plus a small time-perturbed detail octave, layered over continental fbm.
Moon is a full second CelestialBody reusing the planet pipeline with a forced rocky-gray palette and real orbital motion (orbitRadius/orbitSpeed/orbitPhase), not a flat disc.
Seed parsing is robust: numeric seeds coerced to uint32, non-numeric strings FNV-1a hashed into a 32-bit seed, with fallback to avoid zero seed.
Dual pause mechanism β both visibilitychange AND IntersectionObserver(threshold 0.01) pause/resume the RAF loop independently.
Always paints one frame before deciding on RAF, so reduced-motion path still shows a real rendered planet (probe.markPainted) rather than a blank canvas.
CPU camera (camera.ts) is built entirely from the math3d contract and exposes a view-projection matrix purely so it stays unit-testable without a GL context β the contract is genuinely used, not just present to satisfy F7.
Wall warp samples noise on the circle direction vector (a closed loop in noise space) instead of atan angle, deliberately avoiding the Β±Ο seam crack β a subtle artifact most would ship.
Morphing pods are offset into wall niches (poff) off the tunnel axis the camera rides, so the camera flies past rather than through them β caught via a headless screenshot per SELF/REASONING.
Full-screen triangle generated from gl_VertexID with an empty VAO β zero vertex buffers, zero runtime deps, ~6.6KB gzip bundle.
Domain warp (warpedPoint) + z-axis mod repetition build a real tunnel of distinct material IDs (rings/walls/columns/pearls/strands/shelves), not a lone sphere.
Fullscreen coverage via gl_VertexID bit-twiddling in the vertex shader (single triangle, zero VBO/VAO attributes) β quad.ts even defensively disables attrib arrays.
Probe is a live mutable object updated in place, so window.__buildoff.fps always reflects the latest value without re-installing the global.
Hardened init: try/catch around Scene boot paints a CSS radial-gradient fallback so a context-loss/shader failure never leaves a blank page (main.ts).
Adaptive resolution with hysteresis (drop <45fps for 2s, raise >55fps for 2s, clamped [0.5,1.0]) plus a 0.85 default render-scale and DPR cap.
We vary how agents are asked (prompt variant) and the process harness (methodology: baseline / gsd / ralph-loop / skills), then watch what lifts composite, feature coverage, and plan-adherence. Build time = launch β SELF.md.