paperlint 10.1.1 → 10.3.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 (72) hide show
  1. package/README.md +2 -0
  2. package/dist/adapters/study-registry/index.d.ts +357 -0
  3. package/dist/adapters/study-registry/index.d.ts.map +1 -0
  4. package/dist/adapters/study-registry/index.js +221 -0
  5. package/dist/adapters/study-registry/index.js.map +1 -0
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +42 -2
  8. package/dist/cli.js.map +1 -1
  9. package/dist/domain/repro-layout.d.ts +12 -4
  10. package/dist/domain/repro-layout.d.ts.map +1 -1
  11. package/dist/domain/repro-layout.js +49 -18
  12. package/dist/domain/repro-layout.js.map +1 -1
  13. package/dist/domain/scaffold-layout.d.ts +4 -3
  14. package/dist/domain/scaffold-layout.d.ts.map +1 -1
  15. package/dist/domain/scaffold-layout.js +7 -4
  16. package/dist/domain/scaffold-layout.js.map +1 -1
  17. package/dist/domain/study-registry.d.ts +372 -0
  18. package/dist/domain/study-registry.d.ts.map +1 -0
  19. package/dist/domain/study-registry.js +593 -0
  20. package/dist/domain/study-registry.js.map +1 -0
  21. package/dist/ports/study-registry-codec.d.ts +15 -0
  22. package/dist/ports/study-registry-codec.d.ts.map +1 -0
  23. package/dist/ports/study-registry-codec.js +2 -0
  24. package/dist/ports/study-registry-codec.js.map +1 -0
  25. package/dist/repro-layout-rule.d.ts.map +1 -1
  26. package/dist/repro-layout-rule.js +4 -3
  27. package/dist/repro-layout-rule.js.map +1 -1
  28. package/dist/studies.d.ts +27 -0
  29. package/dist/studies.d.ts.map +1 -0
  30. package/dist/studies.js +163 -0
  31. package/dist/studies.js.map +1 -0
  32. package/dist/study-registry-rule.d.ts +24 -0
  33. package/dist/study-registry-rule.d.ts.map +1 -0
  34. package/dist/study-registry-rule.js +145 -0
  35. package/dist/study-registry-rule.js.map +1 -0
  36. package/docs/design/study-registry.md +246 -0
  37. package/docs/layout.md +51 -46
  38. package/docs/rules/paper/allowed-files-only.md +3 -2
  39. package/docs/rules/repro/allowed-files-only.md +40 -30
  40. package/docs/rules/repro/study-plan-name.md +70 -0
  41. package/docs/rules/repro/study-registered.md +320 -0
  42. package/docs/rules/study/declare-sample.md +1 -1
  43. package/docs/rules.md +53 -51
  44. package/package.json +1 -1
  45. package/skills/build-benchmark/SKILL.md +39 -8
  46. package/skills/build-benchmark/SKILL.md.spec.ts +38 -7
  47. package/skills/build-label-page/SKILL.md +14 -9
  48. package/skills/build-label-page/SKILL.md.spec.ts +13 -8
  49. package/skills/paper-pipeline/references/artifact-checklist.md +2 -1
  50. package/skills/paper-pipeline/references/pipeline-status-template.md +5 -3
  51. package/skills/run-agent-grid/SKILL.md +13 -1
  52. package/skills/run-agent-grid/SKILL.md.spec.ts +12 -0
  53. package/src/adapters/study-registry/index.test.ts +484 -0
  54. package/src/adapters/study-registry/index.ts +328 -0
  55. package/src/cli.ts +53 -2
  56. package/src/domain/paper-layout.test.ts +1 -1
  57. package/src/domain/repro-layout.test.ts +18 -9
  58. package/src/domain/repro-layout.ts +58 -18
  59. package/src/domain/scaffold-layout.ts +7 -4
  60. package/src/domain/study-measurements.test.ts +629 -0
  61. package/src/domain/study-registry.test.ts +666 -0
  62. package/src/domain/study-registry.ts +1044 -0
  63. package/src/folder-layout-hook.test.ts +10 -0
  64. package/src/new-paper.test.ts +29 -2
  65. package/src/ports/study-registry-codec.ts +15 -0
  66. package/src/repro-layout-rule.ts +4 -3
  67. package/src/rule-cases.test.ts +68 -0
  68. package/src/studies-cli.test.ts +113 -0
  69. package/src/studies.test.ts +359 -0
  70. package/src/studies.ts +268 -0
  71. package/src/study-registry-rule.test.ts +456 -0
  72. package/src/study-registry-rule.ts +239 -0
@@ -0,0 +1,70 @@
1
+ # repro/study-plan-name
2
+
3
+ **Level:** warning · **Reads:** `repro/studies.json` · **Reported on:** the first line of the
4
+ paper's `PIPELINE-STATUS.md`, once per study
5
+
6
+ ## What it catches
7
+
8
+ A study whose row in `repro/studies.json` names its plan as `prereg.json` — the name the plan had
9
+ before `paperlint studies new` wrote it as `plan.json`.
10
+
11
+ ```json
12
+ {
13
+ "id": "P1-S01",
14
+ "folder": "P1-S01-rule-census",
15
+ "plan": "prereg.json",
16
+ "…": "…"
17
+ }
18
+ ```
19
+
20
+ The file is still read as the study's plan — by a loose schema, since it was written by hand before
21
+ the plan had one: keys of its own are accepted, a seed makes its draw `seeded` and none makes it a
22
+ draw of `all`, a size is not read, and an absent check is `null` —
23
+ and [`repro/study-registered`](study-registered.md) judges it like any `plan.json`. This rule only
24
+ asks for the new name. A `prereg.json` moved to `plan.json` is parsed strictly: its own keys go in
25
+ `extra`.
26
+
27
+ ## Why
28
+
29
+ A study's plan was once a hand-written `prereg.json`. The name misled: it is not a pre-registration
30
+ with an outside registry, it is the study's own plan, fixed before the runs, with the author's check
31
+ of the drawn units. Papers that wrote one before `plan.json` existed keep working; this warning tells
32
+ them where the file moves, without failing their build.
33
+
34
+ ## Examples
35
+
36
+ Failing (a warning):
37
+
38
+ ```text
39
+ papers/example/PIPELINE-STATUS.md
40
+ 1:1 warning The plan of `P1-S01` is `prereg.json`, its old name; it is read as the plan. What to
41
+ do: rename it to `plan.json` in the study's folder (`git mv`) and set the row's `plan`
42
+ to `plan.json`.
43
+ Rule repro/study-plan-name: https://github.com/zernie/paperlint/blob/main/docs/rules/repro/study-plan-name.md repro/study-plan-name
44
+ ```
45
+
46
+ Passing: the row names `"plan": "plan.json"`, as `paperlint studies new` writes it; or the row
47
+ names no plan.
48
+
49
+ ## Options / preset fields
50
+
51
+ No rule options.
52
+
53
+ ## What it does not check
54
+
55
+ - A `prereg.json` in a study folder whose row names no `plan`: the file is not the study's plan
56
+ until the row says so, and is not read.
57
+ - Anything inside the plan: that is [`repro/study-registered`](study-registered.md).
58
+
59
+ ## How to fix
60
+
61
+ ```sh
62
+ git mv papers/example/repro/P1-S01-rule-census/prereg.json papers/example/repro/P1-S01-rule-census/plan.json
63
+ ```
64
+
65
+ then set the row's `"plan": "plan.json"` in `repro/studies.json`. To keep the old name for one
66
+ paper, switch the rule off in its `paperlint.json`:
67
+
68
+ ```json
69
+ { "rules": { "repro/study-plan-name": "off" } }
70
+ ```
@@ -0,0 +1,320 @@
1
+ # repro/study-registered
2
+
3
+ **Level:** error · **Reads:** the listing of the paper's `repro/`, `repro/studies.json`,
4
+ `repro/README.md`, and each `result_file` and `plan` the registry names · **Reported on:** the first
5
+ line of the paper's `PIPELINE-STATUS.md`, once per finding
6
+
7
+ ## What it catches
8
+
9
+ A study that is not in the paper's study registry, a row that does not match the folders, and an
10
+ index that does not match the registry. The registry is `repro/studies.json`: one row per study,
11
+ with a stable id, a plain name, its status and its result. Every study folder at the top of `repro/`
12
+ is named `<id>-<slug>` after its row — `P1-S03-baseline`. The design: [`study-registry.md`](../../design/study-registry.md).
13
+
14
+ ```json
15
+ {
16
+ "prefix": "P1",
17
+ "studies": [
18
+ {
19
+ "id": "P1-S01",
20
+ "folder": "P1-S01-baseline-pass-rate",
21
+ "title": "Baseline pass rate",
22
+ "question": "How often does the unmodified agent pass the task?",
23
+ "kind": "measurement",
24
+ "status": "done",
25
+ "date": "2026-10-15",
26
+ "result": "41 of 60 runs pass",
27
+ "result_file": "results.tsv",
28
+ "in_paper": "yes"
29
+ }
30
+ ]
31
+ }
32
+ ```
33
+
34
+ | field | what it holds |
35
+ | --------------- | -------------------------------------------------------------------------------- |
36
+ | `prefix` | the paper's prefix: a capital letter, then capitals or digits (`P1`) |
37
+ | `id` | `<prefix>-S` and two or more digits; unique |
38
+ | `folder` | `<id>-<slug>`, the study's folder at the top of `repro/` |
39
+ | `title` | a plain name of at most 8 words |
40
+ | `question` | one sentence: what the study asks |
41
+ | `kind` | `measurement`, `spike`, `tooling`, `data`, `artifact` or `salvage` |
42
+ | `status` | `designing`, `running`, `done`, `stopped`, `superseded` or `dropped` |
43
+ | `date` | `YYYY-MM-DD`, the day the study was registered |
44
+ | `result` | optional: the result in one line; required when `done` |
45
+ | `result_file` | optional: the file inside the folder the result is read from; required when done |
46
+ | `superseded_by` | optional: the id of the study that replaced it; required when `superseded` |
47
+ | `in_paper` | `yes`, `no`, or `registry` (listed in the registry, not in the paper's text) |
48
+
49
+ | `measurement` | optional: the id of the measurement the study belongs to (below) |
50
+ | `plan` | optional: the study's plan, a file inside its folder — `plan.json` (below) |
51
+
52
+ A row may carry more fields — a paper's own metadata (`frame`, `method`, `outcome`, …) — and
53
+ `paperlint studies new` keeps them when it rewrites the file. Beside `prefix` and `studies`, the top
54
+ level holds only the optional `author`, `requirements` and `measurements`; any other key is an error.
55
+
56
+ ### Measurements, requirements, the author
57
+
58
+ One measurement — a census, a benchmark — often spans several studies: a pilot, the main run, a
59
+ replication. A measurement is declared once, at the top level, and each of its studies' rows names
60
+ it in `measurement`. The author's requirements on the measurements are kept in their words, beside
61
+ them:
62
+
63
+ ```json
64
+ {
65
+ "prefix": "P1",
66
+ "author": "A. Author",
67
+ "requirements": [
68
+ {
69
+ "id": "R1",
70
+ "text": "Every sample is a random draw from all rules found, no filter by difficulty.",
71
+ "date": "2026-10-10",
72
+ "source": "chat"
73
+ }
74
+ ],
75
+ "measurements": [
76
+ {
77
+ "id": "M1",
78
+ "title": "Rule census",
79
+ "rq": "RQ1",
80
+ "role": "headline",
81
+ "approval": {
82
+ "by": "A. Author",
83
+ "date": "2026-10-12",
84
+ "quote": "This is the one."
85
+ },
86
+ "requirements": ["R1"]
87
+ }
88
+ ],
89
+ "studies": [
90
+ {
91
+ "id": "P1-S01",
92
+ "folder": "P1-S01-census-pilot",
93
+ "measurement": "M1",
94
+ "plan": "plan.json",
95
+ "…": "…"
96
+ },
97
+ {
98
+ "id": "P1-S02",
99
+ "folder": "P1-S02-census",
100
+ "measurement": "M1",
101
+ "plan": "plan.json",
102
+ "…": "…"
103
+ }
104
+ ]
105
+ }
106
+ ```
107
+
108
+ | field | what it holds |
109
+ | ----------------------------- | -------------------------------------------------------------------------------- |
110
+ | `author` | optional: the paper's author, the one person who approves a headline measurement |
111
+ | `requirements[].id` | the requirement's id, named by the measurements that must meet it |
112
+ | `requirements[].text` | the author's words, verbatim |
113
+ | `requirements[].date` | `YYYY-MM-DD` |
114
+ | `requirements[].source` | where they said it: a chat, a message, a review comment |
115
+ | `measurements[].id` | the measurement's id, named by its studies' rows |
116
+ | `measurements[].title` | a plain name |
117
+ | `measurements[].rq` | optional: the research question it answers |
118
+ | `measurements[].role` | `headline` (the paper's claim rests on it) or `baseline` |
119
+ | `measurements[].approval` | the author's approval: `by`, `date`, their words in `quote`, optional `source` |
120
+ | `measurements[].requirements` | optional: the ids of the requirements it must meet |
121
+
122
+ A measurement may carry more fields, as a row does; a requirement and an approval are exactly
123
+ their fields. **A registry without `measurements` is judged as before**: a row's `measurement` is
124
+ then a field of the paper's own, and nothing checks it.
125
+
126
+ ### The study's plan, `plan.json`
127
+
128
+ Each study's plan is a JSON file in its folder, fixed before the runs: what it measures, the
129
+ population and how the sample is drawn from it, the arms compared, the primary outcome, and the
130
+ author's check of the drawn units. `paperlint studies new` writes the template beside the study's
131
+ `README.md` and names it in the row's `plan`:
132
+
133
+ ```json
134
+ {
135
+ "question": "",
136
+ "population": {
137
+ "source": "",
138
+ "draw": { "kind": "all", "method": "" }
139
+ },
140
+ "arms": [],
141
+ "primary_outcome": "",
142
+ "author_check": null
143
+ }
144
+ ```
145
+
146
+ | field | what it holds |
147
+ | ------------------------ | -------------------------------------------------------------------------------- |
148
+ | `question` | what the study measures, one sentence |
149
+ | `population.source` | where the units come from: the census, crawl or registry, with its date |
150
+ | `population.draw.kind` | `all` (the whole population, a census: no seed) or `seeded` (a sample) |
151
+ | `population.draw.method` | how the sample is drawn: `census`, `random`, `stratified` … |
152
+ | `population.draw.seed` | `seeded` only, and required there: the draw's seed, a string or a number |
153
+ | `arms` | the conditions compared, each `{ "name": … }`, each name once; `[]` for a census |
154
+ | `primary_outcome` | the one number the study reports first |
155
+ | `author_check` | `null` until the author has seen the drawn units; then `by`, `date`, `quote` |
156
+ | `extra` | optional: the paper's own keys (hypotheses, models, budget), kept unread |
157
+
158
+ The template's draw is of all the population; a sampled study changes it to
159
+ `{ "kind": "seeded", "method": "random", "seed": 7 }`. The population's size is not stored: it is
160
+ counted from the source, and a stored copy could only contradict it.
161
+
162
+ The plan is closed at every level, and holds no contradiction. Each of these makes the file "not a
163
+ study plan" (`bad-plan`, with the reason): a misspelt key; a key of the paper's own outside `extra`,
164
+ or a key of `extra` that is a field of the plan; a missing key — `null` is the one way to say "not
165
+ yet"; a `seeded` draw without its seed, or an `all` draw with one; two arms of one name; and an
166
+ `author_check` on a plan whose required texts are still empty — the author approves a complete plan.
167
+
168
+ A plan named `prereg.json`, its old name, is parsed by a loose schema — keys of its own accepted at
169
+ every level, those at the top kept in `extra`; a seed makes the draw `seeded`, none (or `null`)
170
+ makes it `all`; a size is not read; an absent check is `null` — and
171
+ [`repro/study-plan-name`](study-plan-name.md) warns that it moves to `plan.json`.
172
+
173
+ The rule reports:
174
+
175
+ - a folder at the top of `repro/` with no row (`tools/`, `data/` and what interpreters and package
176
+ managers leave there, like `__pycache__/` and `node_modules/`, are not studies);
177
+ - a row whose folder does not exist, and a folder named by more than one row;
178
+ - an id that is not `<prefix>-S<digits>`, an id on more than one row, and a folder that is not
179
+ `<id>-<slug>`;
180
+ - a title over 8 words;
181
+ - `done` without `result` or `result_file`, and a `result_file` that is not a file inside the folder;
182
+ - `superseded` without `superseded_by`, or naming an id that is not in the registry;
183
+ - an index out of sync: the block of `repro/README.md` between the markers below must equal the
184
+ text the registry generates, character for character;
185
+
186
+ ```text
187
+ <!-- studies:begin — generated from studies.json by `paperlint studies index`; do not edit -->
188
+ <!-- studies:end -->
189
+ ```
190
+
191
+ - a `repro/` with study folders and no `repro/studies.json` (one finding naming the file), and a
192
+ `studies.json` that is not JSON or not of the shape above (one finding with the reasons);
193
+ - when the registry has `measurements`: a row whose `measurement` is not one of them
194
+ (`unknown-measurement`), a measurement no row names (`empty-measurement`), and a measurement that
195
+ must meet a requirement the registry does not hold (`unknown-requirement`);
196
+ - a `headline` measurement with no `approval`, or, when the registry names its `author`, one approved
197
+ by anyone else (`headline-approval`);
198
+ - a row's `plan` that is outside its folder, not a file, or not of the plan's shape — and, once the
199
+ study has run (`running`, `done`, `stopped`, `superseded`), a plan that leaves `question`,
200
+ `population.source`, `population.draw.method` or `primary_outcome` empty (`bad-plan`);
201
+ - a study of a `headline` measurement that has run with no `author_check` in its plan — or no plan —
202
+ or, when the registry names its `author`, a check by anyone else (`author-check`).
203
+
204
+ A study that is still `designing` owes neither a filled plan nor the author's check: the template
205
+ `studies new` writes is clean until the first run. A `dropped` study owes neither.
206
+
207
+ ## Why
208
+
209
+ A paper's `repro/` grew to 79 study folders named `<slug>-YYYY-MM-DD`, and nobody could tell which was
210
+ which, which had ended, or which one a number in the paper came from. A date and a slug say when a
211
+ study began, not what it is. The registry gives each study a number that does not change and a name a
212
+ person can read, and says in one place where every study stands. A rule holds it, not a guideline: a
213
+ row the rule does not check is a row that drifts.
214
+
215
+ The index in `repro/README.md` is generated, so it is never edited by hand and never parsed: the rule
216
+ compares strings. It is a table padded the way prettier writes one, so formatting the README leaves
217
+ it in sync.
218
+
219
+ ## Examples
220
+
221
+ Failing: a folder in the dated form beside a registered study.
222
+
223
+ ```text
224
+ papers/example/PIPELINE-STATUS.md
225
+ 1:1 error `repro/baseline-2026-10-02/` has no row in `repro/studies.json`, and every study folder
226
+ has exactly one. What to do: add its row with the next free id, `P1-S02`, and rename the
227
+ folder to `P1-S02-<slug>`; a new study is created with
228
+ `npx paperlint studies new <paper-dir> "<title>"`, which does both.
229
+ Rule repro/study-registered: https://github.com/zernie/paperlint/blob/main/docs/rules/repro/study-registered.md repro/study-registered
230
+ ```
231
+
232
+ Failing: a row set to `done` by hand, with no result, and the index not regenerated — two findings.
233
+
234
+ Failing: the census of the example above set to `running` while its plan is still the template —
235
+ the plan is reported for its empty fields, and the study for the author's check it lacks:
236
+
237
+ ```text
238
+ papers/example/PIPELINE-STATUS.md
239
+ 1:1 error The plan of `P1-S02`, `plan.json` in its folder, leaves `question`, `population.source`,
240
+ `population.draw.method` and `primary_outcome` empty, and the study is `running`: a
241
+ plan is written before the runs. What to do: fill them in, or set the study back to
242
+ `designing`.
243
+ 1:1 error `P1-S02` is `running` in the headline measurement `M1`, and its plan has no
244
+ `author_check`. What to do: show the author the drawn units, then record their answer
245
+ in the plan's `author_check` — `by`, `date`, and their words in `quote`.
246
+ ```
247
+
248
+ Passing: a paper with no study folder; and a `repro/` made only by `paperlint studies new`, its rows
249
+ edited as the studies end and its index regenerated:
250
+
251
+ ```text
252
+ repro/
253
+ ├── README.md
254
+ ├── studies.json
255
+ ├── P1-S01-baseline-pass-rate/
256
+ │ ├── README.md
257
+ │ ├── plan.json
258
+ │ └── results.tsv
259
+ ├── tools/
260
+ └── data/
261
+ ```
262
+
263
+ ```markdown
264
+ <!-- studies:begin — generated from studies.json by `paperlint studies index`; do not edit -->
265
+
266
+ | id | title | status | result | in paper | folder |
267
+ | ------ | ------------------ | ------ | ------------------ | -------- | -------------------------------------------------------- |
268
+ | P1-S01 | Baseline pass rate | done | 41 of 60 runs pass | yes | [P1-S01-baseline-pass-rate/](P1-S01-baseline-pass-rate/) |
269
+
270
+ <!-- studies:end -->
271
+ ```
272
+
273
+ ## Options / preset fields
274
+
275
+ No rule options.
276
+
277
+ ## What it does not check
278
+
279
+ - Whether `question` is one sentence and `result` one line, beyond their being text.
280
+ - What a study's `README.md` says, or whether its frontmatter matches the row.
281
+ - Whether a plan's texts say anything true, beyond their being filled in; whether `arms` should be
282
+ empty; whether the person in `approval` or `author_check` really said it — the rule sees the
283
+ name, not who typed it.
284
+ - A repeated measurement or requirement id, and a requirement no measurement names.
285
+ - A `prereg.json` or `plan.json` that no row names.
286
+ - Whether the paper cites a study: `in_paper` is declared, not detected.
287
+ - What may stand at the top of `repro/` besides the study folders, and whether a study folder has a
288
+ `README.md`: that is [`repro/allowed-files-only`](allowed-files-only.md).
289
+
290
+ ## How to fix
291
+
292
+ Create every new study with the command, which takes the next id, makes the folder and its
293
+ `README.md`, appends the row and regenerates the index:
294
+
295
+ ```sh
296
+ npx paperlint studies new papers/example "Baseline pass rate" --kind measurement
297
+ ```
298
+
299
+ `studies new` also writes the study's `plan.json`: fill it in before the first run, and, for a
300
+ study of a headline measurement, show the author the drawn units and record their answer in its
301
+ `author_check`. A measurement is added by hand to `measurements`, with the author's `approval` when
302
+ it is the headline, and each of its studies' rows names it in `measurement`.
303
+
304
+ When a study ends, edit its row in `repro/studies.json` — `status`, `result`, `result_file`,
305
+ `in_paper`, and `superseded_by` when another study replaced it — then regenerate the index:
306
+
307
+ ```sh
308
+ npx paperlint studies index papers/example
309
+ ```
310
+
311
+ A paper without a registry writes `repro/studies.json` once, with its prefix:
312
+ `{ "prefix": "P1", "studies": [] }`. A folder that predates the registry gets a row by hand and is
313
+ renamed to `<id>-<slug>` with `git mv`.
314
+
315
+ To switch the rule off for one paper — one that keeps its dated `<slug>-YYYY-MM-DD` folders —
316
+ set it in that paper's `paperlint.json`; `repro/allowed-files-only` still accepts the dated form:
317
+
318
+ ```json
319
+ { "rules": { "repro/study-registered": "off" } }
320
+ ```
@@ -12,7 +12,7 @@ its name) · **Reported on:** the first line of the paper's
12
12
  ## What it catches
13
13
 
14
14
  A study's pre-registration that does not say how its sample relates to the population the paper
15
- talks about. Every `prereg.json` in a study folder (`repro/<slug>-YYYY-MM-DD/`) must carry five
15
+ talks about. Every `prereg.json` in a study folder (`repro/<id>-<slug>/`) must carry five
16
16
  fields; every other key in the file is the author's and is not read.
17
17
 
18
18
  | field | holds |