From c238657c3db96bbabdd8ce3bc490870a5b4017a9 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sun, 11 Oct 2026 12:12:44 +0200 Subject: [PATCH 1/4] chore(agents): CI failures from the newest finished run reach fix runs; audit runs the comment review; fewer pushes; Stryker failures say why --- .agents/scripts/ci-failures.mjs | 61 ++++++++++++++++ .claude/agents/comment-reviewer.md | 28 +++++++- .claude/agents/implementer.md | 32 +++++---- .claude/agents/reviewer.md | 30 +++----- .claude/skills/deliver/SKILL.md | 11 +-- docs/internal/DELIVERY.md | 11 +-- lefthook.yml | 2 +- scripts/mutate.mjs | 13 ++-- src/ci-failures.test.ts | 112 +++++++++++++++++++++++++++++ src/mutate.test.ts | 20 +++++- 10 files changed, 267 insertions(+), 53 deletions(-) create mode 100644 .agents/scripts/ci-failures.mjs create mode 100644 src/ci-failures.test.ts diff --git a/.agents/scripts/ci-failures.mjs b/.agents/scripts/ci-failures.mjs new file mode 100644 index 000000000..8dde48769 --- /dev/null +++ b/.agents/scripts/ci-failures.mjs @@ -0,0 +1,61 @@ +#!/usr/bin/env node +// `node .agents/scripts/ci-failures.mjs `: the tests that failed in the newest finished run +// of each workflow on the PR's branch. A push cancels the run before it, so while pushes come +// faster than CI the head's own checks stay pending and only an older run shows a failure. +// +// Prints `none`, or for each workflow whose newest finished run failed: ` run at +// `, then one indented line per failed test (` > `), or per failed job when +// its log names no test. +import { execFileSync } from "node:child_process"; + +const pr = process.argv[2]; +if (pr === undefined) { + console.error("usage: ci-failures.mjs <pr>"); + process.exit(2); +} +const gh = (...args) => + execFileSync("gh", args, { encoding: "utf8", maxBuffer: 256 * 1024 * 1024 }); +// GitHub's stored logs spell the escape byte as the two characters `^[`. +const ANSI = new RegExp(`(?:${String.fromCharCode(27)}|\\^\\[)\\[[0-9;]*m`, "g"); + +const branch = JSON.parse(gh("pr", "view", pr, "--json", "headRefName")).headRefName; +const runs = JSON.parse( + gh( + "run", + "list", + "--branch", + branch, + "--limit", + "100", + "--json", + "databaseId,workflowName,headSha,conclusion,createdAt", + ), +); + +const newest = new Map(); +for (const run of runs) { + if (run.conclusion !== "success" && run.conclusion !== "failure") continue; + const seen = newest.get(run.workflowName); + if (seen === undefined || run.createdAt > seen.createdAt) newest.set(run.workflowName, run); +} + +const failed = [...newest.values()].filter((run) => run.conclusion === "failure"); +if (failed.length === 0) console.log("none"); +for (const run of failed) { + const id = String(run.databaseId); + console.log(`${run.workflowName} run ${id} at ${run.headSha.slice(0, 7)}`); + const tests = new Set(); + for (const line of gh("run", "view", id, "--log-failed").split("\n")) { + const plain = line.replace(ANSI, ""); + if (!/ FAIL |\) \[[a-z]+\] › /.test(plain)) continue; + const test = /(?:e2e|src|ui)\/[\w./-]+\.(?:test|spec)\.tsx?.*/.exec(plain); + if (test !== null) tests.add(test[0].trim()); + } + const lines = + tests.size > 0 + ? [...tests] + : JSON.parse(gh("run", "view", id, "--json", "jobs")) + .jobs.filter((job) => job.conclusion === "failure") + .map((job) => `job ${job.name}`); + for (const line of lines) console.log(` ${line}`); +} diff --git a/.claude/agents/comment-reviewer.md b/.claude/agents/comment-reviewer.md index cc460bf05..47ca22d35 100644 --- a/.claude/agents/comment-reviewer.md +++ b/.claude/agents/comment-reviewer.md @@ -1,9 +1,31 @@ --- name: comment-reviewer -description: The blind comment review from delivery rule 14 — checks each comment in reach of a diff against the comment rule. Spawned only by the reviewer agent, which passes the brief, the rule, the comment list and a worktree. +description: Checks each comment in reach of a diff against the comment rule (architecture rule 17) — the blind comment review from delivery rule 14, and the implementer's audit sweep. Spawned by the reviewer agent or the implementer with `rules`, `comments` and `worktree`. model: haiku tools: Read, Grep, Glob --- -You are the comment reviewer. Follow the brief you are given exactly: read -only the worktree and files it names, edit nothing, and report in its form. +You are checking comments against one rule. You have no other context and +have not seen the issue the diff implements. + +Arguments: `rules`, the rules directory; `comments`, the output of +`.agents/scripts/comments.mjs`: each block is a comment the diff adds or +edits, or one within 20 lines of code it adds, followed by the code line +after it (`>`); `worktree`, the repository at the commit under review. + +The rule is rule 17 in `<rules>/architecture.md`. Read the worktree only to +see what a comment sits on, or whether a declaration is exported from an +entry point the rule names. Edit nothing and run nothing. + +For each block, one line: `path:line keep <the why, at most 8 words>` or +`path:line F<n>`. A block stays only when the rule allows all of it. A block +or part of a block the rule does not allow is blocking, class `architecture +17`. + +Output only your list, then your findings: no preamble, no headings, no +summary, no narration. Report every finding; there is no limit on how many. +One line per finding, in this form and no other: + +F<n> B <path:line> <the part the rule does not allow, at most 25 words> [architecture 17] + +No findings: `F0`. diff --git a/.claude/agents/implementer.md b/.claude/agents/implementer.md index 02f79bd9c..ac28906e0 100644 --- a/.claude/agents/implementer.md +++ b/.claude/agents/implementer.md @@ -109,13 +109,16 @@ states the failing count: `3 failing -> 1 failing`. changed unit tests, and the e2e files you added or edited. Never run a check listed under "Checks agents never run", nor a tool behind it, from any path. A type or lint error shows in the commit hook's output. -- Push once per step, not after every commit, in the background, and read - its output when it ends. The last push before your report runs in the - foreground, with the longest timeout your shell tool allows: never end - your turn while a push runs. Never pass - `--no-verify` or `-n`. +- Each push runs the push hook, mutation testing included, for minutes. + Push when you need its output (the mutants left alive), and once before + your report; commits save progress, pushes do not need to. A push you + need nothing from yet runs in the background. The last push before your + report runs in the foreground, with the longest timeout your shell tool + allows: never end your turn while a push runs. Read its whole output, + not a tail. Never pass `--no-verify` or `-n`. - Never wait on CI: no polling `gh pr checks`, no `gh run watch`, no - `sleep` loops. Read `gh pr checks <M>` at most once, before the report. + `sleep` loops. Run `node .agents/scripts/ci-failures.mjs <M>` at most + once, before the report: `none` is `ci: pass`, a failed test `ci: fail`. - Never use `git stash`: all worktrees share one stash list. Commit instead. Temporary files go in your scratchpad, not `/tmp`. - Build what `always-in-scope.md` lists as you go. Anything else you notice @@ -143,10 +146,13 @@ built. other spellings, other paths, other import or call forms, empty and boundary values. Each one it lets through gets a fixture or an `open` line. -- **Commented.** Run `node .agents/scripts/comments.mjs origin/main`: it - lists every comment the diff adds or edits, and every comment within 20 - lines of code it adds. Delete each one the comment rule in - `architecture.md` does not allow. +- **Commented.** Write the output of `node .agents/scripts/comments.mjs +origin/main` (in fix mode, `<the head you started from>` in place of + `origin/main`) to your scratchpad: every comment the diff adds or edits, + and every comment within 20 lines of code it adds. Hand it to a + `comment-reviewer` agent with `rules: docs/internal/agent-rules`, + `comments: <that file>` and `worktree: <your worktree>`. Delete each part + it flags; never reword one into a new comment. - **Promised.** For every Scope and Done when line, name the hunk or test that delivers it. None: do it, or leave the line unticked and say why under `open`. Never tick a box on intent. @@ -202,8 +208,10 @@ the rule it breaks. 2. **Fix every instance:** - behaviour: write the failing test first, then the fix; - stale doc: fix it. Stale comment: delete it, or fix it if the comment - rule allows it. Told to edit comments and docs only: - a finding that needs any other change goes under `open` instead; + rule allows it. Each fact in the new text (who does it, which cases, + which values) names the `path:line` that shows it before you commit; + a fact you cannot point to stays out. Told to edit comments and docs + only: a finding that needs any other change goes under `open` instead; - a line ending in `(record as Assumption: ...)`: also add that assumption to the PR body; - a slow-lane Evidence line is a failing test: fix the code, not the diff --git a/.claude/agents/reviewer.md b/.claude/agents/reviewer.md index 7044ac7b2..5d7c4fd2b 100644 --- a/.claude/agents/reviewer.md +++ b/.claude/agents/reviewer.md @@ -97,7 +97,8 @@ and wait. Never report a review as missing. Each brief below is passed verbatim, paths filled in; leave out a sentence about a file that does not exist. Every brief ends with the **common tail**. -From round 2, every brief starts with the **re-review head**. +From round 2, every brief starts with the **re-review head**. The comment +review brings its own brief. **Re-review head** (round 2 and later, every review but the comment review): @@ -252,34 +253,19 @@ file: `path: 12 34-40 true, 56 F3`: and the doc comment of every declaration the diff changes. Find them all now: a false claim this round misses costs a later round. +Whether a comment should exist at all (rule 17 in architecture.md) is the +comment review's: judge only whether it is true. A claim is false when the code at this commit contradicts it: a name or path that no longer exists, a behaviour, order, owner, default or limit that changed. Blocking: a false claim. Note: a claim that is true but misleading. ``` -**Comment review**: `subagent_type: "comment-reviewer"`, in the claims -worktree. It reads `$R/rules/architecture.md` and `$R/comments.txt`; from -round 2, `$R/comments-fix.txt` in its place. +**Comment review**: `subagent_type: "comment-reviewer"`, with `rules: +$R/rules`, `comments: $R/comments.txt` (from round 2, `$R/comments-fix.txt`) +and `worktree:` the claims worktree. Nothing else. -```markdown -You are checking comments against one rule. You have no other context and -have not seen the issue the diff implements. - -Rule: rule 17 in <rules/architecture.md>. Comments: <comments.txt>: each -block is a comment the diff adds or edits, or one within 20 lines of code it -adds, followed by the code line after it (`>`). Repository: <worktree>, -checked out at the reviewed commit: read it only to see what a comment sits -on, or whether a declaration is exported from an entry point the rule -names. Edit nothing and run nothing. - -For each block, one line: `path:line keep <the why, at most 8 words>` or -`path:line F<n>`. A block stays only when the rule allows all of it. A block -or part of a block the rule does not allow is blocking, class `architecture -17`. -``` - -**Common tail** (every brief): +**Common tail** (every brief but the comment review's): ```markdown Output only your list, then your findings: no preamble, no headings, no diff --git a/.claude/skills/deliver/SKILL.md b/.claude/skills/deliver/SKILL.md index 1d23a4f4a..d3e6c5fb8 100644 --- a/.claude/skills/deliver/SKILL.md +++ b/.claude/skills/deliver/SKILL.md @@ -114,10 +114,13 @@ they name; never build again or restart review at round 1. `failing` and turned at least one test green since the last, another `green` with its `map`; then `mode: audit`. `spec needs` under `open` in any report: park (step 6). -2. **Review**: `reviewer` with the PR number. Before every review round, - read `gh pr checks <M>` and `gh pr view <M> --json mergeable` once. A - failed check no open `flaky-test` issue names, or a conflict, goes into - one `implementer` fix run first. +2. **Review**: `reviewer` with the PR number. Before every review round + and every fix run, run `node .agents/scripts/ci-failures.mjs <M>` and + `gh pr view <M> --json mergeable` once. The script reads the newest + finished CI run, which is often older than the head: newer pushes cancel + theirs. Each failed test no open `flaky-test` issue names joins the fix + run's `fixes` as `ci: <its line> run <id>`; a conflict joins as `merge +the base branch`. With no fix run due, they get one before the round. 3. **Decide** on the review report: - Fix lines: one `implementer` run with `mode: fix` and the Fix lines pasted under `fixes`, then the next round: `reviewer` with `round <n+1>`, the diff --git a/docs/internal/DELIVERY.md b/docs/internal/DELIVERY.md index 8df1bc022..d2c207e93 100644 --- a/docs/internal/DELIVERY.md +++ b/docs/internal/DELIVERY.md @@ -154,12 +154,15 @@ agent per phase, so no context grows past one phase: one commits the spec's tests red and opens a draft PR, so CI runs from the first push; the next turns them green in commits that each lower the failing count, starting from a map of which files each test needs; the last audits the diff with -fresh eyes. Agents pass each other `key: value` lines, not prose. It +fresh eyes, and has the comment reviewer below sweep its comments. Agents pass each other `key: value` lines, not prose. It runs only the tests its change can reach — `pnpm test:changed` and the e2e files it touched. Every other check runs on its own: format, lint and typecheck on commit; Fallow, the e2e typecheck and `pnpm mutate` (mutants on the changed lines only, so every changed line is shown to matter before -anyone reviews it) on push; the full suite in CI. +anyone reviews it) on push; the full suite in CI. Each push cancels the CI +run before it, so before every review round and fix run the orchestrator +reads the newest finished run with `.agents/scripts/ci-failures.mjs`, and +its failed tests go into the next fix run. A spec never answers every question. What any change includes without asking — docs it makes false, both `EVENTS.md` files, a test for every new @@ -335,7 +338,7 @@ a fixed layout: - `docs/internal/adr/` with a `README.md` index, and `docs/internal/templates/` with `feature.md` and `task.md`. - `.agents/scripts/`: `worktree.sh`, `review-inputs.sh`, `stale-refs.sh`, - `merge-pr.sh`, `delivery-stats.mjs` and `budget-guard.mjs`. `worktree.sh` and + `comments.mjs`, `ci-failures.mjs`, `merge-pr.sh`, `delivery-stats.mjs` and `budget-guard.mjs`. `worktree.sh` and `ensure-pnpm.sh` are this project's (they install its dependencies); the others are not. - `.github/workflows/issue-state.yml` and the labels in `.github/labels.json`. @@ -367,7 +370,7 @@ To move it: copy the agents, skills, scripts, workflow, labels, `.claude/settings.json`), `.agents/scripts/ensure-pnpm.sh` (the session-start hook; installs the pinned pnpm into a cache when PATH lacks it), `.agents/scripts/review-inputs.sh`, `.agents/scripts/stale-refs.sh`, - `.agents/scripts/comments.mjs`, + `.agents/scripts/comments.mjs`, `.agents/scripts/ci-failures.mjs`, `.agents/scripts/merge-pr.sh`, `.agents/scripts/delivery-stats.mjs`, `scripts/slow-e2e.sh`, `scripts/mutate.mjs` (`pnpm mutate`) diff --git a/lefthook.yml b/lefthook.yml index 36e3200fe..6575792a0 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -32,4 +32,4 @@ pre-push: # an equivalent mutant cannot be killed, so each survivor is killed or explained in the PR body. mutate: priority: 3 - run: pnpm run mutate || echo "Mutants survived (listed above). Kill each one, or explain it in the PR body." + run: pnpm run mutate || true diff --git a/scripts/mutate.mjs b/scripts/mutate.mjs index d0a14d39c..2803e08a0 100644 --- a/scripts/mutate.mjs +++ b/scripts/mutate.mjs @@ -6,7 +6,8 @@ // under src/ or ui/src/ since the branch's last run reprints that run's result. // // A survivor is a line you can change, or delete, with a green suite: testing rules 2 and 3. -// Exit 0 when every mutant died, 1 when any survived or had no covering test. +// Exit 0 when every mutant died, 1 when any survived or had no covering test, 2 when Stryker +// failed without a report. import { execFileSync, spawnSync } from "node:child_process"; import { existsSync, @@ -93,11 +94,14 @@ const run = spawnSync( "--incrementalFile", `${branch}.json`, ], - { stdio: ["ignore", "inherit", "inherit"] }, + { stdio: ["ignore", "inherit", "pipe"], encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }, ); +process.stderr.write(run.stderr ?? ""); if (!existsSync(REPORT)) { - console.error(`Stryker exited ${run.status} without a report.`); - process.exit(run.status || 1); + // Last, so a caller that keeps only the tail of the output still sees why. + const tail = (run.stderr ?? "").trimEnd().split("\n").slice(-15).join("\n"); + console.error(`\nStryker exited ${run.status} without a report: no mutant was tested.\n${tail}`); + process.exit(2); } const report = JSON.parse(readFileSync(REPORT, "utf8")); @@ -118,5 +122,6 @@ print(total, ranges.length, alive); function print(total, rangeCount, alive) { console.log(`\n${total} mutants on ${rangeCount} changed ranges; ${alive.length} alive.`); for (const line of alive) console.log(line); + if (alive.length > 0) console.log("Kill each one, or explain it in the PR body."); process.exit(alive.length === 0 ? 0 : 1); } diff --git a/src/ci-failures.test.ts b/src/ci-failures.test.ts new file mode 100644 index 000000000..7587ab3e3 --- /dev/null +++ b/src/ci-failures.test.ts @@ -0,0 +1,112 @@ +import { spawnSync } from "node:child_process"; +import { chmodSync, mkdtempSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +import { describe, expect, it } from "vitest"; + +const SCRIPT = join( + dirname(fileURLToPath(import.meta.url)), + "..", + ".agents", + "scripts", + "ci-failures.mjs", +); + +interface Run { + readonly databaseId: number; + readonly workflowName: string; + readonly headSha: string; + readonly conclusion: string; + readonly createdAt: string; +} + +const ESC = "^["; +const VITEST_FAIL = `Quality\tQuality checks\t2026-10-11T09:35:23Z ${ESC}[41m${ESC}[1m FAIL ${ESC}[22m${ESC}[49m ${ESC}[30m${ESC}[45m e2e ${ESC}[49m${ESC}[39m e2e/a.test.ts${ESC}[2m > ${ESC}[22mstartup${ESC}[2m > ${ESC}[22mends the lease`; + +function ciFailures(runs: readonly Run[], logs: Record<number, string>, jobs: string[] = []) { + const dir = mkdtempSync(join(tmpdir(), "ci-failures-")); + writeFileSync(join(dir, "runs.json"), JSON.stringify(runs)); + for (const [id, log] of Object.entries(logs)) writeFileSync(join(dir, `log-${id}`), log); + writeFileSync( + join(dir, "jobs.json"), + JSON.stringify({ jobs: jobs.map((name) => ({ name, conclusion: "failure" })) }), + ); + writeFileSync( + join(dir, "gh"), + `#!/bin/sh +d=${JSON.stringify(dir)} +case "$*" in + "pr view 7 --json headRefName") echo '{"headRefName":"task/7"}' ;; + "run list --branch task/7 --limit 100 --json"*) cat "$d/runs.json" ;; + "run view "*" --log-failed") cat "$d/log-$3" ;; + "run view "*" --json jobs") cat "$d/jobs.json" ;; + *) echo "fake gh: unexpected: $*" >&2; exit 9 ;; +esac +`, + ); + chmodSync(join(dir, "gh"), 0o755); + const run = spawnSync(process.execPath, [SCRIPT, "7"], { + encoding: "utf8", + env: { ...process.env, PATH: `${dir}:/usr/bin:/bin` }, + }); + return run.stdout + run.stderr; +} + +const run = ( + databaseId: number, + conclusion: string, + createdAt: string, + workflowName = "CI", +): Run => ({ databaseId, workflowName, headSha: `sha${databaseId}abcdef`, conclusion, createdAt }); + +describe("ci-failures.mjs", () => { + it("prints the failed tests of an older run when every newer run of its workflow was cancelled", () => { + const output = ciFailures( + [run(3, "cancelled", "2026-10-11T10:00:00Z"), run(2, "failure", "2026-10-11T09:00:00Z")], + { 2: VITEST_FAIL }, + ); + + expect(output).toBe("CI run 2 at sha2abc\n e2e/a.test.ts > startup > ends the lease\n"); + }); + + it("strips colour codes that the log carries as the escape byte itself", () => { + const output = ciFailures([run(2, "failure", "2026-10-11T09:00:00Z")], { + 2: VITEST_FAIL.replaceAll("^[", String.fromCharCode(27)), + }); + + expect(output).toBe("CI run 2 at sha2abc\n e2e/a.test.ts > startup > ends the lease\n"); + }); + + it("prints none when a newer run of the same workflow passed after the failure", () => { + const output = ciFailures( + [run(3, "success", "2026-10-11T10:00:00Z"), run(2, "failure", "2026-10-11T09:00:00Z")], + { 2: VITEST_FAIL }, + ); + + expect(output).toBe("none\n"); + }); + + it("keeps a workflow's failure when another workflow's newer run passed", () => { + const output = ciFailures( + [ + run(3, "success", "2026-10-11T10:00:00Z", "Labels"), + run(2, "failure", "2026-10-11T09:00:00Z"), + ], + { 2: VITEST_FAIL }, + ); + + expect(output).toContain("CI run 2 at sha2abc"); + }); + + it("names the failed job when the run's log names no test", () => { + const output = ciFailures( + [run(2, "failure", "2026-10-11T09:00:00Z")], + { 2: "Quality\tLint\terror: unused import" }, + ["Quality"], + ); + + expect(output).toBe("CI run 2 at sha2abc\n job Quality\n"); + }); +}); diff --git a/src/mutate.test.ts b/src/mutate.test.ts index 6f88ffdaf..3c751cd4a 100644 --- a/src/mutate.test.ts +++ b/src/mutate.test.ts @@ -53,7 +53,7 @@ function repo(): Repo { mkdirSync(bin); writeFileSync( join(bin, "pnpm"), - `#!/bin/sh\necho "$@" >> "${log}"\nmkdir -p .stryker-tmp/report\necho '${REPORT}' > .stryker-tmp/report/mutation.json\n`, + `#!/bin/sh\necho "$@" >> "${log}"\nif [ -n "$CRASH" ]; then echo "$CRASH" >&2; exit 1; fi\nmkdir -p .stryker-tmp/report\necho '${REPORT}' > .stryker-tmp/report/mutation.json\n`, ); chmodSync(join(bin, "pnpm"), 0o755); const git = (...args: string[]) => @@ -76,11 +76,11 @@ function repo(): Repo { return { dir, log, bin, git, commit }; } -function mutate(r: Repo, cwd = r.dir) { +function mutate(r: Repo, cwd = r.dir, crash = "") { const run = spawnSync(process.execPath, [SCRIPT, "base"], { cwd, encoding: "utf8", - env: { ...process.env, PATH: `${r.bin}:/usr/bin:/bin` }, + env: { ...process.env, PATH: `${r.bin}:/usr/bin:/bin`, CRASH: crash }, }); return { code: run.status, output: run.stdout + run.stderr }; } @@ -101,9 +101,23 @@ describe("mutate.mjs", () => { ]); expect(output).toContain("2 mutants on 1 changed ranges; 1 alive."); expect(output).toContain("src/a.ts:2 Survived BooleanLiteral: false"); + expect(output).toContain("Kill each one, or explain it in the PR body."); expect(code).toBe(1); }); + it("ends with Stryker's last error lines and exits 2, not 1, when Stryker fails without a report", () => { + const r = repo(); + + const { code, output } = mutate(r, r.dir, "TypeError: boom"); + + expect(output.trimEnd().split("\n").slice(-2)).toEqual([ + "Stryker exited 1 without a report: no mutant was tested.", + "TypeError: boom", + ]); + expect(output).not.toContain("Kill each one"); + expect(code).toBe(2); + }); + it("reprints the last result without running Stryker when nothing under src/ changed since, even after a commit elsewhere", () => { const r = repo(); mutate(r); From 34b75ca53e374b3f0e2d3d95099dd0e761c19ff8 Mon Sep 17 00:00:00 2001 From: Szymon Chmal <szymon@chmal.it> Date: Sun, 11 Oct 2026 12:13:23 +0200 Subject: [PATCH 2/4] chore(agents): keep the review step's code spans on one line --- .claude/skills/deliver/SKILL.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.claude/skills/deliver/SKILL.md b/.claude/skills/deliver/SKILL.md index d3e6c5fb8..cb3f6046b 100644 --- a/.claude/skills/deliver/SKILL.md +++ b/.claude/skills/deliver/SKILL.md @@ -119,8 +119,9 @@ they name; never build again or restart review at round 1. `gh pr view <M> --json mergeable` once. The script reads the newest finished CI run, which is often older than the head: newer pushes cancel theirs. Each failed test no open `flaky-test` issue names joins the fix - run's `fixes` as `ci: <its line> run <id>`; a conflict joins as `merge -the base branch`. With no fix run due, they get one before the round. + run's `fixes` as `ci: <its line> run <id>`, and a conflict as a line + asking to merge the base branch. With no fix run due, they get one + before the round. 3. **Decide** on the review report: - Fix lines: one `implementer` run with `mode: fix` and the Fix lines pasted under `fixes`, then the next round: `reviewer` with `round <n+1>`, the From 9b0c0369dfaecff737e08cb462c5683a704a8420 Mon Sep 17 00:00:00 2001 From: Szymon Chmal <szymon@chmal.it> Date: Sun, 11 Oct 2026 12:14:02 +0200 Subject: [PATCH 3/4] chore(agents): rewrap the audit comment sweep --- .claude/agents/implementer.md | 15 ++++++++------- docs/internal/DELIVERY.md | 6 ++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.claude/agents/implementer.md b/.claude/agents/implementer.md index ac28906e0..2df035f0f 100644 --- a/.claude/agents/implementer.md +++ b/.claude/agents/implementer.md @@ -146,13 +146,14 @@ built. other spellings, other paths, other import or call forms, empty and boundary values. Each one it lets through gets a fixture or an `open` line. -- **Commented.** Write the output of `node .agents/scripts/comments.mjs -origin/main` (in fix mode, `<the head you started from>` in place of - `origin/main`) to your scratchpad: every comment the diff adds or edits, - and every comment within 20 lines of code it adds. Hand it to a - `comment-reviewer` agent with `rules: docs/internal/agent-rules`, - `comments: <that file>` and `worktree: <your worktree>`. Delete each part - it flags; never reword one into a new comment. +- **Commented.** Write the output of this to your scratchpad (in fix + mode, with the head you started from in place of `origin/main`): + `node .agents/scripts/comments.mjs origin/main`. It lists every comment + the diff adds or edits, and every comment within 20 lines of code it + adds. Hand it to a `comment-reviewer` agent with `rules: +docs/internal/agent-rules`, `comments: <that file>` and `worktree: <your +worktree>`. Delete each part it flags; never reword one into a new + comment. - **Promised.** For every Scope and Done when line, name the hunk or test that delivers it. None: do it, or leave the line unticked and say why under `open`. Never tick a box on intent. diff --git a/docs/internal/DELIVERY.md b/docs/internal/DELIVERY.md index d2c207e93..427ba4462 100644 --- a/docs/internal/DELIVERY.md +++ b/docs/internal/DELIVERY.md @@ -154,7 +154,8 @@ agent per phase, so no context grows past one phase: one commits the spec's tests red and opens a draft PR, so CI runs from the first push; the next turns them green in commits that each lower the failing count, starting from a map of which files each test needs; the last audits the diff with -fresh eyes, and has the comment reviewer below sweep its comments. Agents pass each other `key: value` lines, not prose. It +fresh eyes, and has the comment reviewer below sweep its comments. Agents +pass each other `key: value` lines, not prose. It runs only the tests its change can reach — `pnpm test:changed` and the e2e files it touched. Every other check runs on its own: format, lint and typecheck on commit; Fallow, the e2e typecheck and `pnpm mutate` (mutants @@ -338,7 +339,8 @@ a fixed layout: - `docs/internal/adr/` with a `README.md` index, and `docs/internal/templates/` with `feature.md` and `task.md`. - `.agents/scripts/`: `worktree.sh`, `review-inputs.sh`, `stale-refs.sh`, - `comments.mjs`, `ci-failures.mjs`, `merge-pr.sh`, `delivery-stats.mjs` and `budget-guard.mjs`. `worktree.sh` and + `comments.mjs`, `ci-failures.mjs`, `merge-pr.sh`, `delivery-stats.mjs` + and `budget-guard.mjs`. `worktree.sh` and `ensure-pnpm.sh` are this project's (they install its dependencies); the others are not. - `.github/workflows/issue-state.yml` and the labels in `.github/labels.json`. From b7fbd1e674cb57c4144564e299a2e5c42e91f8db Mon Sep 17 00:00:00 2001 From: Szymon Chmal <szymon@chmal.it> Date: Sun, 11 Oct 2026 12:14:31 +0200 Subject: [PATCH 4/4] chore(agents): keep code spans on one line --- .claude/agents/implementer.md | 8 ++++---- .claude/agents/reviewer.md | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.claude/agents/implementer.md b/.claude/agents/implementer.md index 2df035f0f..377a2973a 100644 --- a/.claude/agents/implementer.md +++ b/.claude/agents/implementer.md @@ -150,10 +150,10 @@ built. mode, with the head you started from in place of `origin/main`): `node .agents/scripts/comments.mjs origin/main`. It lists every comment the diff adds or edits, and every comment within 20 lines of code it - adds. Hand it to a `comment-reviewer` agent with `rules: -docs/internal/agent-rules`, `comments: <that file>` and `worktree: <your -worktree>`. Delete each part it flags; never reword one into a new - comment. + adds. Hand it to a `comment-reviewer` agent with + `rules: docs/internal/agent-rules`, `comments: <that file>` and + `worktree: <your worktree>`. Delete each part it flags; never reword one + into a new comment. - **Promised.** For every Scope and Done when line, name the hunk or test that delivers it. None: do it, or leave the line unticked and say why under `open`. Never tick a box on intent. diff --git a/.claude/agents/reviewer.md b/.claude/agents/reviewer.md index 5d7c4fd2b..7195b423e 100644 --- a/.claude/agents/reviewer.md +++ b/.claude/agents/reviewer.md @@ -261,9 +261,9 @@ path that no longer exists, a behaviour, order, owner, default or limit that changed. Blocking: a false claim. Note: a claim that is true but misleading. ``` -**Comment review**: `subagent_type: "comment-reviewer"`, with `rules: -$R/rules`, `comments: $R/comments.txt` (from round 2, `$R/comments-fix.txt`) -and `worktree:` the claims worktree. Nothing else. +**Comment review**: `subagent_type: "comment-reviewer"`, with +`rules: $R/rules`, `comments: $R/comments.txt` (from round 2, +`$R/comments-fix.txt`) and `worktree:` the claims worktree. Nothing else. **Common tail** (every brief but the comment review's):