Where the work stands

tinyscript is planned in work packets, each with what is true now, what is true after it and the checks that say it is done. Tap a packet to read it.

See the packetsRead the architecture

Every packet, by phase

Nobody writes this board by hand. Every deploy reads the plan in spec/tinyscript.xml at the newest commit, so a packet turns green the day it lands.

  • Doing 1
  • To do 22
  • Done 42
  • Later 3

p0 Land the project and build the instruments 4 to do · 9 done

  1. Now

    Tinyscript is built by a Makefile that calls cc from PATH into one build directory. Five public functions take four parameters, commit subjects lost their scope, and the project has no AGENTS.md.

    Then

    Work stays on the tinyscript branch, where progress is shown. mise tasks build, test and benchmark it on the pinned toolchain; every build writes into a directory the caller names, so agents sharing one checkout never share objects; its public functions take at most three parameters; its commits use the tinyscript scope; tinyscript/AGENTS.md holds its rules and the execution rules of the plan. Merging onto main is a later decision of the maintainer.

    Work
    • Make every Makefile rule write under $(BUILD), default build, so make BUILD=build/agent-name works beside another build.
    • Write mise tasks build, test, spec, bench, callgrind and scxml-test in tinyscript/mise/tasks on the root toolchain, with their MISE sources.
    • Change ta_tinyscript_check_syntax, invoke_values, open_realm, write_cbor_slot and read_cbor_slot in place to take a struct, and migrate their callers.
    • Write tinyscript/AGENTS.md: the project's rules and the plan's execution rules.
    Done when
    • command: mise run test in tinyscript passes: the spec checks, the CLI tests, the embedding test and the SCXML suite.
    • command: Two builds into two build directories run at once and both pass.
    • query: No public function of include/tinyscript.h takes more than three parameters.
    Decisions

    d-in-repo

    Landed
    8ccad33a
  2. Now

    The work ahead was described in conversation only.

    Then

    spec/tinyscript.xml holds the goals, decisions, gates, corpus and packets; tinyscript.xsd describes them; validate.xq checks every reference between them and the rest of the specification; reference.md renders them; spec/plan.xq prints the plan's status, the packets that can start, and one packet's brief.

    Work
    • Add the plan elements to tinyscript.xsd.
    • Write the plan into tinyscript.xml.
    • Check references, the order of packets and the status of done packets in validate.xq.
    • Render the plan in reference.xsl and write spec/plan.xq.
    Done when
    • command: make spec passes, and reference.md shows the plan.
    • query: spec/plan.xq with action=next lists the packets whose prerequisites are done.
    Decisions

    d-in-repo

    Landed
    c1f3d9b2
  3. Now

    spec/census.xq exists and produced the findings of the corpus element by hand, over clones outside the repository.

    Then

    A task fetches the pinned upstream projects at their commits into the build directory, runs the census over them and writes each feature's and member's frequency and tier (everyday, complete or excluded) into the specification; a tier is computed, never written by hand, and an excluded feature gives its reason.

    Work
    • Map census keys (syntax kinds, globals, members, operators) to feature and member entries of the specification.
    • Define the tier rule: everyday when used by at least 2 % of files in at least four projects; excluded only with a decision.
    • Add frequency and tier to features and members, and a validate.xq rule that refuses a tier the census does not give.
    Done when
    • command: The census task, run twice on the pinned commits, writes the same specification.
    • query: Every feature and member of the everyday tier names its frequency and the number of projects using it.
    After
    p0-land
    Decisions

    d-corpus

    Landed
    eebaa7e9
  4. Now

    The ten projects are pinned for the census only.

    Then

    Each project names the programs it contributes: library entry points, examples and test files, selected by rules the specification states (no React, no module mocking, no Cloudflare runtime, OS modules only through transcript-answered shims). Their dependencies are vendored as source (zod, xstate, ai's core, @ai-sdk/provider-utils, among others) and compiled by Tinyscript like any program.

    Work
    • Write the selection rules per project and list the selected programs.
    • Vendor the dependencies the selection needs, pinned, with their licences.
    • Write the node:path shim and the transcript-answered shims of node:fs, node:os and node:child_process.
    Done when
    • query: Every selected program resolves all its imports to the corpus, the vendored dependencies or a shim.
    • command: QuickJS-ng runs every selected program to a recorded output.
    Decisions

    d-corpus, d-node-shims

    Landed
    ad15261e
  5. Now

    Tests are CLI scripts and a C embedding test; host replies are written in C for each case.

    Then

    A transcript format (spec/transcript.xsd) lists a program, its expected tinyscript:host requests with their replies, the clock's advances and its expected output. SXML validates transcripts and compiles them to CBOR replay data; one C driver replays any transcript against a compiled program. A tinyscript:test module gives the vitest subset the census counts: describe, it, expect with the counted matchers, vi.fn, vi.spyOn and fake timers.

    Work
    • Define the transcript format and its schema.
    • Write the XQuery that compiles a transcript to CBOR replay data with the EXPath binary module.
    • Write the replay driver and tinyscript:test.
    • Move the CLI tests that need host replies to transcripts.
    Done when
    • test: A transcript whose request differs from the program's fails with both requests shown.
    • test: The same transcript passes under the replay driver and under QuickJS-ng with the same shims.
    After
    p0-land
    Decisions

    d-transcripts

    Landed
    0f35b030
  6. Now

    No generated programs exist.

    Then

    A checked-in list of prompts per library and domain (an AI SDK tool loop, a Workflow step, an xstate checkout, a Chat SDK bot, a Durable harness task, a Cloudflare agent) produced programs that never mention Tinyscript or its profile. Each program runs against the vendored dependencies with a transcript, and its output under QuickJS-ng is recorded.

    Work
    • Write the prompt list, with the model and date of each generation.
    • Generate, keep only programs QuickJS-ng runs, and write their transcripts.
    Done when
    • query: Every prompt has at least one program with a transcript and a recorded output.
    Decisions

    d-corpus

  7. Now

    Chart code is the W3C suite and five local fixtures.

    Then

    The repository's example and website charts and the W3C scripts form the chart corpus, run through the SCXML adapter; it feeds g-w3c, g-memory and SCXML workloads and never the census ranking.

    Work
    • Collect the charts and the programs their hosts need.
    • Run each through the adapter with its expected outcome.
    Done when
    • suite: Every chart of the corpus reaches its expected outcome, or is listed with its reason.
    Decisions

    d-corpus

  8. Now

    No test262 runner exists; conformance is shown by local tests and the W3C suite.

    Then

    test262 is pinned at one commit. A runner compiles each test in strict mode (noStrict tests skipped unless a sloppy exception covers them), maps its features tag to specification features, and writes pass rates per feature and per tier against a checked-in list of expected failures, each with its reason.

    Work
    • Pin test262 and write the harness includes Tinyscript needs.
    • Write the runner and the mapping of test262 features to specification features.
    • Record the first expected-failure list.
    Done when
    • suite: The runner's results equal the expected-failure list.
    • query: Every everyday feature names its test262 pass rate.
    Decisions

    d-test262, d-strict

    Landed
    af41fc2b
  9. Now

    Eighteen hand-written workloads are compared under Callgrind; QuickJS-ng retires fewer instructions on one of them.

    Then

    Corpus workloads join the eighteen (a zod schema parse, an xstate transition, AI SDK stream processing, JSON shaping), and one task runs g-instructions over all of them, reporting compilation and preparation separately.

    Work
    • Choose and pin the corpus workloads, with their checksums.
    • Write the gate task and its report.
    Done when
    • measure: The gate task prints every workload's instructions for both engines and fails when Tinyscript retires more on any.
    Decisions

    d-instructions

  10. Now

    A realm needs more than 128 KiB of workspace to open for the W3C charts (it opens with 256 KiB, the adapter gives 512 KiB); no measurement compares it with QuickJS.

    Then

    A measurement spawns 10,000 and 100,000 sessions of the same charts (among them policy.js) in the Tinyscript adapter and in tinyactors-core's QuickJS datamodel, and reports resident bytes per session, idle and after one event, with every part counted alike on both sides: the engine's heap, _event and the system variables, the datamodel's rows and core's region.

    Work
    • Write the measurement and its report, with the machine's signature.
    Done when
    • measure: The report gives both engines' bytes per session for each chart and population.
    After
    p0-land
    Decisions

    d-memory

    Landed
    8b6964b0
  11. Now

    Pi Durable is not in the corpus (c-durable-harness is another project and c-pi holds two Pi files), @xstate/store's published JavaScript is not vendored, zod has no tests of its own in the corpus, and no QuickJS-ng runs a library's tests beside Tinyscript; the corpus renames modules (compile.xq) so a library is not compiled unmodified.

    Then

    zod, xstate, @xstate/store and Pi's packages, Pi Durable included, are vendored as published, with their selected tests, and one command compiles each entry unmodified and runs its tests under Tinyscript and QuickJS-ng, reporting each library's first blocker and share of code that compiles.

    Work
    • Vendor the published packages, pinned (zod 4.6.7, xstate 6.0.0-beta.8 and @xstate/store at the version c-xstate pins, @earendil-works/pi-durable, chord, pi-schema, pi-telemetry, pi-ai and pi-agent-core 1.8.0), and select each library's own tests, as d-real-code says.
    • A QuickJS-ng runner of the same programs, so outputs are compared (the replay driver runs only transcripts today).
    • mise run real-code: compiles each library's entries from its published files unmodified, runs its selected tests on both, and prints a table per library (entry, status, first blocker) and the share of lines in files that compile alone; the probe at d-real-code-probe is its first version (scratchpad realcode/probe).
    • Diagnose the two corpus programs whose output differs from QuickJS-ng (ai-provider-utils-convert-image-model-file-to-data-uri, workflow-time-window) and the two that stop with UNSUPPORTED (workflow-codec, cf-agents-sfu-utils) to a root cause each, and report it to the coordinator for routing: a wrong answer is the worst outcome.
    • Patched static built-ins (d-patched-builtins): Date.now, JSON.parse, JSON.stringify and Reflect.apply, called or read as values, read the owner's live property once it is no longer the original native, so workflow-time-window's spied clock is seen; and the %TypedArray%.prototype @@toStringTag getter (ECMA-262 23.2.3.38), which ai-provider-utils-convert-image-model-file-to-data-uri reads.
    Done when
    • command: mise run real-code runs every gate library's entries and selected tests under Tinyscript and QuickJS-ng and prints the table; its numbers at the commit that lands it are recorded in the plan.
    Gates

    g-real-code, g-corpus

    Decisions

    d-real-code, d-real-code-probe, d-patched-builtins

    Landed
    fc3d08e4
  12. Now

    Adding a built-in edits shared lists: native.c's dispatch, builtin.h, internal.h, one test262 expected-failures file of 20,141 lines, tests/embedding.c and tests/cli.sh.

    Then

    A packet that adds or finishes a built-in touches only that built-in's source, header, tests and test262 directory files, and its entries in the plan.

    Work
    • Starts once p0-process has landed: it uses mise run workspace and mise run land, and the t262 slices.
    • Generate native.c's dispatch from the plan's native-abi owners (a generated table of owner handlers, as instructions.inc is generated), so no native id needs a case written by hand; measure Callgrind on every workload.
    • One header per built-in (builtin-json.h, builtin-date.h, ...) under a generated builtin.h; internal.h keeps only what the core shares.
    • test262's expected failures split into one file per test262 directory, read by mise run t262 and the full run alike.
    • tests/embedding.c and tests/cli.sh split into files per area that the test task finds by name.
    • A check that adding a built-in touches only its own files: a fixture built-in added in a scratch workspace changes nothing else.
    Done when
    • command: The fixture built-in's diff lists only its own source, header, tests and test262 files and its plan entries; make test, the transcripts and W3C pass; Callgrind is within 0.1 % on every workload.
    After
    p0-land
    Decisions

    d-builtin-files

  13. Now

    Agents share one checkout and commit by hand: a private index, a clean export, commit-tree and a guarded update-ref. Half-finished edits leak into other agents' builds, the shared tree drifts from HEAD, the specification is edited as text and conflicts, id blocks live only in decisions and briefs, and the three-parameter lint's baseline lets a listed function grow.

    Then

    mise run workspace makes a private export and refreshes it onto origin; mise run land checks a workspace's change on a clean export, commits it on top of the current origin, pushes it and moves the shared checkout; mise run spec:update keeps the specification's changes as XQuery Update files that land applies in order; the plan's id-blocks record every block, checked by validate.xq and shown by mise run plan ids; mise run t262 and mise run callgrind:compare check a slice of test262 and the instructions per workload; the three-parameter lint is a ratchet over src, datamodel, tests, bench and tools.

    Work
    • Write mise run workspace and mise run land, with their shared code in mise/lib/tinyscript/, and land with them from then on.
    • Write mise run spec:update, whose help shows a literal brace doubled.
    • Add the plan's id-blocks to the schema and the specification, their checks to validate.xq, and mise run plan ids.
    • Write mise run t262 and mise run callgrind:compare.
    • Make the three-parameter lint a ratchet of file, function and count, over src, datamodel, tests, bench and tools.
    • Rewrite AGENTS.md's "Executing the plan" and the specification's design section for private workspaces.
    Done when
    • command: mise run land lands a change from a workspace after origin moved during its checks, and the shared checkout and the workspace's base follow.
    • query: validate.xq refuses overlapping id blocks, an id in use outside every block of its table, and a block of an unknown packet.
    • command: mise run t262 on a slice reports new failures and listed passes, and --update refuses a new failure without --allow-new.
    • command: mise run callgrind:compare prints every workload for origin and the workspace, flagging changes over 0.1 %.
    • command: The lint's self-test covers a count that rose and a count that fell, and make lint passes.
    After
    p0-land
    Decisions

    d-private-workspaces, d-id-blocks, d-push-often, d-executor-cost

    Landed
    795a0e5c

p1 Change the shape before adding features 10 done

  1. Now

    A realm opens only with 256 KiB of workspace, and nobody has measured what it holds.

    Then

    A report in the design section says what a realm's workspace holds, what of it is per image and what per session, what a session record in a shared memory would cost, and which heap and object functions the change touches. A fresh agent has tried to refute it.

    Work
    • Instrument realm opening and count the bytes by purpose.
    • Prototype a second session in the same memory without built-ins, and measure it.
    • List the heap and object functions whose contract changes.
    Done when
    • query: The design section holds the measured breakdown and the list of functions, with the refutation's outcome.
    After
    p0-land
    Decisions

    d-memory

    Landed
    9f3bdc94
  2. Now

    compiler.c holds 434 KB and wasm.c 588 KB.

    Then

    Before any feature packet, both are split into the modules the modules element describes (binding, lowering, emission, validation, preparation, interpretation, heap, built-ins), each with its layer and dependencies checked.

    Work
    • Split by layer without changing behaviour, one module per commit.
    • If the split costs instructions where inlining across files is lost, build the library from one translation unit that includes the modules, as the amalgamation will.
    Done when
    • measure: Every workload retires the same instructions as before the split.
    • query: validate.xq's include check passes for every new module.
    After
    p0-land
    Gates

    g-instructions

    Landed
    6f740f40
  3. Now

    Built-ins reach into the heap's layout directly.

    Then

    One internal header gives every built-in what it needs from the heap: allocation, handles, properties, shapes, strings, errors, and the intrinsics by id. Built-ins use only it, and its contract already allows what d-session-shape needs (an intrinsic may live in a read-only image heap and be copied on write; the stacks belong to an executor), so the sessions change happens behind it and built-in packets run in parallel against it.

    Work
    • Write the header from what the built-ins use today and what the spike says will change.
    • Move every built-in onto it; add an include check so no built-in includes the heap's own header.
    Done when
    • measure: Every workload retires at most the instructions it retired before.
    • query: validate.xq refuses a built-in module that needs the heap's own header.
    Gates

    g-instructions

    Decisions

    d-memory, d-session-shape

    Landed
    21be0935
  4. Now

    ta_writable_record and ta_writable_array exist and return what ta_record_at and ta_array_at return; no built-in calls them, and both read calls give mutable pointers.

    Then

    ta_record_at and ta_array_at give const pointers; every mutation of a record or array a built-in did not create in the same operation goes through ta_writable_record or ta_writable_array, and handles their LIMIT.

    Work
    • Make the read calls const and move each mutation site the compiler then reports onto the writable calls.
    Done when
    • test: The test task and the transcripts pass.
    • measure: Every Callgrind workload retires at most the instructions it retired before.
    Decisions

    d-writable-const

    Landed
    25f92f82
  5. Now

    Each session opens a realm in its own workspace of WebAssembly pages, and needs more than 128 KiB.

    Then

    Sessions take the shape of d-session-shape: an executor per host thread, a heap per session at its live size, the image's read-only intrinsics with copy on write, a small global whose prototype is the image's pristine global, and the chart's variables in session slots. A session costs a few hundred bytes plus its own values.

    Work
    • Move the stacks, the field caches and the collection scratch into an executor; park a suspended session's frames in a record.
    • Open a session heap at its live size and grow it by doubling.
    • Build the image's intrinsics once into a read-only heap, with tagged ids and copy on write.
    • Compile a per-chart slot map for data and system variables, and move the SCXML adapter to it.
    • Make a chart's expression functions once per chart, taking the session as an argument as QuickJS's datamodel does, instead of one closure per expression per session (76 B each, 10,864 B for the job-scheduler chart; docs/memory.md), and share _ioprocessors and the In table or make them at first read.
    • Keep ta_hot_state the invocation's first member (d-hot-state-first). If intrinsics in the image heap get ids of their own, give the side tables sized by ta_handle_bound (JSON's and Object's visited bitmaps) a mapping from id to index.
    • Before the image heap can copy an object on write, take the pointer again after every guest call in the runtime and the built-ins (d-writable-pointer; apply_descriptor, ta_array_mutate and environment_request hold one across a call today).
    • Move every allocation that writes into the gap directly onto the overflow-capable path (builtin-collection, builtin-global, builtin-object, builtin-bigint, ta_value_string; builtin-string's in p2-strings).
    Done when
    • measure: g-memory holds on the charts of p0-memory.
    • suite: g-w3c holds.
    Gates

    g-memory, g-w3c

    Decisions

    d-memory, d-session-shape, d-writable-pointer, d-executor-api, d-session-allocator, d-executor-cost, d-heap-moves, d-heap-sizing, d-image-heap, d-global-copy, d-image-heap-cost, d-session-variables, d-native-flags-sessions, d-heap-sizing-small, d-session-kept, d-pack-at-park, d-effect-message-lifetime, d-pinned-main

    Landed
    6b232c8d
  6. Now

    Two of the eighteen workloads fail g-instructions: recent retires 1/0.73 times QuickJS-ng's instructions, and reduction ties it (1.00x).

    Then

    Both retire fewer instructions than QuickJS-ng, with identical results, and no other workload loses its lead.

    Work
    • Profile both with Callgrind's per-function counts against QuickJS-ng's, find where Tinyscript spends the difference, and remove it in the interpreter, the built-ins or the lowering.
    • Fuse the i64 shifts, sub, lt_u and and, and the entry of a try_table, into register blocks: a for-of over a value of unknown type pays about 315 Ir per loop entry for them (backlog +0.84 %, recorded in c0cb5756 and 47809f87).
    Done when
    • measure: mise run callgrind shows every workload below QuickJS-ng.
    Gates

    g-instructions

    Landed
    88fa0d93
  7. Now

    The adapter cannot hibernate, export or snapshot a session.

    Then

    A session serializes to its values (its global's own properties, its lexical bindings, _event, invoke parameters) and restores into a new session of the same image or a newer one, as QuickJS sessions do; payloads serialize the same way; a hibernated session holds nothing in the engine.

    Work
    • Write serialize, deserialize and the payload functions of the adapter over the realm's values.
    • Refuse what cannot be stored (a function, a promise) with the variable's name.
    Done when
    • test: Hibernation, migration and snapshot scenarios of tinyactors-test pass on the adapter.
    Gates

    g-w3c

    Decisions

    d-memory

    Landed
    9676958a
  8. Now

    The compiler's sloppy behaviours for SCXML are spread through the code, and no list names them.

    Then

    Every source compiles in strict mode. Each sloppy behaviour SCXML requires is a sloppy-exception entry naming its W3C test, and validate.xq refuses one without a test.

    Work
    • List the behaviours the W3C suite needs in sloppy form and add the entries.
    • Make strict mode the only mode outside those entries.
    • Run test262's non-module tests as script entries through a script mode of the CLI (d-test262-scripts).
    • Report a with statement as the early error strict mode makes it, not as outside the profile; and give an import the CLI cannot read a diagnostic of its own instead of a syntax error (p1-errors left both).
    • At a script's top level this is the global object, in strict mode too (ECMA-262 16.1.6, ScriptEvaluation's global environment); it reads undefined today, which fails the prop-desc tests of Math, Number and other built-ins (p2-library found it).
    • Report await's early errors (await; new await; (await 1) = 1; an escaped await) as INVALID early errors, not as profile errors.
    Done when
    • suite: g-w3c holds, and test262's strict results do not regress.
    Gates

    g-w3c, g-test262

    Decisions

    d-strict, d-test262-scripts, d-no-sloppy

    Landed
    2b8dbdfd
  9. Now

    The CLI reports an uncaught exception as "uncaught exception".

    Then

    It reports the error's name, message and source position, and the C API gives the same to an embedder.

    Work
    • Carry the throw site's source position with the exception.
    • Format it in the CLI and expose it in the C API.
    • Distinguish, in the compiler's diagnostic, a construct outside the supported profile from a syntax error, so test262's negative parse tests pass only for the right reason.
    • Read the thrown reply [2, id, error] of d-thrown-reply in the wire and the realm, throw it from the request, and replay the transcripts' thrown replies with it, removing their envelope.
    Done when
    • test: An uncaught TypeError from a missing method prints its name, message, file, line and column.
    • test: A transcript whose reply throws a TypeError is caught as a TypeError on both engines, with no envelope in tests/lib/host.js.
    After
    p0-land
    Decisions

    d-thrown-reply

    Landed
    fca4af4a
  10. Now

    Compilation happens before preparation, in the embedder.

    Then

    A running invocation can compile source into a new image with its own fuel and scratch; the image joins the realm's function table and runs on the interpreter like any other image, a per-host cache keys it by source, and the realm keeps it alive while code of it can run.

    Work
    • Expose compilation as an import with fuel accounting.
    • Link a new image into the shared table and collect it when unreachable.
    • Compile the guest library bodies once per host into a library image that programs link (d-library-bodies).
    • With the library image, a String or RegExp body reached only through a computed key no longer meets the stub that throws TypeError, the wide visitor leaves the parser's limit, and a primitive String(), concat or fromCharCode call stops paying about 110 instructions of routing when the wide visitor is linked (p2-native-coercion's lazy linking).
    Done when
    • test: A function compiled at run time is called, collected after its last reference, and compiled again from the cache.
    Gates

    g-memory

    Decisions

    d-runtime-compiler, d-library-bodies

    Landed
    0eca52c4

p1c The compiler on a solid foundation 1 doing · 8 to do · 9 done · 1 later

  1. Now

    Lowering writes WebAssembly bytes straight into program->code (ta_write_byte, ta_index_instruction, ta_call_intrinsic in src/lower-*.c); no tree or instruction list is walked after it, branch depths are hand-written integers and boxing is put before an operand by moving bytes already written (ta_insert_conversion, ta_box_prior_arm: 18 uses).

    Then

    The IR's node kinds are declared in spec/tinyscript.xml and checked by validate.xq; sxml generates their enum, builders, a printer for tests and the emitter that writes a function's bytes, resolving branch depths from labels and intrinsic and definition slots as ta_call_intrinsic and ta_call_definition do; docs/compiler.md describes it.

    Work
    • Record the IR's shape in the design section "Compilation" and in docs/compiler.md: one tree per function in a flat array of the compilation's scratch arena, nodes addressed by u32 index, each carrying its representation (f64 number, i32 boolean or handle, i64 tagged dynamic, void); block, loop, if, try_table with labels by reference; calls naming an intrinsic or a definition; throw-site marks on nodes.
    • Declare the node kinds in the schema and the spec, with their operands, children and result representations; validate.xq checks every kind's operands and representations, and that each name is spelled once.
    • Generate the enum, the builders, the printer and the emitter with sxml (the Makefile's pattern for instructions.inc); the emitter's output for a set of hand-built trees is checked in a unit test against the bytes the current lowering writes for the same constructs.
    • The representation pass: boxing and unboxing placed on the tree from each node's representation and its consumer's, in place of moving written bytes; unit-tested on the trees above.
    • Fragments: a fixed instruction sequence declared in the spec with parameters (locals, representations, slots) generates a builder that adds it to a tree; the first ones are those lower-protocol.c:7-60 repeats (ta_value_is_native, ta_nullish_local, ta_search_method, ta_dispatch_one).
    Done when
    • command: mise run test builds the generated code under the project's warnings and passes the IR's unit tests.
    • query: validate.xq refuses a node kind with an undeclared operand or representation, and a fragment with an undeclared parameter.
    Gates

    g-instructions

    Decisions

    d-generate-first, d-compiler-first, d-typed-ir, d-ir-generated, d-ir-shape, d-ir-steps, d-ir-conversions

    Landed
    a9900e13
  2. Now

    Every lowering file writes bytes directly.

    Then

    lower-assignment.c builds IR and the emitter writes it, still reading tokens; every image the transcripts, the corpus and the W3C suite produce is byte for byte the image before, which proves the IR and the emitter in isolation.

    Work
    • A check that compiles every transcript, corpus program and W3C chart and compares each image with the base commit's (a mise task the later packets reuse).
    • lower-assignment.c onto the IR; its uses of ta_insert_conversion become the representation pass.
    Done when
    • command: the image comparison reports every image identical.
    After
    p1-ir
    Gates

    g-w3c, g-corpus

    Decisions

    d-typed-ir, d-old-compiler-oracle, d-ir-token-bridge

    Landed
    f13d27d2
  3. Now

    src/source.c compares node kinds and fields by their names as strings (tinyparse_tree_symbol_name) and flattens the tree into a token array (ta_scan_one) as it has since 2b35eadd; what a tree costs per node and per source byte is unmeasured.

    Then

    The grammar's symbol and field ids are generated enums, source.c switches on them, and docs/compiler.md records the tree's bytes per node and per source byte and the compile time with one source's tree kept alive, for the corpus's largest programs.

    Work
    • Generate the symbol and field enums from grammar/*.scm (tools/generate-parser.c, or sxml over a mapping in the spec); a grammar change that renames a symbol fails the build, not a string comparison.
    • Replace every string comparison of kind or field names in src/source.c with the enums.
    • Measure the tree: bytes per node and per source byte, peak compile memory and compile time with the tree kept while its source compiles, for xstate's, zod's and pi-durable's largest files and a run-time eval; record them in docs/compiler.md and in the decision.
    Done when
    • query: no call of tinyparse_tree_symbol_name remains in the compiler but for diagnostics.
    • measure: the tree's measurements are recorded.
    Gates

    g-corpus

    Decisions

    d-tree-input, d-grammar-enums, d-tree-memory

    Landed
    93eb9fab
  4. Now

    build/javascript-parser.c and typescript-parser.c embed a packed grammar image (javascript_grammar_bytes); javascript_load calls tinyparse_load_binary_grammar, which decodes it into engine memory, once per scanner (src/source.c:731): 956,112 B and 0.25 to 0.45 ms of a run-time compile.

    Then

    tinyparse's C generator writes the decoded tables (symbols, rules, tokens, character classes, fields) as static const data and the engine runs from them without a load step; a run-time compile allocates nothing for the grammar.

    Work
    • In tinyparse: the generator's output as static const tables in the engine's own layout, and an engine entry that takes them in place; tinyparse's tests and gates pass for every standard grammar (tinyparse's AGENTS.md).
    • In Tinyscript: source.c uses it; the per-scanner load and its memory go.
    • Measure a run-time compile (new Function, a session eval) and the CLI's start before and after: time, bytes and Callgrind; record them in docs/compiler.md and the decision.
    Done when
    • query: no call of tinyparse_load_binary_grammar remains in src/ or in the generated parsers.
    • measure: the run-time compile's time and memory before and after are recorded.
    After
    p1-tree
    Gates

    g-corpus, g-instructions

    Decisions

    d-grammar-static, d-tree-memory

    Landed
    0272007d
  5. Now

    grammar/javascript.scm and grammar/typescript-base.scm are modified copies of tinyparse's std.javascript and std.typescript, and grammar/typescript.scm extends them; tinyparse's own grammars keep the gaps.

    Then

    Each difference is a change to tinyparse/grammars/std with a test there; Tinyscript's Makefile generates from the standard grammars, and whatever is left in grammar/ is an extension with its reason.

    Work
    • Classify every difference between the copies and the standard grammars: a fix to the language (goes upstream) or Tinyscript's own need (stays, as an extension).
    • Upstream the fixes one family per commit, each with a tinyparse test; tinyparse's test task passes.
    • Switch the Makefile to the standard grammars and delete the copies; the generated symbol enums (p1-tree) and every image unchanged (mise run images), test262 with no new failure.
    Done when
    • command: land's checks and mise run t262 pass with no new failure, the corpus prints what it printed, and grammar/ holds no copy of a standard grammar.
    After
    p1-tree
    Gates

    g-test262, g-corpus

    Decisions

    d-grammar-upstream, d-behavior-not-bytes

    Landed
    0e255a73
  6. Now

    src/lower-protocol.c assembles five whole functions call by call (ta_build_descriptor_driver, ta_build_own_value_driver, ta_build_iterable_driver, ta_build_coercion_driver, ta_build_dispatch: about 600 lines), varying only in intrinsic slots, definition indices, arity padding and frame locals.

    Then

    Each driver is an IR tree written in the spec in XML, with named labels and locals; sxml generates its builder; validate.xq checks that each label and local exists and that each block's stack types balance; the images are byte for byte the same.

    Work
    • The driver form in the schema and validate.xq's checks.
    • Each driver moved into the spec, one per commit, its hand-written builder deleted; the image comparison of p1-emitter-proof identical after each.
    Done when
    • command: land's checks pass, and lower-protocol.c builds no driver by hand.
    After
    p1-ir
    Gates

    g-w3c, g-corpus

    Decisions

    d-generate-first, d-ir-generated, d-drivers-generated, d-behavior-not-bytes, d-coercion-adapters, d-dispatch-hook

    Landed
    868b2b6b
  7. Now

    The internal pseudo-opcodes (TA_INSTANCEOF = 0xf9, TA_ABSTRACT_EQ, TA_ABSTRACT_NE, TA_IN_ARRAY, TA_NUMERIC_REMAINDER, TA_NUMERIC_POWER, TA_BITWISE_NOT) are C constants beside the generated opcodes; ta_bigint_operation_code and the operator-to-opcode part of ta_binary are switches.

    Then

    The pseudo-opcodes are declared in the spec and validate.xq refuses one that clashes with a real opcode; operator-to-intrinsic and operator-to-opcode mappings are generated tables; the other switch-to-table mappings in lower-builtin.c and lower-call.c are found and moved or recorded as not tables.

    Work
    • Pseudo-opcodes into the spec, with the clash check.
    • ta_bigint_operation_code and ta_binary's operator mapping as generated tables (keyed by grammar symbol once p1-lower-expressions lands).
    • A survey of lower-builtin.c and lower-call.c for switch-to-table mappings; each moved or recorded with why it stays code.
    Done when
    • command: land's checks pass.
    After
    p1-ir
    Decisions

    d-generate-first, d-operator-tables, d-behavior-not-bytes

    Landed
    d05191d9
  8. Now

    Every function is lowered from tokens; nothing chooses between two lowerings, and nothing compares their outputs.

    Then

    A function whose constructs the new lowering covers is lowered from its tree through the IR, any other by the token compiler; a registry of covered grammar symbols decides, which each family extends; an oracle mode compiles every gate source both ways and compares what it prints and throws; the simplest functions (parameters and locals, numeric and string literals, arithmetic, comparison, return, calls of other functions) lower the new way end to end.

    Work
    • The per-function choice from a table of covered grammar symbols, the walk over a function's tree with an explicit stack, and the files each family will own (src/lower-tree-expression.c, -statement.c, -pattern.c, -function.c) as stubs.
    • The oracle mode: a build or flag that compiles a source both ways and compares outputs and exceptions, as a mise task over every gate source.
    • The simplest functions end to end, with the resolve pass's facts where it has landed and the scanner's otherwise; tests that a covered function lowers the new way.
    Done when
    • suite: land's checks and mise run t262 with no new failure, with the new lowering on; the oracle mode reports the same outputs both ways on every gate source.
    After
    p1-ir
    Gates

    g-test262, g-corpus, g-w3c

    Decisions

    d-tree-input, d-typed-ir, d-old-compiler-oracle, d-behavior-not-bytes, d-parallel-lowering

  9. Now

    The scanner keeps what it derives from the tree as flags on tokens (lexical kind, closures, pattern bindings, class bodies, inferred names), and ta_compile_program finds a function's callees by scanning its tokens for name (.

    Then

    One pass over each source's tree resolves scopes, bindings, captured variables, lexical kinds, pattern names, inferred names and class bodies into side tables keyed by node, and builds the call graph; for every corpus program, transcript, W3C chart and test262 source its facts equal the scanner's.

    Work
    • Before the pass is written: the design note on object shapes (d-shapes-timing) in docs/compiler.md, and the side table for shape facts; the differential check compares the pass's shape facts with the field ordinals the token compiler predicts today.
    • The side tables and the pass, in the compilation's scratch arena.
    • A differential check: the resolve pass's facts against the scanner's for every source the gates compile; each difference fixed or recorded as a scanner bug.
    • The call graph from the resolve pass, compared with the token scan's callees.
    Done when
    • command: the differential check runs on every gate source, and each difference it reports is classified: a bug of the pass, fixed; or a difference of the scanner's, recorded with why (a scanner bug, or a fact the new lowering wants differently).
    Gates

    g-corpus, g-test262

    Decisions

    d-tree-input, d-summaries, d-shapes-timing, d-shape-facts, d-behavior-not-bytes

    Landed
    b1baf935
  10. Now

    Expressions are re-read from tokens by ta_reader, with an operator precedence table of their own (ta_binary) though the grammar settled precedence.

    Then

    A function whose constructs the new lowering covers is lowered from the tree through the IR, and any other function by the old compiler (d-old-compiler-oracle); expressions of every kind are covered: literals, operators, calls, member access, templates, assignments, conditionals, the comma operator, optional chaining.

    Work
    • Expressions, one family per commit; fixed sequences become fragments in the spec.
    Done when
    • suite: the transcripts, test262 (mise run t262, no new failure), the corpus outputs against QuickJS-ng and the W3C suite pass with the new lowering on; the oracle mode reports the same outputs both ways.
    Gates

    g-test262, g-corpus, g-w3c

    Decisions

    d-tree-input, d-typed-ir, d-old-compiler-oracle, d-behavior-not-bytes, d-parallel-lowering

  11. Now

    Control flow is lowered form by form from tokens, with hand-written branch depths; p2-control's last steps found refusals and per-form gaps (a label on an if, more than four exits through one finally, o.x then a line break then ++c).

    Then

    Every statement lowers from the tree through the IR: blocks, if, switch, loops of every kind with labels, break and continue through finally and iterator loops with any number of exits, try, throw, return; p2-control's refusals are its test cases.

    Work
    • Statements, one family per commit, with p2-control's recorded refusals (spec, p2-control's last step) as tests.
    Done when
    • suite: as p1-lower-expressions, and each of p2-control's recorded refusals compiles and runs as QuickJS-ng does.
    Gates

    g-test262, g-corpus, g-w3c

    Decisions

    d-tree-input, d-typed-ir, d-old-compiler-oracle, d-behavior-not-bytes, d-parallel-lowering

  12. Now

    Destructuring is lowered from tokens in lower-pattern.c, each pattern taking a source local.

    Then

    Object and array patterns, defaults, rest and nested patterns in declarations, assignments, parameters, catch clauses and for-of heads lower from the tree through the IR.

    Work
    • Patterns in every position, one per commit.
    Done when
    • suite: as p1-lower-expressions.
    Gates

    g-test262, g-corpus

    Decisions

    d-tree-input, d-typed-ir, d-old-compiler-oracle, d-behavior-not-bytes, d-parallel-lowering

  13. Now

    Functions, parameters, captured variables, generators, async functions and classes are lowered from tokens (lower-function.c, lower-class.c, and the parameter-initializer refusals p2-control recorded).

    Then

    Function bodies, parameters with initializers, closures and their cells, generators, async functions and async generators, and classes with fields, accessors, statics and private names lower from the tree through the IR.

    Work
    • One family per commit.
    Done when
    • suite: as p1-lower-expressions.
    Gates

    g-test262, g-corpus, g-w3c

    Decisions

    d-tree-input, d-typed-ir, d-old-compiler-oracle, d-behavior-not-bytes, d-parallel-lowering

  14. Now

    Imports, exports and the entry's exported host forms are lowered from tokens; an exported async generator is refused in any module.

    Then

    Every function of every module lowers from the tree; the old lowering is reached by no gate source.

    Work
    • Imports, exports, re-exports, the entry's host forms; then the oracle mode on every gate source reports the old lowering unused.
    Done when
    • suite: as p1-lower-expressions, with no function lowered by the old compiler.
    Gates

    g-test262, g-corpus, g-w3c, g-real-code

    Decisions

    d-tree-input, d-typed-ir, d-old-compiler-oracle, d-behavior-not-bytes

  15. Now

    ta_compile_program's work list compiles a body again from its tokens when an assumed representation fails (widen_result, retry_private, inferred_parameters, the result assumed at a recursive call), and ta_emission_undo discards what was emitted.

    Then

    Functions compile in call-graph order, callees first, each against its callees' summaries (each parameter's representation and the result's); a recursive cycle assumes tagged values; a failed inference reruns the representation pass on the function's IR. Only the current function's IR, the current source's tree and the summary table are alive at once; across modules, each module's exported summaries are kept and its tree dropped.

    Work
    • Summaries and the call-graph order; cycles tagged.
    • Inference failures rerun the representation pass; ta_emission_undo and the restore paths removed.
    • Compile time and memory before and after: a cold compile, a run-time eval, the largest corpus program.
    Done when
    • suite: as p1-lower-expressions; compile time and memory recorded in docs/compiler.md.
    Gates

    g-corpus, g-instructions

    Decisions

    d-summaries, d-behavior-not-bytes

  16. Now

    The old lowering, the token array, ta_reader's text matching, ta_binary's precedence, ta_insert_conversion and ta_box_prior_arm stay as the oracle.

    Then

    They are deleted; the compiler reads only the tree.

    Work
    • Delete the old lowering, the scanner's token array, ta_reader, ta_binary's precedence, ta_insert_conversion and ta_box_prior_arm; docs/compiler.md describes only the new compiler.
    Done when
    • query: none of those names remains in src/.
    Gates

    g-test262, g-corpus, g-w3c

    Decisions

    d-tree-input, d-old-compiler-oracle, d-behavior-not-bytes, d-delete-token-compiler

  17. Now

    tinyscript:compiler's ESTree output is written by hand.

    Then

    The mapping from grammar symbols and fields to ESTree nodes is declared in the spec and sxml generates the projection; the tree of every test262 parse test matches its ESTree shape (the plan's existing check).

    Work
    • The mapping, its generator, and the check.
    Done when
    • suite: every test262 parse test's ESTree shape matches.
    After
    p1-tree
    Gates

    g-test262

    Decisions

    d-ir-generated

    Landed
    8cb62966
  18. Now

    Callgrind's baseline is the token compiler's; the compiler packets record their numbers but are not held to it (d-compiler-first).

    Then

    Every Callgrind workload retires fewer instructions than QuickJS-ng (g-instructions) and every session holds at most QuickJS-ng's bytes (g-memory); the counts become callgrind:compare's new baseline, with the 0.1 % rule from then on.

    Work
    • Callgrind against QuickJS-ng on every workload, bench/memory on every chart; each workload above QuickJS-ng gets its cause and a fix (the IR is where folding, dead branches and inlining go).
    • Record the numbers in docs/compiler.md and docs/memory.md.
    • Object shapes beyond hints (d-shapes-timing): measure the member-access share of each workload above QuickJS-ng, then, where it pays, a layout the compiler can prove used without the runtime check, shapes in function summaries, and fields kept unboxed; each with Callgrind and bench/memory before and after.
    Done when
    • measure: every workload below QuickJS-ng in instructions and bytes.
    Gates

    g-instructions, g-memory

    Decisions

    d-compiler-first, d-shapes-timing

  19. Now

    src/interpreter.c has 143 case TA_OP_* written by hand.

    Then

    A semantics attribute on each instruction in the spec generates the numeric cases, landed only if callgrind shows no increase on the hot path.

    Work
    • The semantics attribute, the generator, and a Callgrind comparison.
    Done when
    • measure: callgrind:compare shows no increase.
    Gates

    g-instructions

    Decisions

    d-generate-first

p2 The everyday surface, in census order 8 to do · 13 done

  1. Now

    A script's top-level if, for, while, try, switch and blocks are refused (9,192 test262 failures), and for...in is refused, which breaks test262's propertyHelper.js and about 5,000 tests that include it.

    Then

    Every statement compiles at a script's and a module's top level as inside a function, and for...in enumerates as specified; test262's harness files compile.

    Work
    • Lower top-level statements through the same paths as function bodies, keeping script-scope bindings.
    • Implement for...in over own and inherited enumerable string keys, in the specified order.
    Done when
    • suite: test262's expected-failure list shrinks by every test these block, and no test fails anew.
    Gates

    g-test262

    Decisions

    d-for-in-lowering

    Landed
    159bb009
  2. Now

    The compiler accepts only "./x" specifiers (imports.c, ta_import_source): "../core/index.js", bare package names and .mjs files are refused, so no published library compiles unmodified; an exported async generator is refused in any module ("an exported async generator has no host form").

    Then

    A module graph of published packages compiles as written: relative specifiers up and down, bare specifiers resolved by the embedder's import map or package resolution, .mjs and .js alike; an async generator exported by a module that is not the entry is an ordinary export.

    Work
    • Relative specifiers with ../ and nested directories, normalized against the importing module (zod 91 imports, pi-ai 376, chord 552, pi-durable 102).
    • Bare specifiers through a resolver the embedder gives the compiler (an import map, or package.json exports and main), in the CLI as in the API; pi-durable 107, chord 115, pi-ai 25.
    • .mjs files beside .js in the CLI's resolver.
    • An exported async generator in a module other than the entry is an export like any function; only the entry's exports need a host form (chord, 7 places).
    • The corpus compiles its libraries without compile.xq's renames once this lands.
    • CommonJS as published: a package whose only entry is CommonJS (partial-json 0.1.7, which pi-ai and pi-agent-core import) compiles as a module whose exports are module.exports; the corpus keeps partial-json as published so mise run real-code shows the refusal until then.
    • pi-durable's own dependencies (pi-codemode, pi-images, photon, diff) vendored as p0-corpus-real vendored Pi's other packages, once bare specifiers resolve.
    Done when
    • test: zod's published entries and chord's import graph resolve and reach their first non-module blocker; test262's module-code tests pass, except listed failures.
    Gates

    g-real-code, g-test262

    Decisions

    d-real-code-probe

  3. Now

    The parser takes about 400 to 800 bytes per source byte, so the CLI's 16 MB workspace refuses 20 KB of dense code and every real entry ends with LIMIT; the replay driver's 64 MB refuses xstate's createActor (279 KB) and acorn (234 KB); a graph that includes zod ends with LIMIT and no diagnostic; whole-graph diagnostics name the wrong module or line.

    Then

    The compiler compiles a library's published files in memory proportional to their size and well below a CLI's default workspace, and every refusal names its module, line and column.

    Work
    • Measure where the parser's memory per source byte goes (tokens, nodes, binding tables) and cut it to a small constant; compilation may take more memory than a session (d-compile-memory), within reason: a 300 KB file in a few tens of MB.
    • The CLI sizes its compile workspace from its inputs, or grows it through an allocator, instead of a fixed 16 MB.
    • LIMIT always carries a diagnostic naming what ran out and where.
    • Diagnostics in a module graph name the right module and line (the probe saw an off-by-one module index on zod/v3, likely the compiler's generated namespace sources).
    • The CLI passes a program's arguments to main: export function main(args) { return args.length; } run with -- a b throws "ReferenceError: args is not defined" (found by p2-web-platform).
    • The replay drivers print the compiler's diagnostics when a program does not compile, as the CLI does (22 corpus programs print only "compile failed", 10 of them zod tests); the vitest subset gains it.each and expect.any; record.sh's comment says how the recorder is built (p0-corpus-real built build/cr/record-quickjs by hand).
    • The CLI compiles a large source: today it gives the compiler 16 MiB, the parser about half of what is left, and xstate's 279 KB createActor file needs 56 MiB (p1-tree's measurements in docs/compiler.md, d-tree-memory). The CLI retries a LIMIT with a doubled workspace up to a cap, as linked.c retries 16 then 64 MiB, and says which workspace ran out.
    • A syntax tree costs about 94 B per source byte (288 B a node against a 40 B node record; p1-tree): find where the rest goes (backtracking, copied arrays) and compact it with tinyparse's maintainers' agreement, since tinyparse is its own project.
    Done when
    • measure: xstate's createActor and acorn compile with the CLI's default settings; bytes of compile memory per source byte are reported and recorded.
    Gates

    g-real-code

    Decisions

    d-compile-memory, d-real-code-probe

  4. Now

    A built-in global used as a value (Object.getPrototypeOf passed as an argument, a constructor stored in a variable, Uint8Array named in a helper) is refused with "first-class access to this global is not implemented": test262's propertyHelper.js stops 1,819 tests there, testTypedArray.js about 1,076 and resizableArrayBufferUtils.js 169.

    Then

    Every implemented global, and every function and constructor reachable from one, is an ordinary value: stored, passed, compared and called through the generic call path, with the compiler's direct lowering kept for the calls it can see.

    Work
    • Give each implemented built-in function and constructor a function object the generic call path can invoke, made from the image's intrinsics, and lower a first-class use to it.
    • Make globalThis's properties the same objects.
    • Make Map.groupBy pass (its 14 tests) and the 1,006 tests of built-ins/Array (153), Object (834) and JSON (19) that p2-collections left listed because their first failure is first-class access in propertyHelper.js; Object.groupBy's callback-arg.js, invalid-property-key.js and toPropertyKey.js fail for other reasons and are not this packet's.
    • Make a module namespace an exotic object whose exports are own writable, enumerable data properties read live from the bindings (d-module-namespace), after the built-in globals are first-class.
    Done when
    • suite: No failure detail in test262/expected-failures.txt mentions first-class access to a global; every test whose only blocker it was passes and leaves the list; tests that now stop on a planned global (d-planned-globals) stay listed for that global's packet; and no test fails anew.
    • measure: No Callgrind workload retires more instructions, the direct calls staying direct.
    Gates

    g-test262

    Decisions

    d-native-flags, d-module-namespace, d-visitor-version, d-planned-globals, d-native-block-globals, d-unsupported-reason

    Landed
    b25af893
  5. Now

    A native given an object where it needs a primitive, or a function to call back, fails: String's methods cannot convert an object argument, replace and replaceAll take no callback, and Symbol.replace and Symbol.split on objects are not consulted.

    Then

    Every library call converts its arguments through the coercion adapter on a guest frame, and callback methods run their callbacks on resumable guest frames, with the native kernel unchanged.

    Work
    • Extend the coercion section from operators to the arguments of native library calls, by the conversion each parameter declares.
    • Generate guest-side bodies for replace and replaceAll with a function, and for the Symbol.* dispatch of match, replace, search and split.
    • Run a user exec, replace and replaceAll with a function, and the Symbol.match, matchAll, replace, search and split dispatch for regular expressions through guest-side traversals over p2-regexp's native kernels.
    • Finish the module namespace object (d-namespace-object): the paths b25af893 refuses by name (object spread, Array.prototype.concat, JSON.stringify, Object.getOwnPropertyDescriptors, Object.defineProperty and Reflect.defineProperty, Reflect.set with a namespace receiver, a namespace as a prototype) follow ECMA-262 10.4.6 instead.
    Done when
    • suite: test262's String tests that p2-strings listed for object coercion, callbacks and abrupt completions pass, and the six template-literal expr-obj and tostr-error tests.
    • suite: The three tests p2-regexp put on the list because their regular expression's exec is guest code (built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex-err.js, Symbol.match/g-match-empty-set-lastindex-err.js, Symbol.replace/result-coerce-groups-err.js) pass and leave test262/expected-failures.txt.
    • measure: Callgrind shows no increase on the workloads that pass primitives (d-executor-cost).
    Gates

    g-test262, g-instructions

    Decisions

    d-native-reentry

    Landed
    5ac29f97
  6. Now

    The census finds type-only imports and declarations in 56 % of files, and the compiler refuses them.

    Then

    import type, export type, inline type specifiers, declare statements and type-only re-exports are erased, as TypeScript's erasable syntax defines them; an import whose bindings are all types loads no module.

    Work
    • Erase the type-only forms in the compiler, keeping module evaluation order for the imports that remain.
    • Compile the module forms the corpus uses: default imports and exports, namespace imports, export * from and export from (about 12 corpus programs stop on them).
    • Take xstate's and stately-agent's library code from their published JavaScript (d-corpus-erasable), fold the corpus's compile.xq into tests/transcripts/compile.xq, and move corpus/lib's default-export wrappers into tests/lib once export default compiles.
    Done when
    • test: A TypeScript file with each type-only form compiles and runs, and a module imported only for types is not evaluated.
    Gates

    g-test262

    Decisions

    d-corpus-erasable

    Landed
    7363b1db
  7. Now

    Optional parameters (a?: number), contextual keywords as type members ({ override?: number }), class type-parameter defaults (class C<T = unknown>), infer A extends string, and value imports of type-only names when the import map points at published JavaScript are refused; 11 zod3 programs, about 20 xstate programs and pi-schema-index stop on them.

    Then

    Every erasable TypeScript construct the corpus's sources use is erased; type-only names imported from published JavaScript are dropped as types.

    Work
    • Optional parameters and properties in every position.
    • Contextual keywords (override, readonly, declare, abstract, ...) as type member names.
    • Type-parameter defaults and constraints on classes, functions and aliases; infer with extends.
    • An import of a name that is only a type in the published JavaScript it resolves to is a type import.
    • A census of the corpus's TypeScript (p0-census's tool) lists any construct still refused.
    Done when
    • corpus: Every corpus program compiled from TypeScript gets past type erasure.
    Gates

    g-real-code, g-corpus

    Decisions

    d-real-code-probe

  8. Now

    Destructuring is refused, rest parameters and array spread are refused, spread of objects works.

    Then

    Object and array patterns in declarations, assignments and parameters, with defaults and rest; spread in calls, arrays and objects; the logical assignment operators.

    Work
    • Grow the compiler's function and import tables in the compilation's arena (d-compiler-tables).
    • Lower patterns through the iterator protocol for arrays and through property reads for objects.
    • Give parameter initializers their own environment.
    Done when
    • suite: test262's destructuring, spread, rest and default-parameter tests pass in strict mode, except listed failures.
    Gates

    g-test262, g-instructions

    Decisions

    d-strict, d-compiler-tables, d-rest-arguments, d-native-block-bindings

    Landed
    c0cb5756
  9. Now

    A yield parks the whole invocation for the host, with numeric completions only; a generator function called from guest code, a generator object, yield*, and generator methods of classes and object literals are refused.

    Then

    Generator functions, expressions and methods return generator objects whose next, return and throw resume one suspended frame inside the running invocation; yield anywhere in an expression, yield* delegation with iterator closing, any value as a completion, and generators consumed by for-of, spread and destructuring.

    Work
    • Spike: detach a generator's frame and its value-stack slice into a heap object at a yield and restore it at next, with two generators interleaved, a yield inside a finally, a collection between steps and a hibernation between steps; report the frame record's cost per suspended generator.
    • Generator objects and %GeneratorPrototype% (next, return, throw, @@iterator, @@toStringTag), and the generator methods of classes and object literals.
    • yield in every expression position, any completion value, and yield* with the iterator protocol's return and throw forwarding.
    • Keep the host-driven numeric generators as the case of a generator the embedder drives, on the same machinery.
    • Generator function expressions (function* () as an expression), which the try, destructuring and fn-name tests use.
    • IteratorClose when return or throw leaves a for-of inside a generator: the cleanup region has to survive a suspension (p2-bindings closes on break only there).
    Done when
    • suite: test262's generators, Generator and GeneratorPrototype tests, and the generator forms of the destructuring tests, pass in strict mode, except listed failures.
    • measure: No Callgrind workload retires more than 0.1 % more instructions, each increase recorded with its cause (d-executor-cost; the spike measured +0.02 to +0.06 % for the generator brand checks in the collector and the native-call interception); a session at rest with no suspended generator keeps no more bytes.
    Gates

    g-test262, g-instructions, g-corpus

    Decisions

    d-generators-early, d-native-reentry

    Landed
    907a65c4
  10. Now

    async functions are refused and Promise is absent.

    Then

    Promise with every static and prototype method, async functions and arrows, await in every position, thenable assimilation and a job queue the host drives: an invocation runs jobs until the queue is empty or it waits for a host reply, and a session keeps pending jobs across events.

    Work
    • Implement promise records and reaction jobs on the resumable frames.
    • Lower async functions to the generator machinery.
    • Make tinyscript:test asynchronous: async tests, it.each and describe.each, describe with options, expect.any, assert and expectTypeOf, so the corpus programs excluded for want of them can be selected.
    • Async generators and async generator methods, on the generator machinery (p2-generators refuses them).
    Done when
    • suite: test262's Promise and async-functions tests pass in strict mode, except listed failures.
    • corpus: The first corpus programs that await a transcript-answered request pass.
    Gates

    g-test262, g-instructions

    Decisions

    d-strict, d-generators-early

    Landed
    e689a796
  11. Now

    A pending promise is a record and a guest array of slots [state, result, handled, reactions...]: about 300 B live against QuickJS's 193 (p2-async measured 320 B); an unstarted async generator is 424 to 472 B against 326 (p3-datamodel's probe, p3tools/promprobe.c). The probe also printed about 992 B a promise, perhaps the handle table's high-water mark from construction's temporaries (unverified).

    Then

    A promise's state, result and handled flag, and an async generator's, are native fields of their records, with the reactions the only guest storage, and each is at most QuickJS's size.

    Work
    • Explain the 992 B the probe printed against the 300 B the parts add up to: count the handle table's high-water mark separately.
    • State, result and handled as native fields of ta_promise_record; reactions in a list that is empty for a promise nobody awaits yet.
    • The same for the async generator's record.
    Done when
    • measure: 10,000 pending promises and 10,000 unstarted async generators held in an array cost at most QuickJS's bytes each, live after a collection.
    • suite: test262's Promise, async-function and async-generator directories show no new failure, and Callgrind's workloads stay within 0.1 %.
    Gates

    g-memory, g-instructions

  12. Now

    split, toUpperCase and replace throw; tagged templates and logical assignment are absent.

    Then

    Every String.prototype method, and tagged templates with raw strings.

    Work
    • Implement the census's string members first, then the rest of the prototype.
    Done when
    • suite: test262's String and template tests pass in strict mode, except listed failures.
    • corpus: Once this packet, p2-bindings and p2-async are done, the ratchet set of g-corpus is recorded.
    Gates

    g-test262, g-instructions

    Decisions

    d-native-blocks, d-unicode-tables, d-tagged-templates

    Landed
    0b2a2636
  13. Now

    join and sort throw; Array.from, Object.assign and several prototype methods are absent.

    Then

    Every member of Array, Object and JSON, the census's members first.

    Work
    • Implement join, sort, from, fromEntries, assign, flatMap, at and the rest of the census's members, then the remaining members.
    Done when
    • suite: test262's Array, Object and JSON tests pass in strict mode, except listed failures.
    Gates

    g-test262, g-instructions, g-corpus

    Decisions

    d-native-gaps, d-visitor-version, d-json-guest, d-library-bodies

    Landed
    255cb4c4
  14. Now

    Private fields are refused; extending built-ins is partial.

    Then

    Private fields, methods and accessors, static blocks, extending every built-in, Error subclasses with cause.

    Work
    • Implement private brands and their checks.
    • Construct subclasses of built-ins through new.target.
    • A static private method is not an own property of its class (class C { static #gen() {} } lists #gen in Object.getOwnPropertyNames(C)); behind most of the 240 remaining yield* tests.
    Done when
    • suite: test262's class and Error tests pass in strict mode, except listed failures.
    Gates

    g-test262, g-instructions, g-corpus

    Landed
    1affed2c
  15. Now

    for...of over user iterables closes its iterator on break, return, throw and outer exits outside generators (p2-bindings); for...in heads take patterns; labels, chained assignment (a = b = 3) and spread into native calls are refused.

    Then

    for...of over any iterable with IteratorClose, for...in with the specified enumeration order, finally with every completion kind.

    Work
    • Implement iterator acquisition with the cached next method and IteratorClose's precedence.
    • Implement for...in over the prototype chain.
    • Labelled statements with break and continue to a label.
    • Chained assignment, an assignment expression as the value of another (a = b = 3).
    • Spread arguments into calls of native library functions.
    • A bare yield followed by a line break and a binary operator other than * ends the statement by automatic semicolon insertion.
    • test262's generated property-escapes tests (449): after the harness's chained member assignment compiles, the execution resource limit their buildString reaches and the parser workspace 13 of them exhaust.
    • Shadowing a binding of an enclosing function (for await (const [fn = function(){}] of [[]]) inside async function fn), behind 26 top-level-await syntax tests; yield* with its * on the next line; a yield-expression destructuring target that fails only inside test262's assembled file (async-gen-decl-dstr-array-elem-target-yield-expr.js).
    • p1-strict's profile gaps that real code meets: every labelled statement (label: with ... and the using label tests), a loop's let shadowing a Script's top-level let, and a Script with more than 128 top-level names (the body's fixed binding array, TA_MAX_LOCALS; 24 start-unicode tests); and drop PROPERTY_DELETE's strict operand, now always 1 (lower-literal.c).
    • p2-classes' class failures owned by the language core: a function expression in a parameter default (function f(a = function(){ return 1; }) {}, about 474 test262 tests), an arrow in an async function's parameter default ("parentheses must hold one expression", about 96), and member update ++o.x where it is still refused.
    • A call with more arguments than the program's frame width ends with LIMIT (p2-linked-parity: const f = (...a) => a.length; called with 7 arguments from code whose width is 2): any argument count a callee can take reaches it, from the program and from code compiled at run time.
    • Member update in every form real code uses (d-real-code-probe, about 66 files blocked): postfix and prefix on a property, an element and a private field: o.x++, ++o.x, a[i]--, this.#p++; const o = {x: 1}; o.x++; is refused today ("expected a semicolon or line break").
    • Recursive returns: a function that returns a value built from its own recursive call needs a consistent representation (compiler.c:244, lower-call.c:633); function f(n){ const r = {}; if (n > 0) r.k = f(n - 1); return r; } is refused. It blocks xstate's entry and 38 xstate corpus programs, acorn, chord/tracker.js and pi-ai/anthropic.js: first among p2-control's steps.
    • Shadowing as real code writes it: a local shadowing a module-level or imported function (function node(){} function f(){ const node = 2; }), and a for-of binding that shares a name with a later declaration of the same function (for (const k of m){} const k = 9;); 20 files blocked, @xstate/store's main entries among them.
    • More than 128 locals in a function, a pattern, a for-of or a capture (TA_MAX_LOCALS: "too many function locals", "pattern exceeds local limit"); blocks stately-agent's index, pi-durable's scheduler.js and storage.js, chord's reference.js.
    • The comma operator in any expression: const r = (e.a = 1, e); is refused ("comma is supported only between arguments"; pi-telemetry).
    • Assignment as a value in all its real forms, which the step on chained assignment covers: new Map().set(1, c = 4), const b = a ??= 3, () => d ??= x, tsc's namespace pattern (function(U){})(U || (U = {})); zod's every entry needs it (101 places).
    • Variable-size frames from one value stack, with no fixed cap on a function's locals (d-frame-locals): each call takes the slots its function declares from the executor's value stack instead of TA_MAX_LOCALS in each of 128 fixed frames. A fixed 256 KiB of frames per executor counts against small embedders and WebAssembly, and generated or bundled code exceeds 256 names: pi-durable's SessionImpl (m18.js:90, "capture exceeds local limit") is refused until then. After the real-code blockers above.
    • Left when p2-control stopped for higher-priority work (2026-12-05), each refused with UNSUPPORTED, none a wrong answer; steps 1, 2, 5 to 8 and 11 above are still open as written: an initializer naming its own declaration in an arrow's parameter, const t = [1].map(t => t + 5); ("incomplete expression"; the same in a for-of or for-in head compiles); assignment to a module's function declaration, function s() {} (function (x) {})(s || (s = {})); ("unsupported assignment target", @statelyai/agent m2.js:465, tsc's namespace merging); with a closure in a function's parameters, a body var or function declaration of a parameter's name, function u(x, f = () => x) { var x = 7; return f(); } (a second binding, ECMA-262 10.2.11 step 28, not modelled); a label on a statement other than a loop or a block (L: if (a) break L;); more than four distinct loop exits through one finally or one iterator loop; an assignment to a parenthesized comma group, refused rather than an early error; o.x followed by a line break and ++c; zod v3's m7.js:144 ("expected a scalar expression"), which fails only inside its module graph and is not yet minimized; import() of a computed specifier (pi-ai m2.js:10, pi-agent-core m8.js:10) and an exported async generator (chord m65.js:7), both outside this packet's core.
    Done when
    • suite: test262's for-of, for-in and try tests pass in strict mode, except listed failures.
    Gates

    g-test262, g-instructions, g-corpus, g-real-code

    Decisions

    d-core-serial, d-frame-locals

  16. Now

    new Date is refused; Map and Set lack part of their prototypes.

    Then

    Every member of these built-ins; Date reads the host's clock and time zone as injected policies.

    Work
    • Implement Date over an injected clock and time-zone rules.
    • Complete the remaining members.
    • Find what takes a 4 KiB temporary through a session heap's overflow path for "entry " + amount (number to string is the suspect, p1-sessions' report): in a packed heap it doubles the overflow blocks past 16 KiB and forces a settle mid-run (d-pinned-main). Size it to its result or take it from the executor's scratch.
    Done when
    • suite: test262's tests for these built-ins pass in strict mode, except listed failures.
    Gates

    g-test262, g-instructions, g-corpus

    Decisions

    d-native-flags

    Landed
    638506cb
  17. Now

    Only test on supported literal patterns compiles; exec with captures is refused.

    Then

    A backtracking engine with a step budget beside the DFA path (d-regexp-engine, d-native-fuel): captures, named groups, backreferences, lookaround, the u, v, y, g, s, d and i flags, Unicode properties, and the native kernels of every method that takes a regular expression (exec, match, matchAll, replace and replaceAll with a string replacement, split, search), run when the receiver is a RegExp with its built-in exec and flags; the guest-side protocol (a user exec, replace with a function, the Symbol.* dispatch on other objects) is p2-native-coercion's (d-native-reentry) and reports UNSUPPORTED with a reason until then.

    Work
    • Implement the backtracking engine with fuel accounting.
    • Keep the DFA path for patterns it decides, and choose between them at compilation.
    Done when
    • suite: test262's RegExp tests pass in strict mode, except listed failures.
    Gates

    g-test262, g-instructions, g-corpus

    Decisions

    d-regexp-engine, d-native-fuel, d-native-reentry, d-image-sections

    Landed
    7a729a08
  18. Now

    None of them exists.

    Then

    Uint8Array (which the encoders and the census need before the other typed arrays), URL, URLSearchParams, TextEncoder, TextDecoder, atob, btoa, structuredClone, AbortController, AbortSignal, Headers, and Request and Response as values are built-ins with feature entries of their own. fetch and timers are host capabilities over tinyscript:host.

    Work
    • console.log, warn and error with any number of arguments, as the WHATWG Console standard's Logger does: a first string with format specifiers goes through its Formatter, and the rest are joined by single spaces into the one console.write message (today a second argument is a compile error); console.log read as a value then logs every argument too.
    • Add the web-platform area to the features, with their sources.
    • Implement URL with IDNA mapping tables generated from the pinned Unicode data.
    • Run the Web Platform Tests' data files (urltestdata.json and the encoding tests).
    • Give both replay drivers TextEncoder, TextDecoder, TransformStream, setTimeout on the transcript's clock and console.warn and console.error, so the corpus programs excluded for want of them (about 20) can be selected.
    • Done so far (90d204e2 to daa9852f): console with any number of arguments, Uint8Array, DOMException with atob and btoa, TextEncoder and TextDecoder (UTF-8, UTF-16LE and UTF-16BE); WPT base64 80/80 and encoding labels 4/40 with the other 36 listed. Left in this packet: URL and URLSearchParams (urltestdata is pinned in wpt/pin.txt), structuredClone, AbortController and AbortSignal, Headers, Request and Response, and the replay drivers' globals; and two refusals of its own: Object.create(DOMException.prototype).toString() reads the accessor instead of throwing, and a TextDecoder option that is an accessor ({get fatal() { return true }}) is refused.
    • WPT's testharness-based encoding tests (textdecoder-fatal, streaming, encodeInto .any.js) once ArrayBuffer and the other typed arrays exist: they need testharness.js; tests/encoding.js covers their cases meanwhile.
    • The replay drivers give a program setTimeout, TextEncoder, TextDecoder and console.warn as the CLI does, so mise run real-code's tests that QuickJS-ng's host runs today run on both (a third of Pi's entries need them).
    Done when
    • suite: The pinned WPT data files pass, except listed failures.
    Gates

    g-instructions, g-corpus

    Decisions

    d-web-platform

  19. Now

    eval is planned; the compiler cannot be reached from guest code.

    Then

    Direct and indirect eval in strict mode, new Function, dynamic import through the resolver, and a tinyscript:compiler module that compiles source and returns ESTree syntax trees, diagnostics, declarations and imports.

    Work
    • Keep the variables of a function that contains a direct eval in environment records.
    • Write tinyscript:compiler over the run-time compiler and tinyparse's tree.
    • Give test262's runner a minimal $262 (evalScript, createRealm, detachArrayBuffer, gc) once eval and realms allow it.
    • The %GeneratorFunction% constructor, which compiles source at run time (g.constructor is Function until then).
    • Dynamic import(), with the top-level-await ordering tests it unblocks (fulfillment-order, rejection-order, tick).
    • Linked frames reading bigint and regexp values the program made, tested (likely fixed by 633c4eba, unverified); the wide visitor's text, near the parser workspace's LIMIT, kept under it as members are added.
    • import.meta outside a module as an early error, not a profile error; and test262's $262.evalScript.
    • Subclassing Function, and eval inside class bodies (about 106 class tests).
    • Constructs code compiled at run time refuses with UNSUPPORTED while the program accepts them (p2-linked-parity): a labelled break, bigint literals (10n), Promise.resolve, generators. The run-time compiler accepts every construct the ahead-of-time compiler does.
    • The SCXML datamodel’s executor gets a compile cache, made at its first run-time compile so that it costs nothing until then; measure that cost (p3-datamodel left compile_cache_bytes unset).
    • eval, indirect eval and Function see the session’s variables (d-eval-session-variables), tested across a hibernate and wake in an SCXML session.
    Done when
    • suite: test262's eval and Function tests pass in strict mode, except listed failures.
    • test: tinyscript:compiler's syntax tree of every test262 parse test matches its ESTree shape.
    Gates

    g-test262

    Decisions

    d-runtime-compiler, d-estree

  20. Now

    A linked closure has no name or length and cannot be constructed; a declared function in linked code has no identity of its own; an exception thrown through a bridge frame has no position; JSON.parse and JSON.stringify cannot be read as values; the link scan pins conservatively by numbers.

    Then

    A function made by eval, new Function or the library image reads, calls, constructs, compares and prints as the same function compiled ahead of time does, and its exceptions carry its positions.

    Work
    • Linked code at parity with compiled code (p1-runtime-compiler's gaps): a linked closure's name, length and construct; a declared function's own identity in linked code; positions of exceptions thrown through a bridge frame; JSON.parse and JSON.stringify as values, which need a library function value; the link scan's conservative pinning by numbers.
    • A test that runs the same functions compiled ahead of time and at run time and compares name, length, construct, identity, toString and error positions.
    Done when
    • test: The comparison test passes (d-parity-check: test262's Function and eval tests through the CLI's compile cache are p2-dynamic-code's check).
    Gates

    g-test262, g-instructions

    Decisions

    d-transparent-compiler, d-linked-images, d-parity-check

    Landed
    39330ed4
  21. Now

    These are partial or planned and rare in the corpus.

    Then

    Each is complete, in the order the census ranks them.

    Work
    • Split into one packet per built-in when this packet starts, run in parallel, and one packet of its language steps, which runs after p2-dynamic-code (d-core-serial).
    • Add Annex B's String methods with the member tables' alias for trimLeft and trimRight (d-annex-b).
    • Annex B.3.4: a var in a catch block that names a simple catch parameter assigns to the catch binding (d-annex-b-catch-var).
    • Properties of strings in v-mode regular expressions (RGI_Emoji and the others of UTS #51), which report UNSUPPORTED.
    • new String(object) converts its argument through guest code as String(object) does; a module namespace object may be a prototype, so concat and the array searches see its exports (p2-native-coercion left both).
    • new Number(object) converts its argument through guest code as Number(object) does, and Number.prototype.toString converts an object radix (p2-library found both on the construct path).
    • Date's remaining test262 failures (127 in built-ins/Date, mostly valueOf ordering and guest conversion methods), a Date subclass constructed with no arguments, and a Date argument whose valueOf or toString is the guest's own, which p2-library refuses with a reason.
    • A module waiting at a top-level await holds back its sibling modules, which ECMA-262 evaluates meanwhile (test262's async-module-does-not-block-sibling-modules.js; p2-async ran every module's steps in one async body).
    • yield* from an async generator whose sync iterator's %AsyncIteratorPrototype% constructor is read (yield-star-async-from-sync-iterator-inaccessible.js).
    • The library stubs that still throw TypeError: search's (its body makes a regexp, which a linked image cannot hold) and the lowered RegExp @@match and @@replace stubs (no visitor mode to pass); and String's 64 remaining "conversion method is guest code" failures, which do not go through the wide visitor (p1-runtime-compiler's library image does not reach them).
    • await is an identifier in a Script (var await = 1 is refused as a reserved word in binding).
    • Typed arrays past Uint8Array, ArrayBuffer and DataView, with their subclasses; WeakRef's newtarget-prototype-is-not-object tests (4). Real code waits on this step (p0-corpus-real): ai-provider-utils-convert-image-model-file-to-data-uri reads ArrayBuffer.prototype's byteLength descriptor, workflow-codec stops at Int8Array, and cf-agents-sfu-utils at a typed array's buffer (builtin-typedarray.c).
    • String's replace and replaceAll with a function replacer end with LIMIT unless the program also reads RegExp[Symbol.replace] ("ab".replace(/a/, () => "x")): a regression of the linking of library bodies (d-library-bodies, p2-native-coercion); fix it first when this packet splits.
    • Uint8Array's remainders from p2-web-platform: its callback methods (map, sort with a comparator, from with a mapper: d-native-reentry), guest valueOf and toString in fill and the constructors, an iterable other than an Array or a Uint8Array (new Uint8Array(new Set([1]))), species, index descriptors (configurable: false reported), defineProperty and freeze on indices, fromBase64 and toHex; and TextDecoder's other encodings (new TextDecoder("windows-1252") is refused with UNSUPPORTED, which a program cannot catch).
    Done when
    • suite: test262's tests of each pass in strict mode, except listed failures.
    Gates

    g-test262, g-instructions, g-real-code

    Decisions

    d-annex-b, d-core-serial

p3 Tinyactors as one application 1 to do · 1 done

  1. Now

    The adapter is tests/scxml.c, a test program.

    Then

    A datamodel under tinyscript/ implements tinyactors-core's datamodel interface, and core's hibernation, migration and snapshot gates run against it. It does not replace QuickJS behind ecmascript.

    Work
    • Move the adapter into a library with its own tests.
    • Drive the job queue between events, so a session keeps pending jobs across them.
    • Run tinyactors-test's scenarios against it.
    • Store every change a session makes to its global, not only enumerable data properties: an overwritten built-in, a non-enumerable property and a deleted one survive a wake (p1-state's read_globals keeps enumerable ones).
    • Give the adapter's run_status, run and http_form at most three parameters as it moves into the library.
    • Close the resident gap g-memory measures: p1-state's harness counted about 6.7 KB of malloc per resident session of an order chart (bench/memory gave 43.6 to 64.0 KB before p1-sessions, QuickJS 0.66 to 2.45 KB); rerun bench/memory, alone, and remove what a resident session holds beyond its values.
    • bench/memory builds again at HEAD: sessions.c no longer compiles against tests/scxml.c (chart_instance, message_data), found by p2-async at 9498e786.
    • A pending promise (320 B against QuickJS-ng's 193) and an async generator not started (473 against 326) above QuickJS-ng (p2-async's probe11 and qprobe2).
    • Session variables visible to code compiled at run time (eval and Function inside a session read and write its declared state).
    Done when
    • suite: tinyactors-test's scenarios and the W3C suite pass on it.
    • measure: g-memory holds at 100,000 sessions in bench/memory, which runs core's ta_system with both datamodels (d-memory-gate; tinyactors-core has no stress task, and its torture chamber runs QuickJS only).
    Gates

    g-w3c, g-memory, g-corpus

    Decisions

    d-datamodel-library, d-jobs-between-events, d-fuel-abandon, d-session-globals, d-eval-session-variables

    Landed
    043887c8
  2. Now

    The datamodel runs as a library (p3-datamodel, 043887c8): 10 of tinyactors-test's scenarios and W3C 191/191 pass, and g-memory holds, by 13 B idle for counter at 10,000 sessions. A session holding an XML document in a variable, _event or its init parameters is refused at hibernation and stays resident (d-session-xml-refused); one held only by a script's global is still woken as plain objects. bench/memory has no hibernated column and fails on nothing; the session record keeps its size_t fields.

    Then

    A woken session answers as it did before it slept, for every value the datamodel holds; bench/memory measures hibernated sessions too and fails a landing that puts a chart above QuickJS.

    Work
    • An XML document in a session variable is whole after a wake: datamodel/test.c's test_xml chart, hibernated, woken, then shown (a wrong answer: first).
    • bench/memory fails when a Tinyscript chart's resident bytes exceed QuickJS's, idle or after one event, at 10,000 or 100,000 sessions (d-memory-gate); land runs its 10,000 size when a change touches the session record, the heap or the datamodel.
    • bench/memory gains a hibernated column: bytes the engine holds for a hibernated session (g-memory: none) and the blob's size, against QuickJS's.
    • Narrow the session record where the counts allow: the size_t fields of ta_session_kept and the spill as uint32_t (about 16 to 24 B a session), measured with bench/memory and Callgrind.
    Done when
    • suite: datamodel-test's hibernate and wake of every value kind, tinyactors-test's scenarios and the W3C suite pass.
    • measure: bench/memory's gate passes at 100,000 sessions, hibernated column included.
    Gates

    g-memory, g-w3c

    Decisions

    d-memory-gate

p4 Release 1 to do · 2 later

  1. Now

    Audited at d1169c6c (docs/audits/compiler-d1169c6c.xml): the compiler has strong freestanding arena discipline, a clean unboxed-scalar plus NaN-boxed-dynamic value ABI, and spec-generated tables, but ta_ir is a WASM-shaped tree over mutable locals with no dataflow or liveness, forcing prepare.c to reverse-engineer 8-operation register windows out of stack bytecode. TypeScript annotations specialize only direct top-level scalar calls; shapes predict slot ordinals without field types and drop out of register blocks on SHAPE_READ; closures, methods, and indirect calls flatten into fixed-width dynamic frames; and legacy ta_token[] machinery still causes double-parsing, global arity inflation, retry-by-relowering, leaked temporary locals, and unchecked raw unbox conversions in ta_ir_represent.

    Then

    Once strict test262 coverage has crossed 99% and every in-scope language feature works, the compiler is refactored end-to-end against that test net: ta_token[] and double-parsing are gone, a compact freestanding SSA/register mid-level IR runs real optimizations (SCCP, GVN, LICM, box/unbox elimination, inlining, linear-scan register allocation), typehints drive guarded unboxed shape/array/return/local specialization, closures and methods have typed fast entries with slice varargs, and Tinyscript widens its speed lead significantly over quickjs-wasi and native QuickJS-ng while holding g-memory and strict conformance.

    Work
    • Prerequisite gate: verify strict test262 pass rate is above 99% and all p2 language feature packets are done before starting structural changes.
    • Single-tree front end (docs/audits/compiler-d1169c6c.xml, pr-frontend-cleanup): move signatures, closures, arity, and byte-offset throw sites onto the tree/resolve pass, delete ta_token[] and ta_scan_one, compile one source per parse, materialize resolved shape tables without root-descent ta_node_at walks, precompile Array.prototype.ts visitors at build time, eliminate retry-by-relowering, and tighten IR verification so semantic types are checked and raw bitcasts are explicit.
    • Mid-level SSA/register IR (pr-midlevel-ir): introduce a compact arena-allocated flat-array SSA/CFG IR with SCCP, GVN, LICM, box/unbox cancellation, small-function inlining, dead-code elimination, and linear-scan register allocation; emit register bytecode directly for the internal interpreter (removing prepare.c's 8-op stack-to-register decompilation ceiling) while keeping clean WebAssembly module emission.
    • Typehint-driven specialization (pr-typed-shapes): unify internal TS annotations as speculative hints with runtime guards and dynamic fallback, carry field value types in resolved shapes, propagate shapes and scalar hints through function summaries, return types, locals, and typed arrays, and execute guarded unboxed shape/array loads inside register loops with LICM hoisting.
    • Specialized calling conventions (pr-calling-convention): replace fixed program-wide arity padding with per-arity or stack-slice varargs, add typed fast entries and monomorphic inline caches for closures and class methods, and settle direct self- and mutual-recursion summaries via fixpoint.
    • Measure every workload with mise run callgrind:compare, mise run bench:report (against QuickJS-ng and quickjs-wasi), and bench/memory before and after; record the new audit and numbers in docs/audits/ and docs/compiler.md.
    Done when
    • suite: Strict test262 remains above 99% with zero regressions, W3C SCXML passes 191/191, and every corpus and real-code package passes.
    • measure: Every workload beats native QuickJS-ng in Callgrind instructions and significantly outperforms quickjs-wasi in mise run bench:report, with g-memory holding at 100,000 sessions and runtime compile latency and workspace usage improved or unchanged.
    Gates

    g-instructions, g-memory, g-test262, g-w3c, g-corpus, g-real-code

    Decisions

    d-typed-ir, d-summaries, d-shape-facts, d-shapes-timing, d-tree-input, d-runtime-compiler

  2. Now

    Tinyscript is built from source in this repository only.

    Then

    Each release ships an amalgamation (one C file and its header), CLI binaries per target, a JavaScript package of the imports emitted modules need in WebAssembly engines, the engine itself (compiler and interpreter) built as WebAssembly, and a changelog, through a release repository as tinyactors-core's.

    Work
    • Write the release tasks and checks after the gates hold.
    Done when
    • command: A release builds every artifact reproducibly and smoke-tests it on each target.
    Gates

    g-instructions, g-memory, g-test262, g-w3c, g-corpus, g-real-code

    Decisions

    d-release-later

  3. Now

    A debug image (the compile request's debug flag) carries a name section, tinyscript.positions (the file, line and column of each throw site, by instruction ordinal; library bodies have none) and tinyscript.sources (the whole text of each source that has a function in the table, for Function.prototype.toString). A release image carries only the positions. The runtime ignores custom sections outside tinyscript.* (wasm.c, ta_custom_section), so a .debug_* section is allowed today. Provisional: the maintainer (2026-12-05) wants to know both are possible, not yet whether they ship.

    Then

    On request, an image carries DWARF for WebAssembly (.debug_line, then .debug_info and .debug_abbrev; addresses are offsets into the code section, locals as DW_OP_WASM_location) that WebAssembly engines' debuggers read, and an image can embed the text of every source it was compiled from, so it is self-contained. Neither changes a release image's bytes when not requested.

    Work
    • Line tables: mark a position site at every statement as well as at throw sites when DWARF is requested, convert instruction ordinals to code-section offsets at emit, and write .debug_line from them; library bodies' positions name the library's sources.
    • Variables: describe a function's locals and its session's declared variables in .debug_info; Tinyscript's tagged values need a DWARF type of their own, or a debugger that knows them.
    • Embedded sources: an option to write every source's text, not only those with functions in the table, in a section with a version of its own (d-image-sections), and DWARF 5's file entries pointing at it.
    • Measure image size and compile time with and without, and check that the bytes of an image built without the options do not change.
    Done when
    • command: An image built with DWARF steps by source line in a WebAssembly engine's debugger, and an image built with its sources reproduces each source's text.
    Gates

    g-instructions, g-memory

The work packets of the plan in spec/tinyscript.xml, read at the newest commit of main when the site was built.