waxwing

Engineering guidance and actual enforcement

AGENTS.md is normative. CLAUDE.md is a pointer, so rules are not duplicated. The verification command is npm run verify. scripts/build.mjs removes the output of every workspace module before building, so each build recompiles them and a promoted strict warning fails every build (F004 fixed; dependency output stays cached). Via scripts/build-prune.mjs it also removes output of workspace-prefixed modules whose source was deleted (F006; test/build-prune.test.mjs). scripts/strict-rebuild.mjs, run by verify, proves the recompile. Never obtain green results by suppressing a gate, weakening an assertion, or adding a bypass allowlist.

Automated now

The CST ban on all anonymous lambdas is deliberately stronger than MileAhead’s manual ‘name what you pass’ rule. The Maybe/Either rule is stronger than its pass-through-only automated eliminator gate, following explicit user steering. Named where helpers and maybe’ preserve laziness for computed fallbacks.

Verification contract

(Dossier 18.132; docs/plans/2026-10-30-verification-contract-proposal.md.) Two questions are kept apart. Functional acceptance is npm run verify: every functional test, the structural gates, the regression proofs, the stack-safety checks and generous timeouts that catch hangs. Performance qualification is npm run perf (scripts/perf.mjs): the absolute elapsed-time budgets. The shared machine’s load can fail a budget without any compiler change (dossier 18.130), so a budget is not a condition of routine acceptance. File names decide the command: test/*.perf.test.mjs files run only under npm run perf, one at a time, after a conditions line, every file even after a failure, exit 1 if any failed, no retry; verify skips them by name and ends with the dynamically counted line “Performance qualification was not run: N files under npm run perf.” Perf does not build; run npm run build first. Neither command is run by the other.

Where a file mixed a budget with functional or stack-safety assertions, the routine file keeps the workload and every outcome assertion, without the time bound, and the .perf.test.mjs file keeps the budget with the same workload and constants. The split was checked by a before/after inventory of test names and assertion counts per file (scripts/test-inventory.mjs). Growth checks (doubling ratios) may run in routine verify only through test/growth.mjs and only after a demonstration against a healthy base, the healthy head and a quadratic mutant. test/growth.mjs fixes the protocol: two untimed warm-ups (small, then large), then exactly ten timed invocations in the order S L L S S L L S S L, the statistic median(L) / median(S), the caller’s threshold, every sample printed with its position, size and load1. It bounds growth between two sizes; it does not prove linearity, and a ratio reduces but does not remove interference. The one adopted check is partialFirst at 10,000 and 20,000 parameters, threshold 3.0 (test/fn-linear-growth.serial.test.mjs; regression row partialfirst-growth shows the ratio assertion failing on a constructed quadratic, not a historical one). The existing ratio check (fx008-install’s doubling) stays in perf until it has its own demonstration. Thresholds are reviewed, not machine-checked.

Inventory categories (test/fixtures/timing-inventory.json). Each clock use is classified by its actual assertion, not by the file name:

Clock gate policy. Parallel phase: no clock reads except listed functional exceptions. Regression phase: as serial. Serial phase: reads only through listed uses of a category the scope allows (growth helper, termination helpers, diagnostics). Perf files and the helpers only they reach: free to read clocks, but every *.perf.test.mjs file and every read must be in the inventory. An unlisted read, an import of go-timed.mjs or growth.mjs from an unlisted file, and a listed use that no longer matches are findings. Limits: the gate sees syntax, not intent. It cannot tell a generous timeout from a tight one (the ten-times margin is a review rule; timeouts are listed but read no clock, so the gate only checks that the listed line exists). It cannot see a duration a child process reports in its output. It cannot stop misuse of a listed helper, such as comparing go-timed’s buildMs in a routine file or calling the growth helper with a lax threshold. It does not judge thresholds. It also has the older blind spots: clocks reached through modules outside test/ (scripts/, compiled output, child processes); computed property access with a non-literal key, and eval; a clock root passed as a value (f(performance), { c: performance }, [performance]); elapsed time asserted through a runner timeout; dynamic imports when building the scope; require or createRequire of perf_hooks; a clock read in one file and compared in another; an alias made at top level and used in a function declared earlier; non-.mjs modules under test/ (skipped; none exist today).

Regression phase. test/regression.mjs and test/regression-*.mjs run in verify’s regression phase and are a routine gate scope (the serial categories; no absolute budget). The r005b-quiet probe lost its Date.now() limit and is now the functional check it already was: the mutant fails with E_INTERNAL “re-examination passed”. The row duplicate-scan-timing (an absolute 5 s budget over three 20,000-type compiles) left the routine registry: it is a perf regression proof in scripts/regression-perf.mjs, run by npm run perf after the perf files through the regression runner (probe: test/perf-regression.mjs). A fixed compiler must pass it and the restored defect must fail it; either failing counts as a perf failure. A growth check on it is a later candidate. A row flagged alone runs one at a time after the pooled rows; the growth row uses it, because the pool’s load is not the load a ratio should be measured under.

Growth mutant calibration. The constructed mutant of row partialfirst-growth is not a pre-registered form. Two scratch trials preceded the formal run: a first form (scan of the leading at elements, ratio 3.078, marginal), then the final form (scan of the whole list, ratio 3.444); the formal run gave 3.425. Choosing the form after seeing ratios is a selection effect. The margin over the 3.0 threshold is 14% (3.425 / 3.0), so the row shows sensitivity to this slowdown, not that 3.0 separates every quadratic. The mutant text builds clean under the strict build (spago build --strict --pedantic-packages, 0 warnings, 0 errors, checked by applying the row’s edits to a scratch copy). A row’s mutant is not subject to the style gates (purs-tidy, anonymous-lambda and let rules): those run on the real src tree and on nothing in an isolated clone.

Counts and corrections. The proposal’s first-pass table named five existing ratio checks. By assertion only one is: fx008-install’s doubling. large-source-timing, r013-scale, r0-mgu-scale and fx008-scale hold absolute bounds only. The inventory also missed r005b-predicates (a Date.now bound on each check), now a perf file. npm run perf has a termination safeguard of its own: a perf file running longer than 600 s (fileTimeoutMs, about ten times the longest file) is killed and reported as failed, and the run continues; a skipped, todo or only test inside a perf file is a failure. The perf file count is pinned exactly in the gate (floors.perfFiles), and each perf file must reach a listed absolute budget or ratio use.

scripts/test-inventory.mjs counts static test sites and assert call sites inside each file. Its blind spots: assertions made by a helper in another file are not counted, a test generated by a loop is one site, and a timeout is not an assertion, so an unlisted timeout is not a finding.

Completion reports state functional acceptance (routine verify) and performance qualification (npm run perf: run or not run, result, conditions) separately. A perf check that did not run is never described as passing.

Review conventions, not full automated lint yet

Types/instances, constants, public functions, private functions; descriptive names; named constants except 0/1/2 and test data; 30 declaration lines, 3 nested decisions, 8 active branches, 8 where bindings. Branch expressions should call a named helper when they hold computation. The CST gate currently catches branch do blocks, not every complicated operator/record expression. Comments explain why. These conventions were inspected in MileAhead and apply here; E001 tracks extending automation after the first slice.

Loops whose length grows with the input (characters, tokens, declarations) use tailRecM or a self tail call, and accumulate with Format.Stack or indexing rather than Array.snoc/uncons/drop per item, which copy the array. This is a review convention; only test/large-source.test.mjs (megabyte padding, 20,000 declarations) checks it, and only for the paths it drives.

The FX008 probe gate (test/fx008-probes.test.mjs, data in test/fx008-probes/, table in test/fx008-probe-table*.mjs) pins the outcome of every review probe (code, text, span, Go SHA-256, stdout, stderr, status). A task may change an entry only where the FX008 plan lists that probe for that task; any other change stops the work, and a hash of the table without flipped (test/fx008-probe-hash.mjs) catches accidental edits only, so the reviewer’s diff of the table is the real control.

No coverage percentage is claimed. Properties use deterministic generators and explicit edge cases with no discarded inputs. Parsing tests compare with independent generated trees; executable comparisons use a BigInt interpreter. Record rows with several tails (R005 Tranche B Task 4, Features.Check.UnifyRecord) are compared with an independent brute force (test/row-merge-oracle.mjs, ported from research/open-row-merge/) on generated and exhaustive labels-only problems in several orders, with the solver’s state read back by the test itself (property E, test/row-merge-readback.mjs) and a sensitivity check of that read-back. The unifier (Features.Check.Unify, P001 Task 3) is compared with an independent union-find oracle (test/unify-oracle.mjs) and checked for soundness, acyclicity and most-generality over generated pairs. Row unification (Features.Check.UnifyRow, FX001 Task 3) is compared with an independent recursive Leijen oracle (test/row-oracle.mjs) over generated rows with repeated keys, shared tails and rigid tails, and checked for soundness (scoped-label equality), symmetric acceptance and acyclicity; its side-condition test runs in a timeout-guarded child process. These solved properties remain in test/unify-row.test.mjs. The separate deferred-row properties (test/row-properties.test.mjs) distinguish pending acceptance from solved equality: an independent transactional oracle models rollback, postponement and settling, with deferred keys, same-family payloads, arrow label arguments and nonempty starting substitutions. Pending constraints are retried after the body’s ordinary constraints; they are not equality witnesses. groundErased is used only at Resolve/Seeds monomorphism boundaries; strict ground still checks both type variables and row tails.

Measurement and checking tools are committed, not ad hoc (T003); neither runs in verify. scripts/differential.mjs compares two built compilers phase by phase (lex, parse, resolve, check, specialize, Go emission, full compile) over the sources the test suite parses (harvested by scripts/differential-hook.mjs into .build), token soups, generated nested-match programs and mutations, and exits 1 on any difference: run it against an isolated build of the previous commit for every behavior-preserving refactor or performance change. Its digests carry normalisations for fields an IR gained, each dropped only where a baseline without it agrees: a Plain token’s kind (Text v1), an empty records in the monomorphic IR (R001 Task 7) and a checked function’s sorts, a copy of resolve-phase data (R001 Task 8). R005 Tranche B Task 4 adds two such tools for the row solver: scripts/row-merge-exhaustive.mjs runs a whole exhaustive domain (A is about 19 million runs) through the compiler against the independent oracle, as test/row-merge-domains.test.mjs runs a sample, and scripts/row-merge-cross.mjs compares the compiler with the research prototype on generated problems. scripts/ladder-profile.mjs times the match-lift ladder cold and per phase, alternating with a baseline build. Both are review conventions. The differential loads compilers and harvests sources through scripts/differential-load.mjs.

FX020’s corpus migration used one-off tools (a resolver-driven rewriter and a paired differential of each original program with its migrated twin). They were removed in FX020 Task 7; git history keeps them.

The FX001 differential corpus (Task 10) is a test-side reference interpreter (test/fx-oracle.mjs, written from the design, no compiler code) and a seeded generator of well-typed programs over two user effects, two failure families and Console traces (test/fx-programs.mjs, fx-gen-.mjs). test/fx-differential.serial.test.mjs (serial phase, ruling F11) builds the programs in go-batches of at most 100 and compares Go stdout, stderr and exit status with the interpreter exactly; the census (test/fx-census.mjs counts what the interpreter observed, not what the generator intended) must meet its minimums (50 programs per scoped-handler scenario, 25 per cleanup outcome) or the run fails, and so does a generated program the compiler rejects, with its seed. Knobs, outside verify: WAXWING_FX_SEED (default 20261010; program i has seed SEED+i, reproduced with generate(SEED + i, i)) and WAXWING_FX_PROGRAMS (default 500; the minimums need about 400, so a smaller count fails by design; larger counts build in more batches). A differing program’s source, both outcomes and a shrunk source (test/fx-shrink.mjs) are written to .build/fx001-differential/. The 25 rejection variants of strict defer are generated from the same seed, and 25 more reach a failing handler (FX008: directly, through a forwarding clause, through a clause calling an ambient callback). Since FX020 Task 5 the interpreter reads qualified operations, signature aliases and imports, with Console and Fail as effects (test/fx-oracle-names.mjs; tests in test/fx020-oracle.test.mjs), and the generator spells each function’s operations bare, qualified (some through an alias) or through imports of its own row (test/fx-gen-names.mjs), from a stream of its own so a seed keeps its program shape. Each performed operation reports its spelling, and the census requires programs that perform one qualified (400), imported (150), through an alias (50) and bare (75, until Task 7). Since R001 Task 9 the interpreter models records (test/fx-oracle-records.mjs; hand traces in test/fx-oracle-records.test.mjs): fields and update replacements evaluate once in written order, values compare and print in sorted label order (Text quoted as nested data), and a record payload’s Fail family is its label set. A record frame (test/fx-gen-records.mjs, in 70% of programs) draws a label universe with one type per label, writes literals and types in shuffled order, and calls generic functions over open records (test/fx-gen-record-fns.mjs). The census requires 250 programs each running a record literal, access, update, generic record function, comparison, print and Fail payload. Since R004 Task 4 it also matches record patterns (fields, puns and ...; test/fx-oracle-records.mjs). test/fx-oracle-record-patterns.test.mjs runs 200 generated programs (test/fx-gen-record-patterns.mjs), each match an ordered partition of its scrutinee’s type so it is exhaustive and non-redundant by construction, through the compiler and Go, and compares stdout, stderr and status with the interpreter’s. It requires 95% of the programs to be accepted and each pattern form in at least 10. It shares no code with the compiler or with the coverage oracle. Since R005 Task 3 it also evaluates a literal’s spread (items left to right, the base once), without, a named rest and {} (printed {}; test/fx-oracle-records.mjs). test/fx-oracle-record-extension.test.mjs runs 200 generated programs (test/fx-gen-record-extension.mjs: each record expression is built for a known label set, so it is well typed by construction, with effectful items so output order is checked), through the compiler and Go, and compares stdout, stderr and status with the interpreter’s. It requires 95% accepted and each form in at least 10. test/fx-oracle.test.mjs validates the interpreter against the hand-derived traces of Tasks 2, 4, 7 and 8 (imported from their program modules), the shrinker, and a sensitivity check (clauses run in the operation’s context must change some of 50 programs). Both run in verify; the differential test is in the serial phase.

Random clauses may fail (FX008 Task 11): a clause is fail-free, fails with a family handled outside its with (parameter w, reserved for generated failing clauses; the census counts the aborts of such clauses as failing random clause, at least 25 programs), or forwards to an outer operation whose handler may fail. A failing clause is reachable: the with may sit in its own handle, and its body ends with the operation. Designed failing frames (test/fx-gen-failing.mjs) add the shapes lexical, forward, callee, value and ambient; they are extras outside the focus rotation, and the random path alone meets the census row. The generator tracks the user labels whose innermost handler may fail (ctx.failing): constrained cleanup performs none and no function whose row names one is called under it, so every program compiles. The one-way soundness differential (test/fx008-soundness.serial.test.mjs, serial phase) generates 300 programs generate(SEED + 100000 + i, i, { unconstrained: true }) whose cleanup ignores those frames. A rejected program must carry an FX008 headline at a defer or at a call, or a strict defer text at a defer; a witnessed escape must be rejected by an FX008 headline. An accepted program must never make the interpreter report typed abort escaped cleanup and must agree with Go exactly. Minimums: 50 accepted programs whose cleanup performs a user operation, 50 rejected by an FX008 headline, 25 oracle-witnessed escapes (oracle error: typed abort escaped cleanup), every one rejected, and at least 5 witnessed escapes in each shape (lexical, forward, callee-plain, callee-nofail, value-passed, value-returned, ambient, random). Failures are saved to .build/fx008-soundness/. Sensitivity (ruling R1), run on commit ff0c6d1 (Task 8, no mark check) with this corpus at the default seed: 110 of the 120 witnessed escapes are accepted, every shape except value-returned (its 10 hit the strict Fail text), and the test fails.

Definition of done and handoff

Report functional acceptance (npm run verify) and performance qualification (npm run perf) separately; see “Verification contract”. Acceptance criteria must run through the actual CLI/backend, with typed rejections and regression sensitivity. Check new instructions from a clean output directory, because incremental zero warnings do not prove a rebuild. Update plan, progress, findings, ADRs, provenance, and backlog together. Record known failures with concrete next actions; deferred language features are scope decisions, not hidden failures. No external issue/commit/push rule from a reference project is inherited.

Generated output/output caches and lockfiles are excluded from line limits. Waxwing fixture files and generated Go are data; maintained source or test code cannot be moved into those trees to evade checks. The checker tests test the checker itself. Structural guarantees are bounded by direct imports and known library APIs, not a proof of arbitrary dependency purity.

Installed workflow material

Superpowers is project-local, revision-pinned third-party guidance, preserved unmodified under .agents/skills with its MIT notice. It is distinct from maintained Waxwing source/tests/tooling; project gates still cover their existing roots without weakened checks. docs/planning-skills.md records instruction precedence and adoption. Migrated plans preserve historical evidence without asserting retroactive TDD/commit records. Execution uses the installed plan/task/review helpers and real commit ranges.

Audit review findings (2026-10-07)

The audit moved computed Maybe fallbacks to named maybe’ functions, contextual traversal callbacks into where, independent resolver bindings into where, and branch calculations into helpers. Private comma-list parsing functions now have an explicit export boundary. No language semantics or gate was relaxed. Numeric limits in maintained checking/mutation scripts are named constants.

The 30-line/3-decision/8-branch/8-binding budgets are review targets. The flat exhaustive mappings in Format.Diagnostic (codeName: seventeen ErrorCode arms, one unrendered; code and message: fifteen Problem arms each) are retained together for readability; E003 records this specific target exception and its next review. All maintained code remains below 250 lines; automatic counts do not prove full naming/complexity compliance. No new source behavior or unification is claimed. Existing executable/snapshot/diagnostic tests validate this refactor.

Research scripts

research/ holds maintained evidence for designs that is not part of the compiler: prototypes, oracles and generators a design relies on (first research/open-row-merge/, for R005 Tranche B). It is maintained but not in verify: nothing there is built, tested or run by npm run verify. Automated: scripts/width.mjs scans it like every tracked .mjs and .md file, so the 80-column rule applies. Review convention: the 250-line limit and the other tooling rules hold there too, although scripts/structure.mjs scans only src, test, scripts and tools/style/src. Each directory has a README.md with exact commands, seeds, expected output and what each script checks; a design citing a result names the command that reproduces it.

Evidence for solvers and diagnostics

Approved by the user on 2026-10-17 as a general rule, with proportional scope. It binds new or materially changed solving rules and the diagnostic claims they make (a unifier’s rule, a constraint solver, a decision procedure whose result a diagnostic reports). Routine checker edits (a new text for an existing failure, a refactor, a rule extended to a new syntactic form with the same meaning) do not need a new three-way result type, an exhaustive oracle or a claims ledger. Where the evidence a rule below asks for is unavailable (no independent oracle can be written, the domain is too large, a part of the system is absent from the prototype), the design says so explicitly and names the compiler test that covers it instead. All of this is review convention: no gate checks it.

First applied in docs/plans/2026-10-17-open-row-merge-plan.md (R005 Tranche B); its rule arguments are docs/plans/2026-10-17-open-row-merge-rules.md.

Adversarial review of proposed procedures

Directed by the user on 2026-10-20, after a review refuted the completeness claim of a proposed signature checker (record composition dossier, §13.7) and, earlier, a forced-placement claim (§3.2, C7). Both defects had the same shape: the examples exercised cases where two different properties happened to coincide. Before a proposed procedure or a claim about one is approved for proof or implementation:

Review convention; no gate checks it.

Charter guidance in design and review

The approved Waxwing charter guides substantive language, library, runtime and tooling decisions. Name the relevant principles and explain material tradeoffs in the design’s existing rationale and assurance sections. The decision note asks about the programmer’s problem, library alternatives, guarantees, evidence and any departure. Use those questions where they help; a new form is unnecessary when the design already answers them.

This is a review convention. Neither a link check nor an automated prose check can establish semantic compliance. Latest explicit author decisions govern within scope; record supersession and raise substantially disruptive consequences before applying them. Charter approval does not authorize a feature, proof or implementation plan.

Prose review for READMEs and explanatory docs

Review convention (not automated), adopted 2026-10-19 at the user’s request. Applies to READMEs and documents written to explain a design to readers (not to plans, logs or progress records).

  1. Catalog before rewriting. For each problem, record the exact passage, the pattern it shows, and why it weakens this particular text (what a reader misreads, skips or has to reconstruct). Patterns include the AI-writing signs the humanizer skill lists (not-X-but-Y contrasts, one-line closers, staged openers, forced triads, dash overuse, inflated claims, sales language, stock words, bold labels, filler) and Bryan A. Garner’s plain-English concerns (Garner’s Modern English Usage; Legal Writing in Plain English): needless words, buried nominalizations (“make a determination” for “determine”), passive voice that hides the actor, abstract nouns where a concrete example would serve, unexplained jargon, inconsistent terms for one idea, and points buried mid-paragraph instead of stated first.
  2. Rewrite to fix the catalogued findings.
  3. Review the rewrite the same way and fix what remains.
  4. Preserve facts, qualifications (“measured, not proved”), technical distinctions and the author’s intentional voice. Don’t manufacture informality, and don’t drop a hedge that records a real limit.
  5. The humanizer skill is the tool for steps 1-3 where available; record the catalogue in the commit or review notes.

Known gaps in enforcement (A001)

Review conventions only: the layer names describe reasons to change, which no gate checks; the gate checks import direction, purity and IR access. F005: the nil-guard probe’s temp-directory cleanup is not asserted.

Porting compiler guarantees (draft, 2026-10-27)

The self-hosting roadmap and its source inventory identify parity obligations. This section is proposed review guidance; it adds no automated gate and authorizes no implementation or gate exception.

For each ported subsystem, record the existing static invariant, its Waxwing counterpart, the language/library assumptions, and the check or argument supporting it. Include negative cases for hidden constructors, scoped handles, variable sorts, witness coupling and read tracking where those properties apply. Preserve the independent boundary between untrusted proposals and trusted certification.

Adapt import/export and trusted-surface checks to Waxwing’s parsed module information. Keep executable, rejection and oracle fixtures; replace white-box adapters that depend on compiled PureScript’s JavaScript shapes. Repeated self-compilation is convergence evidence, separate from a proof of model-to-implementation correspondence.

Before claiming a tail-call or iterator-cost guarantee, name the source forms and backends covered. Test self, mutual and indirect tail calls, short-circuiting, callback order, failures and pending cleanup as applicable. On Go and JavaScript, specify Waxwing lowering that supplies the promised space bound rather than relying on host tail-call optimization. Account for pending cleanup and installed handler frames. Measure compiler-scale time, allocation and stack use. Keep the reference loop and size-dependent measurements; a small example passing is not a stack-safety or zero-overhead guarantee.