Merge build/agents-private into main
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by oscabriel · committed by oscabriel · parents c5e82bb, 0ba3a85 · Browse files · 17 files·+77 added−751 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
17 files+77 added−751 removed
- tests:+49 added−711 removed
- other:+28 added−40 removed
Provenance
- Commit
b1f69d8- Tree
969991c- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent 1
c5e82bb- Parent 2
0ba3a85
17 files changed+77 added−751 removed
modified:infra/.env.schema+1 added-1 removed
26 unmodified lines27 # the demo's fictional people with apps/platform/.env.schema's28 # SESSION_TOKENS, run as `bunx varlock run --path apps/platform/ -- bun29 # scripts/swarm.ts …`, so no script or agent reads a `.env*` file. On every30 # stage those tokens come from the stage's generated secrets file outside the31-# repo (STAGE_SECRETS_FILE, .agents/ops/stages.md).31+# repo (STAGE_SECRETS_FILE).modified:infra/bootstrap.ts+3 added-3 removed
27 unmodified lines28 * prints no triggers, so only this read proves the push-event trigger29 * exists.30 *31 * It never deletes, never prints a secret, and never reads a `.env` file.32- * Teardown is written down in `.agents/ops/stages.md`, not automated.32+ * Tearing a stage down is a person's job, not automated.33 */34 import { BunRuntime, BunServices } from "@effect/platform-bun";35 import {36 Config,333 unmodified lines370 "MissingSecrets",371 { names: Schema.Array(Schema.String), stage: Schema.String }372 ) {373 override get message() {374- return `${this.stage}'s platform lacks ${this.names.join(", ")}: set them by name (.agents/ops/stages.md)`;374+ return `${this.stage}'s platform lacks ${this.names.join(", ")}: set them by name, from the stage's secrets file (STAGE_SECRETS_FILE)`;375 }376 }377 378 const API = "https://api.cloudflare.com/client/v4";240 unmodified lines619 const missing = missingSecrets(items, listed);620 621 if (!deployed) {622 return yield* Console.log(623- `bootstrap ${stage}: ${platform} is not deployed yet, so its first deploy must carry ${required.join(", ")} through varlock (.agents/ops/stages.md).`623+ `bootstrap ${stage}: ${platform} is not deployed yet, so its first deploy must carry ${required.join(", ")} through varlock, from the stage's secrets file (STAGE_SECRETS_FILE).`624 );625 }626 627 return yield* missing.length === 0106 unmodified linesmodified:infra/deploy.ts+1 added-2 removed
22 unmodified lines23 * with its own login, never the read-mostly infra token.24 *25 * `STAGE_SECRETS_FILE` names a dotenv file outside the repo whose values the26 * platform's deploy carries as its environment, which varlock reads before any27- * `.env` file: a stage's generated secrets, on every stage (`.agents/ops/stages.md`,28- * "Secrets"). Only the items `apps/platform/.env.schema` declares are passed,27+ * `.env` file: a stage's generated secrets, on every stage. Only the items `apps/platform/.env.schema` declares are passed,28 * to that one step, and no value is ever printed.29 *30 * Each step runs with its own folder's `node_modules/.bin` first on `PATH`,31 * since `varlock-wrangler` starts `wrangler` by name.288 unmodified linesmodified:infra/teardown.ts+1 added-1 removed
123456678910148 unmodified linesExpand all/** * teardown: `bunx varlock run --path infra/ -- bun infra/teardown.ts * [--stage <s>] [--keep <project>]… [--apply]`. Prints which throwaways the * ledger (`infra/created.jsonl`) still has on the account, and with `--apply` * deletes exactly those; `infra/lib/teardown.ts` decides what may be deleted, * and `.agents/ops/stages.md` ("Teardown policy") says why. * and says why. * * It reaches Artifacts with the infra token (`CLOUDFLARE_ACCOUNT_ID` and * `CLOUDFLARE_API_TOKEN`, from `varlock run --path infra/`): repos through * `@repo/artifacts`' REST adapter, one per namespace, and a namespace itself148 unmodified linesExpand allmodified:packages/brand/test/leaks.test.ts+1 added-1 removed
45 unmodified lines46 expect(47 findLeaks([48 { content, path: "packages/brand/src/other.ts" },49 { content, path: "AGENTS.md" },50- { content, path: ".agents/adr/0001-x.md" },50+ { content, path: "examples/datekit/README.md" },51 { content, path: "apps/web/src/components/ui/LICENSE" },52 { content, path: "apps/web/src/assets/fonts/LICENSE-x.txt" },53 { content, path: "LICENSE" },54 ])95 unmodified linesmodified:packages/config/test/bootstrap.test.ts+1 added-1 removed
571 unmodified lines572 names: ["OPERATOR_TOKEN", "COOKIE_KEY"],573 stage: "demo",574 }).message575 ).toBe(576- "demo's platform lacks OPERATOR_TOKEN, COOKIE_KEY: set them by name (.agents/ops/stages.md)"576+ "demo's platform lacks OPERATOR_TOKEN, COOKIE_KEY: set them by name, from the stage's secrets file (STAGE_SECRETS_FILE)"577 );578 expect(579 new CloudflareRefused({ route: "/workers/subdomain", status: 403 })580 .message7 unmodified linesdeleted:packages/config/test/demo-docs.test.ts-642 removed
1-/**2- * The demo folder. On recording day the user opens `.agents/demo/`3- * and finds a narration script timed to the video's seven beats, a shot list,4- * the swarm scenario and a rehearsal checklist that the live walk marks.5- *6- * Every command those files show is one that exists: each line of a shell7- * block runs Bun, git, the CLI or one of the harnesses; each `bun run <x>`8- * is a root script and each `bun <file>` a file in the repo; each CLI line is9- * a command in `commandDocs(Contracts)`, the CLI's one command list, with10- * flags it takes, and so is each CLI command named in prose or in a table11- * cell (a shot's fallback). The shot list's own commands obey the same12- * rules, every shot is on the `demo` stage and named in its beat of the13- * script, and the rehearsal has one checkbox per shot.14- *15- * Each file's presence is asserted before it is read, so a missing file is a16- * failed assertion, not a load error.17- */18-import { NodeServices } from "@effect/platform-node";19-import { describe, expect, it } from "@effect/vitest";20-import { Effect, FileSystem, Option, Path, Schema } from "effect";21-22-import { blankJsonc } from "../../../infra/jsonc.ts";23-import {24- platformOrigin,25- subdomainFile,26- webOrigin,27- WorkersDev,28-} from "../../../infra/stages.ts";29-import { roster } from "../../../scripts/lib/swarm/roster.ts";30-import { nudges } from "../../../scripts/lib/swarm/scenario.ts";31-import { commandDocs } from "../../agent-kit/src/command-doc.ts";32-import type { CommandDoc } from "../../agent-kit/src/command-doc.ts";33-import { Brand } from "../../brand/src/index.ts";34-import { Contracts } from "../../protocol/src/contracts.ts";35-import { repoRoot } from "./root.ts";36-37-/** The folder, from the repo root, and the four files the user records from. */38-const DEMO = ".agents/demo";39-40-const DEMO_FILES = [41- "rehearsal.md",42- "script.md",43- "shot-list.md",44- "swarm-scenario.md",45-] as const;46-47-/** A file under the repo root, as text, once its presence is asserted. */48-const presentText = (file: string) =>49- Effect.gen(function* () {50- const fs = yield* FileSystem.FileSystem;51- const path = yield* Path.Path;52- const at = path.join(yield* repoRoot, file);53-54- expect(yield* fs.exists(at), `${file} exists`).toBeTruthy();55-56- return yield* fs.readFileString(at);57- });58-59-/** Whether `file`, relative to the repo root, is on disk. */60-const existsInRepo = (file: string) =>61- Effect.gen(function* () {62- const fs = yield* FileSystem.FileSystem;63- const path = yield* Path.Path;64-65- return yield* fs.exists(path.join(yield* repoRoot, file));66- });67-68-/** Every Markdown file in the demo folder, by its path from the repo root. */69-const demoMarkdown = Effect.gen(function* () {70- const fs = yield* FileSystem.FileSystem;71- const path = yield* Path.Path;72- const names = yield* fs.readDirectory(path.join(yield* repoRoot, DEMO));73-74- return names75- .filter((name) => name.endsWith(".md"))76- .toSorted()77- .map((name) => `${DEMO}/${name}`);78-});79-80-const RootPackage = Schema.Struct({81- scripts: Schema.Record(Schema.String, Schema.String),82-});83-84-/** The names `bun run <name>` can run from the repo root. */85-const rootScripts = Effect.gen(function* () {86- const text = yield* presentText("package.json");87-88- const { scripts } = yield* Schema.decodeEffect(89- Schema.fromJsonString(RootPackage)90- )(text);91-92- return new Set(Object.keys(scripts));93-});94-95-// A beat's H2: its title, then its range on the video's clock, `0:45–1:30`.96-const BEAT =97- /^## (?<title>.+?) \((?<fromMinutes>\d+):(?<fromSeconds>[0-5]\d)–(?<toMinutes>\d+):(?<toSeconds>[0-5]\d)\)$/u;98-99-/** One beat of the script: its title and its range, in seconds. */100-interface Beat {101- readonly from: number;102- readonly title: string;103- readonly to: number;104-}105-106-/** The script's H2s that read as beats, and those that don't. */107-const beatsOf = (script: string) => {108- const headings = script.split("\n").filter((line) => line.startsWith("## "));109-110- const beats = headings.flatMap((line): readonly Beat[] => {111- const groups = BEAT.exec(line)?.groups;112-113- return groups === undefined114- ? []115- : [116- {117- from: Number(groups.fromMinutes) * 60 + Number(groups.fromSeconds),118- title: groups.title ?? "",119- to: Number(groups.toMinutes) * 60 + Number(groups.toSeconds),120- },121- ];122- });123-124- return {125- beats,126- unranged: headings.filter((line) => !BEAT.test(line)),127- };128-};129-130-/** Where a beat's range breaks the clock: a gap, an overlap or a backwards range. */131-const clockBreaks = (beats: readonly Beat[]) =>132- beats.flatMap((beat, index) => {133- const startsAt = index === 0 ? 0 : (beats[index - 1]?.to ?? -1);134-135- return [136- ...(beat.from === startsAt137- ? []138- : [`${beat.title} starts at ${beat.from}s, not ${startsAt}s`]),139- ...(beat.to > beat.from ? [] : [`${beat.title} ends before it starts`]),140- ];141- });142-143-// A fenced shell block, possibly indented under a list item. `bash`, `shell`144-// and `zsh` count as `sh`, so no command slips past the rules by its tag.145-const SH_FENCE =146- /^[ \t]*```(?:sh|bash|shell|zsh)\n(?<body>[\s\S]*?)^[ \t]*```[ \t]*$/gmu;147-148-// Any fenced block, whatever its language.149-const ANY_FENCE = /^[ \t]*```[\s\S]*?^[ \t]*```[ \t]*$/gmu;150-151-/** Every non-blank line of every shell block in `text`, trimmed. */152-const shLines = (text: string) =>153- [...text.matchAll(SH_FENCE)].flatMap((match) =>154- (match.groups?.body ?? "")155- .split("\n")156- .map((line) => line.trim())157- .filter((line) => line !== "")158- );159-160-// `bunx varlock run --path <dir> -- <command>`: varlock loads a schema's161-// values into the command's env (the swarm's people, the seed's tokens), so162-// the command after `--` is the one the rules read.163-const VARLOCK = /^bunx varlock run(?: --path \S+)? -- (?<inner>.+)$/u;164-165-/** The command a line runs: itself, or the one varlock wraps. */166-const commandOf = (line: string) => VARLOCK.exec(line)?.groups?.inner ?? line;167-168-/** The programs a demo command may start with. */169-const PROGRAMS = new Set([170- "amp",171- "bun",172- "cd",173- "claude",174- "export",175- "git",176- "herdr",177- "opencode",178- "pi",179- Brand.cli,180-]);181-182-/** Shell that would run a second command the rules never read: `&&`, `||`, a pipe or `;`. */183-const CHAINED = /&&|\|\||\s\|\s|;/u;184-185-/** A line's first word, the program it runs. */186-const programOf = (line: string) => commandOf(line).split(/\s+/u)[0] ?? "";187-188-/** Why `line` may not appear in a demo command, if it may not. */189-const programProblem = (line: string): readonly string[] => {190- if (CHAINED.test(line)) {191- return [`${line}: chains a second command`];192- }193-194- return PROGRAMS.has(programOf(line))195- ? []196- : [`${line}: starts with ${programOf(line)}`];197-};198-199-/** The root scripts a line runs with `bun run <name>`. */200-const scriptsIn = (line: string) =>201- [...line.matchAll(/\bbun run (?<name>\S+)/gu)].map(202- (match) => match.groups?.name ?? ""203- );204-205-/** The files a line runs with `bun <file>`. */206-const filesIn = (line: string) =>207- [...line.matchAll(/(?:^|\s)bun (?<file>[\w./-]+\.[cm]?[jt]s)(?=\s|$)/gu)].map(208- (match) => match.groups?.file ?? ""209- );210-211-/** The CLI command a line runs, as its words after the CLI's name, if it runs one. */212-const cliWordsOf = (line: string): readonly string[] | undefined => {213- const [program, ...words] = commandOf(line).split(/\s+/u);214-215- return program === Brand.cli ? words : undefined;216-};217-218-/** The command whose words start `words`, the longest one when several do. */219-const commandFor = (220- docs: readonly CommandDoc[],221- words: readonly string[]222-): CommandDoc | undefined =>223- docs224- .filter((doc) => doc.path.every((word, index) => words[index] === word))225- .toSorted((one, other) => other.path.length - one.path.length)[0];226-227-/** The flags `words` give before a bare `--`, without their `=value`. */228-const flagsIn = (words: readonly string[]) => {229- const end = words.indexOf("--");230-231- return (end === -1 ? words : words.slice(0, end))232- .filter((word) => word.startsWith("--"))233- .map((word) => word.split("=")[0] ?? word);234-};235-236-/** Why a CLI line names no command the CLI has, or a flag its command lacks. */237-const cliProblem = (238- docs: readonly CommandDoc[],239- line: string240-): readonly string[] => {241- const words = cliWordsOf(line);242-243- if (words === undefined) {244- return [];245- }246-247- const doc = commandFor(docs, words);248-249- if (doc === undefined) {250- return [`${line}: no ${Brand.cli} command ${words[0] ?? ""}`];251- }252-253- return flagsIn(words.slice(doc.path.length))254- .filter((flag) => !doc.flags.includes(flag))255- .map((flag) => `${line}: ${doc.path.join(" ")} takes no ${flag}`);256-};257-258-/** Why a line's `bun run` scripts or `bun` files don't exist, if they don't. */259-const bunProblems = (scripts: ReadonlySet<string>, line: string) =>260- Effect.gen(function* () {261- const missingScripts = scriptsIn(line)262- .filter((name) => !scripts.has(name))263- .map((name) => `${line}: no root script ${name}`);264-265- const missingFiles: string[] = [];266-267- for (const file of filesIn(line)) {268- if (!(yield* existsInRepo(file))) {269- missingFiles.push(`${line}: no file ${file}`);270- }271- }272-273- return [...missingScripts, ...missingFiles];274- });275-276-/** Every problem a command line has: its program, its scripts, files and CLI command. */277-const commandProblems = (278- docs: readonly CommandDoc[],279- scripts: ReadonlySet<string>,280- line: string281-) =>282- Effect.map(bunProblems(scripts, line), (missing) => [283- ...programProblem(line),284- ...missing,285- ...cliProblem(docs, line),286- ]);287-288-/** One row of the shot list's table. */289-interface Shot {290- readonly beat: string;291- readonly fallback: string;292- readonly id: string;293- readonly preconditions: string;294- readonly run: string;295- readonly screen: string;296-}297-298-const SHOT_ROW = /^\| S\d{2} \|/u;299-300-/** The shot list's rows: `| S01 | beat | screen | run | preconditions | fallback |`. */301-const shotsOf = (list: string) =>302- list303- .split("\n")304- .filter((line) => SHOT_ROW.test(line))305- .map((line) => {306- const cells = line307- .slice(1, -1)308- .split("|")309- .map((cell) => cell.trim());310-311- return {312- cells: cells.length,313- shot: {314- beat: cells[1] ?? "",315- fallback: cells[5] ?? "",316- id: cells[0] ?? "",317- preconditions: cells[4] ?? "",318- run: cells[3] ?? "",319- screen: cells[2] ?? "",320- } satisfies Shot,321- };322- });323-324-/** The inline code spans of a table cell or a line of prose. */325-const spansIn = (text: string) =>326- [...text.matchAll(/`(?<code>[^`\n]+)`/gu)].map(327- (match) => match.groups?.code ?? ""328- );329-330-/** The inline code spans of `text` outside its fenced blocks. */331-const proseSpans = (text: string) => spansIn(text.replace(ANY_FENCE, ""));332-333-/** Whether a span runs the CLI: its name, then a command. */334-const runsCli = (span: string) => span.startsWith(`${Brand.cli} `);335-336-/** One beat's part of the script: its title, and everything to the next H2. */337-interface BeatSection {338- readonly text: string;339- readonly title: string;340-}341-342-/** The script, cut at its H2s, keeping the parts that are beats. */343-const beatSections = (script: string) =>344- script.split(/^(?=## )/mu).flatMap((part): readonly BeatSection[] => {345- const [heading = "", ...body] = part.split("\n");346- const title = BEAT.exec(heading)?.groups?.title;347-348- return title === undefined ? [] : [{ text: body.join("\n"), title }];349- });350-351-/** The shot ids `text` names: `S01`, `S26`. */352-const shotIdsIn = (text: string) =>353- [...text.matchAll(/\bS\d{2}\b/gu)].map(([id]) => id);354-355-/** The rehearsal's per-shot checkboxes, by shot id, ticked or not. */356-const checkboxIds = (rehearsal: string) =>357- rehearsal358- .split("\n")359- .flatMap(360- (line) => /^- \[[ x]\] (?<id>S\d{2})\b/u.exec(line)?.groups?.id ?? []361- )362- .toSorted();363-364-/** The demo stage's two origins, from the account's workers.dev subdomain. */365-const demoOrigins = Effect.gen(function* () {366- const text = yield* presentText(subdomainFile);367-368- const { subdomain } = yield* Schema.decodeEffect(369- Schema.fromJsonString(WorkersDev)370- )(blankJsonc(text));371-372- return [platformOrigin("demo", subdomain), webOrigin("demo", subdomain)];373-});374-375-const live = <A, E>(376- effect: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>377-) => effect.pipe(Effect.provide(NodeServices.layer));378-379-describe("the demo folder", () => {380- it.live(381- "holds the script, the shot list, the swarm scenario and the rehearsal",382- () =>383- live(384- Effect.gen(function* () {385- const fs = yield* FileSystem.FileSystem;386- const path = yield* Path.Path;387- const root = yield* repoRoot;388- const present: Record<string, boolean> = {};389-390- for (const file of DEMO_FILES) {391- present[file] = yield* fs.exists(path.join(root, DEMO, file));392- }393-394- expect(present).toStrictEqual({395- "rehearsal.md": true,396- "script.md": true,397- "shot-list.md": true,398- "swarm-scenario.md": true,399- });400- })401- )402- );403-404- it.live(405- "times the script's seven beats back to back from 0:00 to at most 10:00",406- () =>407- live(408- Effect.gen(function* () {409- const script = yield* presentText(`${DEMO}/script.md`);410- const { beats, unranged } = beatsOf(script);411-412- expect(unranged, "every H2 is a beat with its range").toStrictEqual(413- []414- );415- expect(beats).toHaveLength(7);416- expect(clockBreaks(beats)).toStrictEqual([]);417- expect(beats.at(-1)?.to ?? Infinity).toBeLessThanOrEqual(600);418- })419- )420- );421-422- it.live(423- "runs only Bun, git, cd, export, the CLI or a harness in its sh blocks",424- () =>425- live(426- Effect.gen(function* () {427- const files = yield* demoMarkdown;428- const lines: string[] = [];429-430- for (const file of files) {431- lines.push(...shLines(yield* presentText(file)));432- }433-434- expect(lines.length, "the demo files show commands").toBeGreaterThan(435- 0436- );437- expect(lines.flatMap(programProblem)).toStrictEqual([]);438- })439- )440- );441-442- it.live(443- "names only root scripts, files that exist and commands the CLI has",444- () =>445- live(446- Effect.gen(function* () {447- const files = yield* demoMarkdown;448- const scripts = yield* rootScripts;449- const docs = commandDocs(Contracts);450- const problems: string[] = [];451-452- for (const file of files) {453- for (const line of shLines(yield* presentText(file))) {454- problems.push(455- ...(yield* bunProblems(scripts, line)),456- ...cliProblem(docs, line)457- );458- }459- }460-461- expect(problems).toStrictEqual([]);462- })463- )464- );465-466- it.live(467- "names only CLI commands and flags the CLI has, in prose and tables too",468- () =>469- live(470- Effect.gen(function* () {471- const docs = commandDocs(Contracts);472- const spans: string[] = [];473-474- for (const file of yield* demoMarkdown) {475- spans.push(...proseSpans(yield* presentText(file)).filter(runsCli));476- }477-478- expect(479- spans.length,480- "the demo files name CLI commands outside their shell blocks"481- ).toBeGreaterThan(0);482- expect(spans.flatMap((span) => cliProblem(docs, span))).toStrictEqual(483- []484- );485- })486- )487- );488-489- it.live(490- "names each shot in its own beat of the script, and no shot the list lacks",491- () =>492- live(493- Effect.gen(function* () {494- const sections = beatSections(495- yield* presentText(`${DEMO}/script.md`)496- );497-498- const shots = shotsOf(yield* presentText(`${DEMO}/shot-list.md`)).map(499- ({ shot }) => shot500- );501-502- const listed = new Set(shots.map((shot) => shot.id));503-504- const unlisted = sections505- .flatMap(({ text }) => shotIdsIn(text))506- .filter((id) => !listed.has(id));507-508- const unnamed = shots509- .filter(510- (shot) =>511- !sections.some(512- ({ text, title }) =>513- title === shot.beat && shotIdsIn(text).includes(shot.id)514- )515- )516- .map((shot) => `${shot.id} in ${shot.beat}`);517-518- expect(shots.length, "the shot list has shots").toBeGreaterThan(0);519- expect({ unlisted, unnamed }).toStrictEqual({520- unlisted: [],521- unnamed: [],522- });523- })524- )525- );526-527- it.live(528- "lists each shot with a script beat, a screen, and commands or URLs on demo",529- () =>530- live(531- Effect.gen(function* () {532- const { beats } = beatsOf(yield* presentText(`${DEMO}/script.md`));533- const titles = new Set(beats.map((beat) => beat.title));534- const rows = shotsOf(yield* presentText(`${DEMO}/shot-list.md`));535- const scripts = yield* rootScripts;536- const docs = commandDocs(Contracts);537- const origins = yield* demoOrigins;538- const problems: string[] = [];539-540- expect(rows.length, "the shot list has shots").toBeGreaterThan(0);541-542- for (const { cells, shot } of rows) {543- if (cells !== 6) {544- problems.push(`${shot.id}: ${cells} cells, not 6`);545- }546-547- if (!titles.has(shot.beat)) {548- problems.push(`${shot.id}: no beat named ${shot.beat}`);549- }550-551- if (!["split", "terminal", "web"].includes(shot.screen)) {552- problems.push(`${shot.id}: screen ${shot.screen}`);553- }554-555- if (shot.preconditions === "" || shot.fallback === "") {556- problems.push(`${shot.id}: no preconditions or no fallback`);557- }558-559- const spans = spansIn(shot.run);560-561- if (spans.length === 0) {562- problems.push(`${shot.id}: nothing to run or open`);563- }564-565- for (const span of spans) {566- if (span.startsWith("https://")) {567- if (!origins.some((origin) => span.startsWith(`${origin}/`))) {568- problems.push(`${shot.id}: ${span} is not on the demo stage`);569- }570- } else {571- problems.push(572- ...(yield* commandProblems(docs, scripts, span)).map(573- (problem) => `${shot.id}: ${problem}`574- )575- );576- }577-578- for (const { groups } of span.matchAll(579- /--stage (?<stage>\S+)/gu580- )) {581- if (groups?.stage !== "demo") {582- problems.push(`${shot.id}: --stage ${groups?.stage ?? ""}`);583- }584- }585- }586-587- if (shot.run.includes("<stage>")) {588- problems.push(`${shot.id}: <stage> is not set`);589- }590- }591-592- expect(problems).toStrictEqual([]);593- })594- )595- );596-597- it.live(598- "names each contributor's exact model, and quotes the video's nudges word for word",599- () =>600- live(601- Effect.gen(function* () {602- const scenario = yield* presentText(`${DEMO}/swarm-scenario.md`);603-604- const rows = scenario605- .split("\n")606- .filter((line) => /^\| \d \|/u.test(line))607- .map((line) => line.split("|").map((cell) => cell.trim()));608-609- expect(610- rows.map((cells) => [611- cells[2],612- /`(?<id>[^`]+)`/u.exec(cells[4] ?? "")?.groups?.id,613- ])614- ).toStrictEqual(roster.map(({ handle, model }) => [handle, model]));615-616- const told = roster.flatMap((_, index) =>617- Option.toArray(nudges("video", index))618- );619-620- expect(told, "the video scenario nudges two").toHaveLength(2);621- expect(622- told.filter((nudge) => !scenario.includes(`> ${nudge}`))623- ).toStrictEqual([]);624- })625- )626- );627-628- it.live("rehearses every shot once, by its id", () =>629- live(630- Effect.gen(function* () {631- const shots = shotsOf(yield* presentText(`${DEMO}/shot-list.md`))632- .map(({ shot }) => shot.id)633- .toSorted();634-635- const rehearsal = yield* presentText(`${DEMO}/rehearsal.md`);636-637- expect(shots.length, "the shot list has shots").toBeGreaterThan(0);638- expect(checkboxIds(rehearsal)).toStrictEqual(shots);639- })640- )641- );642-});modified:packages/config/test/docs-public.test.ts+40 added-62 removed
1 /**2- * The repo's own docs are the public record: AGENTS.md, GLOSSARY.md, the3- * ADRs and the agent docs point at nothing outside the repo, AGENTS.md says4- * what holds today, every decision has a numbered ADR with a status, and the2+ * The repo's own docs are the public record: AGENTS.md and GLOSSARY.md point3+ * at nothing outside the repo, AGENTS.md says what holds today, and the4 * glossary defines the terms the code is written in. No file the repo would6- * commit cites the build's private plan either, code comments included.7- * File reads and string checks only, beside one `git ls-files`.5+ * commit cites the build's private plan or points into the maintainer's6+ * gitignored working docs either, code comments included. File reads and7+ * string checks only, beside one `git ls-files`.8 */9 import { NodeServices } from "@effect/platform-node";10 import { describe, expect, it } from "@effect/vitest";11 import { Array, Effect, FileSystem, Option, Order, Path, Schema } from "effect";12 13 import { committable, readsAtOnce, repoRoot, textOf } from "./root.ts";14 15 /**16+ * A pointer into the maintainer's working docs, which live in a gitignored17+ * `.agents/` folder on the maintainer's machine: the decisions, the demo, the18+ * stage record, the workflow docs, the issue tracker and the folder's README.19+ * A bare `.agents/` is not one: a hosted project's skill lives under it.20+ */21+const PRIVATE_FOLDERS = [22+ ".agents/adr",23+ ".agents/demo",24+ ".agents/ops",25+ ".agents/workflow",26+ ".agents/scratch",27+ ".agents/README",28+] as const;29+30+/**31 * What a pointer to something only the maintainer can open looks like: a32 * home folder, the private research repo or the host that serves it, or the18- * build's own plan folder (gitignored).33+ * maintainer's working docs.34 */35 const PRIVATE = [36 "~/",37 "/home/",38 "wanted-explainer",39 "plans.gneiss.run",25- ".agents/scratch/build",40+ ...PRIVATE_FOLDERS,41 ] as const;42 43 /**44 * What a reference into the build's private plan looks like, which a reader23 unmodified lines68 PLAN_REFERENCES.flatMap((reference) =>69 reference.test(text) ? [reference.source] : []70 );71 72+/**73+ * Where the private folders may be named: the maintainer's folder itself,74+ * while it is still on disk, and `.gitignore`, which keeps it out.75+ */76+const NAMES_THE_PRIVATE_FOLDERS = (file: string) =>77+ file.startsWith(".agents/") || file === ".gitignore";78+79+/** The private plan references and private folder pointers in `file`'s `text`. */80+const privateIn = (file: string, text: string) => [81+ ...planReferencesIn(text),82+ ...(NAMES_THE_PRIVATE_FOLDERS(file)83+ ? []84+ : PRIVATE_FOLDERS.filter((folder) => text.includes(folder))),85+];86+87 /** Terms the code uses in public names, each of which GLOSSARY.md defines. */88 const TERMS = [89 "Claim fork",90 "Decision",23 unmodified lines114 115 return yield* fs.readFileString(path.join(root, relative));116 });117 88-/** The markdown files in a folder, by their paths from the repo root, in name order. */89-const markdownIn = (folder: string) =>90- Effect.gen(function* () {91- const fs = yield* FileSystem.FileSystem;92- const path = yield* Path.Path;93- const root = yield* repoRoot;94- const names = yield* fs.readDirectory(path.join(root, folder));95-96- return Array.sort(97- names.filter((name) => name.endsWith(".md")),98- Order.String99- ).map((name) => `${folder}/${name}`);100- });101-118 /** Each file with its text. */119 const withText = (paths: readonly string[]) =>120 Effect.forEach(paths, (path) =>121 Effect.map(read(path), (text) => ({ path, text }))122 );123 124 /** Every public doc this test reads, with its text. */109-const publicDocs = Effect.gen(function* () {110- return yield* withText([111- "AGENTS.md",112- "GLOSSARY.md",113- ...(yield* markdownIn(".agents/adr")),114- ...(yield* markdownIn(".agents/workflow")),115- ]);116-});125+const publicDocs = withText(["AGENTS.md", "GLOSSARY.md"]);126 118-/** Frontmatter that opens the file and holds a `status:` line. */119-const STATUS_FRONTMATTER =120- /^---\n(?:[^\n]*\n)*?status: \S[^\n]*\n(?:[^\n]*\n)*?---\n/u;121-127 /** The lines of a `## <title>` section, up to the next heading of its level or above. */128 const sectionOf = (text: string, title: string): readonly string[] => {129 const lines = text.split("\n");130 const start = lines.indexOf(`## ${title}`);28 unmodified lines159 }).pipe(Effect.provide(NodeServices.layer))160 );161 162 it.live(158- "and no file the repo would commit cites the private plan, comments included",163+ "and no file the repo would commit cites the private plan or points into the private folders, comments included",164 () =>165 Effect.gen(function* () {166 const files = (yield* committable).filter(167 (file) => TEXT_FILE.test(file) && file !== QUOTES_THE_REFERENCES5 unmodified lines173 Effect.map(textOf(file), (text) =>174 Option.match(text, {175 onNone: () => [],176 onSome: (content) =>172- planReferencesIn(content).map(177+ privateIn(file, content).map(178 (pattern) => `${file}: ${pattern}`179 ),180 })181 ),36 unmodified lines218 ).toStrictEqual(Array.sort(Object.keys(scripts), Order.String));219 }).pipe(Effect.provide(NodeServices.layer))220 );221 217- it.live("every ADR opens with a status line", () =>218- Effect.gen(function* () {219- const adrs = yield* withText(yield* markdownIn(".agents/adr"));220-221- expect(222- adrs.flatMap(({ path, text }) =>223- STATUS_FRONTMATTER.test(text) ? [] : [path]224- )225- ).toStrictEqual([]);226- }).pipe(Effect.provide(NodeServices.layer))227- );228-229- it.live("ADRs are numbered from 0001 with no gap", () =>230- Effect.gen(function* () {231- const numbers = (yield* markdownIn(".agents/adr")).map((path) =>232- path.slice(".agents/adr/".length, ".agents/adr/".length + 5)233- );234-235- expect(numbers).toStrictEqual(236- Array.makeBy(237- numbers.length,238- (index) => `${String(index + 1).padStart(4, "0")}-`239- )240- );241- }).pipe(Effect.provide(NodeServices.layer))242- );243-222 it.live("GLOSSARY.md defines each term the code uses", () =>223 Effect.gen(function* () {224 const glossary = (yield* read("GLOSSARY.md")).split("\n");225 6 unmodified linesmodified:packages/config/test/readme.test.ts+6 added-4 removed
57 unmodified lines58 "packages/project/test/claim.model.test.ts",59 ] as const;60 61 /**62- * What a public README never holds: a home folder, or the private plan's63- * host or folder. Each is joined at run time, so this file spells none of64- * them for a search to find.62+ * What a public README never holds: a home folder, the private plan's host,63+ * or a pointer into the maintainer's gitignored working docs. Each is joined64+ * at run time, so this file spells none of them for a search to find.65 */66 const PRIVATE = [67 ["~", ""].join("/"),68 ["", "home", ""].join("/"),69 ["", "Users", ""].join("/"),70 ["plans", "gneiss", "run"].join("."),71 ["wanted", "explainer"].join("-"),72- [".agents", "scratch", "build"].join("/"),72+ ...["adr", "demo", "ops", "workflow", "scratch", "README"].map((folder) =>73+ [".agents", folder].join("/")74+ ),75 ] as const;76 77 /** The roadmap lines a reader asks about, word for word. */78 const ROADMAP = [412 unmodified linesmodified:packages/config/test/swarm.test.ts+1 added-1 removed
1462 unmodified lines1463 expect(1464 Option.map(Result.getFailure(result), ({ reason }) => reason)1465 ).toStrictEqual(1466 Option.some(1467- 'SESSION_TOKENS has no session for pell: add each to the stage\'s SESSION_TOKENS secret (.agents/ops/stages.md, "Secrets"), and to the env the swarm runs in, then run the swarm again'1467+ "SESSION_TOKENS has no session for pell: add each to the stage's SESSION_TOKENS secret (in the stage's secrets file, STAGE_SECRETS_FILE), and to the env the swarm runs in, then run the swarm again"1468 )1469 );1470 expect(spawned.map(({ args }) => args[1])).toStrictEqual(["asks"]);1471 })2 unmodified linesmodified:scripts/lib/swarm/roster.ts+1 added-1 removed
19 unmodified lines20 /** One contributor: a person, the harness they run, and its model. */21 export const Contributor = Schema.Struct({22 /** True only for the pi agent that loads the CLI's pi adapter (`-e`). */23 adapter: Schema.Boolean,24- /** A fictional person: a key of the stage's `SESSION_TOKENS` (`.agents/ops/stages.md`, "Secrets"). */24+ /** A fictional person: a key of the stage's `SESSION_TOKENS` secret. */25 handle: Handle,26 harness: Harness,27 /**28 * Claude Code: an Anthropic model id. OpenCode: `<provider>/<gpt id>`.60 unmodified linesmodified:scripts/lib/swarm/scenario.ts+2 added-2 removed
1 /**2 * Scenarios: the nudges the swarm adds to some contributors' briefs, so a3- * recorded take shows the refusals the video's beat names (1:30–2:15;4- * `.agents/demo/swarm-scenario.md` documents them). `plain` nudges nobody. Every3+ * recorded take shows the refusals the video's beat names (1:30–2:15).4+ * `plain` nudges nobody. Every5 * nudge is printed in the plan: staging is never hidden.6 */7 import { Option, Schema } from "effect";8 30 unmodified linesmodified:scripts/smoke.ts+1 added-1 removed
18 unmodified lines19 * operator's (`OPERATOR_TOKEN`), who makes the project and opens the ask,20 * and the answerer's, from `SESSION_TOKENS` (a JSON object from token to21 * handle, as the platform's own) by the handle `--as` names (`bram` unless22 * given). For example, with the stage's generated secrets file (outside the23- * repo, `.agents/ops/stages.md` says where) loaded into the env:23+ * repo, named by `STAGE_SECRETS_FILE`) loaded into the env:24 *25 * set -a; . <the stage's secrets file>; set +a26 * bun scripts/smoke.ts --stage dev-oscabriel --loop27 *207 unmodified linesmodified:scripts/swarm.ts+1 added-1 removed
298 unmodified lines299 300 return missing.length === 0301 ? tokens302 : yield* failed(303- `${SESSIONS_VARIABLE} has no session for ${missing.join(", ")}: add each to the stage's ${SESSIONS_VARIABLE} secret (.agents/ops/stages.md, "Secrets"), and to the env the swarm runs in, then run the swarm again`303+ `${SESSIONS_VARIABLE} has no session for ${missing.join(", ")}: add each to the stage's ${SESSIONS_VARIABLE} secret (in the stage's secrets file, STAGE_SECRETS_FILE), and to the env the swarm runs in, then run the swarm again`304 );305 });306 307 /** Records a claim's fork in the throwaway ledger, once. */281 unmodified linesmodified:AGENTS.md+4 added-14 removed
1 # Myr2 3 Myr is a Git platform on Cloudflare. Everything a project ships is public, its contribution process is typed code on main, and a push lands only by passing a typed gate. It is our entry to Cloudflare's "Build the next GitHub" competition, which closes Wed Oct 14, 11:59 PM PDT.4 5-The core loop runs on Cloudflare today: a person claims an ask, pushes an answer through the platform's git gateway, and the platform checks it and lands it, or refuses it: the cheap stages answer in git's own output, and the rest arrive later in `status`, `watch`, MCP and the verdict note. The CLI, MCP and the web all serve the same contracts, and typed visibility (layers, held-back checks, posture, the ledger and write-only env values) plugs in as one cartridge. `README.md` says how to run it, check it and cut it; `.agents/adr/` records each decision and why; `GLOSSARY.md` defines the words.5+The core loop runs on Cloudflare today: a person claims an ask, pushes an answer through the platform's git gateway, and the platform checks it and lands it, or refuses it: the cheap stages answer in git's own output, and the rest arrive later in `status`, `watch`, MCP and the verdict note. The CLI, MCP and the web all serve the same contracts, and typed visibility (layers, held-back checks, posture, the ledger and write-only env values) plugs in as one cartridge. `README.md` says how to run it, check it and cut it; `GLOSSARY.md` defines the words.6 7 `bun run verify` is the gate. The principles table names the check that holds each rule; a rule marked "No fence" is held by review.8 9 ## Principles55 unmodified lines65 - `bootstrap -- --stage <stage>`: makes a stage's Cloudflare resources; a second run creates nothing, and `--dry-run` only prints the plan.66 - `deploy -- --stage <stage>`: the one way to deploy. It runs `verify`, deploys the three Workers with Wrangler, reads the push trigger back, then runs `smoke`.67 - `smoke -- --stage <stage>`: read-only probes against a live stage. `--loop` then runs the whole core loop on a throwaway project, `smoke-<run>`, through the CLI and git, and refuses `demo`.68 - `seed`: puts the two example projects on a platform (`--world node` on this machine, or `--stage <stage>`); a second run changes nothing. `--only <example> --as <name>` seeds a fresh copy under another name, and refuses a taken one.69-- `import-examples -- --stage <stage>`: imports the open-source repos the code browser is previewed on, one at a time, onto a stage (`demo` included, with its reason in `.agents/ops/stages.md`), each recorded in the ledger as kept; `--tags` backfills the tags Artifacts' import leaves out, `--only <name>` imports one, and `--world node` imports onto this machine.69+- `import-examples -- --stage <stage>`: imports the open-source repos the code browser is previewed on, one at a time, onto a stage (`demo` included, with its reason in the stage's record), each recorded in the ledger as kept; `--tags` backfills the tags Artifacts' import leaves out, `--only <name>` imports one, and `--world node` imports onto this machine.70 - `swarm -- --stage <stage> --project <name>`: plans six fictional contributors, on four harnesses, against one split family on a stage, claims each one's ask, prepares a workspace with a clone of its fork outside the checkout, starts each harness headless on the brief and sends every refusal back into the same session, at most three times, then writes the run's summary; `--view herdr` runs them in herdr panes beside a counter, and `--dry-run` only prints the plan.71 - `release -- --build | --upload --stage <stage> | --publish`: builds the CLI's npm package and two binaries, uploads a release to the stage's own bucket, which the platform serves, and leaves `npm publish` to a person: under an agent it prints the command instead.72 73 ## Nouns48 unmodified lines122 - DOMPurify for a README's HTML: it needs a DOM, which the Worker has not got. `rehype-sanitize` runs the same on the server and in the browser.123 - Any inbound or two-way GitHub sync. It would be a second way onto `main` that skips the gate.124 - A decentralised-identity client (an atproto OAuth client, a DID resolver) behind the handle: a sign-in redesign and a third party's account as identity (ADR 0016). A second identity, if ever, is a key the person holds.125 126-## Agent skills126+## Working docs127 128-### Issue tracker128+The maintainer's working docs (the decisions and why each was made, the stage record, the issue tracker and the demo notes) live in a gitignored `.agents/` folder on the maintainer's machine, not in this repo. Nothing committed depends on them or links into them; a clone has `README.md`, `GLOSSARY.md` and this file.129 130-Issues are local markdown files in `.agents/scratch/`, each written as an ask from `.agents/scratch/TEMPLATE.md`. See `.agents/workflow/issue-tracker.md`.131-132-### Triage labels133-134-The five default roles, each label equal to its name: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human` and `wontfix`. See `.agents/workflow/triage-labels.md`.135-136-### Domain docs137-138-Single-context: one `GLOSSARY.md` and `.agents/adr/` at the repo root. See `.agents/workflow/domain.md`.139-130 <!-- BEGIN:turborepo-agent-rules -->131 132 # This is NOT the Turborepo you know133 6 unmodified linesmodified:PRODUCT.md+1 added-1 removed
105 unmodified lines106 107 ## Evidence on Hand108 109 - The examples `examples/datekit` (a date library with a maintainers layer of sealed checks and an `.env.schema`) and `examples/burrow` (six services with a lint ratchet and a migrate ask split six ways) are fictional projects with fictional people (`ines-v`, `okonkwo`, `bram`, `okafor`, `lin-h`, and burrow's vouched contributors). Pages and the video show them as examples, never as real users.110-- The demo is planned in `.agents/demo/`: a narration script, a shot list, the swarm scenario and a rehearsal checklist. What it stages is labelled there.110+- The demo is planned in the maintainer's working notes (not committed): a narration script, a shot list, the swarm scenario and a rehearsal checklist. What it stages is labelled there.111 - Measured numbers come only from recorded live runs on a stage, each with its date (the README's Numbers table). No testimonials, customers or adoption figures exist; none may be invented.112 - A heuristic critique of the web's front page, project home and answer pages, dated 2026-10-11 and kept in the design tool's working files (not committed), scored them 31 of 40. Its findings (the inspector's commands wrapping at 19 rem, one ask reading two state words, lists stacking their state words into a colour stripe, the Landed page ending on hashes, rows with no time) are the source of DESIGN.md's row, inspector, posture and Landed page rules of October 2026, and of ADR 0039. Two peer platforms were read from their own sources the same week, by mechanism; what was taken and declined from them is in ADRs 0034 to 0038 and DESIGN.md's "Rejected on purpose".113 114 ## Product Principles10 unmodified linesmodified:README.md+12 added-13 removed
44 unmodified lines45 6. It lands the checked tree on `main` as its own commit crediting every person, or answers with a refusal.46 47 Around the loop:48 49-- **A web built as the gate's control room.** Every page sits in one shell: a rail of where you are (the site's sections, the projects with their posture, the project's sections), the page, and an inspector of the typed facts of the thing in hand (its state, whose move it is, who may take it, the gate, the claim, the family, the provenance), each with its next command numbered to copy. Lists are rows: select one, with a click or `j`/`k`, and its facts and claim command fill the inspector; a split family is one row with its children drawn as a fan that marks each landing as it happens. Below 1120 px the rail opens from a Menu and the facts follow the page's head, and phones get a bottom bar; Today is built to clear on a phone, one tap a choice with its consequence said under it. Pages arrive with their rows in the server's HTML and move without reloading, `?` lists the keys (`j`/`k`, `J`/`K`, `1`-`9` to copy a numbered command, and a switch that turns them off), and colour still means state, always beside its word and mark ([ADR 0022](.agents/adr/0022-the-web-is-a-control-room-shell.md), [ADR 0023](.agents/adr/0023-links-are-the-routers-and-lists-render-on-the-server.md)).49+- **A web built as the gate's control room.** Every page sits in one shell: a rail of where you are (the site's sections, the projects with their posture, the project's sections), the page, and an inspector of the typed facts of the thing in hand (its state, whose move it is, who may take it, the gate, the claim, the family, the provenance), each with its next command numbered to copy. Lists are rows: select one, with a click or `j`/`k`, and its facts and claim command fill the inspector; a split family is one row with its children drawn as a fan that marks each landing as it happens. Below 1120 px the rail opens from a Menu and the facts follow the page's head, and phones get a bottom bar; Today is built to clear on a phone, one tap a choice with its consequence said under it. Pages arrive with their rows in the server's HTML and move without reloading, `?` lists the keys (`j`/`k`, `J`/`K`, `1`-`9` to copy a numbered command, and a switch that turns them off), and colour still means state, always beside its word and mark.50 - **A landing, the asks, a home and the docs.** The web's `/` is a landing for a first-time reader: what the platform is, the way to the open asks before anything else, the install line, the screen `git push` prints when the gate refuses (from the one renderer), the four nouns, the loop, and the projects to read, each with its posture. The front page of open asks across every project is `/asks`. A signed-in person's `/home` is their own: their claims, newest first, each with its ask's want, its latest answer and the command to run next; the decisions waiting on them, if they decide; and the asks they may take. `/docs` holds five guides and a reference (the commands, every refusal, every event, the MCP tools and the imported projects) read from the sources that define them, each page also as Markdown at `/docs/<page>.md`.51 - **A code browser on the web.** A full-viewport app inside the shell: the file tree stays in the rail across files, with a Code | Why toggle on each file, highlighted code with `#L` line links, raw bytes served under a sandboxing CSP, the landings by day, each commit's diff (unified or split, with its stats by territory and tests) and one refs page (main, tags and claim forks; a monorepo's tags grouped by package, each package's newest first). The server sends each file and diff as plain text at the drawing's exact size, so highlighting lands in place. A project's home is its asks, then its README, rendered as GitHub-flavoured Markdown with links and images pointing into the repo at the commit, in the server's HTML so a crawler or `curl` reads it too. Every page names the commit it shows, so any page is a permalink.52-- **Why each line is there.** A file's why page attributes each line to the landing that put it on `main`, naming its ask, answer, people and verdict, or the ask an opening opened. Imported history reads "before adoption". Why and a file's history are kept by commit in an R2 bucket, so every isolate reads them back ([ADR 0020](.agents/adr/0020-code-history-is-kept-by-immutable-ids.md)): on the dev stage's imports (changesets, click; 200 commits of history) a first view took 5.3 to 7.7 s, down from 18.6 to 39.6 s, and a view already kept answers in under a second.53-- **Asks drafted for a want.** A member proposes a want with `--draft` (or the web's propose form). The platform's agent, a Workers AI model, drafts the ask file and its failing test, runs them red first on the Checker, and puts the draft to a decider with its evidence. Nothing lands until a decider accepts, and the landing discloses the agent with `Assisted-by` ([ADR 0018](.agents/adr/0018-asks-are-drafted-in-a-workflow-and-put-to-a-decider.md)).52+- **Why each line is there.** A file's why page attributes each line to the landing that put it on `main`, naming its ask, answer, people and verdict, or the ask an opening opened. Imported history reads "before adoption". Why and a file's history are kept by commit in an R2 bucket, so every isolate reads them back: on the dev stage's imports (changesets, click; 200 commits of history) a first view took 5.3 to 7.7 s, down from 18.6 to 39.6 s, and a view already kept answers in under a second.53+- **Asks drafted for a want.** A member proposes a want with `--draft` (or the web's propose form). The platform's agent, a Workers AI model, drafts the ask file and its failing test, runs them red first on the Checker, and puts the draft to a decider with its evidence. Nothing lands until a decider accepts, and the landing discloses the agent with `Assisted-by`.54 - **A Policy page.** Who decides which paths, who is vouched for or denounced, each layer's readers, writers and disclosure, and the caps, budget and claim timing, all read from the config folder at the landed commit. It has no edit control: these change by landing a change to the config folder. A project whose config has not evaluated says why (no config folder, or one that failed) and what makes it evaluate; `myr policy` prints the same as text.55 - **The platform's own front page.** The platform's `/` says what the host serves (clone URLs, MCP, agent skills, sign-in, the CLI and the web app), in HTML for a browser and as Markdown for an agent.56 - **A For agents page.** The web's `/agents` (and `/agents.md`) is a reference in the voice of a man page: a Synopsis of the CLI's commands, Connect (remote MCP for Claude Code, Cursor and VS Code, MCP over stdio, the CLI, a prompt for any agent, and the skills), the Endpoints an agent reads, the Limits, and every Refusal. Its MCP entries are the same text the plugin bundles carry.57 - **Markdown on every list page.** `/`, `/asks` and each project's page answer `Accept: text/markdown` with the text of `/llms.txt` and the project's `llms.txt`, and their HTML links to it.58 - **`/llms-full.txt`.** Beyond the index at `/llms.txt`: every refusal with its repair, how git meets the platform, how a landing happens, every event a watcher hears, and short guides. The index names it in its first sentence, and a project's `llms.txt` and each ask's Markdown open with a line pointing to both.59 - **The code over MCP.** An agent with no shell, such as a hosted connector, browses a project's code with five capped MCP tools: `readTree`, `readFile`, `log`, `why` and `listRefs`.60 61-The web reads code only through public contracts the platform serves ([ADR 0019](.agents/adr/0019-the-web-reads-repos-through-public-contracts.md)). On the dev stage, 38 open-source repos are imported and kept for previewing it: eight picked for a shape the code browser must render (anyhow, ky, gum, click, awesome, changesets, stb and fuzzel), then thirty well-known projects in TypeScript, JavaScript, Rust, Go, Python, C, Ruby and shell, each a read-only copy under its own licence. `/docs/imported` names each one's source and licence, and `.agents/ops/stages.md` records each import. An import is heard as a landing, its adoption, so a project imported since that change is listed whether or not its policy evaluates; seventeen of the 38, imported before it, are not yet.61+The web reads code only through public contracts the platform serves. On the dev stage, 38 open-source repos are imported and kept for previewing it: eight picked for a shape the code browser must render (anyhow, ky, gum, click, awesome, changesets, stb and fuzzel), then thirty well-known projects in TypeScript, JavaScript, Rust, Go, Python, C, Ruby and shell, each a read-only copy under its own licence. `/docs/imported` names each one's source and licence, and the stage's record keeps each import. An import is heard as a landing, its adoption, so a project imported since that change is listed whether or not its policy evaluates; seventeen of the 38, imported before it, are not yet.62 63 ## Run it64 65 ### What you need44 unmodified lines110 ```111 112 ### On your own Cloudflare account113 114-Wrangler deploys the three Workers; cf is our ops CLI. Cloudflare's cf can't deploy this platform yet: its config cannot declare the Artifacts push-event trigger, its deploy refuses the sandbox's container self-binding, and it would be a second deploy tool in the recording week. So Wrangler deploys, and cf runs read-mostly operations as `bun run ops -- <command>` ([ADR 0002](.agents/adr/0002-wrangler-deploys-every-worker.md)).114+Wrangler deploys the three Workers; cf is our ops CLI. Cloudflare's cf can't deploy this platform yet: its config cannot declare the Artifacts push-event trigger, its deploy refuses the sandbox's container self-binding, and it would be a second deploy tool in the recording week. So Wrangler deploys, and cf runs read-mostly operations as `bun run ops -- <command>`.115 116 1. Name your stage `dev-<you>`. Add it to `stages` in `infra/stages.ts`, and give it an `env` block in `apps/platform/wrangler.jsonc`, `apps/sandbox/wrangler.jsonc` and `apps/web/wrangler.jsonc`, copied from `dev-oscabriel`'s with your stage's name in its place and your own handle as `OPERATOR_HANDLE`; `packages/config/test/bootstrap.test.ts` holds the three files to the table.117 2. Log Wrangler in once, and set `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` as `infra/.env.schema` describes (`bun run env:check` shows them, redacted):118 36 unmodified lines155 ```sh156 ./node_modules/.bin/varlock run --path apps/platform/ -- bun scripts/smoke.ts --stage dev-<you> --loop157 ```158 159-`.agents/ops/stages.md` lists every resource a stage owns, the secrets, and how a person tears a stage down by hand; no script deletes a stage's own resources. Every throwaway a smoke loop, a swarm run or a `seed --as` copy makes is recorded in `infra/created.jsonl`. `bunx varlock run --path infra/ -- bun infra/teardown.ts` prints which of them still exist, and adding `--apply` deletes exactly those.159+No script deletes a stage's own resources: a person tears a stage down by hand, from the stage's record of what it owns and its secrets. Every throwaway a smoke loop, a swarm run or a `seed --as` copy makes is recorded in `infra/created.jsonl`. `bunx varlock run --path infra/ -- bun infra/teardown.ts` prints which of them still exist, and adding `--apply` deletes exactly those.160 161 ### Install the CLI162 163 The platform serves the CLI itself: the install script and the linux-x64 and darwin-arm64 binaries come from the stage's own `releases-<stage>` bucket:91 unmodified lines255 256 What it does not promise:257 258 - **Held-back checks are hidden from people and agents, not from the code under test.** They run in the check job's own container with the network off, nothing they or the lanes beside them print comes back, and a claim, or a person in one area, may fail an area only a few times each week. That raises the cost of reading them; it cannot stop a determined reader whose code runs beside them. The `Held-back:` trailer names each area, how many of its sealed checks passed and the suite's commitment, nothing more.259-- **Verdicts after the push are asynchronous.** Custody and shape refusals arrive in `git push`; the merged-tree checks report through `myr status`, `myr verdict`, MCP, the web, and a git note on the answer's head ([ADR 0015](.agents/adr/0015-submitting-an-answer-is-asynchronous.md)).259+- **Verdicts after the push are asynchronous.** Custody and shape refusals arrive in `git push`; the merged-tree checks report through `myr status`, `myr verdict`, MCP, the web, and a git note on the answer's head.260 - **No numbers but the table's.** The Numbers section holds only what a live run measured, each with its stage and date.261 262 ## Keep or cut263 53 unmodified lines317 infra/ bootstrap, deploy, the recording lock, the stage table, smoke's probes, teardown318 scripts/ brand and byte checks, seed, smoke, swarm, release319 examples/ datekit and burrow, fictional projects for the demo320 tools/oxlint/ the vendored anti-slop lint plugins321-.agents/ decisions (adr/), agent conventions (workflow/), the demo (demo/), the stage record (ops/), the ask template (scratch/)321 ```322 323 Every internal package is `@repo/<name>`, and in code the product's name lives only in `packages/brand/src/index.ts`. Every operation is one contract in `packages/protocol/src/contracts.ts`, and the CLI, MCP and the web are projections of it, built in each app's `surfaces.ts`.324 8 unmodified lines333 Bindings are declared per stage in each app's `wrangler.jsonc`, and the platform decodes its whole env once, at start (`apps/platform/src/platform.ts`).334 335 ### The core loop, step by step336 338-1. **Init or import.** `myr init` finds the project's own commands (its run block), proposes a config folder, and makes the project, empty or imported once from a public HTTPS repo (from the CLI, or from the web's `/import`). A project is named `<owner>/<name>` (the rule is in the Run a project guide, `packages/agent-kit/src/docs/run-a-project.ts`), and a project made before owners keeps its old address as a redirect ([ADR 0032](.agents/adr/0032-a-project-is-named-by-its-owner-and-the-forty-keep-their-keys.md), [ADR 0033](.agents/adr/0033-a-repo-is-imported-from-the-web-and-its-host-path-offers-the-import.md)). For an empty project, the initializer's first push is the only direct push `main` ever takes; after it, `main` moves only by a landing.337+1. **Init or import.** `myr init` finds the project's own commands (its run block), proposes a config folder, and makes the project, empty or imported once from a public HTTPS repo (from the CLI, or from the web's `/import`). A project is named `<owner>/<name>` (the rule is in the Run a project guide, `packages/agent-kit/src/docs/run-a-project.ts`), and a project made before owners keeps its old address as a redirect. For an empty project, the initializer's first push is the only direct push `main` ever takes; after it, `main` moves only by a landing.338 2. **Rules at the landed SHA.** After every landing the Lander bundles the config folder, and the platform evaluates it once, with frozen time and randomness, into a typed policy. Rules come only from the platform's own last landing.339 3. **Open an ask.** A decider sends the ask and its check; the check runs on `main` twice and must fail the same way by an assertion; the platform lands the ask with `Asked-by`.340 4. **Claim.** `myr claim` makes the claimant's fork (`<owner>/<name>--<ask>--<handle>`). Pushes keep the claim alive; a quiet claim is warned, then lapses.341 5. **Push through the gateway.** Custody admits the pusher before git sees the pack; after the fork takes it, the shape stage reads the diff (territory, judge closure, weakening markers, reached internals, layer paths) and every refusal comes back at once in `remote:` lines.4 unmodified lines346 Read it back with `myr status`, `myr verdict`, `myr why <path>:<line>`, the verdict note, MCP or the web.347 348 ### What the design rests on349 351-Artifacts, the git storage under every repo, has no atomic multi-ref push, so `main` lands by itself, with a non-force push that fails if `main` moved (a compare-and-swap), and the bookkeeping refs (the landed mirror and the notes) follow in pushes of their own. The Project Durable Object's landed SHA is the truth. Any write token can force-push `main`, so a canonical repo's write tokens never leave the platform's own jobs: answers go to forks through the gateway, and only the trusted Lander, which runs no answer code, gets a write token on a canonical repo, for five minutes, inside a landing. Events fire once per pushed ref, the platform's own bookkeeping pushes included, so `OnPush` recognizes those and ignores them. The binding resolves only short branch names and commit SHAs, so the Durable Object keeps the SHAs of custom refs itself ([ADR 0014](.agents/adr/0014-landing-is-a-cas-push-of-main-then-bookkeeping-refs.md)).350+Artifacts, the git storage under every repo, has no atomic multi-ref push, so `main` lands by itself, with a non-force push that fails if `main` moved (a compare-and-swap), and the bookkeeping refs (the landed mirror and the notes) follow in pushes of their own. The Project Durable Object's landed SHA is the truth. Any write token can force-push `main`, so a canonical repo's write tokens never leave the platform's own jobs: answers go to forks through the gateway, and only the trusted Lander, which runs no answer code, gets a write token on a canonical repo, for five minutes, inside a landing. Events fire once per pushed ref, the platform's own bookkeeping pushes included, so `OnPush` recognizes those and ignores them. The binding resolves only short branch names and commit SHAs, so the Durable Object keeps the SHAs of custom refs itself.351 352 ### Plain git, so you can leave353 354 Export is `git clone`. Code, asks (files in the config folder), the rules (TypeScript on `main`) and credit trailers, `Decided-by` included, leave with a clone. Verdict notes need one more fetch of `refs/notes/*`, because `git clone` copies no notes:1 unmodified line356 ```sh357 git fetch origin 'refs/notes/*:refs/notes/*'358 ```359 361-Inbound or two-way sync with GitHub is declined by design: it would be a second way onto `main` that skips the gate ([ADR 0010](.agents/adr/0010-no-inbound-github-sync.md)). A project can be imported once, to start it.360+Inbound or two-way sync with GitHub is declined by design: it would be a second way onto `main` that skips the gate. A project can be imported once, to start it.361 362 ### What is ours363 364 Every app and package here is ours, except the files ported from other projects. Each of those names its upstream in its first line, and carries the upstream's licence notice in its header or in a file beside it:1 unmodified line366 - `packages/protocol/src/{cli,mcp}.ts`: the CLI-flag and MCP-tool projections, from Rat Stack;367 - `packages/visibility/src/leak-scan.ts`: the leak scanner's technique, from varlock;368 - `examples/burrow/tools/oxlint/burrow/rules/no-module-level-mutable-state.ts`: the fictional example's own lint rule, from Rat Stack, with `examples/burrow/tools/oxlint/burrow/LICENSE-rat-stack.txt` beside it.369 371-Vendored folders keep their licence file beside them: `tools/oxlint/anti-slop/` (anti-slop's oxlint plugins, with `tools/oxlint/anti-slop/UPSTREAM.md`), `apps/web/src/components/ui/` (shadcn/ui's components) and `apps/web/src/assets/fonts/` (the web's fonts). Ported code is ours to change once copied, and no upstream is synced in ([ADR 0013](.agents/adr/0013-provenance-copy-with-attribution.md)). The decisions behind the design are in `.agents/adr/`.370+Vendored folders keep their licence file beside them: `tools/oxlint/anti-slop/` (anti-slop's oxlint plugins, with `tools/oxlint/anti-slop/UPSTREAM.md`), `apps/web/src/components/ui/` (shadcn/ui's components) and `apps/web/src/assets/fonts/` (the web's fonts). Ported code is ours to change once copied, and no upstream is synced in.371 372 ## Credits373 374 Each credit names what we took and where it lives.8 unmodified lines383 - **Effect**. The product is written in Effect v4: its schemas, the one `RpcGroup`, the CLI, the MCP servers and the platform's HTTP.384 - **isomorphic-git**. git inside a Worker: the in-memory repo host, the smart-HTTP pushes of the Artifacts binding adapter, and the `/isogit` Lander.385 - **Cloudflare's cf** (ideas, no code). One merged command catalog for every surface (`commandDocs` in `packages/agent-kit/src/command-doc.ts`), and the rule that wire schemas use whole or finite numbers and optional keys, so the JSON Schema an MCP client reads holds no `"Infinity"` and no `null`.386 - **Ghostty's `VOUCHED.td` format**. A project's vouch file: one handle per line, and a leading `-` to denounce.388-- **Matt Pocock's agent-brief shape**. The brief an ask carries (the want, what happens today, the context, the terms, what is out of scope), and the ask-shaped template this repo's own work was written in, `.agents/scratch/TEMPLATE.md`.387+- **Matt Pocock's agent-brief shape**. The brief an ask carries (the want, what happens today, the context, the terms, what is out of scope), and the ask-shaped template this repo's own work was written in.388 389 ## Roadmap390 391 - Later: a one-way push mirror of `main` to GitHub.4 unmodified lines