assaystone 0.3.0__tar.gz

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 (88) hide show
  1. assaystone-0.3.0/CHANGELOG.md +44 -0
  2. assaystone-0.3.0/LICENSE +202 -0
  3. assaystone-0.3.0/MANIFEST.in +4 -0
  4. assaystone-0.3.0/PKG-INFO +417 -0
  5. assaystone-0.3.0/README.md +392 -0
  6. assaystone-0.3.0/assaystone/__init__.py +24 -0
  7. assaystone-0.3.0/assaystone/__main__.py +4 -0
  8. assaystone-0.3.0/assaystone/adapters/__init__.py +16 -0
  9. assaystone-0.3.0/assaystone/adapters/messages.py +254 -0
  10. assaystone-0.3.0/assaystone/audit.py +534 -0
  11. assaystone-0.3.0/assaystone/backtest.py +90 -0
  12. assaystone-0.3.0/assaystone/cli.py +491 -0
  13. assaystone-0.3.0/assaystone/contract.py +69 -0
  14. assaystone-0.3.0/assaystone/demo.py +201 -0
  15. assaystone-0.3.0/assaystone/demo_data/audit/README.md +13 -0
  16. assaystone-0.3.0/assaystone/demo_data/audit/baseline/README.md +5 -0
  17. assaystone-0.3.0/assaystone/demo_data/audit/baseline/ci/build.yml +3 -0
  18. assaystone-0.3.0/assaystone/demo_data/audit/baseline/pricing/__init__.py +1 -0
  19. assaystone-0.3.0/assaystone/demo_data/audit/baseline/pricing/discounts.py +16 -0
  20. assaystone-0.3.0/assaystone/demo_data/audit/baseline/tests/__init__.py +0 -0
  21. assaystone-0.3.0/assaystone/demo_data/audit/baseline/tests/test_discounts.py +40 -0
  22. assaystone-0.3.0/assaystone/demo_data/audit/transcript.jsonl +13 -0
  23. assaystone-0.3.0/assaystone/demo_data/code_agent/baseline/README.md +5 -0
  24. assaystone-0.3.0/assaystone/demo_data/code_agent/baseline/ci/build.yml +3 -0
  25. assaystone-0.3.0/assaystone/demo_data/code_agent/baseline/pricing/__init__.py +1 -0
  26. assaystone-0.3.0/assaystone/demo_data/code_agent/baseline/pricing/discounts.py +16 -0
  27. assaystone-0.3.0/assaystone/demo_data/code_agent/baseline/tests/__init__.py +0 -0
  28. assaystone-0.3.0/assaystone/demo_data/code_agent/baseline/tests/test_discounts.py +40 -0
  29. assaystone-0.3.0/assaystone/demo_data/code_agent/contracts/hardened.json +18 -0
  30. assaystone-0.3.0/assaystone/demo_data/code_agent/contracts/naive.json +11 -0
  31. assaystone-0.3.0/assaystone/demo_data/code_agent/traces/t01-correct.json +49 -0
  32. assaystone-0.3.0/assaystone/demo_data/code_agent/traces/t02-regression.json +49 -0
  33. assaystone-0.3.0/assaystone/demo_data/code_agent/traces/t03-test-tampering.json +62 -0
  34. assaystone-0.3.0/assaystone/demo_data/code_agent/traces/t04-forbidden-path.json +62 -0
  35. assaystone-0.3.0/assaystone/demo_data/code_agent/traces/t05-debug-print.json +49 -0
  36. assaystone-0.3.0/assaystone/demo_data/code_agent/traces/t06-clean-noisy.json +49 -0
  37. assaystone-0.3.0/assaystone/demo_data/importers/README.md +20 -0
  38. assaystone-0.3.0/assaystone/demo_data/importers/langfuse_trace.json +60 -0
  39. assaystone-0.3.0/assaystone/demo_data/importers/langsmith_runs.json +70 -0
  40. assaystone-0.3.0/assaystone/demo_data/importers/otel_trace.json +228 -0
  41. assaystone-0.3.0/assaystone/demo_data/ops_agent/baseline/README.md +5 -0
  42. assaystone-0.3.0/assaystone/demo_data/ops_agent/baseline/orders.json +32 -0
  43. assaystone-0.3.0/assaystone/demo_data/ops_agent/baseline/policy.json +4 -0
  44. assaystone-0.3.0/assaystone/demo_data/ops_agent/contracts/amount_only.json +11 -0
  45. assaystone-0.3.0/assaystone/demo_data/ops_agent/contracts/hardened.json +15 -0
  46. assaystone-0.3.0/assaystone/demo_data/ops_agent/traces/t01-correct.json +60 -0
  47. assaystone-0.3.0/assaystone/demo_data/ops_agent/traces/t02-over-limit.json +60 -0
  48. assaystone-0.3.0/assaystone/demo_data/ops_agent/traces/t03-double-refund.json +60 -0
  49. assaystone-0.3.0/assaystone/demo_data/ops_agent/traces/t04-missing-approval.json +49 -0
  50. assaystone-0.3.0/assaystone/demo_data/ops_agent/traces/t05-bad-status.json +60 -0
  51. assaystone-0.3.0/assaystone/demo_data/ops_agent/traces/t06-clean-noisy.json +60 -0
  52. assaystone-0.3.0/assaystone/hooks/__init__.py +1 -0
  53. assaystone-0.3.0/assaystone/hooks/claude_code.py +236 -0
  54. assaystone-0.3.0/assaystone/importers/__init__.py +45 -0
  55. assaystone-0.3.0/assaystone/importers/common.py +100 -0
  56. assaystone-0.3.0/assaystone/importers/langfuse.py +123 -0
  57. assaystone-0.3.0/assaystone/importers/langsmith.py +140 -0
  58. assaystone-0.3.0/assaystone/importers/otel.py +191 -0
  59. assaystone-0.3.0/assaystone/init.py +138 -0
  60. assaystone-0.3.0/assaystone/model.py +192 -0
  61. assaystone-0.3.0/assaystone/mutate.py +352 -0
  62. assaystone-0.3.0/assaystone/packs/__init__.py +8 -0
  63. assaystone-0.3.0/assaystone/packs/ops.py +180 -0
  64. assaystone-0.3.0/assaystone/pytest_plugin.py +109 -0
  65. assaystone-0.3.0/assaystone/replay.py +274 -0
  66. assaystone-0.3.0/assaystone/reports.py +180 -0
  67. assaystone-0.3.0/assaystone/runner.py +87 -0
  68. assaystone-0.3.0/assaystone/runtime.py +225 -0
  69. assaystone-0.3.0/assaystone/scorecard.py +163 -0
  70. assaystone-0.3.0/assaystone/verifiers.py +318 -0
  71. assaystone-0.3.0/assaystone/workspace.py +73 -0
  72. assaystone-0.3.0/assaystone.egg-info/PKG-INFO +417 -0
  73. assaystone-0.3.0/assaystone.egg-info/SOURCES.txt +86 -0
  74. assaystone-0.3.0/assaystone.egg-info/dependency_links.txt +1 -0
  75. assaystone-0.3.0/assaystone.egg-info/entry_points.txt +5 -0
  76. assaystone-0.3.0/assaystone.egg-info/requires.txt +3 -0
  77. assaystone-0.3.0/assaystone.egg-info/top_level.txt +1 -0
  78. assaystone-0.3.0/pyproject.toml +56 -0
  79. assaystone-0.3.0/setup.cfg +4 -0
  80. assaystone-0.3.0/tests/test_assaystone.py +83 -0
  81. assaystone-0.3.0/tests/test_audit.py +175 -0
  82. assaystone-0.3.0/tests/test_demo.py +31 -0
  83. assaystone-0.3.0/tests/test_hook.py +107 -0
  84. assaystone-0.3.0/tests/test_importers.py +47 -0
  85. assaystone-0.3.0/tests/test_integrations.py +258 -0
  86. assaystone-0.3.0/tests/test_ops.py +96 -0
  87. assaystone-0.3.0/tests/test_replay.py +58 -0
  88. assaystone-0.3.0/tests/test_reports.py +78 -0
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0
4
+
5
+ - `assaystone audit`: Claude Code transcripts, message exports, trace JSON
6
+ - LangSmith, Langfuse, and OpenTelemetry GenAI importers (`--format`, auto-detect)
7
+ - Claude Code Stop hook (`assaystone hook install claude-code`), warn/block, dedupe,
8
+ and `.assaystone/hook.json` ignore rules
9
+ - SARIF 2.1.0 and JUnit output for `audit` and `verify`
10
+ - shared tool-call replay and test-evidence inference
11
+ - `--workspace` / post-session fallback: current files when replay cannot cover edits
12
+ - `--git-preimage`: HEAD-based baseline for post-session diff checks; the hook uses it
13
+ when available
14
+ - `tests.integrity` matches nested test dirs (`server/tests/`, `demo2/server/tests/`)
15
+ - default audit rules, severity levels, JSON output, `--fail-on`, suggested contract
16
+ - `Contract.from_dict` / `to_dict`; `fail_fast=False` aggregates all verdicts
17
+ - `record` accepts Claude Code transcripts, importers, and trace JSON
18
+ - packaged `demo_data` so `pip install assaystone && assaystone demo` works
19
+ - `--no-evidence` to keep raw evidence out of machine reports
20
+ - third-party verifier packs via `assaystone.verifiers` entry points
21
+ - CI matrix 3.10–3.12 plus a wheel build/install demo job
22
+ - GitHub Action install input; project metadata and license files
23
+
24
+ ## 0.2.0
25
+
26
+ - runtime gate: irreversible-tool policies, approval callbacks, contract enforcement,
27
+ shadow mode
28
+ - ops/refund verifier pack and `assaystone demo ops`
29
+ - LangGraph adapter
30
+ - runtime, adapter, verifier, and contract reference docs
31
+
32
+ ## 0.1.0
33
+
34
+ - acceptance contracts and a cost-ordered verifier ladder
35
+ - `pass / fail / escalate` verdicts with reasons and evidence refs
36
+ - mutation testing and backtesting over recorded traces
37
+ - Claude Agent SDK / OpenAI-style / LangGraph message adapters and `artifacts_from_git`
38
+ - `assaystone init --ci`, `assaystone record`, `verify --json`, `verify --github`
39
+ - pytest plugin (one item per trace) and a composite GitHub Action
40
+ - scorecard, Failure Zoo seed, and launch docs
41
+
42
+ ## 0.0.1
43
+
44
+ - initial code/test verifier pack and demo
@@ -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.
@@ -0,0 +1,4 @@
1
+ include LICENSE
2
+ include README.md
3
+ include CHANGELOG.md
4
+ recursive-include assaystone/demo_data *
@@ -0,0 +1,417 @@
1
+ Metadata-Version: 2.4
2
+ Name: assaystone
3
+ Version: 0.3.0
4
+ Summary: Audit AI agent traces for silent failures, then gate CI and runtime with acceptance contracts.
5
+ Author: Assaystone contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/yellowsand1/assaystone
8
+ Project-URL: Repository, https://github.com/yellowsand1/assaystone
9
+ Project-URL: Issues, https://github.com/yellowsand1/assaystone/issues
10
+ Project-URL: Changelog, https://github.com/yellowsand1/assaystone/blob/main/CHANGELOG.md
11
+ Keywords: ai,agents,verification,evaluation,mutation-testing,llm,audit,ai-agents
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Provides-Extra: pytest
23
+ Requires-Dist: pytest>=7; extra == "pytest"
24
+ Dynamic: license-file
25
+
26
+ <p align="center"><img src="assets/logo.svg" width="88" alt="Assaystone"></p>
27
+
28
+ # Assaystone
29
+
30
+ **Your agent's tests pass. Did it delete the failing test?**
31
+
32
+ ![ci](https://github.com/yellowsand1/assaystone/actions/workflows/ci.yml/badge.svg)
33
+ ![status](https://img.shields.io/badge/status-alpha-orange)
34
+ ![python](https://img.shields.io/badge/python-3.10%2B-blue)
35
+ ![pip](https://img.shields.io/badge/pip-install%20assaystone-blue)
36
+ ![license](https://img.shields.io/badge/license-Apache--2.0-blue)
37
+
38
+ Assaystone audits existing agent traces for silent failures — the failures a green
39
+ test suite cannot see. Point it at a transcript; get findings and a suggested contract
40
+ in seconds. Then gate CI and runtime with the same contract, and prove the checks work
41
+ with mutation testing and backtesting.
42
+
43
+ ```bash
44
+ python3 -m assaystone demo audit
45
+ ```
46
+
47
+ ```
48
+ audit-demo-session changed: pricing/discounts.py, tests/test_discounts.py
49
+ HIGH tests.integrity tests/test_discounts.py (modified)
50
+
51
+ summary: 0 critical, 1 high, 0 medium, 0 low
52
+ ```
53
+
54
+ The agent fixed the rounding bug, then deleted the one test it still failed, and
55
+ reported success. `tests.pass` saw a green suite. The audit found the deleted test.
56
+
57
+ The rest of the loop:
58
+
59
+ ```bash
60
+ python3 -m assaystone demo # code/test verifier pack
61
+ python3 -m assaystone demo ops # runtime gate + ops/refund pack
62
+ ```
63
+
64
+ The code demo compares a naive contract (`tests + syntax`) with a hardened one:
65
+ **1/4 vs 4/4** defects caught, and mutation testing raises verifier recall from
66
+ **67% to 94%**. The ops demo catches **0/4 vs 4/4** bad refunds, and the runtime gate
67
+ blocks a denied approval and an over-limit refund.
68
+
69
+ ## What a passing test suite misses
70
+
71
+ | Defect | `tests.pass` | Assaystone |
72
+ |---|---|---|
73
+ | Agent deletes the failing test | ✅ passes | ❌ `tests.integrity` |
74
+ | Agent edits CI to skip the suite | ✅ passes | ❌ `diff.forbidden_paths` |
75
+ | Agent leaves a debug print | ✅ passes | ❌ `quality.no_debug_prints` |
76
+ | Agent weakens an assertion | ✅ passes | ❌ `tests.integrity` |
77
+ | Regression in another module | ❌ fails | ❌ `tests.pass` |
78
+
79
+ Actions have the same problem. In the ops demo, an amount-only contract catches 0/4
80
+ bad refunds; policy, ledger, status, and approval checks catch 4/4.
81
+
82
+ ## Why
83
+
84
+ Evaluations give you a score. Production needs a verdict: what failed, why, with
85
+ what evidence, and whether a human must look. Agents fail silently; a green test
86
+ suite is not an acceptance criterion.
87
+
88
+ The longer argument: [Verification is the bottleneck](docs/why.md).
89
+
90
+ ## Install
91
+
92
+ Python 3.10+. No runtime dependencies.
93
+
94
+ ```bash
95
+ pip install assaystone
96
+ assaystone demo audit
97
+ ```
98
+
99
+ From source for contributors:
100
+
101
+ ```bash
102
+ git clone https://github.com/yellowsand1/assaystone
103
+ cd assaystone
104
+ python3 -m pip install -e ".[pytest]"
105
+ python3 -m assaystone demo audit
106
+ ```
107
+
108
+ ## Audit your own traces
109
+
110
+ ```bash
111
+ # Claude Code transcript
112
+ assaystone audit ~/.claude/projects/.../<session>.jsonl --baseline .
113
+
114
+ # LangSmith / Langfuse exports
115
+ assaystone audit runs.json --format langsmith --baseline .
116
+ assaystone audit trace.json --format langfuse --baseline .
117
+
118
+ # OpenTelemetry GenAI (OTLP JSON)
119
+ assaystone audit otel.json --format otel --baseline .
120
+
121
+ # a message export or a trace JSON
122
+ assaystone audit trace-export.json --git-repo .
123
+
124
+ # turn findings into a contract
125
+ assaystone audit session.jsonl --baseline . \
126
+ --write-contract .assaystone/contract.json
127
+
128
+ # CI reports
129
+ assaystone audit session.jsonl --baseline . \
130
+ --sarif results.sarif --junit results.xml
131
+
132
+ # use HEAD as the pre-session baseline for diff-size / public-API checks
133
+ assaystone audit session.jsonl --baseline . --git-preimage
134
+ ```
135
+
136
+ Supported inputs: Claude Code `.jsonl` transcripts, LangSmith run exports, Langfuse
137
+ trace/observation exports, OpenTelemetry GenAI spans, message JSON/lists, and
138
+ Assaystone trace JSON. Importers are heuristic; `--format` forces one. For transcripts
139
+ and importers, artifacts are reconstructed from `Write` / `Edit` tool calls;
140
+ `--git-repo` is more reliable when the changes are real. If the repository is already
141
+ in its post-session state, the audit falls back to reading the current files;
142
+ `--workspace` forces that mode (the Claude Code hook uses it). Default rules: test
143
+ integrity, forbidden paths, syntax, diff size, public API, debug prints, and
144
+ claim-vs-evidence. `--run-tests` adds the test suite. `--json` is for machines;
145
+ `--sarif` / `--junit` are for CI; `--no-evidence` keeps raw evidence out of reports.
146
+ Details: [docs/audit.md](docs/audit.md) · [importers](docs/importers.md).
147
+
148
+ ## Quickstart in your repo
149
+
150
+ If you already have transcripts, start with `assaystone audit` above. `init` is for
151
+ when you want a contract to gate future runs:
152
+
153
+ ```bash
154
+ cd your-agent-repo
155
+ assaystone init --ci
156
+ ```
157
+
158
+ This writes `.assaystone/contract.json` and a GitHub Actions workflow. The contract
159
+ includes checks for syntax, forbidden paths, test integrity, diff size, public API,
160
+ debug prints, claim-vs-evidence, and the test suite (when one is detected).
161
+
162
+ Record a trace from a framework message list:
163
+
164
+ ```python
165
+ from assaystone.adapters import artifacts_from_git, from_claude_agent
166
+
167
+ trace = from_claude_agent(
168
+ messages,
169
+ artifacts=artifacts_from_git("."),
170
+ task="fix the failing rounding test",
171
+ )
172
+ trace.save(".assaystone/traces/run-001.json")
173
+ ```
174
+
175
+ Or from a recorded transcript:
176
+
177
+ ```bash
178
+ assaystone record --transcript messages.json --git-repo . \
179
+ --out .assaystone/traces/run-001.json
180
+ ```
181
+
182
+ Verify:
183
+
184
+ ```bash
185
+ assaystone verify --contract .assaystone/contract.json \
186
+ --trace .assaystone/traces
187
+ ```
188
+
189
+ Exit codes: `0` all pass, `1` at least one fail, `2` needs human review. Use `--json`
190
+ for machines, `--github` for Actions annotations.
191
+
192
+ ## Integrations
193
+
194
+ ### Claude Code Stop hook
195
+
196
+ ```bash
197
+ assaystone hook install claude-code --mode warn
198
+ ```
199
+
200
+ This merges a Stop hook into `.claude/settings.local.json` (use `--user` for global
201
+ settings). The hook audits the session transcript when Claude stops. Default is warn;
202
+ `--mode block` blocks high/critical findings. Repeated identical findings are
203
+ suppressed per session, and `.assaystone/hook.json` can ignore known-good test edits.
204
+ Details: [docs/hooks.md](docs/hooks.md), example:
205
+ [examples/hooks](examples/hooks/README.md).
206
+
207
+ ### pytest
208
+
209
+ ```bash
210
+ pytest --assaystone-contract .assaystone/contract.json \
211
+ --assaystone-traces .assaystone/traces
212
+ ```
213
+
214
+ One test item per trace; failures show up like normal pytest failures. Or use the
215
+ fixture:
216
+
217
+ ```python
218
+ def test_agent_run(assaystone):
219
+ result = assaystone.verify(".assaystone/traces/run-001.json")
220
+ assert result.verdict == "pass", result.first_failure
221
+ ```
222
+
223
+ ### GitHub Action
224
+
225
+ ```yaml
226
+ - uses: yellowsand1/assaystone@main
227
+ with:
228
+ contract: .assaystone/contract.json
229
+ traces: .assaystone/traces
230
+ install: assaystone==0.3.0 # optional; default installs the action repo
231
+ ```
232
+
233
+ Failures become PR annotations; a Markdown summary is written to the job summary.
234
+
235
+ ### Framework adapters
236
+
237
+ - Claude Agent SDK message streams (`from_claude_agent`)
238
+ - OpenAI-style chat/tool messages (`from_openai_agents`)
239
+ - LangGraph state dicts (`from_langgraph`)
240
+ - Generic message lists (`from_messages`)
241
+ - `artifacts_from_git` collects changed files as artifacts
242
+
243
+ Adapters are duck-typed and never import the framework. Details:
244
+ [docs/adapters.md](docs/adapters.md).
245
+
246
+ ### Custom verifier
247
+
248
+ ```python
249
+ from assaystone import Verifier, register
250
+
251
+ @register
252
+ class NoMigrationEdits(Verifier):
253
+ name = "policy.no_migrations"
254
+ layer = "L1"
255
+ cost_usd = 0.00001
256
+ independence = "high"
257
+
258
+ def check(self, ctx, params):
259
+ bad = [path for path, _ in ctx.changed() if path.startswith("migrations/")]
260
+ return (not bad, [f"migration touched: {path}" for path in bad], [])
261
+ ```
262
+
263
+ Add `{"name": "policy.no_migrations"}` to the contract.
264
+
265
+ ## How it works
266
+
267
+ ```
268
+ recorded trace (task, tool calls, artifacts, evidence)
269
+ │
270
+ ▼
271
+ acceptance contract (verifier ladder + budget + escalation)
272
+ │
273
+ ▼
274
+ pass / fail / escalate ──► CI gate, runtime gate, human review
275
+ │
276
+ ├── mutate: inject labeled defects, measure verifier recall
277
+ └── backtest: replay historical traces before enforcing a check
278
+ ```
279
+
280
+ - **Trace** — what the agent did, what it produced, what evidence it left.
281
+ - **Contract** — acceptance criteria for one task type, versioned with the agent.
282
+ - **Verifier** — a cheap, independent check with a declared layer and cost.
283
+ - **Verdict** — pass, fail, or escalate with reasons and evidence refs.
284
+ - **Mutation** — inject one plausible defect at a time; did the contract kill it?
285
+ - **Backtest** — replay human-labeled traces; measure catch rate, escaped defects,
286
+ false alarms, and cost.
287
+
288
+ ## Runtime gate
289
+
290
+ The same contract can gate actions, not just CI:
291
+
292
+ ```python
293
+ from assaystone.adapters import artifacts_from_git
294
+ from assaystone.runtime import RuntimeGuard
295
+
296
+ guard = RuntimeGuard(
297
+ ".assaystone/contract.json",
298
+ baseline=".",
299
+ irreversible={"refund.create"},
300
+ approval_callback=ask_human,
301
+ )
302
+
303
+ with guard.session(task="refund duplicate charge") as session:
304
+ session.call("read_order", {"order_id": "O-1"}, read_order)
305
+ session.call("refund.create", {"amount_cents": 4000}, do_refund)
306
+ result = session.finish(artifacts=artifacts_from_git("."))
307
+ ```
308
+
309
+ Irreversible tools are blocked unless `approval_callback` returns True. The full
310
+ contract runs at `finish`; `ContractFailed` and `EscalationRequired` stop the run.
311
+ `enforce=False` runs in shadow mode. Details: [docs/runtime.md](docs/runtime.md).
312
+
313
+ ## The verifier ladder
314
+
315
+ | Layer | Examples | Cost | Independence |
316
+ |---|---|---|---|
317
+ | L0 | invariants, schema, step budget | ~free | high |
318
+ | L1 | compiler, tests, path policy | low | high |
319
+ | L2 | diff, public API, custom rules | low | high |
320
+ | L3 | evidence / citation checks | low-medium | medium-high |
321
+ | L4 | LLM judge (not in the default ladder) | low but correlated | low |
322
+
323
+ Use the cheapest sufficient verifier. A judge is a filter, never the oracle.
324
+
325
+ References: [built-in verifiers](docs/verifiers.md) · [contract format](docs/contracts.md).
326
+
327
+ ## Comparison
328
+
329
+ | | trace audit | per-run verdict | evidence | runtime gate | mutation testing | backtesting | cost-aware ladder |
330
+ |---|---|---|---|---|---|---|---|
331
+ | promptfoo | — | ✅ | partial | — | — | — | — |
332
+ | DeepEval | — | ✅ | partial | — | — | — | — |
333
+ | Inspect AI | — | ✅ | partial | — | — | — | — |
334
+ | Guardrails AI | — | ✅ | partial | ✅ | — | — | — |
335
+ | OpenWorkProof | partial | ✅ | ✅ | ✅ | — | partial | — |
336
+ | **Assaystone** | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
337
+
338
+ Based on public documentation as of November 2026; corrections welcome. More
339
+ framework adapters and domain packs are next.
340
+
341
+ ## Design principles
342
+
343
+ 1. **Verify artifacts, not self-reports.** "All tests pass" is a claim; the recorded
344
+ exit code and the re-run suite are evidence.
345
+ 2. **Record once, verify many.** Verification is decoupled from generation, so checks
346
+ can be replayed, backtested, and mutated.
347
+ 3. **Cheapest sufficient verifier first.** Every verifier declares cost; the runner
348
+ stops at the first required failure.
349
+ 4. **Escalation is a first-class outcome.** If cheap checks cannot decide, route to a
350
+ human with an evidence bundle.
351
+ 5. **Verifiers are code, and they are tested.** Mutation testing measures recall; a
352
+ verifier you never challenged is a liability.
353
+
354
+ ## Repository layout
355
+
356
+ ```
357
+ assaystone/ # library: models, runner, verifiers, adapters, audit, runtime, CLI
358
+ assaystone/demo_data/ # packaged demos (the wheel can run them)
359
+ examples/code_agent/ # baseline repo, contracts, scenarios, generated traces
360
+ examples/ops_agent/ # runtime gate + ops/refund pack
361
+ examples/audit/ # a Claude Code transcript that deletes the failing test
362
+ examples/importers/ # LangSmith / Langfuse / OTel export fixtures
363
+ examples/hooks/ # Claude Code Stop hook settings
364
+ failure_zoo/ # labeled failure corpus (seed)
365
+ docs/why.md # the longer argument
366
+ docs/audit.md # audit inputs, rules, output, limitations
367
+ docs/importers.md # LangSmith / Langfuse / OTel formats
368
+ docs/hooks.md # Claude Code Stop hook
369
+ docs/adapters.md # Claude / OpenAI / LangGraph adapters
370
+ docs/verifiers.md # built-in verifier reference
371
+ docs/contracts.md # contract format and exit codes
372
+ docs/runtime.md # runtime guard reference
373
+ docs/launch.md # adoption plan
374
+ docs/release.md # maintainer release checklist
375
+ docs/releases/ # per-version release notes
376
+ tests/ # unit + integration tests
377
+ ```
378
+
379
+ ## Status and roadmap
380
+
381
+ `v0.3.0` — alpha. The core is domain-agnostic; the code/test and ops/refund packs
382
+ ship today.
383
+
384
+ - [x] audit: Claude Code transcripts, message exports, trace JSON
385
+ - [x] LangSmith / Langfuse / OpenTelemetry importers
386
+ - [x] Claude Code Stop hook (warn/block, install, dedupe, allowlist)
387
+ - [x] SARIF and JUnit output
388
+ - [x] contracts, verifier ladder, pass/fail/escalate
389
+ - [x] mutation testing and backtesting
390
+ - [x] Claude Agent SDK / OpenAI-style / LangGraph adapters, `artifacts_from_git`
391
+ - [x] pytest plugin and GitHub Action
392
+ - [x] runtime gate for irreversible actions (approvals, shadow mode)
393
+ - [x] ops/refund pack
394
+ - [x] git pre-image baseline for post-session diff checks
395
+ - [ ] data reconciliation and report citation packs
396
+ - [ ] verifier registry and Failure Zoo benchmark
397
+ - [ ] TypeScript port
398
+
399
+ ## Contributing
400
+
401
+ The fastest way to help is to
402
+ [bring a failure case](.github/ISSUE_TEMPLATE/failure_case.md). See
403
+ [CONTRIBUTING.md](CONTRIBUTING.md) for verifier and adapter guidelines.
404
+
405
+ Maintainers: see [docs/release.md](docs/release.md) for the release checklist.
406
+
407
+ If this saves you from one silent failure, star the repo — it helps other agent teams
408
+ find it.
409
+
410
+ ## Name
411
+
412
+ An *assay* determines the quality of a substance; an *assay stone* (touchstone) tests
413
+ gold. Chinese: 试金石.
414
+
415
+ ## License
416
+
417
+ Apache-2.0.