assurance-core 0.1.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 (41) hide show
  1. assurance_core-0.1.0/LICENSE +190 -0
  2. assurance_core-0.1.0/PKG-INFO +189 -0
  3. assurance_core-0.1.0/README.md +164 -0
  4. assurance_core-0.1.0/assurance_core/__init__.py +1 -0
  5. assurance_core-0.1.0/assurance_core/admission.py +117 -0
  6. assurance_core-0.1.0/assurance_core/admission_config.py +206 -0
  7. assurance_core-0.1.0/assurance_core/coverage.py +189 -0
  8. assurance_core-0.1.0/assurance_core/effects.py +149 -0
  9. assurance_core-0.1.0/assurance_core/policy.py +242 -0
  10. assurance_core-0.1.0/assurance_core/policy_config.py +226 -0
  11. assurance_core-0.1.0/assurance_core/principal.py +290 -0
  12. assurance_core-0.1.0/assurance_core/report_period.py +236 -0
  13. assurance_core-0.1.0/assurance_core/rule_of_two.py +367 -0
  14. assurance_core-0.1.0/assurance_core/run_budget.py +276 -0
  15. assurance_core-0.1.0/assurance_core/run_outcome.py +439 -0
  16. assurance_core-0.1.0/assurance_core/semantic_checks.py +234 -0
  17. assurance_core-0.1.0/assurance_core/staleness.py +196 -0
  18. assurance_core-0.1.0/assurance_core/task_contract.py +127 -0
  19. assurance_core-0.1.0/assurance_core/verification.py +134 -0
  20. assurance_core-0.1.0/assurance_core/worker.py +201 -0
  21. assurance_core-0.1.0/assurance_core.egg-info/PKG-INFO +189 -0
  22. assurance_core-0.1.0/assurance_core.egg-info/SOURCES.txt +39 -0
  23. assurance_core-0.1.0/assurance_core.egg-info/dependency_links.txt +1 -0
  24. assurance_core-0.1.0/assurance_core.egg-info/requires.txt +3 -0
  25. assurance_core-0.1.0/assurance_core.egg-info/top_level.txt +1 -0
  26. assurance_core-0.1.0/pyproject.toml +40 -0
  27. assurance_core-0.1.0/setup.cfg +4 -0
  28. assurance_core-0.1.0/tests/test_admission.py +105 -0
  29. assurance_core-0.1.0/tests/test_coverage.py +209 -0
  30. assurance_core-0.1.0/tests/test_effects.py +60 -0
  31. assurance_core-0.1.0/tests/test_policy_and_delegation.py +244 -0
  32. assurance_core-0.1.0/tests/test_policy_as_configuration.py +103 -0
  33. assurance_core-0.1.0/tests/test_principal_and_worker.py +205 -0
  34. assurance_core-0.1.0/tests/test_report_period.py +73 -0
  35. assurance_core-0.1.0/tests/test_rule_of_two.py +106 -0
  36. assurance_core-0.1.0/tests/test_run_budget.py +223 -0
  37. assurance_core-0.1.0/tests/test_run_outcome.py +279 -0
  38. assurance_core-0.1.0/tests/test_run_outcome_vocabulary.py +212 -0
  39. assurance_core-0.1.0/tests/test_semantic_checks.py +93 -0
  40. assurance_core-0.1.0/tests/test_staleness.py +86 -0
  41. assurance_core-0.1.0/tests/test_verification.py +50 -0
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions. Notwithstanding
134
+ the above, nothing herein shall supersede or modify the terms of any
135
+ separate license agreement you may have executed with Licensor regarding
136
+ such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 I-Ops Operations Intelligence, LLC
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: assurance-core
3
+ Version: 0.1.0
4
+ Summary: Pure decision modules for enterprise task assurance — arithmetic, not models.
5
+ Author-email: "I-Ops Operations Intelligence, LLC" <hello@i-ops.dev>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://i-ops.dev
8
+ Project-URL: Source, https://github.com/i-ops-hq/assurance-core
9
+ Keywords: ai-agents,governance,auditing,evaluation,assurance,rag
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
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: dev
23
+ Requires-Dist: pytest>=8.0; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ # assurance-core
27
+
28
+ **We don't score completion. We check it — against conditions declared before the run, by code that
29
+ isn't the worker.**
30
+
31
+ This repository publishes the pure decision modules from [I-Ops](https://i-ops.dev): the
32
+ arithmetic that decides whether a task is complete, what was read, what may inform an answer, and
33
+ what a run is allowed to do. **No model decides any of this.** If our claims are wrong, the code is
34
+ right here.
35
+
36
+ **Provenance:** cut from I-Ops `0.56.2` on 2026-08-28. I-Ops is upstream; this repo is a
37
+ publication, never a source.
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install assurance-core
43
+ ```
44
+
45
+ Python 3.10 or newer. **Zero dependencies** — nothing is pulled in, nothing phones home.
46
+ Not on PyPI yet, so until it is:
47
+
48
+ ```bash
49
+ pip install git+https://github.com/i-ops-hq/assurance-core.git
50
+ ```
51
+
52
+ ## Use it in your own agent
53
+
54
+ Two runnable examples in [`examples/`](examples). The first is the question almost nobody asks:
55
+
56
+ ```python
57
+ from assurance_core.coverage import Coverage, EvidenceRef, Expectation
58
+
59
+ # Declare what the task requires, BEFORE it runs.
60
+ expected = [Expectation(key=f"2024-{m:02d}", label=f"{m:02d}/2024") for m in range(1, 13)]
61
+
62
+ # Record what your agent actually opened, as it opens it.
63
+ found = {e.key: EvidenceRef(key=e.key, path=f"/reports/{e.key}.csv", reader="my_agent")
64
+ for e in expected if e.key != "2024-03"}
65
+
66
+ coverage = Coverage(scope_label="2024 monthly reports", expected=expected, found=found,
67
+ missing=[e for e in expected if e.key not in found])
68
+
69
+ print(coverage.summary()) # 11 of 12 2024 monthly reports — not in this folder: 03/2024
70
+ print(coverage.complete) # False
71
+ ```
72
+
73
+ Every tool call can return 200 and the answer can still be built on eleven twelfths of the data.
74
+ `coverage.complete` is the difference between a run that succeeded and a run that was *right*.
75
+
76
+ The rest of the modules do the same job for other questions: `staleness` asks whether a document
77
+ still matches the source it was made from, `admission` decides which retrieved sources may inform an
78
+ answer, `task_contract` records what done means before the first step runs, and `policy` and
79
+ `rule_of_two` decide what a run is allowed to do at all.
80
+
81
+ **None of them import a model, and a test proves it** — see *Model independence is gated, not
82
+ claimed* below.
83
+
84
+ ## What this is not
85
+
86
+ - Not a runtime, agent framework, or installable product that does anything on its own
87
+ - Not an orchestrator, not capabilities, not services, not UI, not MLX, not a database
88
+ - Not a fork that will drift — changes are made in I-Ops and copied out deliberately
89
+
90
+ Read the modules. Run the tests. That is the point.
91
+
92
+ ## The three legs
93
+
94
+ ### 1. Declared postconditions
95
+
96
+ Before anything executes, the task contract states what *done* means in terms a machine can check.
97
+ Each line is true or false. Partial completion is declared up front too.
98
+
99
+ ### 2. Independent verification
100
+
101
+ A verifier reads the state of the world **outside** the run. The worker is never the judge. Where no
102
+ verifier exists for a condition, the honest answer is **complete but unverified** — not verified.
103
+
104
+ ### 3. Evidence coverage
105
+
106
+ > **Did the agent look at everything it was supposed to look at?**
107
+
108
+ The harness works out, from the request and the folder — never from the model — which files the
109
+ answer requires, records which ones were actually opened, and compares the two. A gap blocks verified
110
+ completion.
111
+
112
+ ## Model independence is gated, not claimed
113
+
114
+ The central promise is enforced by AST tests that walk each module and forbid model or service
115
+ imports. Example — the gate on `coverage.py`:
116
+
117
+ ```python
118
+ def test_coverage_never_consults_a_model():
119
+ import assurance_core.coverage as module
120
+
121
+ source = Path(module.__file__).read_text(encoding="utf-8")
122
+ tree = ast.parse(source)
123
+
124
+ imported: list[str] = []
125
+ for node in ast.walk(tree):
126
+ if isinstance(node, ast.ImportFrom) and node.module:
127
+ imported.append(node.module)
128
+ elif isinstance(node, ast.Import):
129
+ imported.extend(a.name for a in node.names)
130
+
131
+ forbidden = [
132
+ name
133
+ for name in imported
134
+ if name.startswith("app.services")
135
+ or any(t in name for t in ("model_source", "vinci_client", "mlx", "openai", "anthropic"))
136
+ ]
137
+ assert not forbidden
138
+ ```
139
+
140
+ The same pattern gates `admission.py` and `staleness.py`. A reader who sees a test that forbids the
141
+ thing we promise not to do can trust the rest.
142
+
143
+ ## Honest limits
144
+
145
+ A governance repo that oversells itself refutes its own thesis in public. Current limits:
146
+
147
+ - **`verified_complete`** was unreachable by construction until real verifiers shipped; the vocabulary
148
+ exists so the honest answer is always available, but many conditions still have no verifier
149
+ - **Source admission** is provenance-only; on a corpus with no tombstones or supersession events it
150
+ is inert — it admits everything with no provenance and excludes only what the record says to
151
+ - **Standing staleness** compares recorded figures to a fresh recompute; it needs a prior artifact
152
+ record, which this library does not provide
153
+ - **The rule of two** deliberately under-counts files inside an explicitly granted workspace; that is
154
+ a stated calibration trade-off, not an accident
155
+
156
+ ## Modules
157
+
158
+ | Module | Question it answers |
159
+ |---|---|
160
+ | `coverage` | Did the worker read everything the task required? |
161
+ | `staleness` | Do recorded figures still match the source? |
162
+ | `admission` | Should this source inform the answer, given provenance? |
163
+ | `verification` | What does *checked* mean for a postcondition? |
164
+ | `run_outcome` | What actually happened, derived from structured signals? |
165
+ | `task_contract` | What would count as done, declared before the run? |
166
+ | `policy` · `principal` · `worker` · `effects` | Who may have which worker produce which effect? |
167
+ | `rule_of_two` | Does this session hold too many risk properties at once? |
168
+ | `run_budget` | Are loop, retry, and spend limits enforced by code? |
169
+ | `report_period` | Which month does this request mean? |
170
+ | `semantic_checks` | Deterministic figure and text checks |
171
+
172
+ ## Run the tests
173
+
174
+ ```bash
175
+ python -m pytest -q
176
+ python -c "import sys; assert not [m for m in sys.modules if m.startswith('app.')]"
177
+ ```
178
+
179
+ ## Licence
180
+
181
+ Apache-2.0. See [LICENSE](LICENSE).
182
+
183
+ ## Contributing
184
+
185
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Feature requests belong upstream.
186
+
187
+ ## Security
188
+
189
+ See [SECURITY.md](SECURITY.md).
@@ -0,0 +1,164 @@
1
+ # assurance-core
2
+
3
+ **We don't score completion. We check it — against conditions declared before the run, by code that
4
+ isn't the worker.**
5
+
6
+ This repository publishes the pure decision modules from [I-Ops](https://i-ops.dev): the
7
+ arithmetic that decides whether a task is complete, what was read, what may inform an answer, and
8
+ what a run is allowed to do. **No model decides any of this.** If our claims are wrong, the code is
9
+ right here.
10
+
11
+ **Provenance:** cut from I-Ops `0.56.2` on 2026-08-28. I-Ops is upstream; this repo is a
12
+ publication, never a source.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pip install assurance-core
18
+ ```
19
+
20
+ Python 3.10 or newer. **Zero dependencies** — nothing is pulled in, nothing phones home.
21
+ Not on PyPI yet, so until it is:
22
+
23
+ ```bash
24
+ pip install git+https://github.com/i-ops-hq/assurance-core.git
25
+ ```
26
+
27
+ ## Use it in your own agent
28
+
29
+ Two runnable examples in [`examples/`](examples). The first is the question almost nobody asks:
30
+
31
+ ```python
32
+ from assurance_core.coverage import Coverage, EvidenceRef, Expectation
33
+
34
+ # Declare what the task requires, BEFORE it runs.
35
+ expected = [Expectation(key=f"2024-{m:02d}", label=f"{m:02d}/2024") for m in range(1, 13)]
36
+
37
+ # Record what your agent actually opened, as it opens it.
38
+ found = {e.key: EvidenceRef(key=e.key, path=f"/reports/{e.key}.csv", reader="my_agent")
39
+ for e in expected if e.key != "2024-03"}
40
+
41
+ coverage = Coverage(scope_label="2024 monthly reports", expected=expected, found=found,
42
+ missing=[e for e in expected if e.key not in found])
43
+
44
+ print(coverage.summary()) # 11 of 12 2024 monthly reports — not in this folder: 03/2024
45
+ print(coverage.complete) # False
46
+ ```
47
+
48
+ Every tool call can return 200 and the answer can still be built on eleven twelfths of the data.
49
+ `coverage.complete` is the difference between a run that succeeded and a run that was *right*.
50
+
51
+ The rest of the modules do the same job for other questions: `staleness` asks whether a document
52
+ still matches the source it was made from, `admission` decides which retrieved sources may inform an
53
+ answer, `task_contract` records what done means before the first step runs, and `policy` and
54
+ `rule_of_two` decide what a run is allowed to do at all.
55
+
56
+ **None of them import a model, and a test proves it** — see *Model independence is gated, not
57
+ claimed* below.
58
+
59
+ ## What this is not
60
+
61
+ - Not a runtime, agent framework, or installable product that does anything on its own
62
+ - Not an orchestrator, not capabilities, not services, not UI, not MLX, not a database
63
+ - Not a fork that will drift — changes are made in I-Ops and copied out deliberately
64
+
65
+ Read the modules. Run the tests. That is the point.
66
+
67
+ ## The three legs
68
+
69
+ ### 1. Declared postconditions
70
+
71
+ Before anything executes, the task contract states what *done* means in terms a machine can check.
72
+ Each line is true or false. Partial completion is declared up front too.
73
+
74
+ ### 2. Independent verification
75
+
76
+ A verifier reads the state of the world **outside** the run. The worker is never the judge. Where no
77
+ verifier exists for a condition, the honest answer is **complete but unverified** — not verified.
78
+
79
+ ### 3. Evidence coverage
80
+
81
+ > **Did the agent look at everything it was supposed to look at?**
82
+
83
+ The harness works out, from the request and the folder — never from the model — which files the
84
+ answer requires, records which ones were actually opened, and compares the two. A gap blocks verified
85
+ completion.
86
+
87
+ ## Model independence is gated, not claimed
88
+
89
+ The central promise is enforced by AST tests that walk each module and forbid model or service
90
+ imports. Example — the gate on `coverage.py`:
91
+
92
+ ```python
93
+ def test_coverage_never_consults_a_model():
94
+ import assurance_core.coverage as module
95
+
96
+ source = Path(module.__file__).read_text(encoding="utf-8")
97
+ tree = ast.parse(source)
98
+
99
+ imported: list[str] = []
100
+ for node in ast.walk(tree):
101
+ if isinstance(node, ast.ImportFrom) and node.module:
102
+ imported.append(node.module)
103
+ elif isinstance(node, ast.Import):
104
+ imported.extend(a.name for a in node.names)
105
+
106
+ forbidden = [
107
+ name
108
+ for name in imported
109
+ if name.startswith("app.services")
110
+ or any(t in name for t in ("model_source", "vinci_client", "mlx", "openai", "anthropic"))
111
+ ]
112
+ assert not forbidden
113
+ ```
114
+
115
+ The same pattern gates `admission.py` and `staleness.py`. A reader who sees a test that forbids the
116
+ thing we promise not to do can trust the rest.
117
+
118
+ ## Honest limits
119
+
120
+ A governance repo that oversells itself refutes its own thesis in public. Current limits:
121
+
122
+ - **`verified_complete`** was unreachable by construction until real verifiers shipped; the vocabulary
123
+ exists so the honest answer is always available, but many conditions still have no verifier
124
+ - **Source admission** is provenance-only; on a corpus with no tombstones or supersession events it
125
+ is inert — it admits everything with no provenance and excludes only what the record says to
126
+ - **Standing staleness** compares recorded figures to a fresh recompute; it needs a prior artifact
127
+ record, which this library does not provide
128
+ - **The rule of two** deliberately under-counts files inside an explicitly granted workspace; that is
129
+ a stated calibration trade-off, not an accident
130
+
131
+ ## Modules
132
+
133
+ | Module | Question it answers |
134
+ |---|---|
135
+ | `coverage` | Did the worker read everything the task required? |
136
+ | `staleness` | Do recorded figures still match the source? |
137
+ | `admission` | Should this source inform the answer, given provenance? |
138
+ | `verification` | What does *checked* mean for a postcondition? |
139
+ | `run_outcome` | What actually happened, derived from structured signals? |
140
+ | `task_contract` | What would count as done, declared before the run? |
141
+ | `policy` · `principal` · `worker` · `effects` | Who may have which worker produce which effect? |
142
+ | `rule_of_two` | Does this session hold too many risk properties at once? |
143
+ | `run_budget` | Are loop, retry, and spend limits enforced by code? |
144
+ | `report_period` | Which month does this request mean? |
145
+ | `semantic_checks` | Deterministic figure and text checks |
146
+
147
+ ## Run the tests
148
+
149
+ ```bash
150
+ python -m pytest -q
151
+ python -c "import sys; assert not [m for m in sys.modules if m.startswith('app.')]"
152
+ ```
153
+
154
+ ## Licence
155
+
156
+ Apache-2.0. See [LICENSE](LICENSE).
157
+
158
+ ## Contributing
159
+
160
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Feature requests belong upstream.
161
+
162
+ ## Security
163
+
164
+ See [SECURITY.md](SECURITY.md).
@@ -0,0 +1 @@
1
+ """Pure decision modules — arithmetic, not models."""
@@ -0,0 +1,117 @@
1
+ r"""Whether a retrieved source may inform an answer — computed from provenance, never from content.
2
+
3
+ Leg of the strategy docs §7: between binary grant admission and post-hoc
4
+ groundedness, nothing said *which* retrieved chunk may shape the answer or why one beat another.
5
+ This module is that layer. It reads `workspace_files` columns only — `grant_id`, `mtime`,
6
+ `content_hash`, `period_year/month`, `removed_at` — and never a byte of text. Same principle as
7
+ `rule_of_two.assess`: *"nothing here inspects a document… it cannot be evaded by an injection that
8
+ reads well."*
9
+
10
+ ## Default-admit — the deliberate inversion of `policy.decide`
11
+
12
+ `policy.decide` is default-deny because refusing an unlisted effect is safe. Sources are default-
13
+ admit because refusing an unranked source means the product answers nothing. The discipline that
14
+ replaces default-deny here is that **every `REVIEW` and `EXCLUDED` must carry a reason a person can
15
+ read and disagree with.**
16
+
17
+ Pure: no I/O, no model, no `app.services` import. `tests/test_admission.py` gates it.
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ from collections.abc import Callable
23
+ from dataclasses import dataclass
24
+ from enum import Enum
25
+ from pathlib import Path
26
+
27
+
28
+ class Standing(str, Enum):
29
+ ADMITTED = "admitted"
30
+ REVIEW = "review"
31
+ EXCLUDED = "excluded"
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ class SourceFacts:
36
+ """Provenance ONLY. Adding a content field here is the bug this module exists to prevent."""
37
+
38
+ path: str
39
+ grant_id: str
40
+ mtime: float | None
41
+ tombstoned: bool
42
+ newer_sibling: str | None
43
+ kind: str = "unknown"
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class Admission:
48
+ standing: Standing
49
+ reason: str
50
+ rule: str
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class AdmissionRule:
55
+ name: str
56
+ standing: Standing
57
+ reason: str
58
+ predicate: Callable[[SourceFacts], bool]
59
+
60
+
61
+ _STANDING_RANK = {
62
+ Standing.ADMITTED: 0,
63
+ Standing.REVIEW: 1,
64
+ Standing.EXCLUDED: 2,
65
+ }
66
+
67
+
68
+ def _pick_strictest(candidates: list[Admission]) -> Admission:
69
+ return max(candidates, key=lambda item: _STANDING_RANK[item.standing])
70
+
71
+
72
+ def admit(facts: SourceFacts, rules: tuple[AdmissionRule, ...]) -> Admission:
73
+ """Decide whether a source may inform an answer from provenance facts alone."""
74
+ if facts.tombstoned:
75
+ return Admission(
76
+ standing=Standing.EXCLUDED,
77
+ reason="This source was removed from your workspace.",
78
+ rule="tombstoned_source",
79
+ )
80
+
81
+ if not (facts.grant_id or "").strip():
82
+ return Admission(
83
+ standing=Standing.ADMITTED,
84
+ reason="no provenance recorded",
85
+ rule="no_provenance",
86
+ )
87
+
88
+ matched: list[Admission] = []
89
+ for rule in rules:
90
+ if rule.predicate(facts):
91
+ matched.append(
92
+ Admission(standing=rule.standing, reason=rule.reason, rule=rule.name)
93
+ )
94
+
95
+ if facts.newer_sibling:
96
+ sibling_name = Path(facts.newer_sibling).name
97
+ matched.append(
98
+ Admission(
99
+ standing=Standing.REVIEW,
100
+ reason=f"A newer version exists in the same folder ({sibling_name}).",
101
+ rule="superseded_sibling",
102
+ )
103
+ )
104
+
105
+ if not matched:
106
+ return Admission(
107
+ standing=Standing.ADMITTED,
108
+ reason="nothing known against it",
109
+ rule="default_admit",
110
+ )
111
+
112
+ return _pick_strictest(matched)
113
+
114
+
115
+ def standing_sort_key(standing: Standing) -> int:
116
+ """Lower sorts earlier — ADMITTED before REVIEW before EXCLUDED."""
117
+ return _STANDING_RANK[standing]