# Let real projects and AI improve the engine together

**Pajama Engine: product feedback, agent harnesses, reproducible demos and measured optimization**

Yuntian Chai · Pajama Studio · November 20, 2026

While building Pajama Engine, I have become more interested in the complete path from a real requirement to a reusable capability than in how much code an AI can produce in one session. A game needs better cloth and destruction. A visualization application needs stable fine detail, glass and editing tools. A persistent world needs new gameplay without losing player progress. Each exposes a different weakness in the same engine.

My role is to set the direction, define boundaries, organize AI-assisted implementation and decide what to retain based on evidence. These examples describe historical work with explicit qualification limits, not benchmarks rerun for this article.

## Projects supply the questions

The working loop is: **playable requirement → project reproduction → owner boundary → bounded implementation → original-project acceptance → reusable engine integration.**

Game rules, levels and customer workflows stay in their projects. Rendering, loading, editing and observation capabilities enter the engine when a demonstrated need supports reuse. Electrical's order and payment logic, for example, does not belong in a renderer. Its temporal antialiasing problems can reveal a general rendering opportunity. The reusable editor follows the same pattern: typed property descriptions, history and native widgets belong to the SDK; domain validation and persistence belong to the application. [C1–C2]

Skydancer and Harry Maze exercise movement, collision, cloth, destruction, foliage and native input. Their port records explicitly retain missing mechanisms. Passing rules tests, opening a window, qualifying a complete game and outperforming its predecessor are separate outcomes. These projects are consumers and test workloads; Pajama's product goal remains an extensible persistent multiplayer runtime. [C3]

## The harness makes work resumable

The development harness consists of task constraints, tool entry points, state records and verification. A task starts with a concrete outcome, its owning module and fixed acceptance criteria. Agents inspect the relevant contract, implement a candidate, execute checks and leave the next actionable blocker with exact evidence.

Gameplay, loading, rendering and editor work have separate owners. Overlapping files or frozen dependency closures need one writer and a stable validation window. A CPU or GPU reservation does not grant ownership of source files. [C4]

The running game's agent loop is distinct. `AgentSession`, `ActionDirector` and a provider-neutral `choose` interface organize observations and approved actions. The server still decides collision, damage, terrain and persistence. A complex request may return `needs_planning`; that result is not an implemented automatic handoff to another coding agent. [C5]

Across both loops, models propose or choose actions and the system supplies outcomes. Compiler results, authoritative receipts, matching content identities and actual pixels determine what passed. The model's completion message is an index to evidence.

## Lower cost through less repeated work

The workflow uses familiar software: Git and Markdown for contracts and handoffs; JSON for machine-readable results; Rust/Cargo for native capabilities; Node.js and Python for orchestration and analysis; a local SQLite-backed resource coordinator; native capture and FFmpeg; a static documentation site and Google Drive for reusable material. Cloudflare's local tools support control-plane rehearsals. [C4, C6, C8]

The practical saving comes from reusing existing tools, assets, binaries and captured inputs. Rule changes using already admitted capabilities follow the Package path without rebuilding an unchanged Rust host. Native changes receive the appropriate build and consumer checks. There is no consolidated accounting of labor, subscriptions, cloud services, hardware and electricity here, so this is not an audited claim about total monetary savings.

Small replay tools are especially valuable. A kitchen interaction failure was captured once, then examined through hit-query, held-object and box-overlap probes. A historical replay took approximately **20, 60 and 104 ms** respectively, excluding compilation and capture. The held-object probe correctly returned a failure because the hand error exceeded its threshold. Fast reproduction was useful even though the underlying problem was not yet fixed. [C6]

For shaders, a persistent development replay compares baseline and candidate outputs and rejects incompatible inputs. One real shared-world capture observed **511.707 ms** from a source edit to its report, **247.863 ms** for rejection and **375.244 ms** for restoration. Initial builds, connection and capture remain separate costs. These are editing-feedback observations, not FPS gains. [C7]

## A demo is also an engineering artifact

Recording begins with a claim: activate a new behavior, show two clients using the same revision, perform an interaction or recover the same world state. Existing runners can orchestrate an isolated local rehearsal, ordinary Package publication, two native clients, PNG/JSON frames, authoritative receipts and an action timeline. FFmpeg assembles the result using capture time; failures remain in the record. [C8]

The vehicle and constraint-layout demonstrations connect generated definitions, publication, staged construction and two-client observation. Their early footage sampled at 6 Hz and was encoded at 30 fps; selected delivery cuts ran at 1.25× speed. That is useful functional footage, not evidence of 30 unique rendered frames per second or real-time performance. Recorded gaps outside the delivery cut were retained.

Reusing these tools today requires the current qualified binaries, established assets and the appropriate world authority. Historical recording commands do not authorize replacing a live world or resetting progress. Functional raw footage, normal-speed acceptance footage and promotional edits have different purposes and should be labeled accordingly.

## Optimization needs an experiment that can reject the candidate

AI helps formulate hypotheses, implement changes and analyze logs. Acceptance criteria must be fixed before evaluating the candidate. Exact inputs and baseline controls matter as much as the proposed algorithm.

Electrical's TAA footprint-reload candidate changed how motion data was accessed while preserving immutable texels and calculation semantics. Actual shader cases and multi-view pixel comparisons preceded a same-executable baseline/candidate/baseline experiment. On **Windows, RTX 4090, Vulkan, driver 591.86 and Immediate presentation**, each arm ran for 90 seconds with the first 15 seconds excluded. The surface was 1707×960 and the internal render extent 2560×1439, with full quality retained. Relative to the two controls, **FPS improved 10.49%, P50 frame intervals fell 9.43% and P95 fell 10.16%**. Those results belong to that workload and device. [C1]

The reusable mechanisms subsequently entered the shared renderer, with 37 owning checks and two ordinary-client entry checks for default and forced fallback. Customer logic stayed in its project and unmeasured devices retained the baseline. Source integration did not replace the running world or establish the same FPS gain elsewhere. [C2]

A second case shows why component and delivery metrics must remain separate. Bounded reuse of exact immutable content in V17 checkpoint preparation produced A/B/A medians of **12.831, 5.336 and 12.532 seconds**: a **57.922%** reduction relative to the control mean, with byte-identical output and a valid measurement receipt. [C9]

Yet the two observed complete candidate publications took about **36.2 and 54.4 seconds**, against baseline observations of **49.7 and 47.5 seconds**. The second candidate observation was slower. We retained the preparation-stage result without claiming stable end-to-end acceleration, and identified script-preparation resource backpressure as the next question.

Rejection also creates useful knowledge. A cloud-sampling candidate passed component and low-resolution checks but failed image quality in 24 of 128 shared-world frames at 1440p. It was withdrawn before whole-frame performance sampling. A failed candidate with a reproducible counterexample is a valid experiment outcome. [C10]

## What survives into the next round

The useful improvement loop is bounded: observe a failure, state a falsifiable hypothesis, freeze inputs and evaluation, implement, verify and retain the result for later work. Existing operator procedures, round records and research notes support this practice. A complete durable evolution coordinator remains a proposal; these records do not establish unattended recursive self-improvement or superior performance on unseen tasks. [C11]

What accumulates is concrete: a smaller reproduction, a test that catches a bad candidate, a reusable capability validated by its consumers, and a handoff that another session can actually resume. Connecting those pieces is the engineering skill I want Pajama to demonstrate.

## Source map

C1: Electrical R24 report and measurement receipt. C2: November 5 renderer backfeed report and editor SDK contract. C3: Skydancer and Harry Maze port records. C4: repository agent guide, consolidation handoff and native-build contract. C5: Agent Runtime and Agent Integration. C6: AI Iteration and the kitchen replay receipt. C7: Render Iteration, `world-edit-v4`. C8: Recording Rehearsal, Generative Demo Recording and Capture README. C9: November 8 V17 Package loop decision and preparation receipt. C10: November 1 cloud-quadrature rejection. C11: Architecture Iteration Loop, Engine Evolution and Performance Loop. The accompanying public evidence projection preserves dates, source hashes and claim limits.
