paperlint 19.0.3 → 20.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "19.0.3",
3
+ "version": "20.0.0",
4
4
  "description": "Skills and hooks for writing a research paper with paperlint",
5
5
  "skills": "./skills/",
6
6
  "hooks": "./plugin/hooks/hooks.json"
@@ -207,20 +207,6 @@ export async function runSkillTriggerEval(skill, opts = {}) {
207
207
  console.log(formatTriggerRateReport(report));
208
208
  if (report.n === 0) throw new Error("no runs executed");
209
209
 
210
- // Record that THIS description text was measured. Added 2026-08-28: before that recall was
211
- // a number obtained once — reword the description, and nobody catches the firing regression.
212
- // It is written AFTER the run and only when n > 0, otherwise the ledger would assert a
213
- // measurement that never happened.
214
- {
215
- const { recordRun } = await import("./trigger-ledger.mjs");
216
- recordRun(skill, {
217
- recall: report.rate ?? report.triggerRate ?? null,
218
- precision: report.precision ?? null,
219
- model,
220
- trials,
221
- });
222
- }
223
-
224
210
  // Machine-readable row, appended when asked. The printed report TRUNCATES each
225
211
  // prompt, so comparing two models' per-prompt outcomes off the text would match
226
212
  // on prefixes — fine until two prompts share one. This keeps the full prompt.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperlint",
3
- "version": "19.0.3",
3
+ "version": "20.0.0",
4
4
  "description": "A linter for scientific papers written in LaTeX: catches mistakes before you submit to a conference or journal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -105,7 +105,6 @@
105
105
  "./lib/skill-corpus.mjs": "./lib/skill-corpus.mjs",
106
106
  "./lib/skill-eval-kit.mjs": "./lib/skill-eval-kit.mjs",
107
107
  "./lib/skill-trigger-cases.mjs": "./lib/skill-trigger-cases.mjs",
108
- "./lib/trigger-ledger.mjs": "./lib/trigger-ledger.mjs",
109
108
  "./lib/*.mjs": {
110
109
  "types": "./dist/lib/*.d.ts",
111
110
  "default": "./dist/lib/*.js"
@@ -451,7 +451,6 @@ test("the exclude list is exactly the justified set", () => {
451
451
  assert.deepEqual(CONFIG.evalOnly, [
452
452
  "lib/skill-eval-kit.mjs",
453
453
  "lib/skill-eval-fixture.ts",
454
- "lib/trigger-ledger.mjs",
455
454
  ]);
456
455
  });
457
456
 
@@ -1,215 +0,0 @@
1
- /**
2
- * trigger-ledger.mjs — "this description was measured, here is when and with what result".
3
- *
4
- * WHY. Trigger evals cost money and are therefore not in CI ("Not CI. Run it deliberately" —
5
- * that is what every `*.eval.mjs` says). The consequence, measured 2026-08-28: recall is a
6
- * quantity obtained ONCE, not one that is maintained. Let anyone reword a `description`
7
- * tomorrow — nobody will ever catch the firing regression, because there is nothing and
8
- * nobody to catch it with.
9
- *
10
- * 🔴 WHY THE READY-MADE `skillHash()` WAS NOT TAKEN. It hashes the WHOLE skill directory
11
- * (`.md`, `.mjs`, `.sh`, `.py`, `.ts`). EXACTLY ONE FIELD affects the model's choice of a
12
- * skill — `description`: the eval kit sets `stubSkillBodies: true` with the comment
13
- * "selection is decided by frontmatter; don't run the body". Had we taken the whole
14
- * directory, the gate would redden at a typo in the body and at every new harness, that is,
15
- * almost always. A check that is red for no reason lives one day, gets silenced, and the hole
16
- * comes back, this time unnoticed. So the field is what gets hashed.
17
- *
18
- * ⚠️ WHAT THIS LEDGER DOES NOT KNOW. It does not know that a description got BETTER or WORSE
19
- * — only that it is DIFFERENT. The verdict still comes from the paid run; all that is
20
- * recorded here is that the run relates to this text and not to some earlier one.
21
- *
22
- * vigiles:local-by-design — the generic version ("coverage must cover the eval tier, not only
23
- * the harness") belongs to the product: `.vigiles/coverage.json` is written by the CLI from a
24
- * completed run, while `*.eval.mjs` are started as `node <file>` past the CLI, so there are
25
- * ZERO evals there against 50 harness records (measured 2026-08-28). What stays here is ours:
26
- * WHICH of our descriptions were measured and with what number.
27
- */
28
- import { createHash } from "node:crypto";
29
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
30
- import { join } from "node:path";
31
- import {
32
- consumerRoot,
33
- installedSkills,
34
- } from "../skills/paper-pipeline/scripts/consumer.mjs";
35
-
36
- // The CONSUMER's root, not this file's grandparent — see the same note in `skill-corpus.mjs`.
37
- // The ledger itself (`.claude/skill-trigger-runs.json`) is the consumer's DATA and stays there;
38
- // only the code that reads and writes it lives here.
39
- export const ROOT = consumerRoot();
40
- export const LEDGER = join(ROOT, ".claude", "skill-trigger-runs.json");
41
- const SKILLS = join(ROOT, ".claude", "skills");
42
-
43
- // THE DEBT BASELINE WAS DELETED 2026-08-28. A ratchet with 24 names "never measured once"
44
- // stood here — and it was a way of not doing the work. The corpus owner: "a ratchet again, fuck…
45
- // let's just fix it properly". All 24 were run (~40 min of machine time, $0 metered —
46
- // subscription), the debt is paid off, the check became an ordinary gate. Its meaning changed
47
- // with that: it was "the debt does not grow", it became "a measurement must relate to the
48
- // current description". The same transition as the markdown-regex debt, and for the same
49
- // reason — paying it off is cheaper than servicing it.
50
-
51
- /** The exact text of `description:` from the frontmatter. Empty string if the field is absent. */
52
- export function descriptionOf(skill) {
53
- const p = join(SKILLS, skill, "SKILL.md");
54
- if (!existsSync(p)) return "";
55
- const src = readFileSync(p, "utf8");
56
- const fm = src.match(/^---\r?\n([\s\S]*?)\r?\n---/);
57
- if (!fm) return "";
58
- // description may be multi-line, up to the next top-level key
59
- const m = fm[1].match(
60
- /^description:[ \t]*([\s\S]*?)(?=\r?\n[a-zA-Z_-]+:|$)/m,
61
- );
62
- return m ? m[1].trim() : "";
63
- }
64
-
65
- export const hashOf = (s) =>
66
- createHash("sha256").update(s).digest("hex").slice(0, 16);
67
-
68
- /**
69
- * A hash of the WHOLE set of descriptions — "against whom it was measured".
70
- *
71
- * 🔴 Why a second mark (the corpus owner's question, 2026-08-28). A trigger eval measures the
72
- * model's CHOICE out of all installed descriptions — the kit says exactly that: "whole-harness by
73
- * construction… an isolated measurement OVERSTATES recall and UNDERSTATES false positives". So my
74
- * recall can go stale from an edit to a NEIGHBOUR'S DESCRIPTION: it starts winning my prompts
75
- * while my own description does not change by a single character. A hash of my own field is not
76
- * enough for that.
77
- *
78
- * ⚠️ But hashing the corpus STRICTLY is not allowed either: one edit to any description would
79
- * void every record at once, and the check would again be always-red. Hence the different
80
- * loudness:
81
- * my own description changed → THE MEASUREMENT IS INVALID (an error);
82
- * the set of competitors changed → the measurement WEAKENED (a note in the ledger, no shouting).
83
- */
84
- export function corpusHash() {
85
- const names = installedSkills(SKILLS);
86
- return hashOf(
87
- names.map((n) => n + "\u0000" + descriptionOf(n)).join("\u0001"),
88
- );
89
- }
90
-
91
- export const readLedger = () =>
92
- existsSync(LEDGER)
93
- ? JSON.parse(readFileSync(LEDGER, "utf8"))
94
- : { v: 1, runs: {} };
95
-
96
- /** Record a measurement that happened. Called by the kit AFTER the run, not before. */
97
- export function recordRun(skill, { recall, precision, model, trials }) {
98
- const l = readLedger();
99
- l.runs[skill] = {
100
- description_sha: hashOf(descriptionOf(skill)),
101
- corpus_sha: corpusHash(),
102
- measured_at: new Date().toISOString().slice(0, 10),
103
- recall,
104
- precision,
105
- model,
106
- trials,
107
- };
108
- writeFileSync(LEDGER, JSON.stringify(l, null, 2) + "\n");
109
- return l.runs[skill];
110
- }
111
-
112
- /**
113
- * Skills that HAVE an `*.eval.mjs` but whose measurement does not relate to the current
114
- * description. Returns [{skill, reason}]. `reason` — 'never' or 'changed'.
115
- */
116
- export function staleSkills(skillsWithEval) {
117
- const l = readLedger();
118
- const out = [];
119
- for (const s of skillsWithEval) {
120
- const rec = l.runs[s];
121
- if (!rec) {
122
- out.push({ skill: s, reason: "never" });
123
- continue;
124
- }
125
- if (rec.description_sha !== hashOf(descriptionOf(s))) {
126
- out.push({ skill: s, reason: "changed", measured_at: rec.measured_at });
127
- continue;
128
- }
129
- // The skill's own description is the same but the competitors differ — the measurement
130
- // weakened, it did not die.
131
- if (rec.corpus_sha && rec.corpus_sha !== corpusHash())
132
- out.push({
133
- skill: s,
134
- reason: "corpus",
135
- measured_at: rec.measured_at,
136
- soft: true,
137
- });
138
- }
139
- return out;
140
- }
141
-
142
- // ── CLI: `node .claude/lib/trigger-ledger.mjs --check` ────────────────────────────
143
- // Cheap: no model, no network — only reading frontmatter and comparing hashes.
144
- // That is exactly why this can be kept in CI, unlike the evals themselves.
145
- if (process.argv[1] && process.argv[1].endsWith("trigger-ledger.mjs")) {
146
- const withEval = installedSkills(SKILLS).filter((d) =>
147
- existsSync(join(SKILLS, d, `${d}.eval.mjs`)),
148
- );
149
- // A RATCHET, not a gate. Measured 2026-08-28 on a clean tree: 24 findings "never measured
150
- // once" — for the paper skills firing had been measured earlier, just not into this ledger,
151
- // which is five minutes old. A check with 24 red lines on its first day does not get read, it
152
- // gets silenced: that is exactly how the markdown-regex debt already died in this repo, and
153
- // there it was turned into a ratchet.
154
- //
155
- // So: "the description changed after the measurement" — LOUD ALWAYS, that is the very
156
- // regression all of this was started for. "Never measured once" — loud only for skills that
157
- // are not in the debt baseline, that is, for NEW ones. The debt does not grow silently, but it
158
- // does not shout on every run either.
159
- const all = staleSkills(withEval);
160
- const soft = all.filter((x) => x.soft);
161
- const stale = all.filter((x) => !x.soft);
162
- // ONE line, not one line per skill. Measured 2026-08-28: an edit to ONE description changes
163
- // the corpus hash as a whole, and per-line output produced 27 notes at once. Twenty-seven
164
- // informational lines per edit is noise, and noise gets silenced; and then the hard half stops
165
- // being read along with it.
166
- // Three names + a counter, not only a counter and not 27 lines. A bare counter cannot be
167
- // checked and gives nothing to start a re-measurement from; one line per skill is 27 lines of
168
- // noise per edit (measured 2026-08-28). The assertion "the note is addressed" in the harness
169
- // requires exactly the names — and it was RED from 2026-08-28 to 2026-08-31, because the code
170
- // printed only the counter: the harness was written, declared working, and not run.
171
- if (soft.length) {
172
- const names = soft
173
- .slice(0, 3)
174
- .map((x) => x.skill)
175
- .join(", ");
176
- console.log(
177
- `ℹ️ the set of competing descriptions changed after the last measurement — ` +
178
- `for ${soft.length} skill(s) recall may have shifted without their own description being ` +
179
- `touched (${names}${soft.length > 3 ? ` and ${soft.length - 3} more` : ""}). ` +
180
- `Not an error: re-measure when convenient.`,
181
- );
182
- }
183
- // 🔴 THE DENOMINATOR IS MANDATORY. The line "✓ current for 27" reads as "27 skills are fine",
184
- // whereas the true statement is "27 of 50 fall under this check at all": a skill without its
185
- // own .eval.mjs is inexpressible for this gate, there is nothing to re-measure for it.
186
- // Measured 2026-08-31: 50 skills on disk, 27 with an eval, 23 without. That day I changed the
187
- // description of telegram-channel-audit (no eval), the gate printed green, and that looked
188
- // like "the change was verified". A counter that does not name what it ignores lies — the
189
- // CLAUDE.md rule §"A counter that counts what it IGNORES".
190
- const total = installedSkills(SKILLS).length;
191
- const noEval = total - withEval.length;
192
- if (!stale.length) {
193
- console.log(
194
- `✓ trigger measurements are current for ${withEval.length} skill(s) of ${total}` +
195
- (noEval
196
- ? ` — the other ${noEval} have NO .eval.mjs of their own, they are outside this ` +
197
- `check by construction (nothing to measure, not "fine")`
198
- : ""),
199
- );
200
- process.exit(0);
201
- }
202
- for (const s of stale) {
203
- console.error(
204
- s.reason === "never"
205
- ? `✗ ${s.skill}: ${s.skill}.eval.mjs exists, but a firing measurement NEVER happened`
206
- : `✗ ${s.skill}: description changed after the ${s.measured_at} measurement — recall relates to the former text`,
207
- );
208
- }
209
- console.error(
210
- `\nRun it: node .claude/skills/<skill>/<skill>.eval.mjs` +
211
- `\nThis is the paid tier (a real model), so CI does not run it — it only requires that a run ` +
212
- `exists and relates to the current description.`,
213
- );
214
- process.exit(1);
215
- }