semafide-seal 0.0.1__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 (29) hide show
  1. semafide_seal-0.0.1/LICENSE +21 -0
  2. semafide_seal-0.0.1/PKG-INFO +321 -0
  3. semafide_seal-0.0.1/README.md +271 -0
  4. semafide_seal-0.0.1/code/seal/__init__.py +175 -0
  5. semafide_seal-0.0.1/code/seal/anchor.py +351 -0
  6. semafide_seal-0.0.1/code/seal/artifact.py +510 -0
  7. semafide_seal-0.0.1/code/seal/assignment.py +364 -0
  8. semafide_seal-0.0.1/code/seal/capture/__init__.py +56 -0
  9. semafide_seal-0.0.1/code/seal/capture/assignment.py +321 -0
  10. semafide_seal-0.0.1/code/seal/capture/decorator.py +516 -0
  11. semafide_seal-0.0.1/code/seal/capture/witness_client.py +104 -0
  12. semafide_seal-0.0.1/code/seal/checkpoint.py +280 -0
  13. semafide_seal-0.0.1/code/seal/demo.py +470 -0
  14. semafide_seal-0.0.1/code/seal/demo_60s.py +219 -0
  15. semafide_seal-0.0.1/code/seal/demo_custody.py +157 -0
  16. semafide_seal-0.0.1/code/seal/evidence.py +55 -0
  17. semafide_seal-0.0.1/code/seal/log.py +355 -0
  18. semafide_seal-0.0.1/code/seal/primitives.py +236 -0
  19. semafide_seal-0.0.1/code/seal/public_api.py +39 -0
  20. semafide_seal-0.0.1/code/seal/retention.py +337 -0
  21. semafide_seal-0.0.1/code/seal/verifier.py +1039 -0
  22. semafide_seal-0.0.1/code/seal/witness.py +304 -0
  23. semafide_seal-0.0.1/code/semafide_seal.egg-info/PKG-INFO +321 -0
  24. semafide_seal-0.0.1/code/semafide_seal.egg-info/SOURCES.txt +27 -0
  25. semafide_seal-0.0.1/code/semafide_seal.egg-info/dependency_links.txt +1 -0
  26. semafide_seal-0.0.1/code/semafide_seal.egg-info/requires.txt +8 -0
  27. semafide_seal-0.0.1/code/semafide_seal.egg-info/top_level.txt +1 -0
  28. semafide_seal-0.0.1/pyproject.toml +67 -0
  29. semafide_seal-0.0.1/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Eli Besser
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,321 @@
1
+ Metadata-Version: 2.4
2
+ Name: semafide-seal
3
+ Version: 0.0.1
4
+ Summary: Pre-build verifier and artifact scaffold for independently verifiable evidence of automated executions
5
+ Author-email: Eli Besser <eli@semafide.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Eli Besser
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/besscog13/semafide-seal
29
+ Project-URL: Repository, https://github.com/besscog13/semafide-seal
30
+ Project-URL: Security, https://github.com/besscog13/semafide-seal/blob/main/SECURITY.md
31
+ Keywords: evidence,transparency-log,append-only-log,attestation,provenance,audit,automated-valuation-model
32
+ Classifier: Development Status :: 2 - Pre-Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Intended Audience :: Legal Industry
35
+ Classifier: Intended Audience :: Financial and Insurance Industry
36
+ Classifier: Topic :: Security :: Cryptography
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Classifier: Programming Language :: Python :: 3.13
40
+ Requires-Python: >=3.11
41
+ Description-Content-Type: text/markdown
42
+ License-File: LICENSE
43
+ Requires-Dist: cryptography>=41.0.0
44
+ Provides-Extra: test
45
+ Requires-Dist: pytest>=8.0.0; extra == "test"
46
+ Requires-Dist: hypothesis>=6.0; extra == "test"
47
+ Provides-Extra: specs
48
+ Requires-Dist: z3-solver>=4.12; extra == "specs"
49
+ Dynamic: license-file
50
+
51
+ # Semafide
52
+
53
+ [![CI](https://github.com/besscog13/semafide-seal/actions/workflows/ci.yml/badge.svg)](https://github.com/besscog13/semafide-seal/actions/workflows/ci.yml)
54
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
55
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
56
+ [![Status: pre-alpha scaffold](https://img.shields.io/badge/status-pre--alpha%20scaffold-orange.svg)](#verification-status)
57
+ [![Security policy](https://img.shields.io/badge/security-policy-informational.svg)](SECURITY.md)
58
+
59
+ Appraisals and automated valuations get challenged years after they run. By then the data they used may have changed, been corrected, or disappeared, and rerunning the analysis can produce a different number. Semafide is testing whether independent custody can preserve enough evidence to establish what actually happened.
60
+
61
+ Mortgage lending is the first market this is tested against, not the only one, because it was inexpensive to test.
62
+
63
+ ## What a partner should look at first
64
+
65
+ Not a library clone. One sealed run, and what an examiner is allowed to say about it.
66
+
67
+ `python -m seal.demo_60s` walks an honest valuation on assignment `ASG-8942`, then two attacks. On the honest case the verifier prints:
68
+
69
+ ```
70
+ HONEST EXECUTION (Collateral Valuation #ASG-8942)
71
+ ------------------------------------------------------------------------
72
+ Precedence ✓ ESTABLISHED
73
+ Witness attestation ✗ NOT ESTABLISHED
74
+ Recipe available ✓ ESTABLISHED
75
+ Recipe reproduced ✓ ESTABLISHED
76
+ Historical execution ✗ NOT ESTABLISHED
77
+ Completeness ✗ NOT ESTABLISHED
78
+ ------------------------------------------------------------------------
79
+ CRYPTOGRAPHIC RESULT ✓ ESTABLISHED
80
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
81
+ ```
82
+
83
+ An examiner can say the evidence commitment predates the seal, and that a pinned recipe later reproduced the sealed output. An examiner cannot say a witness observed the run, that historical execution is established, or that this was the only run in the assignment. Cryptographic integrity is not evidentiary reliance.
84
+
85
+ That refusal is the product. The rest of this README is the argument underneath it.
86
+
87
+ **See it run** (sixty seconds, built for someone outside the project):
88
+
89
+ ```bash
90
+ cd code
91
+ pip install -r seal/requirements.txt
92
+ python -m seal.demo_60s
93
+ ```
94
+
95
+ Talk: eli@semafide.com
96
+
97
+ ## Built / unbuilt
98
+
99
+ | | Status |
100
+ |---|---|
101
+ | Verifier for five independent propositions | **Built** |
102
+ | Capture scaffold that seals a decorated function call into a chain | **Built** |
103
+ | Assignment checkpoint and disclosure check | **Built** as a model |
104
+ | Hosted production custody service | **Unbuilt** |
105
+ | Enforcement that every run in an assignment reaches the chain | **Unbuilt** — an undecorated call is invisible |
106
+ | Independent operational witness | **Unbuilt** |
107
+
108
+ The intended architecture places the evidentiary record outside the control of the party that produced the analysis.
109
+
110
+ ## What an examiner can and cannot say
111
+
112
+ The verifier records five independent propositions. They are not a ladder.
113
+
114
+ | Proposition | What it establishes | What it does not establish |
115
+ |---|---|---|
116
+ | Precedence | The evidence commitment predates the run seal. | The analysis consumed that evidence. |
117
+ | Witness attestation | A separately trusted witness key signed an observed-execution attestation covering the run, evidence, action, and capture reference. | That the witness organization is operationally independent or truthful. |
118
+ | Recipe availability | A complete recipe is present and linked to the claimed evidence and action. | That it has been executed. |
119
+ | Recipe reproduction | A verifier later produced the sealed output from that recipe. | That the historical execution ran the recipe. |
120
+ | Historical execution established | A valid observed-execution witness attestation covers the relation. | General custody completeness or substantive correctness. |
121
+
122
+ Successful re-derivation does not make `historical_execution_established` true. A generic signature over a supplied bundle does not make `witness_attestation` true.
123
+
124
+ This table and [`docs/claim-vocabulary.md`](docs/claim-vocabulary.md) are the source for these five names.
125
+
126
+ Further reading, after the table: [`docs/demos/README.md`](docs/demos/README.md) (worked example to architecture), [`docs/executive-thesis.md`](docs/executive-thesis.md) (commercial thesis), and the [system map](https://besscog13.github.io/semafide-seal/) generated from [`docs/semafide.architecture.json`](docs/semafide.architecture.json). The interactive [design canvas](https://claude.ai/code/artifact/24c8c27e-a797-4cca-851a-ac95dfe9f88a) assumes this table.
127
+
128
+ ## The problem
129
+
130
+ Mortgage valuation increasingly relies on software and data sources that can change after an analysis runs. Automated valuation models can use public records, listings, market data, and other inputs. Appraisers can use statistical analysis and regression-based methods to support adjustments. The underlying data, tools, and model versions may change, be corrected, or become unavailable.
131
+
132
+ When a repurchase demand, regulatory examination, or dispute arrives later, rerunning the analysis can produce a different result. The historical execution may have depended on a state that is no longer available in the same form.
133
+
134
+ The interagency Quality Control Standards for Automated Valuation Models became effective October 1, 2025. For covered mortgage originators and secondary market issuers, the rule requires policies, practices, procedures, and control systems designed to comply with specified quality-control standards, including protection against the manipulation of data. The rule does not itself prescribe Semafide's evidence model. Separately, Fannie Mae's Selling Guide requires appraisal reports dated on or after March 1, 2025 to summarize the data sources, tools, and techniques used to support time adjustments. Semafide's narrower question is whether the underlying execution state can later be established rather than merely asserted.
135
+
136
+ ## Authorization and admissibility
137
+
138
+ Authorization is prospective and structural. It asks whether an action is permitted and whether the output conforms: schema validity, licence currency, a passing risk score, the required checks completed.
139
+
140
+ Admissibility asks a different question. If a transaction is challenged three years from now, can the data state it rested on be established?
141
+
142
+ The question is adjudicated retrospectively, but the evidence needed to answer it has to be preserved prospectively. An analysis cannot be made historically reproducible after the relevant state has disappeared. The system that produced the analysis also cannot provide independent evidence of the completeness of its own record without some external control over that record.
143
+
144
+ ## The principle
145
+
146
+ A record showing that an analysis and its inputs sat together in one file is not evidence that the output was derived from those inputs at that moment. **Co-occurrence is not binding.**
147
+
148
+ A prior evidence commitment establishes precedence: the evidence commitment existed in the chain before the run seal that names it. That rules out selecting the committed evidence after seeing the output. It does not by itself prove that the analysis actually consumed those inputs.
149
+
150
+ ## Why custody rather than a file
151
+
152
+ The obvious design hands the appraiser or institution a signed artifact to keep. A signature does not solve completeness.
153
+
154
+ A signature proves that what a document contains has not been altered, assuming the signing key and verification process are trusted. It cannot prove that the document contains everything. Completeness is a claim about what is absent, and the party deciding what to disclose can also decide what to omit. Run five analyses, seal all five, and disclose the three that support the conclusion. Each of the three can verify perfectly. Nothing inside them establishes that the other two existed.
155
+
156
+ Timestamping does not close this. A timestamp can establish that a particular document existed by a stated time. It says nothing about documents nobody was shown. Timestamp all five runs and hand over three, and all three still verify.
157
+
158
+ Splitting the work across five separate records does not help. Each record can be internally complete and authentic while the disclosure remains incomplete.
159
+
160
+ The intended custody architecture addresses that problem by putting assignment-level disclosure outside the control of the party being examined. An examiner can then ask the custodian how many runs and records it received and compare that statement with the supplied artifact. This is a custody property, not something a signature alone provides.
161
+
162
+ The same limit applies to watermarks and to Content Credentials, which travel attached to the artifact and therefore remain with whoever chooses which artifacts to hand over. Longer version in [`docs/watermarking.md`](docs/watermarking.md).
163
+
164
+ The current repository implements the verification side of that model, plus a capture scaffold that seals a decorated function call into a chain and self-checks it against that verifier. It does not implement a hosted production custody service, and the capture scaffold does not enforce that every run in an assignment reaches the chain: an undecorated call is invisible, and a manifest never handed to a custodian is not one anybody can count.
165
+
166
+ ## How the intended architecture integrates
167
+
168
+ Semafide sits at the application boundary. Upstream analytical software would submit an execution manifest carrying the evidence commitment, parameter set, tool and model version, and output.
169
+
170
+ The manifest can also carry a re-derivation recipe. The current schema requires a pinned endpoint and version, the exact invocation, the input reference, the expected output digest, and a service window. A verifier can later execute the recipe and compare the produced output with the sealed output when the partner still serves that environment.
171
+
172
+ Successful re-derivation establishes reproducibility of the claimed execution recipe. It does not, standing alone, establish that the historical execution used that recipe. Historical capture and custody are the remaining operational layer.
173
+
174
+ The intended examiner workflow has two distinct statements. One concerns the supplied chain and its completeness. The other concerns the assignment-level disclosure: how many chains the assignment contains and what the custodian says it holds. The latter must come from a party other than the sealer. Without that independent statement, the verifier reports that assignment disclosure was not checked rather than treating the artifact as complete.
175
+
176
+ Each analysis is committed to its assignment when the chain opens, rather than being assigned at certification. The anchor fixes the assignment before later entries are added. This prevents a completed chain from being relabelled after the fact. It does not establish that the assignment contains no sibling chains; that requires an assignment-level disclosure from outside the chain.
177
+
178
+ ## External time
179
+
180
+ The time a record states is a value chosen by its author. A chain assembled today can therefore contain timestamps from last year and still have internally valid signatures.
181
+
182
+ A conventional timestamp authority addresses a different side of the problem. It can establish that a particular document existed no later than the time asserted by the timestamp token. It does not establish that the document did not exist earlier.
183
+
184
+ The repository therefore models two external bounds. An upper bound comes from an external time authority. A lower bound comes from a published unpredictable value that could not have been known before it was issued. If both are available and independently resolved, the verifier reports the resulting interval rather than treating the author's timestamp as historical proof.
185
+
186
+ The current package models these bounds but does not itself provide a production RFC 3161 service or a production beacon. Those are deployment dependencies.
187
+
188
+ ## What it does not do
189
+
190
+ **Custody, not judgment.**
191
+
192
+ The intended record is symmetric evidence. It should document a flawed analysis as faithfully as a sound one. It does not establish that the inputs were well chosen, that an appraisal conclusion was correct, or that an automated decision was substantively sound.
193
+
194
+ It also does not claim that successful re-derivation proves historical execution. The strongest historical claim requires capture at the time of execution and a custody arrangement that prevents the interested party from selecting the evidence after seeing the outcome.
195
+
196
+ Custody carries costs that a file handed over does not. A production guarantee would depend on Semafide continuing to operate, a custodian preserving the records it received, and partners keeping pinned execution environments available. Those are operational and contractual dependencies, not consequences of cryptography alone.
197
+
198
+ Collusion remains an operational question. An append-only log can make later equivocation detectable when its consistency proofs are checked. Independent witnesses can make conflicting views harder to maintain without detection. The deployment still has to establish who the witnesses are, whether they are independent, and whether anyone checks what they signed.
199
+
200
+ ## About this repository
201
+
202
+ `code/seal/` contains the artifact schema, checkpoint formats, external time-bound models, append-only log primitives, witness machinery, standalone verifier, and a capture scaffold (`code/seal/capture/`) that seals a live function call into a real artifact and self-checks it against the verifier. It holds one chain open per assignment so that sequence numbers and prev-hash linkage run unbroken across calls, which makes an omitted run detectable rather than merely undesirable. What it does not do is site a witness on the operator's machine or establish how many runs an assignment holds: the decorator is opt-in per function, an undecorated call is invisible, and a chain never handed to a custodian is not a chain anybody can count. There is no hosted production custody service.
203
+
204
+ The verifier reports the epistemic propositions above and nothing else in that register. An earlier revision of this package also exposed `BindingLevel`, a single derived value that collapsed the five propositions into one rung on a lossy summary ladder; it has been removed, since it could not even represent the strongest of the five claims and every place it could mislead a reader was easier to fix by removing it than by re-caveating it again.
205
+
206
+ The verifier also reports chain completeness, assignment disclosure, external time bounds, and input-retention determinations. These answer different questions. Completeness asks whether a supplied chain is whole. Disclosure asks whether the chain is the whole assignment. Anchoring asks what external evidence constrains when the chain existed. Retention asks whether the operator could have kept the input, which determines whether re-derivation provides something beyond a locally retained and timestamped copy.
207
+
208
+ A green verification result is not a claim that the underlying model, appraisal, or business decision was correct. It means the artifact satisfied the particular checks the verifier performed against the evidence supplied to it.
209
+
210
+ The package also documents known limits. The current re-derivation recipe pins the endpoint, tool, version, invocation, input reference, output digest, and service window, but does not yet pin the full execution environment, numerical libraries, hardware, or linked BLAS. A later mismatch can therefore reflect environmental drift rather than a changed analysis. The verifier fails conservatively rather than converting that uncertainty into a clean pass.
211
+
212
+ The package deliberately does not present its experimental transparency-log implementation as a production foundation. Production deployments should use established transparency-log and witness specifications rather than treating this scaffold as a replacement for them.
213
+
214
+ It depends on `cryptography` alone.
215
+
216
+ ## Reproduce the verifier
217
+
218
+ ```bash
219
+ git clone https://github.com/besscog13/semafide-seal.git
220
+ cd semafide-seal
221
+ pip install -e .
222
+
223
+ python -m seal.demo # the guided walkthrough
224
+ python -m seal.demo_60s # a 60-second external-facing walkthrough: honest execution, tamper detection, and a selective-disclosure attack
225
+ ```
226
+
227
+ The demo exercises the verifier against cases including truncation, assignment-level disclosure, retention determinations, and time-bound failures. It is the fastest way to see what the verifier refuses to grant.
228
+
229
+ `demo_60s` is a shorter presentation layer over the same real verifier, built for showing someone outside the project what it establishes and what it catches, rather than for diagnostic depth.
230
+
231
+ To run the checks yourself:
232
+
233
+ ```bash
234
+ pip install -e ".[test]"
235
+ pytest # unit, adversarial, and property-based tests
236
+
237
+ pip install -e ".[specs]"
238
+ python specs/SPEC_merkle_consistency.py # each spec exits 0 or 1
239
+ ```
240
+
241
+ ## What the demo prints
242
+
243
+ `python -m seal.demo_60s`, verbatim:
244
+
245
+ ```
246
+
247
+ ------------------------------------------------------------------------
248
+ SEMAFIDE
249
+ EXECUTION EVIDENCE DEMO
250
+ ------------------------------------------------------------------------
251
+
252
+ HONEST EXECUTION (Collateral Valuation #ASG-8942)
253
+ ------------------------------------------------------------------------
254
+ Precedence ✓ ESTABLISHED
255
+ Witness attestation ✗ NOT ESTABLISHED
256
+ Recipe available ✓ ESTABLISHED
257
+ Recipe reproduced ✓ ESTABLISHED
258
+ Historical execution ✗ NOT ESTABLISHED
259
+ Completeness ✗ NOT ESTABLISHED
260
+ ------------------------------------------------------------------------
261
+ CRYPTOGRAPHIC RESULT ✓ ESTABLISHED
262
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
263
+ ↳ Cryptographic integrity is established, but the evidence vector
264
+ does not establish every claim required for historical reliance.
265
+
266
+ ATTACK: POST-HOC INPUT SUBSTITUTION
267
+ Scenario: Operator alters the committed action after execution.
268
+ ------------------------------------------------------------------------
269
+ Original evidence COMMITTED
270
+ Altered input NOT DETECTED
271
+ Commitment relation ✗ BROKEN
272
+ ------------------------------------------------------------------------
273
+ CRYPTOGRAPHIC RESULT ✗ NOT ESTABLISHED
274
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
275
+ ↳ Mechanism: the verifier detects that the claimed execution no longer
276
+ agrees with the committed evidence.
277
+
278
+ ATTACK: SELECTIVE ASSIGNMENT OMISSION
279
+ Scenario: Operator ran 3 models but presents only the favorable run.
280
+ ------------------------------------------------------------------------
281
+ Runs committed 3 (independent assignment record)
282
+ Runs disclosed 1 (presented by operator)
283
+ Assignment disclosure ✗ NOT ESTABLISHED
284
+ ------------------------------------------------------------------------
285
+ CRYPTOGRAPHIC RESULT ✓ ESTABLISHED
286
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
287
+ ↳ Mechanism: the assignment record identifies three committed chains;
288
+ the disclosed artifact contains only one.
289
+ ```
290
+
291
+ Read what it refuses on the honest case. Every cryptographic check passes and evidentiary reliance is still not established, because no witness observed the run and nothing outside the record states how many runs the assignment holds.
292
+
293
+ This block is copied output and can go stale. CI checks it against `code/seal/demo_60s.py` rather than trusting it.
294
+
295
+ ## Verification status
296
+
297
+ The claims in this repository are asserted by CI on every push rather than described. What currently passes:
298
+
299
+ | Check | Status |
300
+ |---|---|
301
+ | Unit and adversarial tests (`code/tests/`) | **196 passing** |
302
+ | Property-based tests (Hypothesis) | Included above, over canonicalization and log invariants |
303
+ | Formal specifications (Z3/SMT, `specs/`) | **4 specs**: Merkle consistency, checkpoint issuance, witness cosigning, assignment issuance |
304
+ | End-to-end demo | Runs clean |
305
+ | Dependency isolation | Asserted — the live package imports `cryptography` and the standard library only |
306
+
307
+ The division of labour is deliberate: **SMT for mathematical invariants** forced by the construction, **property-based testing for input-shaped questions** quantified over arbitrary values, and **unit tests for explicit design rules** somebody chose and could have chosen differently. Each spec proves a safety property over unbounded histories *and* drives the real implementation over concrete traces, because a proof about a model that nothing ties to the code establishes nothing about the code.
308
+
309
+ What this establishes about the repository is limited to the checks above. The scaffold is not production-ready, no hosted custody service exists, the capture layer does not enforce completeness, and independent audit has not been performed.
310
+
311
+ ## Security
312
+
313
+ The security property this project cares about is narrow: a party should not be able to make an epistemic claim true by declaring it. Vulnerability reporting, in-scope and out-of-scope findings, and the documented known limits are in [`SECURITY.md`](SECURITY.md).
314
+
315
+ ## License
316
+
317
+ MIT. See [`LICENSE`](LICENSE).
318
+
319
+ ## Contact
320
+
321
+ eli@semafide.com
@@ -0,0 +1,271 @@
1
+ # Semafide
2
+
3
+ [![CI](https://github.com/besscog13/semafide-seal/actions/workflows/ci.yml/badge.svg)](https://github.com/besscog13/semafide-seal/actions/workflows/ci.yml)
4
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
6
+ [![Status: pre-alpha scaffold](https://img.shields.io/badge/status-pre--alpha%20scaffold-orange.svg)](#verification-status)
7
+ [![Security policy](https://img.shields.io/badge/security-policy-informational.svg)](SECURITY.md)
8
+
9
+ Appraisals and automated valuations get challenged years after they run. By then the data they used may have changed, been corrected, or disappeared, and rerunning the analysis can produce a different number. Semafide is testing whether independent custody can preserve enough evidence to establish what actually happened.
10
+
11
+ Mortgage lending is the first market this is tested against, not the only one, because it was inexpensive to test.
12
+
13
+ ## What a partner should look at first
14
+
15
+ Not a library clone. One sealed run, and what an examiner is allowed to say about it.
16
+
17
+ `python -m seal.demo_60s` walks an honest valuation on assignment `ASG-8942`, then two attacks. On the honest case the verifier prints:
18
+
19
+ ```
20
+ HONEST EXECUTION (Collateral Valuation #ASG-8942)
21
+ ------------------------------------------------------------------------
22
+ Precedence ✓ ESTABLISHED
23
+ Witness attestation ✗ NOT ESTABLISHED
24
+ Recipe available ✓ ESTABLISHED
25
+ Recipe reproduced ✓ ESTABLISHED
26
+ Historical execution ✗ NOT ESTABLISHED
27
+ Completeness ✗ NOT ESTABLISHED
28
+ ------------------------------------------------------------------------
29
+ CRYPTOGRAPHIC RESULT ✓ ESTABLISHED
30
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
31
+ ```
32
+
33
+ An examiner can say the evidence commitment predates the seal, and that a pinned recipe later reproduced the sealed output. An examiner cannot say a witness observed the run, that historical execution is established, or that this was the only run in the assignment. Cryptographic integrity is not evidentiary reliance.
34
+
35
+ That refusal is the product. The rest of this README is the argument underneath it.
36
+
37
+ **See it run** (sixty seconds, built for someone outside the project):
38
+
39
+ ```bash
40
+ cd code
41
+ pip install -r seal/requirements.txt
42
+ python -m seal.demo_60s
43
+ ```
44
+
45
+ Talk: eli@semafide.com
46
+
47
+ ## Built / unbuilt
48
+
49
+ | | Status |
50
+ |---|---|
51
+ | Verifier for five independent propositions | **Built** |
52
+ | Capture scaffold that seals a decorated function call into a chain | **Built** |
53
+ | Assignment checkpoint and disclosure check | **Built** as a model |
54
+ | Hosted production custody service | **Unbuilt** |
55
+ | Enforcement that every run in an assignment reaches the chain | **Unbuilt** — an undecorated call is invisible |
56
+ | Independent operational witness | **Unbuilt** |
57
+
58
+ The intended architecture places the evidentiary record outside the control of the party that produced the analysis.
59
+
60
+ ## What an examiner can and cannot say
61
+
62
+ The verifier records five independent propositions. They are not a ladder.
63
+
64
+ | Proposition | What it establishes | What it does not establish |
65
+ |---|---|---|
66
+ | Precedence | The evidence commitment predates the run seal. | The analysis consumed that evidence. |
67
+ | Witness attestation | A separately trusted witness key signed an observed-execution attestation covering the run, evidence, action, and capture reference. | That the witness organization is operationally independent or truthful. |
68
+ | Recipe availability | A complete recipe is present and linked to the claimed evidence and action. | That it has been executed. |
69
+ | Recipe reproduction | A verifier later produced the sealed output from that recipe. | That the historical execution ran the recipe. |
70
+ | Historical execution established | A valid observed-execution witness attestation covers the relation. | General custody completeness or substantive correctness. |
71
+
72
+ Successful re-derivation does not make `historical_execution_established` true. A generic signature over a supplied bundle does not make `witness_attestation` true.
73
+
74
+ This table and [`docs/claim-vocabulary.md`](docs/claim-vocabulary.md) are the source for these five names.
75
+
76
+ Further reading, after the table: [`docs/demos/README.md`](docs/demos/README.md) (worked example to architecture), [`docs/executive-thesis.md`](docs/executive-thesis.md) (commercial thesis), and the [system map](https://besscog13.github.io/semafide-seal/) generated from [`docs/semafide.architecture.json`](docs/semafide.architecture.json). The interactive [design canvas](https://claude.ai/code/artifact/24c8c27e-a797-4cca-851a-ac95dfe9f88a) assumes this table.
77
+
78
+ ## The problem
79
+
80
+ Mortgage valuation increasingly relies on software and data sources that can change after an analysis runs. Automated valuation models can use public records, listings, market data, and other inputs. Appraisers can use statistical analysis and regression-based methods to support adjustments. The underlying data, tools, and model versions may change, be corrected, or become unavailable.
81
+
82
+ When a repurchase demand, regulatory examination, or dispute arrives later, rerunning the analysis can produce a different result. The historical execution may have depended on a state that is no longer available in the same form.
83
+
84
+ The interagency Quality Control Standards for Automated Valuation Models became effective October 1, 2025. For covered mortgage originators and secondary market issuers, the rule requires policies, practices, procedures, and control systems designed to comply with specified quality-control standards, including protection against the manipulation of data. The rule does not itself prescribe Semafide's evidence model. Separately, Fannie Mae's Selling Guide requires appraisal reports dated on or after March 1, 2025 to summarize the data sources, tools, and techniques used to support time adjustments. Semafide's narrower question is whether the underlying execution state can later be established rather than merely asserted.
85
+
86
+ ## Authorization and admissibility
87
+
88
+ Authorization is prospective and structural. It asks whether an action is permitted and whether the output conforms: schema validity, licence currency, a passing risk score, the required checks completed.
89
+
90
+ Admissibility asks a different question. If a transaction is challenged three years from now, can the data state it rested on be established?
91
+
92
+ The question is adjudicated retrospectively, but the evidence needed to answer it has to be preserved prospectively. An analysis cannot be made historically reproducible after the relevant state has disappeared. The system that produced the analysis also cannot provide independent evidence of the completeness of its own record without some external control over that record.
93
+
94
+ ## The principle
95
+
96
+ A record showing that an analysis and its inputs sat together in one file is not evidence that the output was derived from those inputs at that moment. **Co-occurrence is not binding.**
97
+
98
+ A prior evidence commitment establishes precedence: the evidence commitment existed in the chain before the run seal that names it. That rules out selecting the committed evidence after seeing the output. It does not by itself prove that the analysis actually consumed those inputs.
99
+
100
+ ## Why custody rather than a file
101
+
102
+ The obvious design hands the appraiser or institution a signed artifact to keep. A signature does not solve completeness.
103
+
104
+ A signature proves that what a document contains has not been altered, assuming the signing key and verification process are trusted. It cannot prove that the document contains everything. Completeness is a claim about what is absent, and the party deciding what to disclose can also decide what to omit. Run five analyses, seal all five, and disclose the three that support the conclusion. Each of the three can verify perfectly. Nothing inside them establishes that the other two existed.
105
+
106
+ Timestamping does not close this. A timestamp can establish that a particular document existed by a stated time. It says nothing about documents nobody was shown. Timestamp all five runs and hand over three, and all three still verify.
107
+
108
+ Splitting the work across five separate records does not help. Each record can be internally complete and authentic while the disclosure remains incomplete.
109
+
110
+ The intended custody architecture addresses that problem by putting assignment-level disclosure outside the control of the party being examined. An examiner can then ask the custodian how many runs and records it received and compare that statement with the supplied artifact. This is a custody property, not something a signature alone provides.
111
+
112
+ The same limit applies to watermarks and to Content Credentials, which travel attached to the artifact and therefore remain with whoever chooses which artifacts to hand over. Longer version in [`docs/watermarking.md`](docs/watermarking.md).
113
+
114
+ The current repository implements the verification side of that model, plus a capture scaffold that seals a decorated function call into a chain and self-checks it against that verifier. It does not implement a hosted production custody service, and the capture scaffold does not enforce that every run in an assignment reaches the chain: an undecorated call is invisible, and a manifest never handed to a custodian is not one anybody can count.
115
+
116
+ ## How the intended architecture integrates
117
+
118
+ Semafide sits at the application boundary. Upstream analytical software would submit an execution manifest carrying the evidence commitment, parameter set, tool and model version, and output.
119
+
120
+ The manifest can also carry a re-derivation recipe. The current schema requires a pinned endpoint and version, the exact invocation, the input reference, the expected output digest, and a service window. A verifier can later execute the recipe and compare the produced output with the sealed output when the partner still serves that environment.
121
+
122
+ Successful re-derivation establishes reproducibility of the claimed execution recipe. It does not, standing alone, establish that the historical execution used that recipe. Historical capture and custody are the remaining operational layer.
123
+
124
+ The intended examiner workflow has two distinct statements. One concerns the supplied chain and its completeness. The other concerns the assignment-level disclosure: how many chains the assignment contains and what the custodian says it holds. The latter must come from a party other than the sealer. Without that independent statement, the verifier reports that assignment disclosure was not checked rather than treating the artifact as complete.
125
+
126
+ Each analysis is committed to its assignment when the chain opens, rather than being assigned at certification. The anchor fixes the assignment before later entries are added. This prevents a completed chain from being relabelled after the fact. It does not establish that the assignment contains no sibling chains; that requires an assignment-level disclosure from outside the chain.
127
+
128
+ ## External time
129
+
130
+ The time a record states is a value chosen by its author. A chain assembled today can therefore contain timestamps from last year and still have internally valid signatures.
131
+
132
+ A conventional timestamp authority addresses a different side of the problem. It can establish that a particular document existed no later than the time asserted by the timestamp token. It does not establish that the document did not exist earlier.
133
+
134
+ The repository therefore models two external bounds. An upper bound comes from an external time authority. A lower bound comes from a published unpredictable value that could not have been known before it was issued. If both are available and independently resolved, the verifier reports the resulting interval rather than treating the author's timestamp as historical proof.
135
+
136
+ The current package models these bounds but does not itself provide a production RFC 3161 service or a production beacon. Those are deployment dependencies.
137
+
138
+ ## What it does not do
139
+
140
+ **Custody, not judgment.**
141
+
142
+ The intended record is symmetric evidence. It should document a flawed analysis as faithfully as a sound one. It does not establish that the inputs were well chosen, that an appraisal conclusion was correct, or that an automated decision was substantively sound.
143
+
144
+ It also does not claim that successful re-derivation proves historical execution. The strongest historical claim requires capture at the time of execution and a custody arrangement that prevents the interested party from selecting the evidence after seeing the outcome.
145
+
146
+ Custody carries costs that a file handed over does not. A production guarantee would depend on Semafide continuing to operate, a custodian preserving the records it received, and partners keeping pinned execution environments available. Those are operational and contractual dependencies, not consequences of cryptography alone.
147
+
148
+ Collusion remains an operational question. An append-only log can make later equivocation detectable when its consistency proofs are checked. Independent witnesses can make conflicting views harder to maintain without detection. The deployment still has to establish who the witnesses are, whether they are independent, and whether anyone checks what they signed.
149
+
150
+ ## About this repository
151
+
152
+ `code/seal/` contains the artifact schema, checkpoint formats, external time-bound models, append-only log primitives, witness machinery, standalone verifier, and a capture scaffold (`code/seal/capture/`) that seals a live function call into a real artifact and self-checks it against the verifier. It holds one chain open per assignment so that sequence numbers and prev-hash linkage run unbroken across calls, which makes an omitted run detectable rather than merely undesirable. What it does not do is site a witness on the operator's machine or establish how many runs an assignment holds: the decorator is opt-in per function, an undecorated call is invisible, and a chain never handed to a custodian is not a chain anybody can count. There is no hosted production custody service.
153
+
154
+ The verifier reports the epistemic propositions above and nothing else in that register. An earlier revision of this package also exposed `BindingLevel`, a single derived value that collapsed the five propositions into one rung on a lossy summary ladder; it has been removed, since it could not even represent the strongest of the five claims and every place it could mislead a reader was easier to fix by removing it than by re-caveating it again.
155
+
156
+ The verifier also reports chain completeness, assignment disclosure, external time bounds, and input-retention determinations. These answer different questions. Completeness asks whether a supplied chain is whole. Disclosure asks whether the chain is the whole assignment. Anchoring asks what external evidence constrains when the chain existed. Retention asks whether the operator could have kept the input, which determines whether re-derivation provides something beyond a locally retained and timestamped copy.
157
+
158
+ A green verification result is not a claim that the underlying model, appraisal, or business decision was correct. It means the artifact satisfied the particular checks the verifier performed against the evidence supplied to it.
159
+
160
+ The package also documents known limits. The current re-derivation recipe pins the endpoint, tool, version, invocation, input reference, output digest, and service window, but does not yet pin the full execution environment, numerical libraries, hardware, or linked BLAS. A later mismatch can therefore reflect environmental drift rather than a changed analysis. The verifier fails conservatively rather than converting that uncertainty into a clean pass.
161
+
162
+ The package deliberately does not present its experimental transparency-log implementation as a production foundation. Production deployments should use established transparency-log and witness specifications rather than treating this scaffold as a replacement for them.
163
+
164
+ It depends on `cryptography` alone.
165
+
166
+ ## Reproduce the verifier
167
+
168
+ ```bash
169
+ git clone https://github.com/besscog13/semafide-seal.git
170
+ cd semafide-seal
171
+ pip install -e .
172
+
173
+ python -m seal.demo # the guided walkthrough
174
+ python -m seal.demo_60s # a 60-second external-facing walkthrough: honest execution, tamper detection, and a selective-disclosure attack
175
+ ```
176
+
177
+ The demo exercises the verifier against cases including truncation, assignment-level disclosure, retention determinations, and time-bound failures. It is the fastest way to see what the verifier refuses to grant.
178
+
179
+ `demo_60s` is a shorter presentation layer over the same real verifier, built for showing someone outside the project what it establishes and what it catches, rather than for diagnostic depth.
180
+
181
+ To run the checks yourself:
182
+
183
+ ```bash
184
+ pip install -e ".[test]"
185
+ pytest # unit, adversarial, and property-based tests
186
+
187
+ pip install -e ".[specs]"
188
+ python specs/SPEC_merkle_consistency.py # each spec exits 0 or 1
189
+ ```
190
+
191
+ ## What the demo prints
192
+
193
+ `python -m seal.demo_60s`, verbatim:
194
+
195
+ ```
196
+
197
+ ------------------------------------------------------------------------
198
+ SEMAFIDE
199
+ EXECUTION EVIDENCE DEMO
200
+ ------------------------------------------------------------------------
201
+
202
+ HONEST EXECUTION (Collateral Valuation #ASG-8942)
203
+ ------------------------------------------------------------------------
204
+ Precedence ✓ ESTABLISHED
205
+ Witness attestation ✗ NOT ESTABLISHED
206
+ Recipe available ✓ ESTABLISHED
207
+ Recipe reproduced ✓ ESTABLISHED
208
+ Historical execution ✗ NOT ESTABLISHED
209
+ Completeness ✗ NOT ESTABLISHED
210
+ ------------------------------------------------------------------------
211
+ CRYPTOGRAPHIC RESULT ✓ ESTABLISHED
212
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
213
+ ↳ Cryptographic integrity is established, but the evidence vector
214
+ does not establish every claim required for historical reliance.
215
+
216
+ ATTACK: POST-HOC INPUT SUBSTITUTION
217
+ Scenario: Operator alters the committed action after execution.
218
+ ------------------------------------------------------------------------
219
+ Original evidence COMMITTED
220
+ Altered input NOT DETECTED
221
+ Commitment relation ✗ BROKEN
222
+ ------------------------------------------------------------------------
223
+ CRYPTOGRAPHIC RESULT ✗ NOT ESTABLISHED
224
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
225
+ ↳ Mechanism: the verifier detects that the claimed execution no longer
226
+ agrees with the committed evidence.
227
+
228
+ ATTACK: SELECTIVE ASSIGNMENT OMISSION
229
+ Scenario: Operator ran 3 models but presents only the favorable run.
230
+ ------------------------------------------------------------------------
231
+ Runs committed 3 (independent assignment record)
232
+ Runs disclosed 1 (presented by operator)
233
+ Assignment disclosure ✗ NOT ESTABLISHED
234
+ ------------------------------------------------------------------------
235
+ CRYPTOGRAPHIC RESULT ✓ ESTABLISHED
236
+ EVIDENTIARY RELIANCE ✗ NOT ESTABLISHED
237
+ ↳ Mechanism: the assignment record identifies three committed chains;
238
+ the disclosed artifact contains only one.
239
+ ```
240
+
241
+ Read what it refuses on the honest case. Every cryptographic check passes and evidentiary reliance is still not established, because no witness observed the run and nothing outside the record states how many runs the assignment holds.
242
+
243
+ This block is copied output and can go stale. CI checks it against `code/seal/demo_60s.py` rather than trusting it.
244
+
245
+ ## Verification status
246
+
247
+ The claims in this repository are asserted by CI on every push rather than described. What currently passes:
248
+
249
+ | Check | Status |
250
+ |---|---|
251
+ | Unit and adversarial tests (`code/tests/`) | **196 passing** |
252
+ | Property-based tests (Hypothesis) | Included above, over canonicalization and log invariants |
253
+ | Formal specifications (Z3/SMT, `specs/`) | **4 specs**: Merkle consistency, checkpoint issuance, witness cosigning, assignment issuance |
254
+ | End-to-end demo | Runs clean |
255
+ | Dependency isolation | Asserted — the live package imports `cryptography` and the standard library only |
256
+
257
+ The division of labour is deliberate: **SMT for mathematical invariants** forced by the construction, **property-based testing for input-shaped questions** quantified over arbitrary values, and **unit tests for explicit design rules** somebody chose and could have chosen differently. Each spec proves a safety property over unbounded histories *and* drives the real implementation over concrete traces, because a proof about a model that nothing ties to the code establishes nothing about the code.
258
+
259
+ What this establishes about the repository is limited to the checks above. The scaffold is not production-ready, no hosted custody service exists, the capture layer does not enforce completeness, and independent audit has not been performed.
260
+
261
+ ## Security
262
+
263
+ The security property this project cares about is narrow: a party should not be able to make an epistemic claim true by declaring it. Vulnerability reporting, in-scope and out-of-scope findings, and the documented known limits are in [`SECURITY.md`](SECURITY.md).
264
+
265
+ ## License
266
+
267
+ MIT. See [`LICENSE`](LICENSE).
268
+
269
+ ## Contact
270
+
271
+ eli@semafide.com