Read coding style before changing code, and test accounts for authenticated local/stage/production testing.
- Effect v4 internally, ordinary values and Promises at public SDK /
appsauthor boundaries. Derive author callback types from native contracts; compose Effects directly inside the library. - Product-owned authorization. Core SDK ownership is a lookup primitive, not permission enforcement. Share capabilities and UI views without forcing hosted organizations into local or adding
isCloudflags. - Migrations must keep the app online. Cloud migrations run before the replacement server deploys; a failed deploy does not roll back SQL. Add schema first, deploy code that uses it, drop obsolete fields in a later release. Never drop/rename a required column before replacement deploys, never add a maintenance Worker, never reset data or relabel a schema version. Verify fresh setup, retained data, repeat runs, and rollback on real adapters (storage).
- Every product change is proven from what a person or agent sees. Add or change its behavior in the feature map, then prove it with a journey or a test that ships a break, or block it with the reason. Which proof a change needs, and the whole path from map to verdict: proving a change. The pieces: feature map, journeys, lab, test policy, gate and proof.
- Tests live in a
test/directory beside thesrc/they verify and run on vitest throughbun run test(one package or file:bun run test <path>); hosted tests undertest/hosted/run withbun run test:hosted. Journeys live injourneys/and run withbun run journeys. The harness for both islab/(@executor-js/lab). - The same commit always gives the same result. A test or journey is never retried, re-run on failure, skipped, focused or marked todo.
- Never wait on wall-clock time. No sleeps, timers, polling or time budgets. A test waits on
host.clock.advance,host.clock.forkfor work that waits on the clock,host.background.run, or a completion the product exposes. A journey waits on the landmark an action leads to and on the page's settle marks; when a page gives no signal, add one in the product or block the behavior. Timeouts only detect hangs. - One clock, owned by the test. Time comes from
host.clock. If the product reads time the clock cannot reach, the test is blocked on a missing product seam: report it, never work around it. Journeys have no clock: behavior that needs time passing is proven by a test. - No network. Only loopback and registered stand-ins (
egress.standIn, or a stand-in a journey declares); anything else fails the run and names the URL.bun run test,test:hosted,journeysandsurfacerun in a loopback-only network namespace (scripts/no-network.ts): any name lookup or connection beyond loopback by any process they start fails the run and names the address and the process (record:network.jsonbesiderun.json). Defaults that reach the internet are turned off for every process the lab starts inlab/src/contracts/offline.ts. Where the machine allows no namespace the run says loudly that it had a network, and under CI it refuses; such a run is not a no-network result: get one withbun run remote. Images the suites build from or start must be on the machine first:bun run images:pull. - No shared state. Every test and journey gets its own host or instance, data directory, port and database, and passes in any order with any number of workers. Order is shuffled every run and the seed is printed; replay with
LAB_SEED=<seed>. Every Cloud journey that runsexecutor loginlives injourneys/test/cli-sign-in.journey.ts, because the CLI keeps sign-ins per host. - Assert on structure. Compare normalised data (
host.normaliser; snapshots, accessibility trees and transcripts are normalised automatically): ids by order of first appearance, times relative to the start. Never raw ids, raw timestamps or pixels. - Through a public surface only. A test reaches the product through HTTP, MCP, the CLI or the UI, never by importing implementation: it imports
@executor-js/lab, its sibling.verifies.ts,expect,effectandsrc/contracts/modules (linttest-policy/through-surface). The only exception is an invariant over a pure rule, written as aproperty, listed with its rule and why no surface shows it inpolicy/src/invariants.ts. - Everything names what it verifies.
x.test.tsregisters its tests withtests(declarations, bodies)from./x.verifies.ts, which names for each a feature-map behavior or an entrypoint ofsurface/entrypoints.txt, its invariant, or its check. A journey's declaration names its behaviors inproves. Both are typed: a typo is a compile error, and when what they name goes,bun run tests:checkorbun run features:checkfails until they go too. Coverage is generated intopolicy/coverage.mdbybun run testsandsurface/journeys.mdbybun run features. - Everything ships a break. A break is a patch under which the test or journey fails where it says:
test/breaks/<test id>.patchwith{ "fails": "assertion" | "snapshot", "why" }, proved bybun run tests:break <test id>;journeys/breaks/<journey id>.patchwith{ "fails": "<checkpoint or transcript>", "why" }, proved bybun run journeys:breaks <journey id>.tests:checkandfeatures:checkfail when a break is missing or no longer applies. - Same commit, same result. A property checks the same generated inputs on every run of a commit: its seed comes from its test id, not from the run. Cases it once failed on are recorded and replayed first, and a known product defect lives in the test's known-defect list with its smallest case, printed in
policy/coverage.md, until it is fixed. New inputs are tried outside the gate withbun run explore. - Admission before gating. A new or changed test file or journey gates only after it passes every run of admission across the conditions in
ci/src/contracts/admission.ts(bun run test:admission <files>for tests; the gate admits journeys). To run one of the gate's journey units yourself before pushing:bun run remote --size xlarge -- bun run ci gate admission --kind journeys --file <journey file> --members <journey,…> --cell <0-5> --runs <n> --sized-to-this-machine --out /tmp/admission. It sizes the unit to the machine it is on and says so in its first line, records nothing, and is refused inside the gate's own jobs; it shows whether the unit passes in that condition, not how long the gate takes.--outhas to be outside any checkout, because a journey run refuses to write evidence inside one. On a smaller machine fewer runs fit at once (a Cloud journey runs one at a time in 31 GB) and the unit stops at its deadline, so pass--deadline-seconds <n>when you need every one of--runs. - Never bend a test or journey to pass. A product defect, or a disagreement between the map and the product, is blocked with its seam in the files
journeys/src/journeys/blocked.tslists and reported, never waited out or recorded as right.
- On a host that other agents share, run every suite, browser run or build that takes more than a minute or a few cores with
bun run remote -- <command>:bun run check,bun run test,bun run journeys:build/journeys,bun run test:hosted,bun run typecheck, image builds. Quick single-file runs may stay local, undernice -n 10; on a machine that allows no network namespace they run with a network (see No network). - It sends exactly
HEAD(agit archive, rebuilt there as the same commit) to a fresh machine, runs the command with no network but loopback and its own containers, streams its output and exits with its status.--patchalso sends uncommitted changes;--back <path>copies a path in the checkout back;--out <dir>copies$REMOTE_OUTback (evidence that must live outside a work tree);--shards Nsplits over N machines ({shard}/{shards}in the command),--size xlargefor 16 cores. Any run with a Cloud journey in it needs--size xlarge: the journeys' memory check plans Cloud at about 11 GB, what it holds by the end of a whole suite, however short the run, so the default 16 GB machine is refused at any worker count; Local and self-host files fit there. A whole suite on one Cloud instance can hold about 220 Cloud journeys (116 today): under the local runtime each new organization leaves about 23 MB in Cloud's app-data worker, which dies at its memory limit after about 260 to 280 of them, and the gate reports a worker that dies as the product failing. - Machines delete themselves at the end and stop on their own 10 minutes after the runner dies (
--max-minutes, default 120, is the hard limit).bun run remote statuslists them. A run's runner keeps its machine up; once the runner dies the machine stops by itself within 10 minutes, and only then is it anyone's to sweep:bun run remote gcdeletes this repository's stopped machines and never one that is up, whatever state the provider reports (a machine whose job runs over a connection readsidle), and prints what it deleted and what it left. Stop a run of yours by its process; to delete a machine you started that is still up,bun run remote delete <machine id>, which refuses a machine started from another checkout (each name carries its checkout,xn-run-<checkout>-<time>-<suffix>).bun run remote baserebuilds the prepared base after a change to Node, bun, Playwright, Rust or the Dockerfiles' images. - Nothing secret is sent: a secret-like name (
.env*,*.pem,*.key,id_*, token files), any.local/or.reference/, or anything outside the commit and patch refuses the run. Never work around a refusal by renaming or archiving a file; a committed non-secret file is pinned by blob hash inscripts/remote.ts. --allow-networkgives the command the network. It is for diagnosis only, and a result from it is not a no-network verdict (the suite runners still enter their own namespace there;LAB_ALLOW_NETWORK=1keeps the network, outside CI only).
- Public
UsefulSoftwareCo/executorbranchv2is overwritten fromexecutor-nextmainon export. Never merge, push to, or open PRs directly againstv2. - To land an external contributor's
v2PR so GitHub marks it merged: port it into a draftexecutor-nextPR with a commit body linePublic-PR: UsefulSoftwareCo/executor#<number> <full head sha>. Keep the SHA current if the contributor pushes updates.
- CI, release and preview tools:
bun run ci --helplists every one (the gate, proof, Cloud deploys, releases, products, previews, the scoreboard);bun run ci <command> --helpgives its flags. - Setup: in a fresh checkout run
bun installbefore anything else. - Workspace: keep
~/agent-workspace/executor-nextclean onmain. Do all work in a rift workspace on a named branch; before starting, runbun run workspace:check --taskin the rift. It fetchesoriginand changes nothing; it checks only its own checkout: clean, inside a rift, on a named branch other thanmain, and not behindorigin/main. - Before pushing: run
bun run formatandbun run check. - After pushing: wait with
bun run ci verdict --sha $(git rev-parse HEAD) --pr <N>, never by sleeping, polling or watching the run. It blocks up to 9 minutes and exits with the verdict:0pass, done;1fail: reproduce each printed cause with its command, fix, push;2fails only on pending admission: do not change code for it;3inconclusive: proof code changed, tell the owner;4no readable verdict,5not started: nothing says your code is at fault, remove the printed cause or tell the owner;6superseded: wait for the head it prints;7gave up: run the printed resume command;8could not ask GitHub: read the printed error. A change to any journey,lab/orci/is proof code and is always inconclusive. How an owner reads the proof page: proving a change. - Before handing over:
bun run ci proof show --pr <N>reads the proof; on exit2name each behavior it prints as unproven in the pull request, with what proves it instead. - Evidence after a re-run: an earlier attempt's artifacts are not evidence you can rely on: GitHub removes some of them each time every job of a run is re-run (about 50, lowest ids first; re-running only the failed jobs removes none). An attempt's evidence is its stored proof, linked from that attempt's
proofstatus (https://proof.executor.engineering/b/<id>/);bun run ci verdictfinds it. - Stacks: land stacks only via
gh stack merge <top PR> --yes --squashafter checking all layers are in one stack onmain. Never bypass themainruleset (--admin, API bypass). Never run CI checks on macOS runners. - Release notes: for changes users of Cloud, the CLI, desktop, or self-host would notice, add
Release-note: Feature|Improvement|Fix: <plain sentence>in a commit message body (PR titles are never published; see RELEASING.md). A note goes to every product its change reaches;node scripts/releases/release-notes.ts --check <base>prints who and the note's hash, where<base>is the branch the pull request merges into (origin/main, or the branch below it in a stack): it reads the commits in<base>..HEAD, and an entry with that hash inscripts/releases/note-audiences.tschanges it. appsversions: a change to what theappspackage ships needs a higher version inpackages/apps/package.json,bun install, andbun run apps:record, committed together; a recorded version's content never changes (apps publishing).- Generated / patched files: never edit
node_modulesdirectly (usebun patch <pkg>). Never read/editpackages/apps/protocols/*.jsondirectly (runbun run apps:protocols/--write; see apps publishing). - Cloud Worker size:
bun run checkbuilds the Cloud Workers as a deploy does and fails when one is over its budget inapps/hosted/cloud/src/infrastructure/worker-build.ts, or grew past the size recorded for it inapps/hosted/cloud/worker-sizes.jsonby more thangrowthLimit(apps/hosted/cloud/scripts/worker-sizes.ts). To allow growth, record it with its reason in the same change:bun run hosted:cloud:worker-sizes --record <worker> "<why it is worth the cold-start time>". Never raise budgets to fit a change. - Documentation: every
bun runscript,bun run citool, repository path and link thatAGENTS.md, the top-level documents,notes/,.agents/and the READMEs ofjourneys/,lab/,policy/,ci/,surface/andscripts/name must exist (scripts/check-docs.ts). Write numbers that change (counts of journeys, behaviors) only as a pointer to the generated file that holds them. - Test failures: never re-run a failed test or job to get a pass. Replay its printed seed and matrix cell locally; a failure that does not reproduce is still a defect in the test or the product. A gate run with no verdict because machines could not be prepared (a step before their own command failed, and nothing that ran failed) has no failed test: running those machines again, with a new push or "re-run failed jobs", is not a re-run of a failed test.
Every enforcer below runs in bun run check (steps in ci/src/contracts/checks.ts) or in the gate, unless the row says otherwise.
| Rule | Enforcer |
|---|---|
Format, lint, executor/* Oxlint rules |
format and lint steps (.oxlintrc.jsonc, scripts/oxlint-plugin.ts) |
| Types & Effect diagnostics | typecheck step (bun run typecheck, tsc-rs) |
| No retries, re-runs, skips or focused tests and journeys | vitest.config.ts and vitest.journeys.config.ts (retry: 0, allowOnly: false), scripts/test.ts and scripts/journeys.ts refuse retry and focus flags, lab reporter fails skipped/todo/retried runs, executor/no-test-timeout-or-retry and executor/no-skipped-or-focused-tests |
| No waiting on wall-clock time | executor/no-test-waiting, test-code timer tripwire (lab/src/implementation/tripwires.ts), hang-only timeouts in the vitest configs; journeys read pages only once settled (web.checkpoint) |
| One clock, owned by the test | controlled clock (lab), executor/no-test-wall-clock, test-code Date tripwire; product Date and randomUUID tripwires report call sites |
| No network | scripts/no-network.ts (loopback-only namespace and a watcher for name lookups and connections, network.json; refuses a run with a network under CI), scripts/no-network/netns.sh, lab/src/contracts/offline.ts, lab egress guard (fetch, sockets, DNS, Effect HttpClient) checked after every test, the journey browser's request filter |
| No shared state | a host or instance per test and journey (fresh data dir, own port), shuffled order with printed seed, pool: forks, handle-leak check after every test, executor/journey-through-harness; the harness refuses Cloud executor login from a second journey file |
| Assert on structure | normalising snapshot serializer (lab/src/vitest/setup.ts), normalised journey trees and transcripts (journeys/src/implementation/harness.ts), executor/no-pixel-assertions |
| Admission before a test or journey gates | the gate's admission units (bun run ci gate admission, running scripts/test-admission.ts and ci/scripts/journey-admission.ts) |
Nothing secret, .local/ or .reference/ sent to boat.dev; same commit there |
scripts/remote.ts, on every bun run remote and in bun run check (remote upload rules: the same stageTree over the tracked tree, so a pull request cannot make every later commit unsendable; upload rules checked on the commit, the patch and the transfer; tree and commit hashes checked on the machine) |
| Dependency patches & exact versions | dependency-patches and exact-versions steps |
bun.lock matches every package.json |
lockfile step (scripts/check-lockfile.ts) |
| Tests only through a surface; invariants listed | lint test-policy/through-surface (scripts/oxlint-test-policy.ts), policy/src/invariants.ts |
| Every test names what it verifies and ships a break | lint test-policy/declares-what-it-verifies, typed .verifies.ts, test-policy step (bun run tests:check); bun run tests:break proves one |
| Every journey names its behaviors, agrees with the map and ships a break; blocks name a seam | typed proves, feature-map step (bun run features:check); bun run journeys:breaks proves one |
| Every served entrypoint is claimed or listed as unclaimed | surface-snapshots step (bun run surface:check) |
| Host protocols, telemetry, API errors | host-protocols, app-telemetry and api-errors steps |
A published apps version never changes content |
apps-version step (scripts/releases/apps-recorded.ts, packages/apps/released.json); on main, the publish compares with npm |
| Better Auth refuses redirects and keeps its security patches | auth-security step (bun run auth:security) |
| Cloud Worker upload sizes, growth and the sites' links | cloud-build step: bun run hosted:cloud:worker-sizes, then bun run site:links and bun run docs:audit on the site it built |
| GitHub Actions workflow syntax | workflows step (scripts/check-workflows.ts: GitHub's workflow schema, needs and local uses) |
| Documentation names only what exists | doc-references step (scripts/check-docs.ts) |