Skip to content

agda-algebras' archives

This note explains how the IDE's copy of agda-algebras is built for the page: its interfaces built by the Agda the page runs, packed so that a reader's imports fetch what they need and nothing else, and indexed from the dependency graph Agda itself computes (#12). ADR 0001 § 10 records the decisions; this note is the explanation it links. The page ships and mounts the sources archive, for the playground's project, which depends on the library (#11; ADR 0001 § 11); since #14 it ships the index and the interface archives too, and mounts those a check's imports need, after it has stated their bytes and the reader has agreed ("The mount in the page", below; ADR 0001 § 12); the Explorer that lists the modules is #9's. Every figure is from the runs of 2026-10-11 that #12's findings describe: the local ones in docs/measurements/library-archives-2026-10-11.json, with the machine and its load, and the runner's in its run; the gate's, which checks them under the page's own language server (#13), from the runs of 2026-10-12 in docs/measurements/library-archives-browser-2026-10-12.json; and the mount's, from the runs of 2026-10-13 in docs/measurements/library-mount-2026-10-13.json.

An interface (.agdai) is what Agda writes after it type-checks a module: the module's definitions in a binary form, which a later check that imports the module reads instead of checking it again. Agda accepts an interface only when the same Agda wrote it, from the same source, under the same options, against imports with the same hashes, and a rejected one is checked again without a word. Under Agda 2.9.0 the interface's integers also have the word size of the Agda that wrote it, so the page's 32-bit (wasm32) Agda reads only what a wasm32 Agda wrote (#58; ADR 0001 § 7). So every interface here is built by the compiler's own plain agda.wasm, and acceptance is counted, never inferred: Agda prints one Checking line for each module it type-checks (indented for nested ones, so the count is unanchored), and a check that found every interface it needed prints one, for the module checked.

What the package builds

nix build .#agda-algebras-archives is the one command. Its output is the following:

  • index.json, the index (below);
  • agda-algebras-sources.zip, agda-algebras' sources as the page mounts them: agda-algebras/agda-algebras.agda-lib, agda-algebras/src/, and the license texts its NOTICE names for them (LICENSE, LICENSE-data, NOTICE), deflated; the site ships the same file, from the same derivation (#11);
  • interfaces/*.zip, the interface archives: one per agda-algebras module, named by the module (interfaces/Setoid.Varieties.HSP.zip), and one per group of standard-library modules (below), named by a digest of the group's members (interfaces/stdlib-bbd88e40b6f4.zip);
  • summary.md, the sizes: by library, the archives, a fixed set of roots, and the spread over every root.

It is built in three derivations, so that each step reruns only when its own inputs change:

Package Script What it does
(internal) flake.nix, mkAgdaAlgebrasSources Zips the pinned sources.
agda-algebras-interfaces scripts/library-archives/build.sh Builds the interfaces and the graph, under wasmtime.
agda-algebras-archives scripts/library-archives/pack.mjs Packs them and writes the index.
agda-algebras-check scripts/library-archives/check.sh Checks every root from the archives the index names.

Each derivation copies only its own scripts into the store, so a change to the check does not rebuild the interfaces.

The build

(scripts/library-archives/build.sh and stage.sh.)

  • The inputs: agda-algebras at the commit flake.nix pins (agdaAlgebras, a fetchFromGitHub with its hash, beside the standard library's stdlibSource); the three archives the page mounts, exactly as it ships or will ship them: agda-data.zip (the builtins, with their interfaces, built by the same agda.wasm; mkAgdaData), agda-stdlib-2.4.1.zip (mkStdlib) and agda-algebras-sources.zip; the compiler's agda.wasm (nix build .#compiler); and nixpkgs' wasmtime, 38.0.4 at this flake's nixpkgs.
  • The stage: a directory laid out as the page's drive (layOutDrive, in the engine's packages/engine/src/browser/worker/drive.ts), from those archives, and mounted as the guest's root (wasmtime run --dir <stage>::/), with HOME=/home/root and Agda_datadir=/, as the page's server has them (packages/engine/src/browser/worker/als.ts):
Path on the drive From
/lib/prim agda-data.zip: the builtins' sources and interfaces
/stdlib the standard library's archive: src/ and standard-library.agda-lib, as layOutDrive takes them
/agda-algebras agda-algebras' sources archive: agda-algebras.agda-lib and src/
/home/root/.config/agda/libraries written: the two .agda-lib files
  • What the layout buys, each measured: every interface lands under its library's _build/2.9.0/agda/src/, where the server looks (mounted as the guest's root, Agda's walk for a project root ends at /); the builtins' interfaces from agda-data.zip are accepted (no Checking line has a path under /lib/prim); and the paths Agda stores in an interface (with a deprecation warning, for one) are the page's, not the build machine's. Where agda-algebras sits, /agda-algebras, is the layout #11's finding of 2026-10-04 used, which #11 kept.
  • What is built: every module of agda-algebras' include path, Legacy/ included, since a reader may import any of them, and the standard-library modules they import, not the whole standard library. agda --build-library, run at /agda-algebras, does this: it finds every Agda file in the library's include path, sorts the paths, and checks them one at a time, so its order does not depend on the filesystem (Agda.Interaction.BuildLibrary at the pin), and no generated Everything.agda is needed (agda-algebras' own Makefile writes two, which are not tracked). It took 5 min 54 s to 6 min 59 s in three builds here with the machine quieter, 10 min 27 s to 12 min 27 s in three while other sessions loaded it (1-minute loads of 2.1 to 3.5 before them), and 10 min 33 s on GitHub's runner: this workstation's cores fall to 2.2 GHz under load, from a peak of 5 GHz, so its times move with its load.
  • The graph: a module All in /play, importing every module of agda-algebras, checked with --dependency-graph over the built stage, so that only All is checked (11.2 to 22.5 s here). Agda builds the graph from each interface's own list of imports and reduces it transitively (Agda.Interaction.Highlighting.Dot.Backend): reachability in it is exact, though its edges are not a module's imports. The index takes every closure from it, never from the sources: the fork's PLFA index reads imports with a regular expression, which misses an open import inside a parameterized or nested module (#12's finding of 2026-10-04).
  • wasmtime compiles agda.wasm before it runs it: 13.6 to 22.9 s and 4.4 GiB of resident memory here (4,549,816 to 4,568,428 KiB), and 1 min 12 s on the runner's two cores. It caches the result under $HOME/.cache, so each derivation gives it a writable HOME and pays the compile once; without the cache every run pays it. The 4.4 GiB at once is the build's peak, on a runner with 7.8 GiB.
  • The heap: a wasm32 heap cannot pass 4 GiB, and running out is an error, not swapping. The whole build, one process, held 995 MiB of GHC's total memory in use (+RTS -s; maximum residency 584,345,808 bytes; 981 MiB on the runner), about a quarter of the cap. If the library outgrows it, the build stops with an error and nothing is shipped; the remedy is to split it into several agda processes over the same stage (by top-level directory, say, in a fixed order), since what a process holds is what its own session has loaded, and the interfaces persist between processes. The page's own heap is a separate question: a check of the umbrella module agda-algebras, which reaches 603 modules, peaked at 1,029,252 KiB under wasmtime here, and 1,048,188 KiB on the runner.

Reproducibility

  • The bytes reproduce: six builds of the interfaces here wrote the same output (the third by nix build .#agda-algebras-interfaces --rebuild, which builds again and fails if a byte differs, and the fifth by build.sh outside the sandbox, at a host path), and --rebuild of the archives passes. The control shows that the comparison can fail: with a timestamp written into the archives' output (an uncommitted line in pack.mjs), --rebuild stopped with "may not be deterministic: output ... differs", and diff -r named the file. On GitHub's runner the same --rebuild passed, and the index it wrote, which holds every archive's SHA-256, is byte for byte the one built here (run 38153481044): all 395 archives reproduce across machines.
  • One fixed procedure: how many deprecation warnings an interface stores depends on the order the build checks the modules in. The probe of 2026-10-10 built the same inputs through a generated Everything.agda and then --build-library; 600 of its 601 interfaces equal the package's byte for byte, and the umbrella module agda-algebras differs: 314,087 bytes against 284,544, its payload holding 70 deprecation warnings that name Legacy/ sources, where the package's holds none. So the order is part of the build, and --build-library's is fixed.
  • No host path enters: the guest's paths are the same in every build, so the 65 interfaces that native builds in two directories wrote differently (#61) cannot differ by path here.

The packing

(scripts/library-archives/pack.mjs.)

The rule: one archive per agda-algebras module, holding its interface; and the standard-library modules grouped by the set of agda-algebras modules that reach them, one archive per group.

  • Why it costs nothing extra: two standard-library modules in one group are reached by exactly the same agda-algebras modules, so a set of imports from agda-algebras needs either every module of a group or none of them. The archives an import needs therefore hold exactly its closure's interfaces, for any set of agda-algebras roots: the bytes fetched exceed the floor (the closure's own interfaces) by the zip headers alone. An agda-algebras module is reached by itself, so no two share a group, which is why each has its own archive. A reader who imports a standard-library module that agda-algebras does not reach checks it from source; one that agda-algebras does reach may bring the rest of its group.
  • What it gives (agda-algebras f067d57d): 395 archives, 350 of agda-algebras and 45 groups of the standard library, 70,104,812 bytes in all. The largest, 6,965,690 bytes, is a group of 45 standard-library modules that 293 of the 350 roots need; every archive is far under the 25 MiB that Cloudflare Pages allows a file (ADR 0001 § 3), though 183 of the 350 closures need more than 25 MiB, so a closure is never one file. For the fixed roots (the modules count a closure's builtins too, which are on the drive from the start; the floor is the closure's other interfaces):
Imports Modules Archives Bytes fetched Floor
Overture.Basic 66 14 4,318,471 4,306,193
Setoid.Algebras.Basic 179 50 16,974,016 16,939,046
Setoid.Varieties.HSP 313 128 39,251,541 39,186,131
the three together 313 128 39,251,541 39,186,131
agda-algebras, the umbrella module, the heaviest root 603 385 69,376,238 69,242,574

Under Agda 2.8.0, #12's packing fetched 99 files and 54.6 MB for the three together, against a floor of 54.3 MB.

  • Against the alternatives, on the same interfaces: #12's recommendation from 2.8.0's numbers, the standard library in tiers by the first top-level directory of agda-algebras that needs a module (reconstructed here in the order Overture, Order, Setoid, Classical, Examples, Exercises, Legacy), fetches 15,858,563 bytes for Overture.Basic against a floor of 4,306,193, since its tier carries everything any Overture module needs, and 4.0% over the floor for the HSP root; and grouping agda-algebras' own modules by their first two name components cuts the HSP root from 128 archives to 58, at 6.2% over the floor there and 18.9% for the median root. The cost of the rule is the number of files: 82 for the median root, 128 for the HSP root, 385 for the umbrella module. The page fetches six at a time (the engine's browser transport, mountArchives in packages/engine/src/browser/index.ts), so the HSP root's 128 took 0.4 s from a local server ("The mount in the page", below).
  • Stored zips: the payload of a 2.9.0 interface is already zstd, so gzip saves 0.09% on the HSP closure (the probe), and a stored zip costs nothing to unpack; but the name matters, since Cloudflare caches .zip and .gz at its edge and not .agdai or .json, and the drive's mountArchive takes a zip. Entries are sorted, at their paths on the drive (agda-algebras/_build/2.9.0/agda/src/..., stdlib/_build/...), with one fixed time, so an archive's bytes depend on its inputs alone.
  • The names: an agda-algebras archive is named by its module; a standard-library group by a digest of its members' names, so its name changes only when its membership does. The index carries each archive's SHA-256, which the page checks a fetched archive against, keeps it under in the browser, and puts in its URL as the ?cache= token (#14).
  • The sources come beside the standard library's, not inside it: agda-algebras-sources.zip, 985,864 bytes, deflated, holding every module (the Explorer lists them, #9). It is a different library, at a different pin, under a different license, and the standard library's archive is an asset the page already ships under its own cache token; joining them would change that archive whenever agda-algebras moves. The page mounts it eagerly with the standard library's.

The index

index.json, schema 1, is the contract with the issues that read it: #14 reads which archives an import needs and their bytes before it fetches, and #13 reads the roots to check. #9's Explorer lists the same modules from a list of its own, written from the sources archive alone, which agrees with roots and with each module's source (docs/notes/explorer.md). scripts/library-archives/index.mjs reads it through two functions, closure and needs, which compute what those issues are to compute, and the check stages each root from what needs says.

Field What it holds
schema 1
agda version (the _build/<version> the interfaces live under) and wasm, the SHA-256 of the agda.wasm that built them
libraries per library (agda-algebras, standard-library, builtins): its root on the drive, its .agda-lib (agdaLib), its name as a depend: line names it, and its sources archive (path, bytes, sha256); agda-algebras' also its commit
roots every module of agda-algebras, sorted: what a reader can import
archives per interface archive, by its path in the output: bytes, sha256, and the number of modules it holds
modules per module of the closure of agda-algebras (its 350, the standard library's 251, and 12 builtins): its library, its source and interface paths on the drive, the interface's bytes, its archive (null for a builtin, whose interface is in agda-data.zip), and deps, its successors in Agda's graph

To find what a set of imports needs: walk deps from the imported modules (everything reached is the closure, since Agda's graph keeps reachability exact), and take each reached module's archive, less null. An import the index does not list (a standard-library module agda-algebras does not reach, or a reader's own) has no archive here, and Agda checks it from source; needs returns it in unknown. The index is one archive and one module per line, so that two indexes diff by line. It is 285,618 bytes, 42,353 gzipped.

The check

(scripts/library-archives/check.sh, nix build .#agda-algebras-check.)

  • What it proves, #12's second criterion: for each root, a fresh stage with the builtins, both libraries' sources, and only the archives the index names for that root; a /play/Main.agda that imports the root under agda-algebras' options line ({-# OPTIONS --without-K --exact-split --safe #-}, which all 350 modules carry), in a play library that depends on both libraries; and the compiler's agda.wasm, which must exit 0 having printed one Checking line. Anything else fails.
  • Every root, every time: 350 of 350 in the sandbox here, eight at once, in 7 min 21 s (the checks' own times sum to 3,271 s, at the machine's clock under that load); the slowest root, Examples.Classical, 25.7 s, and the largest memory, the umbrella module's, 1,029,252 KiB. An earlier run, before the script's last change, took 7 min 25 s; the runner's, two at once, 30 min 6 s. Each check is one thread, so the job scales with the cores it is given.
  • Two controls, run after the roots on Overture.Basic, each of which must print more than one Checking line, or the check could not fail: the root's own archive left out (Agda checks Overture.Basic again, and exits 0 with 2 lines), and the first byte of its source changed under its interface (Agda checks it again and then cannot write its interface, 2 lines, exit 42).
  • How a root is staged: each archive is extracted once, and a root's stage hard-links the files it needs from those copies and from a base stage of the sources; every shared file is read-only, so a check that rejected an interface cannot overwrite what another check reads (the second control shows it trying). Staging costs little, and the checks run in parallel (JOBS).
  • A proxy for the server: the page's Agda is the language server's reactor build, a separate binary of the same Agda commit at the same word size, which cannot run under wasmtime; the plain agda stands in for it here, and the gate below proves the same under the server itself.

The gate

(scripts/library-archives/gate.mjs and gate/, make library-gate; #13.)

  • What it proves, #13's two criteria: the check above, under the language server the site ships, its reactor (als-reactor-2.9.0.wasm), in headless Chromium. For each root, a fresh session of the engine's browser transport, over a drive laid out from the site's own builtins, standard library and agda-algebras' sources archive; a play library beside /play/Main.agda, written as stage.sh writes it; the archives the index names for the root (index.mjs's needs, as check.sh stages them), mounted with the transport's mountArchives as the page mounts archives; then a load of a Main that imports the root under agda-algebras' options line. It passes when the load's Checking lines (the session's LoadValue.checking) name Main alone and Agda reports no error. Before it starts, the site's builtins, standard library and (since the site ships it, #11) agda-algebras' sources archive must have the digests the index records, or it stops: archives built against other inputs would be checked again, and the gate would measure that.
  • The drive's libraries: the drive wrote Agda's registry once, as fixed text naming the standard library and PLFA, so agda-algebras could not be on it (#11's finding of 2026-10-04). The engine now takes a list of libraries (BrowserConfig.archives.libraries), each a zip extracted at the root, its .agda-lib on the drive and its name, the fields index.json records under libraries; layOutDrive writes the libraries file from it after the standard library's .agda-lib, which is the stage's file, and a defaults file from the names, which Agda reads only for a file in no library. The page passes agda-algebras' and PLFA's (#11); the gate passes agda-algebras'. A list rather than a slot for agda-algebras, since the engine is every host's, and #14 and #11 mount the same library.
  • Every root, every time: 350 of 350 on 2026-10-12 here (headless Chromium 149, four at once, a 1-minute load of 3.0 at the start and 6.1 at the end, from other sessions' builds), in 12 min 49 s. Per root, the engine's start took 0.53 to 2.19 s (median 0.86 s), the mount median 0.23 s, and Agda's load median 7.9 s, the slowest 16.8 s (Classical.Structures.Group.SubgroupClassification); summed over the roots, 3,020 s, of which the starts are 313 s. An earlier run, before the gate's last edits, gave the same counts in 13 min 36 s at a 1-minute load of 6.3 to 8.3. These runs were at e891c84, before the branch was rebased onto main at 999c4a4, which brought #64's engine, whose session counts the Checking lines; at the rebased head, 495a793, the gate gave the same counts again, 350 of 350 and the controls 2 and 2, in 15 min (a 1-minute load of 5.5 to 7.0), and once more at 6f275c2, after the self-review's fixes, in 8 min 55 s on a quieter machine (a 1-minute load of 1.4 to 4.0). The fixed roots:
Imports Archives Bytes mounted Load Heap
Overture.Basic 14 4,318,471 2.0 s 57 MiB
Setoid.Algebras.Basic 50 16,974,016 3.7 s 181 MiB
Setoid.Varieties.HSP 128 39,251,541 8.5 s 351 MiB
agda-algebras, the umbrella module 385 69,376,238 15.0 s 701 MiB
  • The heap is the reactor's linear memory when the check has ended, which never shrinks, so it is the check's peak: a probe in the gate's worker (gate/memory.ts) keeps the instance's memory and reports its size. The umbrella module's 735,248,384 bytes are the largest, a sixth of a wasm32 heap's 4 GiB; wasmtime's 1,029,252 KiB for the same check is its process's resident set, the runtime's and the compiled code's with Agda's.
  • Against wasmtime: on one runner, four at once each (run 38209105006), the check under agda.wasm summed 2,498 s over the roots and the gate's loads 3,369 s, 3,908 s with the starts and the mounts: the browser takes 1.3 to 1.6 times wasmtime's time, and the umbrella module 19.1 s against 14.5 s. The local runs (3,020 s four at once here, 3,271 s eight at once on 2026-10-11) ran under different loads and do not compare. The counts, not these times, are the finding.
  • Two controls, after the roots, each in a fresh session, on Overture.Basic, each of which must type-check more than Main: its own archive left out, and the first byte of its source changed under its interface (a zip of the changed source, mounted after the archives). Each type-checked Main and Overture.Basic, 2 lines, in 2.0 and 2.2 s; here the drive is writable, so Agda writes the new interface and reports no error, where check.sh's read-only stage made the changed-source control exit 42. And the gate's own exit: over a copy of the archives whose Overture.Basic.zip holds no interface, both Overture.Basic and Overture, which imports it, type-checked 2 modules, and the gate exited 1.
  • A fresh session per root, not one per job: with --shared, each of four sessions checks its roots in turn, mounting each root's archives as it comes, and the 350 roots took 85 s, where fresh sessions took 769 s, since Agda keeps the interfaces it decoded and a later root reads only what is new. The heap does not decide it: the four sessions ended at 844,693,504 to 906,166,272 bytes, the umbrella module among one session's roots. What decides it is the criterion: a shared session's drive holds every archive mounted for its earlier roots, so a root whose index entry lacked an archive would still pass, and a root's closure is not read from the drive again. So the gate opens a session per root, and pays its start, a tenth of its time, and the decoding of every closure; --shared stays as a quick run while iterating.
  • What the record holds: per root, how many Checking lines it printed and how many archives it mounted, their bytes, the three times, and the heap; the controls; the site's and the archives' digests and Agda's version as the server reports it; the machine and its load (docs/measurements/library-archives-browser-2026-10-12.json).

The mount in the page

(packages/manifest/src/imports.ts and library.ts; the engine's browser transport, packages/engine/src/browser/index.ts, with its archive store, archive-store.ts, and its stale caches, drive-caches.ts; src/lib/controller.svelte.ts, prepareImports; #14.)

The page mounts, before a check of the playground's Main, the archives its imports need, and asks before it fetches any. A mount extracts an archive's interfaces onto the drive, where Agda reads them; the drive's cache is the IndexedDB database in which the drive keeps what Agda wrote, named by a digest of the assets (its namespace); the archive store is a second database, in which the browser keeps the archives it fetched, by their SHA-256.

  • Where they come from: the page's own origin, /agda-algebras/ (William's decision of 2026-10-13). A GitHub release cannot serve them: neither its redirect nor the file it redirects to sends Access-Control-Allow-Origin, and a page's fetch of one fails in Chromium 149. The page fetches the index when Agda starts, beside the library's sources, and an archive only when a check needs it.
  • The plan: the imports are read from the buffer by Agda 2.9.0's own lexical and literate rules (comments, pragmas, strings and characters blanked; in Markdown, a bare fence and an agda fence are both code, as Agda takes them by default). The closure of what this reading finds is Agda's own for 597 of agda-algebras' and the standard library's 601 modules; the other 4 differ by Agda.Primitive, which Agda imports without a statement, and which is on the drive from the start. Agda's builtins (Agda.*) need no plan, so the default Main never waits for the index. The closure comes from the index (index.mjs's needs; a unit test compares the two for every root), and an import the index does not list is followed into its source on the drive (/play, then /agda-algebras/src, then /stdlib/src), whose imports join the plan: open import Data.Vec, which agda-algebras does not reach, mounts the 29 archives (25,191,583 bytes) its own imports need, and leaves 2 modules to check from source, where the index alone would have mounted nothing. A module found nowhere is named in a note.
  • What it skips: an archive mounted earlier in the session, and one whose every interface the drive already holds, because an earlier check from source wrote them and the drive's cache restored them. Agda 2.9.0 accepts an imported module's interface by iFullHash, the hash of its source combined with its imports' (Agda.TypeChecking.Monad.Base and Agda.Interaction.Imports at the compiler's commit), not by the interface's bytes; and the interfaces the page wrote from source were byte-identical to the archives' (11 of 11 for Overture.Signatures's closure, 170 of 170 for Setoid.Algebras.Basic's).
  • The question: the bytes still to fetch, in one convention (bytes, then KB of 1,024 bytes, then MiB) with the exact count beside them, the archives and the modules whose interfaces they hold, and the origin: "Checking Main.agda needs 202.1 KB (206,933 bytes) of agda-algebras' interfaces: 3 archives holding 11 modules, from this site." Its answers are Fetch, Check from source and Cancel, and the answer may be remembered for the tab (sessionStorage); a decline is remembered for the archives declined, so a later check that needs only those does not ask again, and one that needs new archives asks for all of them, saying how many of them, and how many bytes, were declined before. Check from source still mounts what the browser keeps: Agda then checks the declined archives' modules alone, and accepts the archived interfaces above them (the browser check's declined fetch: one archive declined, its one module checked, nothing else, not even Main). The question takes the keyboard's focus only when the reader asked for the check; Esc, and any edit, cancel it; it shows no spinner, since nothing is under way while it waits. Nothing is requested before the answer.
  • The fetch: at most six archives at once, their progress in the unit of their total ("120.0 of 202.1 KB"), each checked against its SHA-256 with the browser's own digest (which needs a secure origin, https or localhost; elsewhere the page does not offer the fetch), kept in the archive store, and extracted as it arrives. STOP ends it, and a failure names the archive; either way nothing is checked, and the plan's note says so. A plan whose imports change while it is made is made again, twice at most, and then not checked. An archive whose bytes are not its digest's says that the site may have changed since the page was loaded.
  • The store: agda-native-ide-archives, keyed by each archive's SHA-256 and named once, since its keys are the archives' contents. A second visit mounts from it with no request. When the page reads the index it evicts what the index no longer names; a record that cannot be read or extracted is forgotten; an archive the plan counted as kept that is gone when the mount reads it is not fetched, but planned and asked for again.
  • The drive's cache: the index's digest is in its namespace, a mounted archive's paths leave it (neither persisted nor restored again), and the page deletes every drive database of another namespace when it starts: those indexedDB.databases() lists (Chromium; Firefox from 126), and those a list in localStorage records, which is all Firefox 114 to 125 can find, and only for namespaces this code recorded.

Measured 2026-10-13 in headless Chromium 149, from a local server, at a 1-minute load of 2 to 3, three rounds each, medians; the archives are the fixed roots' (the mount is from the answer to the check's start, the check is the page's own duration, and the second visit is a reload in the same profile):

Imports Question Mount Check Second visit: mount, check
Overture.Basic 4.1 MiB (4,318,471 bytes), 14 archives 58 ms 1.06 s 43 ms, 1.02 s
Setoid.Algebras.Basic 16.2 MiB (16,974,016 bytes), 50 archives 157 ms 3.21 s 96 ms, 3.16 s
Setoid.Varieties.HSP 37.4 MiB (39,251,541 bytes), 128 archives 419 ms 6.54 s 188 ms, 6.31 s

A second sample, at the change's last revision and a load of 1.8 to 4.9, took 77, 176 and 599 ms to mount and 1.25, 3.73 and 8.56 s to check, and its second visits again asked nothing and requested no archive. From source, the page checked Setoid.Algebras.Basic's 170 modules in 1 min 38 s to 6 min 32 s over six runs (#11) and 5 min 0.5 s on 2026-10-13. Over a network the fetch adds the transfer: 39,251,541 bytes take about 6 s at 50 Mbit/s.

  • What the page does not yet state in bytes: what it loads when Agda starts (the compiler's gzip, 11,095,997 bytes; the builtins, the standard library and the two libraries' sources; the index), and PLFA's chapter archives, built by Agda 2.8.0, which the page's Agda does not read (#20 retires them).

CI

(.github/workflows/library-archives.yml.)

  • What it runs: it builds the interfaces, packs the archives (and rebuilds them, a matter of seconds), checks every root, and writes the sizes, the check's counts and the build's time and memory to the step summary, uploading the index, the summary, the report and the check's log. It also builds the interfaces a second time with --rebuild, which fails if a byte differs. The archives are not uploaded: the package rebuilds them from the pins.
  • When: on demand, and on a push to main or a pull request that changes what the archives are built from (the flake and its lock, the standard library's patches, the compiler's hashes, the scripts, the workflow), as a path filter; and then only if the check's derivation differs from the base's, or the workflow changed, or what the gate is made of did (the gate, below, which also widens the path filter). The job evaluates .#agda-algebras-check.drvPath at the base (the pull request's base, or the commit before a push) and at the head, in seconds, and builds nothing when they are equal and the gate's code is unchanged, since that derivation is the one the base proved. Nearly every change touches flake.nix, so without the guard an unrelated change would build everything (58 minutes on a 2-core runner); with it, a push that changed nothing the archives are built from took 21 s (run 38159537130). A newer run cancels one in progress on a pull request, never on main, since a later push's guard compares against the commit before it.
  • What it measured on GitHub's runner while the repository was private (2 cores, 7.8 GiB, 3 GiB of swap, none used; 2026-10-11, run 38153481044), 58 minutes in all: the interfaces with their inputs in 13 min 43 s, --build-library itself 10 min 33 s (981 MiB of GHC's total memory in use) after wasmtime's compile, 1 min 12 s at 4,501,604 KiB; their --rebuild in 12 min 3 s, passed; the archives in 8 s; and the check, two at once, in 30 min 6 s, 350 of 350, the controls 2 and 2. The memory sampled every two minutes never passed 2,923 MiB of 7,938 (the compile's peak falls between samples), and the disk went from 14 to 13 GB free.
  • The gate, after the check: it builds the site (nix build .#site) and runs make library-gate with every root, as many at once as the runner has cores, writing its counts, its summed times, the slowest load and the largest heap to the step summary and uploading its report and log with the records. It runs when the check's derivation changed, and also when what the gate is made of did, which the derivation does not cover: the gate's app, whose store path holds its scripts (gate.mjs, index.mjs, and the DevTools driver and static server it shares with the browser check) and the node and Chromium it pins, which the guard compares with the base's as it compares the derivation; and, by a diff against the base, the engine's core and browser transport (they lay out the drive and count the Checking lines; the gate's page imports nothing else of the engine), the gate's page, the lockfile, and the Makefile, whose library-gate target CI runs. The path filter names them. It runs every root wherever it runs, pull requests included, since it runs only when one of its own inputs changed. On GitHub's runner (4 cores, an AMD EPYC 9V74, 15.6 GiB; 2026-10-12, run 38209105006, dispatched on #13's branch, so everything was built): 350 of 350 and the controls 2 and 2, the gate itself in 16 min 33 s and its step, with npm ci and the page's build, in 17 min 18 s; Agda's load a median 10.3 s and at most 23.7 s (Examples), the umbrella module 19.1 s at 768,081,920 bytes. The whole job took 49 min 0 s: the interfaces 9 min 47 s, their --rebuild 9 min 6 s, the check under agda.wasm four at once 11 min 45 s, the site 29 s. The pull request's own two runs, on slower runners, took 62 min 23 s and 66 min 28 s, the gate's step 21 min 5 s and 23 min 56 s (runs 38213187621 and 38243413321; the record has all four runs of the day). A change to the gate alone builds the interfaces once, without the --rebuild, and runs the gate: from these steps, about 25 to 40 minutes while nothing is cached, an estimate, since no run has changed the gate alone yet.
  • In the site: since #14, the site carries the index and the archives under /agda-algebras/ (285,618 and 70,104,812 bytes; the built site went from 30,439,204 to 100,856,795 bytes), so the site's derivation depends on the interfaces'. site.yml reads this job's cache, and builds the interfaces itself (9 min 47 s to 13 min 43 s on a runner) until main's runs push them; William chose this on 2026-10-13 over an origin of their own (ADR 0001 § 12).
  • The cache: the job reads the public formalverification Cachix cache, which agda-algebras' CI also uses, so a derivation built before is fetched rather than built, and it pushes what it builds from main only, since a pull request's run executes what the pull request changed (the write token, CACHIX_AUTH_TOKEN, reaches the action on main alone). It pushes none of what the flake fetches by hash from GitHub anyway: the compiler's files and the sources' tarballs. --rebuild is never fetched: it builds again on the runner and compares with the first build, built or fetched, so on a cached run it proves the bytes reproduce across machines. William's decision of 2026-10-11, with the repository public, where runners cost no minutes. The token has not reached the action yet: main's run of 2026-10-12 says "Pushing is disabled", so nothing is cached yet, and a change to the gate alone builds the interfaces again before it runs. It does not push the site or its npm dependencies, which site.yml builds without the cache.

Licenses

What the archives carry is licensed as its source is, since a 2.9.0 interface holds its module's source text (iSource in Agda's Interface, kept "so that the HTML and LaTeX backends can generate their output"; Overture.Basic's decompressed interface holds its front matter and prose).

  • agda-algebras' sources and interfaces: Apache-2.0. The sources archive carries LICENSE, NOTICE and LICENSE-data. An interface is the work in object form, which Apache-2.0 covers by name, not a machine-extracted representation: agda-algebras' LICENSE-data excludes "the source files under src/ themselves, in whole or in part", and an interface contains them whole.
  • The index: Apache-2.0 or CC0-1.0, at the recipient's option (LICENSE-data): module names and paths, dependency metadata, sizes and digests, which that file names.
  • The standard library's interfaces: MIT, like its sources, whose archive the page already ships with its LICENCE; the builtins' are already in agda-data.zip, under Agda's MIT license.
  • What the site ships: the sources archive since #11, which NOTICE names, with agda-algebras' LICENSE and NOTICE copied into licenses/agda-algebras/, and docs/provenance.md records. Since #14 the site ships the interfaces and the index, and the same files name them: the interfaces under Apache-2.0 like the sources (the standard library's under MIT), and the index under LICENSE-data, which licenses/agda-algebras/ now holds too.

(William's decision of 2026-10-11, on the session's recommendation.)

Moving to another commit, or another Agda

  • agda-algebras: change rev and hash in flake.nix's agdaAlgebras together (set hash to lib.fakeHash and the build reports it), then nix build .#agda-algebras-check. The index records the commit; archives whose modules changed get new digests, and the standard-library groups may regroup if agda-algebras' imports changed.
  • Agda: a new compiler (its pins in compiler/agda-2.9.0.sha256) rebuilds the builtins, the interfaces and the archives, since each takes the compiler as an input; the interfaces move to _build/<version>/, which pack.mjs reads from the build and the index records. A new standard library is a new source pin (stdlibSource and stdlibVersion), and the same rebuild.
  • The page's cache: the index's digest is in the drive cache's namespace (scripts/asset-manifest.mjs), so a drive persisted against one set of archives is not restored against another, and the page deletes the old namespace's database when it starts; the browser keeps each archive by its own SHA-256, so an archive that did not change is not fetched again, and one that did is fetched, and its old copy evicted, by the first check that needs it (#14).