@rebilder/agent-readability 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,204 @@
1
+ Copyright 2026 Rebilder LLC
2
+
3
+
4
+ Apache License
5
+ Version 2.0, January 2004
6
+ http://www.apache.org/licenses/
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction,
13
+ and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by
16
+ the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all
19
+ other entities that control, are controlled by, or are under common
20
+ control with that entity. For the purposes of this definition,
21
+ "control" means (i) the power, direct or indirect, to cause the
22
+ direction or management of such entity, whether by contract or
23
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications,
30
+ including but not limited to software source code, documentation
31
+ source, and configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but
35
+ not limited to compiled object code, generated documentation,
36
+ and conversions to other media types.
37
+
38
+ "Work" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work
41
+ (an example is provided in the Appendix below).
42
+
43
+ "Derivative Works" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # @rebilder/agent-readability
2
+
3
+ The Agent Readability Score (**ARS 0.1**). **The default export (`.`) is a pure, deterministic function of its inputs and nothing else** — no network, no clock, no randomness, no LLM, and zero runtime dependencies. The guarantee we publish is: _for a given `evidenceHash`, `rulesetHash` and `corpusHash`, `score()` returns a byte-identical `ArsResult` in any conformant implementation, in any language._ A number without all three hashes is not an ARS score. Purity is enforced at **build time** by an ESLint `no-restricted-globals` / `no-restricted-properties` rule over `src/` (`Date`, `Math.random`, `fetch`, `performance`), not by a runtime stub that would only prove our own fixtures behave. The one impure half lives behind a separate entry point, `./probe`, which is server-only and exempt from that rule — and from nothing else.
4
+
5
+ ## Contract
6
+
7
+ | Entry point | What it is |
8
+ | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
9
+ | `.` | `score()`, `recommend()`, `bandFor()`, `DEFAULT_RULESET`, the ruleset/evidence hashes, the page-kind profiles, the classifier, the money parser, and all published types. Pure. Safe anywhere. |
10
+ | `./probe` | Fetches evidence from a live origin: SSRF policy with DNS pinning, a streamed 2 MiB body cap, an injected politeness limiter, robots.txt handling. Node-only. **Not implemented yet** — Phase 1.5a step 8. |
11
+
12
+ The two halves meet at exactly one type. The probe produces an `ArsEvidence` bundle; `score()` consumes that bundle plus an `ArsRuleset` and produces an `ArsResult`. There is no third input.
13
+
14
+ The tokenizer and the extractor are **not** exported: they are the mechanism of the score, not its interface, and freezing them into the public surface would make every extraction bugfix a breaking change.
15
+
16
+ ```ts
17
+ import { DEFAULT_RULESET, parseMoneyText, score } from '@rebilder/agent-readability'
18
+
19
+ const result = score(evidence, DEFAULT_RULESET)
20
+ result.grade // 'A' | 'B' | 'C' | 'D' | 'F' — or null, for the three non-grades
21
+ result.score // 0..100, or null. Integers. No decimals, ever.
22
+ result.dimensions // always 6, weights always summing to 100
23
+ result.dimensions[0].checks[0].basis // 'measured' | 'heuristic', per check, always
24
+ result.recommendations // ranked, deduplicated: Σ pointsAvailable ≤ 100 − score
25
+
26
+ parseMoneyText('$1,499.00') // { amount: 149900, currency: 'USD', qualified: false }
27
+ parseMoneyText('From $9') // { amount: 900, currency: 'USD', qualified: true }
28
+ parseMoneyText('1,500') // null — no currency, and the separator is ambiguous
29
+ ```
30
+
31
+ ## What ARS measures, and what it does not
32
+
33
+ ARS scores **format and retrievability**: whether the facts a caller needs _for this kind of page_ are present, findable, and cheap _relative to what that kind of page costs_. Two lines print on every surface that shows a grade, and they are not boilerplate:
34
+
35
+ > ARS measures format and retrievability. It does not measure whether the facts are true, or whether any assistant cites this page.
36
+
37
+ - **Fixed weights, 100 points, identical for every page kind.** No conditional weights, no redistribution, no heuristic gate over measured points. Redistribution is a gaming vector; a heuristic that can zero measured points makes those points heuristic.
38
+ - **What varies by page kind is the fact set and the byte reference**, never a weight. That is what stops long-form content being structurally capped around C — the defect in every design that used absolute byte bands.
39
+ - **Measured 64 / heuristic 36**, published, with a spec ceiling of 40 on heuristic weight. The figure is honest because the two comparison checks (D2.4 substance parity, D5.3 structured-data agreement) are _scored checks, not gates_: failing parity loses its own 3 points and raises a `warn`, and does not touch D2's other 17 measured points.
40
+ - **Ordinal, not cardinal.** Bands headline, integers are secondary, no decimals ever.
41
+ - **Three non-grades**, none of which is an F: `opt-out` (a deliberate, well-formed robots disallow — a choice, not a failure), `unscored — blocked`, and `unscored — unreachable / non-2xx / robots-unavailable / robots-disallow-scanner / truncated-evidence`.
42
+ - **Blocking training crawlers while allowing assistants scores identically to a fully open site.** The `training` audience is strictly neutral and can never lower a score.
43
+
44
+ **Conflict-of-interest disclosure**, printed at the top of `/spec/ars`, on every scanner result, and in the CLI `--help`:
45
+
46
+ > ARS is authored by Rebilder, which sells content-negotiation middleware. Two ARS checks (D2.1 content negotiation, D5 structured data) can be satisfied by Rebilder's free gateway, and reaching an A requires both. The full ruleset, thresholds, and conformance corpus are published so this bias is auditable rather than hidden.
47
+
48
+ ## Modules in this package
49
+
50
+ ### `src/types.ts` — the published contract
51
+
52
+ Transcribed from design §3.9. These types are the schema of `expected.json` in the conformance corpus, which is what a second implementation in Go or Python has to reproduce. Adding a field here is adding a field an outside team must reverse-engineer.
53
+
54
+ ### `src/ruleset.ts` — `DEFAULT_RULESET`
55
+
56
+ Every number a second implementation needs, and nothing that varies between runs: check weights (19 checks summing to 100), the §3.6 scoring bands, crawler audience tokens, the D5.2 required-property table, the action lexicon, the A–F grade bands, and the three probe limits that are inputs to the score (2 MiB body cap, 3 redirects, 5 000ms timeout — two implementations with different caps produce different scores, so they are hashed with everything else).
57
+
58
+ `rulesetHash` is the SHA-256 of the RFC 8785 canonical JSON of this object. **Editing a number here is a spec version change, not a code change**: per §3.1, any edit that moves a conformance `expected.json` is at minimum a MINOR, and MINOR means scores stop being comparable and every published surface re-scores in a batch.
59
+
60
+ ### `src/profiles.ts` — the eight page-kind profiles
61
+
62
+ `product`, `collection`, `article`, `place`, `service`, `faq`, `document`, `unknown`. A closed set; every kind has a complete profile, and the mapping is total by construction (`PROFILE_BY_KIND` is a total `Record`, so a missing profile is a compile error). Core facts score at full weight, extended facts at ¼ credit — one definition, applied everywhere. `unknown` is not an easy exit: it still scores D5.2 against "any recognised schema.org type present".
63
+
64
+ ### `src/html.ts` — a tolerant, non-executing tokenizer
65
+
66
+ Hand-rolled, and that is a normative decision rather than a preference: **a third-party parser version is an unversioned input to a deterministic score.** A dependency that changes how a malformed `<div` is recovered would change scores on a `pnpm update`, with no ARS version bump and no conformance diff. The recovery rules here _are_ the spec.
67
+
68
+ - Byte offsets are **UTF-8 byte offsets**, not string indices, because `ArsHttpCapture.bytes` is defined as the decoded UTF-8 byte length and D4 scores offsets against it. One `€` before the price is enough to make the two disagree.
69
+ - Counted text follows the §3.6 rule exactly: everything except `<script>`, `<style>`, `<template>`, `hidden`, and inline `style="display:none"`. **No CSS resolution** — a cascade engine would not be deterministic across implementations, so a class that hides an element in a stylesheet does not hide it here.
70
+ - `tokenizeHtml` **never throws**, for any input. A scanner that can be crashed by the page it is scanning is a denial-of-service endpoint.
71
+
72
+ One reading decision is flagged in the file header: JSON-LD script contents are surfaced separately (`doc.jsonLd`) and are **not** counted as visible text, because the other reading would trivially satisfy both D5.3 and the definition of "corroborated".
73
+
74
+ ### `src/parse-money.ts` — text → `Money`, or `null`
75
+
76
+ Real work, budgeted as such. `@rebilder/render-md`'s `money.ts` only _formats_ an already-structured `Money`; it cannot parse text, and the claim that it could hid the largest single piece of extraction work in the program.
77
+
78
+ **Fails closed.** Ambiguous input returns `null`, and a `null` price is simply not a fact — it costs coverage points and nothing else. A _wrong_ price would be published on a scanner page as truth and would make a parity check accuse a merchant of a divergence they did not commit. Supported: leading/trailing symbols, ISO code prefix/suffix, comma and period as both group and decimal separator (disambiguated by position and by the minor-unit width of the resolved currency), space/NBSP/apostrophe group separators, zero-decimal currencies, ranges and qualifiers (→ the lower bound, `qualified: true`, which excludes them from the D2.4 parity comparison).
79
+
80
+ `Money` is declared here rather than imported from `@rebilder/render-md`. The duplication is deliberate: `tooling/check-package-graph.ts` forbids that dependency edge in both directions, because the two packages point in opposite directions — gateway/render-md turn a source of truth into output; the scorer turns a response into a judgment.
81
+
82
+ ### `src/score.ts` — the scoring engine
83
+
84
+ `score(evidence, ruleset = DEFAULT_RULESET) → ArsResult`. Nineteen checks, six dimensions, 100 points, one pure function.
85
+
86
+ **Integer arithmetic only.** Every number is produced by exact integer division (`(n − n % d) / d`, which never rounds, unlike `Math.floor(n / d)` on a double quotient) and half-up rounding via `(n + d/2) / d`. `Math.round`, `0.25 ×` and `0.5 ×` appear nowhere in the scoring path. Two implementations that disagree in the third decimal disagree about grades at the band boundary, and the boundaries are what the product publishes.
87
+
88
+ **Which representation scores what.** D3 (coverage) and D4 (position) score the **agent** representation, because ARS measures what a caller actually receives — a merchant whose Markdown omits `availability` loses coverage even though the HTML declares it. D1.3 (render independence) and D5 (structured data) score the representation that carries a **document**. Corroboration crosses the two: a price stated in the negotiated Markdown _and_ in the HTML's JSON-LD is observed in two sources, which is the only reason a correct gateway install can reach an A.
89
+
90
+ **Two gates, both pointing the safe way.** D2.3 (`Vary: Accept`) and D2.4 (substance parity) score 0 unless D2.1 earned points — a **measured** check gating others. That is what makes the published ceiling provable: no content negotiation loses 10 + 3 + 3 → **max 84 → capped at B**; no valid structured data loses 15 → **max 85 → capped at B**; **an A requires both**. The forbidden direction — a heuristic that can zero measured points — appears nowhere, and fixture `053` re-derives the heuristic-controlled weight (36) from the gate graph to prove it.
91
+
92
+ **Comparison is asymmetric, deliberately.** D2.4 and D5.3 ask whether the value one side would _publish_ (its lowest-offset unqualified observation, the same choice the published fact set makes) appears anywhere among the values the other side _stated_. Requiring the two headline values to be equal produces false accusations on ordinary pages — `tooling/fixtures/demo-pdp-before.html` names a backordered variant above the line that says the product is in stock, and both statements are true. Accepting any shared value lets a real divergence hide behind an incidental match, because "Free shipping over $50" appears in both representations. The asymmetric rule catches the second and not the first, which is the conservative direction: a missed divergence costs a merchant nothing, and a false one is published next to their name.
93
+
94
+ **Gate order for non-grades**, and none of them is an F: `robots-disallow-scanner` (a statement about our own conduct, and only `vantage: 'public'` is gated — an owner consents for their own origin) → `robots-unavailable` → `opt-out` (the site's decision, reported before any failure of ours) → fetch failures → `evidence-incomplete` → `truncated-evidence`. A non-grade still carries all six dimensions with their weights, every check at `earned: 0` with an evidence line naming the reason, and the policy and cost reports — but no sub-scores, because publishing those next to `score: null` would be scoring by another name.
95
+
96
+ **Known limitations of 0.1, stated rather than discovered:**
97
+
98
+ - **D5.2 walks JSON-LD only.** Microdata and RDFa satisfy D5.1 (present and parsing) but are not traversed for required properties, so a microdata-only page scores 5/15 on D5 rather than up to 12.
99
+ - **A declared paywall is flagged, not exempted.** `isAccessibleForFree: false`, HTTP 402 and `WWW-Authenticate` raise the `paywalled` flag; the §3.8 exemption of the gated part from coverage and position needs `hasPart` + `cssSelector` support in the extractor and is not implemented.
100
+ - **`corpusHash` is not yet a corpus digest.** The pure half cannot read the corpus directory, so the value is a pinned constant regenerated at corpus freeze. ARS 0.1 ships as a draft with its corpus still open, so `ARS_CORPUS_HASH` is the SHA-256 of the ASCII string `ars-0.1-corpus-unfrozen` — anyone comparing it against a computed digest of the shipped corpus will find it does not match, which is the correct signal.
101
+ - **`SUBPOINTS` and the classification tables are not covered by `rulesetHash`.** §3.9's `ArsRuleset` has no field for either. They are published (exported, and printed in the spec) and the corpus is what pins them.
102
+ - **SHA-256 is implemented in this file.** `node:crypto` would make the package Node-only and `apps/rebilder-web` imports the root entry point; `crypto.subtle` is async and `score()` is not; a dependency is out by contract. It is checked against the FIPS 180-4 vectors in `tests/score.test.ts`.
103
+
104
+ ### `src/recommend.ts` — what to fix, in what order, and what it is worth
105
+
106
+ `recommend({ dimensions, score })` computes remedies over a dependency DAG. A recommendation's `pointsAvailable` counts only the checks not already claimed by a higher-ranked one, **plus** the checks it uniquely unlocks — D2.1 owns D2.3 and D2.4 while it is at zero, and only while it is at zero. Sums are capped per dimension, output order is rank order, and a recommendation may claim its unlocks only if it also closes something itself. Every number is a real gap between `earned` and `weight`; a page at 100 gets an empty list rather than a list of platitudes. `Σ pointsAvailable ≤ 100 − score` is asserted over the whole corpus.
107
+
108
+ ### `src/index.ts` — the published surface
109
+
110
+ `score`, `recommend`, `bandFor`, the three hashes, `DEFAULT_RULESET`, `CHECK_META`, `DIMENSION_META`, `SUBPOINTS`, the profiles, `classify`, `parseMoneyText`, and every type in §3.9. **The tokenizer and the extractor are deliberately not exported.** They are the mechanism of the score, not its interface: they change whenever a real page teaches us something, which is what a MINOR is for, and exporting them would freeze the way ARS reads a page into the way ARS is used.
111
+
112
+ ## Boundaries
113
+
114
+ ```
115
+ cli ──┐
116
+ ├──► agent-readability (. pure, ./probe server-only)
117
+ mcp ──┘
118
+ gateway ──X──► agent-readability (forbidden, BOTH directions)
119
+ agent-readability ──X──► gateway
120
+ rebilder-web ──► agent-readability (. only, never ./probe)
121
+ rebilder-api ──► agent-readability (. and ./probe)
122
+ ```
123
+
124
+ Enforced by `tooling/check-package-graph.ts`, which also forbids deep imports: `.` and `./probe` are the entire public API. `rebilder-web` never makes an outbound fetch to an arbitrary host — the scan routes through `rebilder-api` — and that property is only real if the probe entry point cannot be imported there.
125
+
126
+ ## Development
127
+
128
+ ```bash
129
+ pnpm --filter @rebilder/agent-readability typecheck
130
+ pnpm --filter @rebilder/agent-readability lint # includes the purity rule
131
+ pnpm --filter @rebilder/agent-readability test # includes the conformance corpus
132
+ ```
133
+
134
+ The root `ars:conform` alias named in design §3.10 is **not wired yet**; the corpus runs as part of this package's `test` script in the meantime.
135
+
136
+ ## The conformance corpus
137
+
138
+ `conformance/NNN-name/` and its runner (`tests/conformance.test.ts`) are the language-neutral standard. The spec describes the score in prose; the corpus says what the prose means, in JSON, in a form a Go or Python implementation can consume without reading TypeScript.
139
+
140
+ ```
141
+ conformance/NNN-name/
142
+ evidence.json the INPUT — an ArsEvidence bundle, response bodies included
143
+ expected.json SPEC-DERIVABLE fields only. A second implementation must reproduce this.
144
+ identity.json rulesetHash / corpusHash / evidenceHash — properties of OUR artifact.
145
+ A second implementation is explicitly NOT required to match them, and
146
+ that split is what makes independent certification possible at all.
147
+ README.md one paragraph on what the fixture proves
148
+ ```
149
+
150
+ **The runner globs.** Every directory under `conformance/` is picked up with no edit to the runner — fixtures land from several people at once, and a hand-maintained list is a list that silently skips the one someone forgot to register. A directory with no `evidence.json`, no `expected.json`, no `README.md` or unparseable JSON is an **error**, never a skip.
151
+
152
+ **What `expected.json` pins**, and what it deliberately does not: every number and every identifier — `earned` per check and per dimension, grade, score, band label, page kind and confidence, the fact set, the flags raised, the policy decisions, the cost report, and the recommendation arithmetic. Not the three hashes (they are `identity.json`'s job), and not a single human-facing string — check labels, evidence lines, flag messages, recommendation copy. Those are ours to reword in a PATCH, and a corpus that pinned them would turn copy edits into spec changes.
153
+
154
+ **`corpusHash` is recorded but not asserted per fixture.** It is a digest over the whole corpus, so it moves every time anyone adds a fixture; pinning it while the corpus is open would make every new fixture break every old one. `rulesetHash` and `evidenceHash` are asserted, because they are properties of inputs that do not move.
155
+
156
+ **Regenerating:**
157
+
158
+ ```bash
159
+ ARS_CONFORM_UPDATE=1 pnpm --filter @rebilder/agent-readability test
160
+ ```
161
+
162
+ writes `expected.json` and `identity.json` from the current implementation **and then fails the run**, so an update can never be mistaken for a pass. Read the diff before committing it: blessing output you have not checked is how a corpus stops encoding the spec and starts encoding the bug.
163
+
164
+ ### The golden pair
165
+
166
+ `001-pdp-gateway-md` and `002-pdp-raw-html` carry the **same 91,226-byte HTML body** — the real committed page at `tooling/fixtures/demo-pdp-before.html` — and differ only in what the agent probe receives and in the response headers, which is exactly the one variable §3.3 allows. The same page scores **54 (D)** raw and **90 (A)** with the gateway installed. Three of the ten points 001 still lacks are gaps in `@rebilder/gateway` itself: it declares no `Link: rel="alternate"` (D2.2, 4 points) and no canonical on the Markdown response (D6.1, 1 point). The corpus is where that is visible, and closing it will move `expected.json` — which is a MINOR, and correctly so.
167
+
168
+ ### Property fixtures 050–059
169
+
170
+ Design §3.10 names ten properties. Two need an evidence bundle to be about anything and are **corpus directories**; the other eight are properties of the ruleset, the profiles, the parsers or the build, and live in `tests/score.test.ts` as `describe('05N …')` blocks. Every id appears in exactly one of the two places:
171
+
172
+ | id | where |
173
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
174
+ | `050-byte-identical-replay` | **directory** (+ corpus-wide replay assertion in the runner, and the volatile-header assertions in `score.test.ts`) |
175
+ | `051-multi-value-headers` | **directory** |
176
+ | `052-weights-sum-100…` | test |
177
+ | `053-heuristic-controlled…` | test |
178
+ | `054-band-boundaries` | test |
179
+ | `055-no-network` | test (asserts the ESLint gate, which is the real check, plus a source scan) |
180
+ | `056-no-clock` | test (same shape) |
181
+ | `057-tokenizer-fuzz` | test (seeded LCG — a fuzz corpus that differs between machines teaches nobody anything) |
182
+ | `058-profiles-total-and-typed` | test |
183
+ | `059-money-parser` | test |