paperlint 18.9.1 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/lib/skill-corpus.mjs +2 -113
  3. package/lib/skill-corpus.test.mjs +10 -11
  4. package/package.json +1 -2
  5. package/scripts/harness-api.frozen.json +0 -18
  6. package/skills/build-label-page/build-label-page.test.ts +2 -7
  7. package/skills/harden-paper/check-numbers.test.ts +104 -0
  8. package/skills/harden-paper/check-release-claims.test.ts +126 -0
  9. package/skills/label-agent-runs/label-agent-runs.harness.ts +2 -6
  10. package/skills/render-paper/render-paper.harness.mjs +153 -0
  11. package/skills/rewrite-unclear/rewrite-unclear.harness.ts +0 -5
  12. package/skills/run-agent-grid/run-agent-grid.harness.ts +2 -6
  13. package/skills/submit-paper/check-deanon.test.ts +165 -0
  14. package/lib/skill-checks.d.mts +0 -10
  15. package/lib/skill-checks.mjs +0 -403
  16. package/lib/skill-checks.test.mjs +0 -288
  17. package/skills/analyze-sibling-paper/analyze-sibling-paper.harness.mjs +0 -23
  18. package/skills/argument-arc/argument-arc.harness.mjs +0 -23
  19. package/skills/build-benchmark/build-benchmark.harness.mjs +0 -23
  20. package/skills/camera-ready/camera-ready.harness.mjs +0 -23
  21. package/skills/cold-read-diff/cold-read-diff.harness.mjs +0 -21
  22. package/skills/draft-paper/draft-paper.harness.mjs +0 -23
  23. package/skills/extend-paper/extend-paper.harness.mjs +0 -23
  24. package/skills/find-venue/find-venue.harness.mjs +0 -23
  25. package/skills/harden-paper/harden-paper.harness.mjs +0 -23
  26. package/skills/map-prior-work/map-prior-work.harness.mjs +0 -23
  27. package/skills/paper-status/paper-status.harness.mjs +0 -25
  28. package/skills/pc-panel-review/pc-panel-review.harness.mjs +0 -24
  29. package/skills/plan-paper-timeline/plan-paper-timeline.harness.mjs +0 -23
  30. package/skills/research-ideate/research-ideate.harness.mjs +0 -23
  31. package/skills/study-accepted-papers/study-accepted-papers.harness.mjs +0 -23
  32. package/skills/submit-paper/submit-paper.harness.mjs +0 -23
  33. package/skills/tighten-paper/tighten-paper.harness.mjs +0 -23
  34. package/skills/verify-citations/verify-citations.harness.mjs +0 -23
@@ -5,8 +5,6 @@
5
5
  * Runs the REAL `claude` CLI against a SCRIPTED MOCK MODEL (`runHarnessTest`): $0, no API key.
6
6
  * The script activates the skill and stops; the check reads what reached the model.
7
7
  *
8
- * Also, without the CLI: the shared per-skill checks (`checkSkill`).
9
- *
10
8
  * What it does NOT prove: that a real model's rewrite is clearer, or that the description fires on
11
9
  * an author's complaint. The first is the cold reader inside the skill (step 3); the second is
12
10
  * `rewrite-unclear.eval.ts`.
@@ -14,14 +12,11 @@
14
12
  import { spawnSync } from "node:child_process";
15
13
  import { runHarnessTest, skip } from "vigiles";
16
14
  import { createChecker } from "../../lib/check.ts";
17
- import { checkSkill } from "../../lib/skill-checks.mjs";
18
15
  import { observeAgentCli } from "#lib/agent-cli-version";
19
16
  import { claudeDir } from "#src/package-dirs";
20
17
 
21
18
  const check = createChecker();
22
19
 
23
- await checkSkill("rewrite-unclear");
24
-
25
20
  const cli = observeAgentCli({ spawnSync });
26
21
  if (!cli.present) skip(`rewrite-unclear effects: ${cli.note}`);
27
22
 
@@ -9,9 +9,8 @@
9
9
  * consumer: the skill's link under `.claude/skills/`, and the COMPILED `grid-guard.js` there,
10
10
  * which is what runs from `node_modules` (`npm run build` makes it; `npm run check` builds first).
11
11
  *
12
- * Also, without the CLI: the shared per-skill checks (`checkSkill`). Whether the skill names only
13
- * subcommands the guard has is not tested here: the spec interpolates them from
14
- * `scripts/grid-guard-commands.ts`, so a wrong one fails `tsc`.
12
+ * Whether the skill names only subcommands the guard has is not tested here: the spec interpolates
13
+ * them from `scripts/grid-guard-commands.ts`, so a wrong one fails `tsc`.
15
14
  *
16
15
  * What it does NOT prove: that a real model follows the order of the gates. That is a
17
16
  * probabilistic question for `run-agent-grid.eval.ts` and a real grid.
@@ -20,15 +19,12 @@ import { spawnSync } from "node:child_process";
20
19
  import { join } from "node:path";
21
20
  import { runHarnessTest, skip, type ToolCall } from "vigiles";
22
21
  import { createChecker } from "../../lib/check.ts";
23
- import { checkSkill } from "../../lib/skill-checks.mjs";
24
22
  import { observeAgentCli } from "#lib/agent-cli-version";
25
23
  import { claudeDir } from "#src/package-dirs";
26
24
  import { COMMANDS } from "./scripts/grid-guard-commands.ts";
27
25
 
28
26
  const check = createChecker();
29
27
 
30
- await checkSkill("run-agent-grid");
31
-
32
28
  // ── Through the real CLI: the lock, as the skill tells an agent to take it ────────────────
33
29
  const SKILL_LINK = join(claudeDir(), "skills", "run-agent-grid");
34
30
  const cli = observeAgentCli({ spawnSync });
@@ -139,3 +139,168 @@ describe("check-deanon.sh — both halves of the scan", () => {
139
139
  });
140
140
  });
141
141
  });
142
+
143
+ const python = (code: string, ...args: readonly string[]) =>
144
+ spawnSync("python3", ["-W", "ignore", "-c", code, ...args], {
145
+ encoding: "utf8",
146
+ });
147
+ const havePython = python("").status === 0;
148
+ const havePymupdf = havePython && python("import fitz").status === 0;
149
+
150
+ /** A one-page PDF at `path` whose text is `text`. */
151
+ const writePdf = (path: string, text: string): void => {
152
+ const r = python(
153
+ "import sys,fitz\nd=fitz.open()\np=d.new_page()\np.insert_text((72,72),sys.argv[2])\nd.save(sys.argv[1])",
154
+ path,
155
+ text,
156
+ );
157
+ expect(r.status).toBe(0);
158
+ };
159
+
160
+ /** An `artifact.zip` at `path` holding the given members. */
161
+ const writeZip = (path: string, members: Record<string, string>): void => {
162
+ const r = python(
163
+ "import sys,json,zipfile\nwith zipfile.ZipFile(sys.argv[1],'w') as f:\n [f.writestr(k,v) for k,v in json.loads(sys.argv[2]).items()]",
164
+ path,
165
+ JSON.stringify(members),
166
+ );
167
+ expect(r.status).toBe(0);
168
+ };
169
+
170
+ describe("check-deanon.sh — what the deny-list matches", () => {
171
+ const list =
172
+ "# fake identity\nquillfeather\n\\bmoss\\b\ngithub\\.com/quillfeather\n";
173
+
174
+ it("a word-boundary entry does not match ordinary prose that contains the word", () => {
175
+ const { root, paper } = project(
176
+ "The mossy-green plots in Figure 3 come from run.sh.",
177
+ );
178
+ mkdirSync(join(root, ".paperlint"));
179
+ writeFileSync(join(root, ".paperlint", "deanon-denylist.txt"), list);
180
+ expect(run([paper], { env: { CLAUDE_PROJECT_DIR: root } }).status).toBe(0);
181
+ });
182
+
183
+ it("a file whose extension no list names (.yml) is scanned like any other", () => {
184
+ const { root, paper } = project("Authors omitted for double-blind review.");
185
+ mkdirSync(join(root, ".paperlint"));
186
+ writeFileSync(join(root, ".paperlint", "deanon-denylist.txt"), list);
187
+ writeFileSync(
188
+ join(paper, "artifact", "config.yml"),
189
+ "maintainer: quillfeather\nrepo: github.com/quillfeather/toolkit\n",
190
+ );
191
+ const { status, stdout } = run([paper], {
192
+ env: { CLAUDE_PROJECT_DIR: root },
193
+ });
194
+ expect({
195
+ status,
196
+ leaks: stdout.split("\n").filter((l) => l.includes("LEAK")),
197
+ }).toEqual({
198
+ status: 1,
199
+ leaks: [
200
+ " LEAK artifact/config.yml:1:maintainer: quillfeather",
201
+ " LEAK artifact/config.yml:2:repo: github.com/quillfeather/toolkit",
202
+ ],
203
+ });
204
+ });
205
+ });
206
+
207
+ describe("check-deanon.sh — the bundle that gets uploaded", () => {
208
+ it.skipIf(!havePython)(
209
+ "a leak that exists only inside artifact.zip names the zip and the member",
210
+ () => {
211
+ const { root, paper } = project(
212
+ "Authors omitted for double-blind review.",
213
+ );
214
+ const deny = denyList(join(root, "deny.txt"));
215
+ writeZip(join(paper, "artifact.zip"), {
216
+ "artifact/README.md": "Authors omitted for double-blind review.\n",
217
+ "artifact/METADATA.txt": "upstream: by Quillfeather\n",
218
+ });
219
+ expect(run([paper, "paper.pdf", deny]).stdout).toContain(
220
+ " LEAK artifact.zip!artifact/METADATA.txt:1:upstream: by Quillfeather\n",
221
+ );
222
+ expect(run([paper, "paper.pdf", deny]).status).toBe(1);
223
+ },
224
+ );
225
+ });
226
+
227
+ describe("check-deanon.sh — a deny-list that cannot protect anything", () => {
228
+ it("a named deny-list that does not exist is exit 2, never a pass", () => {
229
+ const { root, paper } = project("by Quillfeather");
230
+ const missing = join(root, "does-not-exist.txt");
231
+ expect(run([paper, "paper.pdf", missing])).toEqual({
232
+ status: 2,
233
+ stdout: `FAIL: no deny-list ${missing}\n`,
234
+ });
235
+ });
236
+
237
+ it("a deny-list that is all comments is exit 2, never a pass", () => {
238
+ const { root, paper } = project("by Quillfeather");
239
+ const named = join(root, "deny.txt");
240
+ writeFileSync(
241
+ named,
242
+ "# emptied while chasing a false positive\n#quillfeather\n\n",
243
+ );
244
+ expect(run([paper, "paper.pdf", named])).toEqual({
245
+ status: 2,
246
+ stdout: `FAIL: deny-list ${named} has no patterns\n`,
247
+ });
248
+ });
249
+ });
250
+
251
+ describe("check-deanon.sh — the compiled PDF", () => {
252
+ it("an absent PDF is a warning, not silence", () => {
253
+ const { root, paper } = project("Authors omitted.");
254
+ const deny = denyList(join(root, "deny.txt"));
255
+ expect(run([paper, "nonexistent.pdf", deny]).stdout).toBe(
256
+ [
257
+ `== check-deanon: ${paper} (pdf=nonexistent.pdf, 1 patterns) ==`,
258
+ ` WARN: ${paper}/nonexistent.pdf not found — PDF not scanned`,
259
+ "-- summary: 0 identifier hit(s) across PDF + artifact + zip",
260
+ "PASS: no author-identifying strings found. Safe for double-blind.",
261
+ "",
262
+ ].join("\n"),
263
+ );
264
+ });
265
+
266
+ it("a PDF that cannot be read is a warning, not a pass about a document never opened", () => {
267
+ const { root, paper } = project("Authors omitted.");
268
+ const deny = denyList(join(root, "deny.txt"));
269
+ writeFileSync(join(paper, "paper.pdf"), "%PDF-1.4\n% not a real pdf\n");
270
+ expect(run([paper, "paper.pdf", deny]).stdout).toContain(
271
+ " WARN: could not extract PDF text (pymupdf missing?) — PDF not scanned\n",
272
+ );
273
+ });
274
+
275
+ it.skipIf(!havePymupdf)(
276
+ "an identifier compiled into the PDF text is a leak naming the PDF",
277
+ () => {
278
+ const { root, paper } = project("Authors omitted.");
279
+ const deny = denyList(join(root, "deny.txt"));
280
+ writePdf(
281
+ join(paper, "paper.pdf"),
282
+ "Anonymous submission. Tooling: Quillfeather-kit.",
283
+ );
284
+ const { status, stdout } = run([paper, "paper.pdf", deny]);
285
+ expect({
286
+ status,
287
+ leaks: stdout.split("\n").filter((l) => l.includes("LEAK")),
288
+ }).toEqual({
289
+ status: 1,
290
+ leaks: [
291
+ " LEAK PDF[paper.pdf]:1:Anonymous submission. Tooling: Quillfeather-kit.",
292
+ ],
293
+ });
294
+ },
295
+ );
296
+
297
+ it.skipIf(!havePymupdf)("a PDF with no identifier in it passes", () => {
298
+ const { root, paper } = project("Authors omitted.");
299
+ const deny = denyList(join(root, "deny.txt"));
300
+ writePdf(
301
+ join(paper, "paper.pdf"),
302
+ "Anonymous submission. Tooling: REDACTED for review.",
303
+ );
304
+ expect(run([paper, "paper.pdf", deny]).status).toBe(0);
305
+ });
306
+ });
@@ -1,10 +0,0 @@
1
- /**
2
- * Types for `skill-checks.mjs`, for the TypeScript tests that call it. Only what they call is
3
- * declared; the module stays JavaScript.
4
- */
5
-
6
- /** The shared per-skill checks for `skills/<name>/SKILL.md`; rejects naming every failure. */
7
- export function checkSkill(name: string): Promise<void>;
8
-
9
- /** Asserts a soundness- or novelty-scoring skill points to the shared venue-bar reference and carries the fallback line. */
10
- export function checkVenueBar(name: string): number;
@@ -1,403 +0,0 @@
1
- /**
2
- * skill-checks.mjs — everything asserted about ONE skill, as a function you call with its name.
3
- * `checkSkill("verify-citations")`.
4
- *
5
- * WHY A FUNCTION AND NOT A HARNESS. Until 2026-08-11 these assertions lived in
6
- * `skills.harness.mjs`, a 614-line file named after no surface, and the 21 colocated per-skill
7
- * harnesses reached it by setting `PIPELINE_SKILL_ONLY` and importing it for its side effects.
8
- * That is a script pretending to be an API: the caller could not pass an argument, could not get
9
- * a result, and the coupling was an environment variable. The owner asked three times why the
10
- * file survived; the answer was that I had wrapped it instead of splitting it.
11
- *
12
- * WHAT IS CHECKED HERE. Anything decidable from one SKILL.md: strict-YAML frontmatter, the
13
- * declared tool contract, every script path it instructs, and whether it is PERMITTED to run what
14
- * it instructs.
15
- *
16
- * 🔴 KNOWN-RED ASSERTIONS ARE DEFERRED, NOT WEAKENED, and the deferral list is now PER CALL.
17
- * A throw would abort the rest, making one open finding silently skip every check after it —
18
- * the failure this whole directory exists to end. Per call matters too: with one shared list,
19
- * a full sweep could attribute one skill's failures to another's line in the report.
20
- */
21
- import assert from "node:assert/strict";
22
- import { existsSync, readFileSync } from "node:fs";
23
- import { join } from "node:path";
24
- import { recordCheck } from "vigiles";
25
- import { presetsDir } from "#src/package-dirs";
26
-
27
- import { SKILLS_DIR, ROOT, load, commands, permits } from "./skill-corpus.mjs";
28
-
29
- // Where the pipeline's own scripts live is asked of the package, not spelled here. The resolver
30
- // refuses a root that is not on disk, because every use below is a FILTER: a wrong prefix would
31
- // match nothing and report a clean skill that was never examined.
32
- import {
33
- pipelineScripts,
34
- scriptsRoot,
35
- } from "../skills/paper-pipeline/scripts/consumer.mjs";
36
-
37
- const PIPELINE = pipelineScripts(scriptsRoot({ env: {}, cwd: ROOT }));
38
- /** How a SKILL.md names its own directory in a command: Claude Code substitutes it wherever the skill is. */
39
- const SKILL_DIR_VAR = "${CLAUDE_SKILL_DIR}/";
40
-
41
- /** How a skill names a file of the package's presets directory. */
42
- const PRESETS_PREFIX = "presets/";
43
-
44
- /** The preset files a skill's text names in code spans (`presets/agenticdev-2026.md`), placeholders left out. */
45
- export const presetRefs = (src) => [
46
- ...new Set(
47
- [...src.matchAll(/`(presets\/[A-Za-z0-9._-]+)`/g)].map((m) => m[1]),
48
- ),
49
- ];
50
-
51
- /**
52
- * Assert everything single-skill about `name`. Throws with EVERY finding, not the first.
53
- * Returns the number of skills checked (1) so a caller can report what it actually did.
54
- */
55
- export async function checkSkill(name) {
56
- if (!existsSync(join(SKILLS_DIR, name, "SKILL.md")))
57
- throw new Error(`"${name}" has no SKILL.md under ${SKILLS_DIR}`);
58
- const deferred = [];
59
- const soft = (fn) => {
60
- try {
61
- fn();
62
- } catch (e) {
63
- deferred.push(e);
64
- }
65
- };
66
- const skills = [load(name)];
67
-
68
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
69
- // 1. GONE, AND THAT IS THE RESULT (2026-08-19). This slot held a strict-YAML assertion whose whole
70
- // job was to police the gap between how the corpus was READ here (a hand-rolled lenient reader)
71
- // and how every other consumer reads it (a real YAML parser). The corpus owner, on being shown the gap:
72
- // "sounds like a hack… let's think about how to do it properly". The right fix was not a better
73
- // check — it was to stop being lenient: the two remaining unparseable descriptions were quoted and
74
- // `parseFm` in skill-corpus.mjs now throws on anything a real parser rejects.
75
- //
76
- // So the defect class is not detected here any more; it is UNREACHABLE. A skill whose frontmatter
77
- // is not valid YAML does not reach these assertions with a plausible-looking object and a missing
78
- // `allowed-tools` — it does not load at all, and says why. What the corpus does about the root
79
- // cause (`vigiles compile` interpolating the description into YAML raw) is written where the
80
- // parser lives.
81
-
82
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
83
- // 2-4. Identity and contract fields, read from the strict parse — there is no other kind now, and
84
- // nothing above can fail while leaving these reachable. `name` is what Claude Code lists and
85
- // matches the skill by, so a name that disagrees with its directory is two identities for one skill.
86
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
87
- for (const s of skills) {
88
- soft(() =>
89
- assert.equal(
90
- s.fm.name,
91
- s.name,
92
- `${s.name}: frontmatter name is ${JSON.stringify(s.fm.name)} but the directory is "${s.name}".`,
93
- ),
94
- );
95
-
96
- soft(() =>
97
- assert.ok(
98
- (s.fm.description || "").length > 40,
99
- `${s.name}: description is missing or trivially short (${(s.fm.description || "").length} chars). ` +
100
- `The description is the ONLY thing the model matches on when choosing a skill — an empty one is ` +
101
- `a skill that never fires, and a skill that never fires is indistinguishable from one that works.`,
102
- ),
103
- );
104
-
105
- soft(() =>
106
- assert.ok(
107
- s.tools.length > 0,
108
- `${s.name}: no allowed-tools. A skill declaring nothing INHERITS EVERYTHING — Bash, WebFetch and ` +
109
- `every MCP server (Calendar, GitHub-write, Vercel) — over a repo holding health data, DNA and ` +
110
- `bank balances. This is the finding the 2026-08-03 audit closed for all 35 skills.`,
111
- ),
112
- );
113
- }
114
-
115
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
116
- // 7. EVERY script path the skill instructs resolves.
117
- //
118
- // Scoped to paths that are unambiguously resolvable: `${CLAUDE_SKILL_DIR}/…` and `scripts/…`, both
119
- // skill-relative. A `.claude/skills/…` path is not resolved here: under the plugin no such folder
120
- // exists, and `port/md-install-path` flags it in the skill's text. A `.js` a skill runs is a build output
121
- // (`npm run build`), so this checks the checkout as built. Paths
122
- // like `repro/build-submission.sh` are relative to a PAPER directory that does not exist at test
123
- // time, so they are excluded BY NAME rather than by a guess that would fire on correct text.
124
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
125
- for (const s of skills) {
126
- for (const c of commands(s.src)) {
127
- const abs = c.script.startsWith(SKILL_DIR_VAR)
128
- ? join(SKILLS_DIR, s.name, c.script.slice(SKILL_DIR_VAR.length))
129
- : c.script.startsWith("scripts/")
130
- ? join(SKILLS_DIR, s.name, c.script)
131
- : null;
132
- if (!abs) continue;
133
- soft(() =>
134
- assert.ok(
135
- existsSync(abs),
136
- `${s.name}: instructs \`${c.cmd}\` but ${c.script} does not exist (looked at ${abs}). Dead ` +
137
- `instruction — the model will improvise something adjacent and report it as done.`,
138
- ),
139
- );
140
- }
141
- }
142
-
143
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
144
- // 8. A skill is PERMITTED TO RUN what it instructs. The inverse-direction risk of narrowing: over-
145
- // narrow an allowed-tools entry and the skill's own instruction is denied at runtime, which looks
146
- // like the skill silently declining a step — the same invisible failure as a dead hook, arrived at
147
- // from the opposite direction. Nothing else checks the two halves against each other.
148
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
149
- for (const s of skills) {
150
- for (const c of commands(s.src)) {
151
- // The pipeline's own scripts, by either spelling; any other command is the consumer's business.
152
- const own =
153
- c.script.startsWith(PIPELINE.prefix) ||
154
- c.script.startsWith(SKILL_DIR_VAR);
155
- if (!own) continue;
156
- soft(() =>
157
- assert.ok(
158
- s.tools.some((t) => permits(t, c.cmd)),
159
- `${s.name}: instructs \`${c.cmd}\` but its allowed-tools [${s.tools.join(", ")}] permit no such ` +
160
- `Bash command. The instruction is denied at runtime and the step silently does not happen.`,
161
- ),
162
- );
163
- }
164
- }
165
-
166
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
167
- // 9. EVERY PRESET FILE the skill names exists in the package. Skills name a venue's card and preset
168
- // as `presets/<name>.md` / `presets/<name>.jsonc` "in the package" — a path inside the package, the
169
- // same in every install channel — and the cards once lived under a skill's `references/`, so a
170
- // name that outlived a move would send the model to a file that is not there. Resolved against
171
- // the package's presets directory (`#src/package-dirs`, the one module that knows where it is).
172
- // Placeholders (`presets/<venue>.md`) are not names of a file and are left out.
173
- // ═══════════════════════════════════════════════════════════════════════════════════════════════
174
- for (const s of skills) {
175
- for (const ref of presetRefs(s.src)) {
176
- const abs = join(presetsDir(), ref.slice(PRESETS_PREFIX.length));
177
- soft(() =>
178
- assert.ok(
179
- existsSync(abs),
180
- `${s.name}: names \`${ref}\` in the package, and there is no such file (looked at ${abs}).`,
181
- ),
182
- );
183
- }
184
- }
185
-
186
- if (deferred.length) {
187
- const e = new Error(
188
- `${deferred.length} assertion(s) failed for skill "${name}":\n\n` +
189
- deferred.map((d, i) => ` [${i + 1}] ${d.message}`).join("\n\n"),
190
- );
191
- e.stack = e.message;
192
- throw e;
193
- }
194
- // Reported so `vigiles test` can tell a run that verified this skill from a file that merely
195
- // sits beside it — the distinction colocation cannot make (see vigiles check-count.ts).
196
- recordCheck();
197
- console.log(`✓ ${name}: frontmatter, script paths, tool contract`);
198
- return 1;
199
- }
200
-
201
- /** The shared reference every skill that scores soundness or novelty points to, and its fallback line. */
202
- const VENUE_BAR_REF = "paper-pipeline/references/venue-bar.md";
203
- const VENUE_BAR_FALLBACK = "main-conference bar assumed";
204
-
205
- /**
206
- * Assert that the skill `name`, which scores soundness or novelty, takes the venue's measured bar:
207
- * it names the one shared reference and carries the no-summary fallback line. Both halves are
208
- * needed: a skill that reads the summary but never says what a missing one means scores against an
209
- * unnamed main-conference bar in silence, and a skill that only says the fallback never reads it.
210
- * The wording itself lives in the reference, so the reference must hold both as well.
211
- */
212
- export function checkVenueBar(name) {
213
- const skill = load(name);
214
- const ref = join(SKILLS_DIR, VENUE_BAR_REF);
215
- assert.ok(
216
- existsSync(ref),
217
- `${name}: ${VENUE_BAR_REF} does not exist (looked at ${ref}).`,
218
- );
219
- const shared = readFileSync(ref, "utf8");
220
- const findings = [
221
- [
222
- skill.src.includes(VENUE_BAR_REF),
223
- `does not point to \`${VENUE_BAR_REF}\``,
224
- ],
225
- [
226
- skill.src.includes("venues/<venue>/summary.md"),
227
- "does not name `<papers-root>/venues/<venue>/summary.md`",
228
- ],
229
- [
230
- skill.src.includes(VENUE_BAR_FALLBACK),
231
- `does not carry the fallback "${VENUE_BAR_FALLBACK}"`,
232
- ],
233
- [
234
- shared.includes(VENUE_BAR_FALLBACK),
235
- `the shared reference lacks the fallback "${VENUE_BAR_FALLBACK}"`,
236
- ],
237
- ]
238
- .filter(([ok]) => !ok)
239
- .map(([, why]) => `${name}: ${why}`);
240
- assert.deepEqual(
241
- findings,
242
- [],
243
- `${name}: venue bar not wired:\n${findings.join("\n")}`,
244
- );
245
- recordCheck();
246
- console.log(`✓ ${name}: venue bar input and fallback`);
247
- return 1;
248
- }
249
-
250
- // ═════════════════════════════════════════════════════════════════════════════════════════════════
251
- // checkProseSkill — for skills WITHOUT the pipeline (2026-08-27)
252
- //
253
- // WHY A SEPARATE FUNCTION. A prose skill only writes text, so Bash, Agent and Task are banned
254
- // unless an exemption names a reason; a pipeline skill runs its scripts through narrowed Bash
255
- // entries and is checked instead for whether those scripts exist and are permitted.
256
- //
257
- // 🔴 BOTH HALVES ARE BUILT IN, NOT WRITTEN BY HAND. The `CLAUDE.md` rule requires two halves of
258
- // every check: it fires on a planted defect AND it stays silent on clean input. The "fires" half is
259
- // written less often — it is not needed to make a run go green. So here it is not entrusted to the
260
- // author: EVERY predicate below is run twice — over the real text and over the mutated one, and the
261
- // disagreement of the verdicts IS the assertion. The mutation cannot be forgotten, there is nowhere
262
- // to forget it.
263
- //
264
- // WHAT THIS DOES NOT PROVE: that the skill fires on the right request and that its advice gives a
265
- // good result. The first is the trigger eval, the second is the model. Only what is decidable from
266
- // the text is here.
267
- // ═════════════════════════════════════════════════════════════════════════════════════════════════
268
-
269
- /** Relative markdown links that do not resolve from the skill's directory. */
270
- function danglingLinks(src, dir) {
271
- const out = [];
272
- for (const m of src.matchAll(/\[[^\]]*\]\(([^)\s]+)\)/g)) {
273
- const t = m[1].split("#")[0];
274
- if (!t || /^(https?:|mailto:)/.test(t)) continue;
275
- if (!existsSync(join(dir, t))) out.push(t);
276
- }
277
- return out;
278
- }
279
-
280
- /**
281
- * Check the prose skill `name`.
282
- *
283
- * @param {string} name — the directory name in `.claude/skills/`
284
- * @param {{toolsNeeded?: Record<string,string>}} opts
285
- * `toolsNeeded` — {tool: REASON}. Lifts the ban on Bash/Agent/Task for a skill that
286
- * needs the tool IN SUBSTANCE. The reason is mandatory and non-empty.
287
- *
288
- * 🔴 Why `toolsNeeded` appeared (2026-09-01) and why it carries a REASON rather than a flag.
289
- * The ban on Bash/Agent/Task was written for two text-only skills and was hard-wired as
290
- * universal: "a skill that only writes text". For `session-retro` that is a lie — its own
291
- * instruction prescribes SPAWNING auditors ("Spawn parallel audit subagents") and running
292
- * measurements, that is, without Agent and Bash it does not do what it is.
293
- *
294
- * The temptation was to switch the check off for it entirely. That is wrong: the ban protects
295
- * a repository with health data and balances from the third leg of the lethal trifecta, and it
296
- * is still right for the rest. So it is not a flag but a NAMED exemption with a reason — the
297
- * same form as `vigiles:local-by-design` in this same knowledge base: switching off is
298
- * possible, but it stays written down, and the next reader sees WHAT exactly was decided.
299
- */
300
- export async function checkProseSkill(name, opts = {}) {
301
- const { skillContract } = await import("vigiles");
302
- const dir = join(SKILLS_DIR, name);
303
- const md = join(dir, "SKILL.md");
304
- const deferred = [];
305
- const soft = (fn) => {
306
- try {
307
- fn();
308
- } catch (e) {
309
- deferred.push(e);
310
- }
311
- };
312
-
313
- // Any other option is refused by name: an option this function no longer reads would be a
314
- // check the caller believes runs and that does nothing.
315
- const unknown = Object.keys(opts).filter((k) => k !== "toolsNeeded");
316
- assert.deepEqual(
317
- unknown,
318
- [],
319
- `${name}: unknown option(s) ${unknown.join(", ")} — checkProseSkill takes only toolsNeeded`,
320
- );
321
- assert.ok(existsSync(md), `${name}: no ${md} — nothing to check`);
322
- const src = readFileSync(md, "utf8");
323
-
324
- // 1. The tool contract. Both skills deliberately DROPPED Bash — it was the third leg of the
325
- // lethal trifecta over a repo with health data and balances. A regression here is silent: a
326
- // skill with no parseable `allowed-tools` INHERITS EVERYTHING, and that looks exactly like a
327
- // declared contract.
328
- const c = await skillContract(dir);
329
- soft(() =>
330
- assert.equal(
331
- c.malformed,
332
- false,
333
- `${name}: allowed-tools does not parse. The file LOOKS like it declares a contract, while a ` +
334
- `strict parser sees nothing — the skill silently inherits every tool. Known cause: ` +
335
- `\`vigiles compile\` strips the quotes off a scalar containing ": " and breaks the YAML ` +
336
- `(see CLAUDE.md, measured 2026-08-19).`,
337
- ),
338
- );
339
- soft(() =>
340
- assert.ok(
341
- c.declared.length > 0,
342
- `${name}: empty allowed-tools — inherits everything`,
343
- ),
344
- );
345
- const needed = opts.toolsNeeded ?? {};
346
- // An exemption without a reason is not an exemption: an empty string would pass as "decided"
347
- // while saying nothing. The same miss as "a counter that counts what it ignores".
348
- for (const [tool, why] of Object.entries(needed))
349
- assert.ok(
350
- typeof why === "string" && why.trim().length >= 10,
351
- `${name}: toolsNeeded.${tool} is declared without an intelligible reason. An exemption must ` +
352
- `say WHY the tool is needed in substance — otherwise it is a silent disabling of the check.`,
353
- );
354
- for (const banned of ["Bash", "Agent", "Task"]) {
355
- if (banned in needed) continue;
356
- soft(() =>
357
- assert.ok(
358
- !c.declared.includes(banned),
359
- `${name}: ${banned} appeared in the contract. It was dropped deliberately; bringing it back ` +
360
- `restores a leg of the lethal trifecta (data + network + execution) on a skill that only ` +
361
- `writes text. If the tool IS needed IN SUBSTANCE — declare it in toolsNeeded WITH A REASON, ` +
362
- `not silently.`,
363
- ),
364
- );
365
- }
366
- // The other side: an exemption that exempts nothing is garbage, and garbage accumulates.
367
- // A year later such lines read as "there was a risk here", though there is no risk.
368
- for (const tool of Object.keys(needed))
369
- soft(() =>
370
- assert.ok(
371
- c.declared.includes(tool),
372
- `${name}: toolsNeeded.${tool} is declared, but ${tool} itself is NOT in the contract. ` +
373
- `The exemption is stale — remove it, otherwise it describes a different skill.`,
374
- ),
375
- );
376
-
377
- // 2. Links. The class we got burned on 2026-08-27: a file moves one level deeper, the link
378
- // stays as it was and silently stops resolving. A grep by name does not see that.
379
- const dangling = danglingLinks(src, dir);
380
- soft(() =>
381
- assert.deepEqual(
382
- dangling,
383
- [],
384
- `${name}: dangling links → ${dangling.join(", ")}. A skill naming a path that does not exist ` +
385
- `is a dead instruction: the model reads it, does something adjacent and reports success.`,
386
- ),
387
- );
388
-
389
- // 3. Whether it is compiled. Editing the markdown by hand desynchronises the sha and gets
390
- // quietly rolled back by the next `vigiles compile`.
391
- soft(() =>
392
- assert.ok(
393
- /vigiles:sha256:/.test(src),
394
- `${name}: no compilation mark. That means SKILL.md was edited by hand rather than through ` +
395
- `.spec.ts — the next \`vigiles compile\` will overwrite the edit without warning.`,
396
- ),
397
- );
398
-
399
- if (deferred.length)
400
- throw new AggregateError(deferred, `${name}: ${deferred.length} findings`);
401
- recordCheck();
402
- return 1;
403
- }