driftproof 0.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.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,274 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ # Driftproof
3
+
4
+ **Continuous, model-version-bound verification of agent skills.**
5
+
6
+ [![driftproof](https://img.shields.io/endpoint?url=https://driftproofhq.com/badges/commit-message-conventions.json)](https://driftproofhq.com)
7
+ &nbsp;— live badge for the bundled `commit-message-conventions` example, generated from its own receipt.
8
+
9
+ Driftproof is an open **receipt spec** plus a **runner** that measures whether an
10
+ agent skill actually helps — by running the skill's eval suite **with** and
11
+ **without** the skill on a named model version, judging each case several times to
12
+ get a confidence band, and emitting a signed, dated **receipt**. Diff two receipts
13
+ across model releases and you get a **drift report**.
14
+
15
+ Driftproof **consumes** the [`agentskills.io/evals`](https://agentskills.io) eval
16
+ format; it does not invent its own.
17
+
18
+ 📊 **[Report #001](docs/reports/001/index.html)** ([markdown](reports/report-001.md))
19
+ — ten public agent skills, run across a current-vs-previous Sonnet release with
20
+ sampled, band-based verdicts.
21
+
22
+ ## Why
23
+
24
+ A skill is usually tested **once**, against **one** model, and the verdict is
25
+ treated as permanent. But the substrate moves: models get updated, retired, and
26
+ replaced. A skill that measurably helped last quarter can quietly become a no-op —
27
+ or a net negative — the next time the model underneath it changes, and nobody
28
+ re-checks.
29
+
30
+ **Verdicts age because the substrate moves.** Driftproof exists to keep the
31
+ verdict current: cheap, repeatable, hash-stamped measurements bound to a specific
32
+ model version, so "does this skill still help?" has a dated, reproducible answer
33
+ instead of a stale one.
34
+
35
+ The hard part isn't running an eval once — it's making the number **credible
36
+ enough to act on**. An LLM judge is noisy, so a naive score can swing run to run
37
+ by more than the drift you're trying to detect. Driftproof's answer is to **sample
38
+ the judge and report confidence bands**, and to **only claim a regression when the
39
+ bands don't overlap**. A tool that cries wolf is worse than no tool.
40
+
41
+ ## Quickstart — receipt for your own skill in ~10 minutes
42
+
43
+ You need Node ≥ 22 and an `ANTHROPIC_API_KEY`.
44
+
45
+ ```bash
46
+ # 1. Scaffold a skill skeleton: SKILL.md + evals/evals.json (3 example cases) + .driftproofrc
47
+ npx driftproof init my-skill
48
+
49
+ # 2. Edit the 3 example cases in my-skill/evals/evals.json so each one is grounded
50
+ # in a claim your SKILL.md makes. Every rubric is anchored at 0.80 = "fully correct".
51
+
52
+ # 3. Point the runner at the metered API (scanner-safe: never commit a key)
53
+ export CLAUDE_PROVIDER=api
54
+ read -rsp "Anthropic API key: " ANTHROPIC_API_KEY && export ANTHROPIC_API_KEY
55
+
56
+ # 4. Run the suite with a hard $2 budget (the run is refused up front if it would exceed it)
57
+ npx driftproof run my-skill --models claude-haiku-4-5 --max-usd 2
58
+
59
+ # 5. Read the receipt + human summary written to ./receipts/
60
+ cat receipts/*.summary.md
61
+ ```
62
+
63
+ **Reading the result.** The **verdict** answers "does the skill still help on this
64
+ model?" — `PASSED` when the with-skill score beats the baseline by at least the
65
+ effect floor, `NO_EFFECT` when it doesn't, `REGRESSED` when the skill hurts. Each
66
+ case is judged several times, so it carries a **band** (`mean ± stddev`) instead of
67
+ one fragile number, and a case is only ever called regressed/improved when its two
68
+ bands don't overlap. The **effect floor** (0.05, one judge quantization step) is the
69
+ minimum real move required before a change counts as more than noise — band
70
+ separation *plus* a floor-sized delta, never either alone.
71
+
72
+ ### Install
73
+
74
+ ```bash
75
+ npx driftproof <cmd> # no install — always the published version
76
+ npm install -g driftproof # or install the CLI globally
77
+ ```
78
+
79
+ The only runtime dependency is `ajv` (schema validation); `@anthropic-ai/sdk` is
80
+ optional and pulled in only for `CLAUDE_PROVIDER=api`. The CLI resolves its spec,
81
+ schema, and model registry from inside the package, so it runs the same from a
82
+ global/npx install as it does in a checkout.
83
+
84
+ ### Other commands
85
+
86
+ ```bash
87
+ # Diff two receipts across a model release into a drift report (markdown)
88
+ npx driftproof diff receiptA.json receiptB.json --out drift.md
89
+
90
+ # Validate a receipt against the schema + verify its self-hash
91
+ npx driftproof validate receipt.json
92
+
93
+ # Emit a shields.io badge from a receipt (see "Badge", below)
94
+ npx driftproof badge receipt.json --out badges/my-skill.json
95
+ ```
96
+
97
+ A skill directory is expected to look like:
98
+
99
+ ```
100
+ my-skill/
101
+ SKILL.md # the skill instructions (required)
102
+ evals/evals.json # agentskills.io/evals suite (required)
103
+ .driftproofrc # optional per-project run defaults (models, samples, max_usd)
104
+ ... # any bundled files (contribute to content_hash)
105
+ ```
106
+
107
+ Writing a suite that measures fairly is its own craft — see
108
+ **[AUTHORING.md](AUTHORING.md)** ([site](https://driftproofhq.com/authoring.html)).
109
+
110
+ ### Providers
111
+
112
+ | `CLAUDE_PROVIDER` | surface | notes |
113
+ |---|---|---|
114
+ | `cli` *(default)* | `claude-cli` | Spawns `claude -p` with `ANTHROPIC_API_KEY` **stripped** from the child env, so dev runs use your local subscription session. Sampling params are surface-controlled. |
115
+ | `api` | `api` | Uses the Anthropic Messages API; requires `ANTHROPIC_API_KEY` and `@anthropic-ai/sdk`. Judge calls are pinned to temperature 0 for determinism where the surface allows it. |
116
+
117
+ The surface and judge settings used are recorded in every receipt.
118
+
119
+ ### Cost guard
120
+
121
+ Sampling multiplies calls. Each case costs `2 + 2 × samples` model calls
122
+ (two generations, each judged `samples` times) — 12 calls per case at the default
123
+ `--samples 5`. Driftproof **projects the whole run up front, prints the count, and
124
+ refuses before spending anything** if it would exceed `--max-calls` (default 200).
125
+ The default model list is `haiku` only.
126
+
127
+ ## Receipt anatomy
128
+
129
+ A receipt is the unit of evidence — one JSON document conforming to
130
+ [`spec/receipt.schema.json`](spec/receipt.schema.json) (human companion:
131
+ [`spec/RECEIPT.md`](spec/RECEIPT.md)). Abridged, with real shape:
132
+
133
+ ```jsonc
134
+ {
135
+ "schema_version": "0.2",
136
+ "skill": { "name": "commit-message-conventions", "version": "0.2.0",
137
+ "content_hash": "…sha256 over SKILL.md + bundled files…" },
138
+ "suite": { "format": "agentskills.io/evals", "suite_hash": "…", "case_count": 10 },
139
+ "run": {
140
+ "model_id": "claude-haiku-4-5-20251001",
141
+ "model_release_date": "2025-10-01",
142
+ "surface": "claude-cli",
143
+ "runner_version": "0.2.0",
144
+ "date_utc": "2026-07-27T…Z",
145
+ "judge": { "samples": 5, "temperature": null, "sampling": "surface-controlled",
146
+ "surface": "claude-cli" }
147
+ },
148
+ "results": {
149
+ "cases": [
150
+ { "id": "perf-not-refactor", "mode": "with_skill",
151
+ "outcome": "pass", "score": 0.86, "mean": 0.86, "stddev": 0.05,
152
+ "samples": [0.9, 0.8, 0.85, 0.9, 0.85],
153
+ "judge": { "model_id": "claude-haiku-4-5-20251001", "rubric_hash": "…" } }
154
+ // …one entry per (case, mode); baseline entries too…
155
+ ],
156
+ "aggregates": {
157
+ "with_skill": { "case_count": 10, "pass_count": 7, "borderline_count": 1,
158
+ "mean_score": 0.81, "stddev": 0.02 },
159
+ "baseline": { "case_count": 10, "pass_count": 1, "mean_score": 0.42, "stddev": 0.03 }
160
+ }
161
+ },
162
+ "comparison": { "with_skill_score": 0.81, "baseline_score": 0.42,
163
+ "delta": 0.39, "delta_uncertainty": 0.036 },
164
+ "verification_level": "TESTED",
165
+ "receipt_hash": "…sha256 of the canonical receipt with this field removed…"
166
+ }
167
+ ```
168
+
169
+ Key ideas:
170
+
171
+ - **`content_hash` / `suite_hash`** are computed over a canonical JSON form, so the
172
+ same skill and suite hash identically on any machine — receipts are comparable.
173
+ - **Per-case `samples` / `mean` / `stddev`** give each case a confidence band. An
174
+ `outcome` of **`borderline`** means the pass threshold sits *inside* the band —
175
+ the run can't confidently call it pass or fail.
176
+ - **`delta_uncertainty`** is the combined band on the with-skill-vs-baseline lift.
177
+ - **`verification_level`** uses the community lattice: `UNVERIFIED` / `DECLARED` /
178
+ `TESTED` (Driftproof emits `TESTED`). `FORMAL` is reserved.
179
+ - **`receipt_hash`** is a self-hash for tamper-evidence (integrity, not yet a key
180
+ signature — see the spec's open questions).
181
+
182
+ ### Drift reports
183
+
184
+ `driftproof diff A.json B.json` compares the with-skill bands per case across two
185
+ receipts. The rule that keeps it honest: a **regression** (or improvement) is
186
+ claimed **only when the two bands do not overlap**. Overlapping bands are reported
187
+ as **within noise** and never counted as a regression.
188
+
189
+ ## Continuous verification in CI (GitHub Action + badge)
190
+
191
+ Wire drift detection into a repo so the skill is re-checked on every push and when
192
+ the model underneath it changes.
193
+
194
+ ```yaml
195
+ # .github/workflows/driftproof.yml
196
+ name: driftproof
197
+ on: [push, workflow_dispatch]
198
+ jobs:
199
+ verify:
200
+ runs-on: ubuntu-latest
201
+ steps:
202
+ - uses: actions/checkout@v4
203
+ - uses: driftproofhq/driftproof@v0.3.0
204
+ with:
205
+ skill-dir: skills/my-skill
206
+ models: claude-haiku-4-5
207
+ max-usd: '2'
208
+ api-key: ${{ secrets.ANTHROPIC_API_KEY }}
209
+ # fail-on-regression: 'true' # (default) fail the job if the skill REGRESSED
210
+ ```
211
+
212
+ The action runs the suite, uploads the receipt as a build artifact, and exposes
213
+ `verdict` (`PASSED` / `NO_EFFECT` / `REGRESSED`) and `delta` as step outputs. It
214
+ fails the job on `REGRESSED` unless you set `fail-on-regression: 'false'`. For a
215
+ free CI dry-run with **zero model calls**, set `DRIFTPROOF_STUB=1` in the job env —
216
+ the runner returns canned receipts so the wiring can be tested without spend (this
217
+ is exactly how the action's own [self-test](.github/workflows/action-selftest.yml)
218
+ runs).
219
+
220
+ ### Badge
221
+
222
+ `driftproof badge <receipt>` emits a [shields.io endpoint](https://shields.io/badges/endpoint-badge)
223
+ JSON object. Commit it somewhere public and point a shields endpoint URL at it:
224
+
225
+ ```bash
226
+ npx driftproof run skills/my-skill --models claude-haiku-4-5 --max-usd 2 --out receipts
227
+ npx driftproof badge receipts/*.json --out badges/my-skill.json
228
+ git add badges/my-skill.json && git commit -m "chore: driftproof badge"
229
+ ```
230
+
231
+ ```markdown
232
+ ![driftproof](https://img.shields.io/endpoint?url=https://<your-site>/badges/my-skill.json)
233
+ ```
234
+
235
+ The [badge at the top of this README](badges/) is the living demo: it is generated
236
+ from the `commit-message-conventions` example's own receipt and served from the
237
+ site, so it reflects a real dated run, not a hand-set color.
238
+
239
+ ## Reports
240
+
241
+ **[Report #001](reports/report-001.md)** diffs ten public, text-representable
242
+ agent skills across a Sonnet model pair. The report and every verdict in it are
243
+ **re-derived from the receipts** in [`receipts/report-001/`](receipts/report-001/) —
244
+ nothing is hand-entered.
245
+
246
+ Driftproof does **not** commit third-party skill content. Each `SKILL.md` is
247
+ fetched at run time from a pinned commit and verified by sha256 against
248
+ [`suites/manifest.json`](suites/manifest.json); we commit only the manifest, our
249
+ authored eval suites ([`suites/`](suites/)), the receipts, and the report.
250
+ Reproduce it in three commands:
251
+
252
+ ```bash
253
+ node scripts/fetch-skills.js # fetch pinned SKILL.md files (sha256-verified) → untracked workdir
254
+ node scripts/run-report-001.js --concurrency 5 # run both models × with/baseline, emit v0.2 receipts
255
+ node scripts/build-report-001.js # re-derive the report from the receipts
256
+ ```
257
+
258
+ ## Roadmap
259
+
260
+ - **Monthly drift reports** for a curated set of public skills, published under
261
+ `reports/` and at driftproofhq.com.
262
+ - **Model-release triggers** — re-run receipts automatically when a new model
263
+ version ships, so drift is caught at the release, not months later.
264
+ - **A sandboxed-execution harness** for tool-execution skills (document
265
+ renderers, diagram/asset generators) that Report #001 scopes out.
266
+ - **Signed receipts** — key signatures / attestation over the canonical form.
267
+
268
+ ## Contributing
269
+
270
+ See [CONTRIBUTING.md](CONTRIBUTING.md). The gate (`npm run gate`) must stay green.
271
+
272
+ ## License
273
+
274
+ [Apache-2.0](LICENSE).