agdr-mantle 1.0.2__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.
@@ -0,0 +1,229 @@
1
+ <<<<<<< HEAD
2
+ =======
3
+ AgDR-Mantle is dual-licensed. You may use this software under the terms of EITHER
4
+ the Creative Commons Zero v1.0 Universal (CC0 1.0) OR the Apache License 2.0.
5
+
6
+ ================================================================================
7
+ OPTION 1: CREATIVE COMMONS ZERO v1.0 UNIVERSAL (CC0 1.0)
8
+ ================================================================================
9
+
10
+ The person who associated a work with this deed has dedicated the work to the
11
+ public domain by waiving all of his or her rights to the work worldwide under
12
+ copyright law, including all related and neighboring rights, to the extent
13
+ allowed by law.
14
+
15
+ You can copy, modify, distribute and perform the work, even for commercial
16
+ purposes, all without asking permission.
17
+
18
+ Full legal text: https://creativecommons.org/publicdomain/zero/1.0/legalcode
19
+
20
+ ================================================================================
21
+ OPTION 2: APACHE LICENSE, VERSION 2.0
22
+ ================================================================================
23
+
24
+ >>>>>>> c28cf92 (Genesis Release: AgDR-Mantle v1.0.1 - Sub-microsecond GZ Fortification)
25
+ Apache License
26
+ Version 2.0, January 2004
27
+ http://www.apache.org/licenses/
28
+
29
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
30
+
31
+ 1. Definitions.
32
+
33
+ "License" shall mean the terms and conditions for use, reproduction,
34
+ and distribution as defined by Sections 1 through 9 of this document.
35
+
36
+ "Licensor" shall mean the copyright owner or entity authorized by
37
+ the copyright owner that is granting the License.
38
+
39
+ "Legal Entity" shall mean the union of the acting entity and all
40
+ other entities that control, are controlled by, or are under common
41
+ control with that entity. For the purposes of this definition,
42
+ "control" means (i) the power, direct or indirect, to cause the
43
+ direction or management of such entity, whether by contract or
44
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
45
+ outstanding shares, or (iii) beneficial ownership of such entity.
46
+
47
+ "You" (or "Your") shall mean an individual or Legal Entity
48
+ exercising permissions granted by this License.
49
+
50
+ "Source" form shall mean the preferred form for making modifications,
51
+ including but not limited to software source code, documentation
52
+ source, and configuration files.
53
+
54
+ "Object" form shall mean any form resulting from mechanical
55
+ transformation or translation of a Source form, including but
56
+ not limited to compiled object code, generated documentation,
57
+ and conversions to other media types.
58
+
59
+ "Work" shall mean the work of authorship, whether in Source or
60
+ Object form, made available under the License, as indicated by a
61
+ copyright notice that is included in or attached to the work
62
+ (an example is provided in the Appendix below).
63
+
64
+ "Derivative Works" shall mean any work, whether in Source or Object
65
+ form, that is based on (or derived from) the Work and for which the
66
+ editorial revisions, annotations, elaborations, or other modifications
67
+ represent, as a whole, an original work of authorship. For the purposes
68
+ of this License, Derivative Works shall not include works that remain
69
+ separable from, or merely link (or bind by name) to the interfaces of,
70
+ the Work and Derivative Works thereof.
71
+
72
+ "Contribution" shall mean any work of authorship, including
73
+ the original version of the Work and any modifications or additions
74
+ to that Work or Derivative Works thereof, that is intentionally
75
+ submitted to Licensor for inclusion in the Work by the copyright owner
76
+ or by an individual or Legal Entity authorized to submit on behalf of
77
+ the copyright owner. For the purposes of this definition, "submitted"
78
+ means any form of electronic, verbal, or written communication sent
79
+ to the Licensor or its representatives, including but not limited to
80
+ communication on electronic mailing lists, source code control systems,
81
+ and issue tracking systems that are managed by, or on behalf of, the
82
+ Licensor for the purpose of discussing and improving the Work, but
83
+ excluding communication that is conspicuously marked or otherwise
84
+ designated in writing by the copyright owner as "Not a Contribution."
85
+
86
+ "Contributor" shall mean Licensor and any individual or Legal Entity
87
+ on behalf of whom a Contribution has been received by Licensor and
88
+ subsequently incorporated within the Work.
89
+
90
+ 2. Grant of Copyright License. Subject to the terms and conditions of
91
+ this License, each Contributor hereby grants to You a perpetual,
92
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
93
+ copyright license to reproduce, prepare Derivative Works of,
94
+ publicly display, publicly perform, sublicense, and distribute the
95
+ Work and such Derivative Works in Source or Object form.
96
+
97
+ 3. Grant of Patent License. Subject to the terms and conditions of
98
+ this License, each Contributor hereby grants to You a perpetual,
99
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
100
+ (except as stated in this section) patent license to make, have made,
101
+ use, offer to sell, sell, import, and otherwise transfer the Work,
102
+ where such license applies only to those patent claims licensable
103
+ by such Contributor that are necessarily infringed by their
104
+ Contribution(s) alone or by combination of their Contribution(s)
105
+ with the Work to which such Contribution(s) was submitted. If You
106
+ institute patent litigation against any entity (including a
107
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
108
+ or a Contribution incorporated within the Work constitutes direct
109
+ or contributory patent infringement, then any patent licenses
110
+ granted to You under this License for that Work shall terminate
111
+ as of the date such litigation is filed.
112
+
113
+ 4. Redistribution. You may reproduce and distribute copies of the
114
+ Work or Derivative Works thereof in any medium, with or without
115
+ modifications, and in Source or Object form, provided that You
116
+ meet the following conditions:
117
+
118
+ (a) You must give any other recipients of the Work or
119
+ Derivative Works a copy of this License; and
120
+
121
+ (b) You must cause any modified files to carry prominent notices
122
+ stating that You changed the files; and
123
+
124
+ (c) You must retain, in the Source form of any Derivative Works
125
+ that You distribute, all copyright, patent, trademark, and
126
+ attribution notices from the Source form of the Work,
127
+ excluding those notices that do not pertain to any part of
128
+ the Derivative Works; and
129
+
130
+ (d) If the Work includes a "NOTICE" text file as part of its
131
+ distribution, then any Derivative Works that You distribute must
132
+ include a readable copy of the attribution notices contained
133
+ within such NOTICE file, excluding those notices that do not
134
+ pertain to any part of the Derivative Works, in at least one
135
+ of the following places: within a NOTICE text file distributed
136
+ as part of the Derivative Works; within the Source form or
137
+ documentation, if provided along with the Derivative Works; or,
138
+ within a display generated by the Derivative Works, if and
139
+ wherever such third-party notices normally appear. The contents
140
+ of the NOTICE file are for informational purposes only and
141
+ do not modify the License. You may add Your own attribution
142
+ notices within Derivative Works that You distribute, alongside
143
+ or as an addendum to the NOTICE text from the Work, provided
144
+ that such additional attribution notices cannot be construed
145
+ as modifying the License.
146
+
147
+ You may add Your own copyright statement to Your modifications and
148
+ may provide additional or different license terms and conditions
149
+ for use, reproduction, or distribution of Your modifications, or
150
+ for any such Derivative Works as a whole, provided Your use,
151
+ reproduction, and distribution of the Work otherwise complies with
152
+ the conditions stated in this License.
153
+
154
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
155
+ any Contribution intentionally submitted for inclusion in the Work
156
+ by You to the Licensor shall be under the terms and conditions of
157
+ this License, without any additional terms or conditions.
158
+ Notwithstanding the above, nothing herein shall supersede or modify
159
+ the terms of any separate license agreement you may have executed
160
+ with Licensor regarding such Contributions.
161
+
162
+ 6. Trademarks. This License does not grant permission to use the trade
163
+ names, trademarks, service marks, or product names of the Licensor,
164
+ except as required for reasonable and customary use in describing the
165
+ origin of the Work and reproducing the content of the NOTICE file.
166
+
167
+ 7. Disclaimer of Warranty. Unless required by applicable law or
168
+ agreed to in writing, Licensor provides the Work (and each
169
+ Contributor provides its Contributions) on an "AS IS" BASIS,
170
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
171
+ implied, including, without limitation, any warranties or conditions
172
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
173
+ PARTICULAR PURPOSE. You are solely responsible for determining the
174
+ appropriateness of using or redistributing the Work and assume any
175
+ risks associated with Your exercise of permissions under this License.
176
+
177
+ 8. Limitation of Liability. In no event and under no legal theory,
178
+ whether in tort (including negligence), contract, or otherwise,
179
+ unless required by applicable law (such as deliberate and grossly
180
+ negligent acts) or agreed to in writing, shall any Contributor be
181
+ liable to You for damages, including any direct, indirect, special,
182
+ incidental, or consequential damages of any character arising as a
183
+ result of this License or out of the use or inability to use the
184
+ Work (including but not limited to damages for loss of goodwill,
185
+ work stoppage, computer failure or malfunction, or any and all
186
+ other commercial damages or losses), even if such Contributor
187
+ has been advised of the possibility of such damages.
188
+
189
+ 9. Accepting Warranty or Additional Liability. While redistributing
190
+ the Work or Derivative Works thereof, You may choose to offer,
191
+ and charge a fee for, acceptance of support, warranty, indemnity,
192
+ or other liability obligations and/or rights consistent with this
193
+ License. However, in accepting such obligations, You may act only
194
+ on Your own behalf and on Your sole responsibility, not on behalf
195
+ of any other Contributor, and only if You agree to indemnify,
196
+ defend, and hold each Contributor harmless for any liability
197
+ incurred by, or claims asserted against, such Contributor by reason
198
+ of your accepting any such warranty or additional liability.
199
+
200
+ END OF TERMS AND CONDITIONS
201
+
202
+ <<<<<<< HEAD
203
+ APPENDIX: How to apply the Apache License to your work.
204
+
205
+ To apply the Apache License to your work, attach the following
206
+ boilerplate notice, with the fields enclosed by brackets "[]"
207
+ replaced with your own identifying information. (Don't include
208
+ the brackets!) The text should be enclosed in the appropriate
209
+ comment syntax for the file format. We also recommend that a
210
+ file or class name and description of purpose be included on the
211
+ same "printed page" as the copyright notice for easier
212
+ identification within third-party archives.
213
+
214
+ Copyright [yyyy] [name of copyright owner]
215
+ =======
216
+ Copyright 2026 Genesis Glass Foundation / Fondation Genese Cristal
217
+ >>>>>>> c28cf92 (Genesis Release: AgDR-Mantle v1.0.1 - Sub-microsecond GZ Fortification)
218
+
219
+ Licensed under the Apache License, Version 2.0 (the "License");
220
+ you may not use this file except in compliance with the License.
221
+ You may obtain a copy of the License at
222
+
223
+ http://www.apache.org/licenses/LICENSE-2.0
224
+
225
+ Unless required by applicable law or agreed to in writing, software
226
+ distributed under the License is distributed on an "AS IS" BASIS,
227
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228
+ See the License for the specific language governing permissions and
229
+ limitations under the License.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: agdr-mantle
3
+ Version: 1.0.2
4
+ Summary: AgDR-Mantle: Sovereign post-quantum fortification for AgDR-Phoenix output (ML-DSA-65, Sparse Merkle, Brotli)
5
+ Author-email: Genesis Glass Foundation <founding@accountability.ai>
6
+ License-Expression: Apache-2.0 OR CC0-1.0
7
+ Project-URL: Homepage, https://accountability.ai
8
+ Project-URL: Repository, https://github.com/aiccountability-source/AgDR-Mantle
9
+ Project-URL: Specification, https://accountability.ai/agdr-spec
10
+ Keywords: agdr,accountability,post-quantum,ml-dsa,fips-204,evidentiary,sovereign
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Rust
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: numpy
18
+ Requires-Dist: pydantic
19
+ Requires-Dist: blake3
20
+ Requires-Dist: brotli
21
+ Provides-Extra: post-quantum
22
+ Requires-Dist: pqcrypto>=0.4.0; extra == "post-quantum"
23
+ Provides-Extra: self-learning
24
+ Provides-Extra: sovereign
25
+ Dynamic: license-file
26
+
27
+ # AgDR-Mantle v1.0.1
28
+
29
+ Sovereign post-quantum fortification for AgDR records.
30
+
31
+ ## Architecture
32
+
33
+ AgDR-Mantle is the Fortification tier of the AgDR standard. It operates within a three-tier lineage:
34
+
35
+ - **AKI** is the Core. Atomic Kernel Inference is the architectural principle defined in the AgDR specification. It is captured at the moment of decision and carries the PPP triplet (Provenance, Place, Purpose).
36
+ - **AgDR-Phoenix** is the Implementation. The reference Rust engine that realizes the AKI Core in running code at sub-microsecond latency, with kernel monotonic timestamps, Byzantine fault tolerance, and the critic pre-filter.
37
+ - **AgDR-Mantle** is the Fortification. It wraps AgDR-Phoenix output with an optional ML-DSA-65 post-quantum envelope, a sovereign sparse Merkle tree witness, and Brotli-compressed forensic archives for Commonwealth and bandwidth-constrained deployments.
38
+
39
+ ```
40
+ +---------------------------------------------------+
41
+ | AgDR-Mantle : FORTIFICATION |
42
+ | - ML-DSA-65 (FIPS 204) post-quantum envelope |
43
+ | - Sovereign Sparse Merkle Tree witness |
44
+ | - Brotli-compressed forensic archive |
45
+ +---------------------------------------------------+
46
+ | AgDR-Phoenix : IMPLEMENTATION |
47
+ | - Rust AKI engine, sub-microsecond latency |
48
+ | - BFT, critic, PPP capture, kernel timestamps |
49
+ +---------------------------------------------------+
50
+ | AKI : CORE |
51
+ | The architectural invariant. Defined in the |
52
+ | AgDR specification. Captured at decision time. |
53
+ +---------------------------------------------------+
54
+ ```
55
+
56
+ The Phoenix hot path remains classical Ed25519 and is not modified by Mantle. Mantle runs after Phoenix completes. Its operations therefore do not affect AKI latency.
57
+
58
+ ## Features
59
+
60
+ - Optional ML-DSA-65 (FIPS 204) quantum-resistant signature envelope via the pqcrypto library. Opt-in, disabled by default.
61
+ - Sovereign forensic archive using a 256-bit sparse Merkle tree with Brotli compression.
62
+ - Self-learning coherence weighting via exponential moving average (feature-gated).
63
+ - Designed for Commonwealth, Northern, and other bandwidth-constrained jurisdictions requiring quantum-resistant evidentiary signatures today.
64
+
65
+ ## Install
66
+
67
+ ~~~bash
68
+ pip install agdr-mantle
69
+
70
+ # With the post-quantum fortification enabled
71
+ pip install agdr-mantle[post-quantum]
72
+
73
+ # With all optional features
74
+ pip install agdr-mantle[post-quantum,self-learning,sovereign]
75
+ ~~~
76
+
77
+ ## Quick Start
78
+
79
+ ~~~python
80
+ from agdr_mantle import AgDRMantle
81
+
82
+ # Classical AKI only (fastest configuration)
83
+ engine = AgDRMantle(fo_i="Accountability (Toronto)")
84
+
85
+ # With ML-DSA-65 post-quantum fortification enabled
86
+ engine = AgDRMantle(
87
+ fo_i="Accountability (Toronto)",
88
+ enable_pq=True,
89
+ enable_self_learning=True,
90
+ enable_sovereign=True,
91
+ )
92
+
93
+ ppp = {"provenance": "...", "place": "Toronto, ON", "purpose": "Accountability review"}
94
+ sealed_record = engine.seal(ppp)
95
+
96
+ # Verify the post-quantum fortification envelope
97
+ if sealed_record["pq_applied"]:
98
+ envelope = bytes.fromhex(sealed_record["aki_seal"])
99
+ assert engine.pq.verify(envelope)
100
+ ~~~
101
+
102
+ ## Post-Quantum Fortification Notes
103
+
104
+ - Algorithm: ML-DSA-65 (NIST FIPS 204, Security Level 3, 192-bit classical equivalent strength).
105
+ - Signature size: 3,309 bytes per envelope.
106
+ - Public key size: 1,952 bytes. Private key size: 4,032 bytes.
107
+ - Library: pqcrypto v0.4.0 or later. The pqcrypto package wraps the pqclean reference C implementations and ships pre-compiled wheels for common platforms.
108
+ - Envelope format: `[seal_length][classical_seal][MAGIC][pubkey_length][pubkey][sig_length][signature]`.
109
+ - Keys: ephemeral per-instance by default. Production deployments should inject long-term keys through the `pq_keypair` constructor parameter.
110
+
111
+ ## Performance
112
+
113
+ Measured on commodity hardware:
114
+
115
+ | Operation | Latency |
116
+ |---|---|
117
+ | ML-DSA-65 keygen | around 0.3 ms |
118
+ | Sign and wrap | around 1 ms |
119
+ | Verify | around 0.2 ms |
120
+
121
+ The fortification layer runs downstream of AgDR-Phoenix. The Phoenix hot path latency is unaffected.
122
+
123
+ ## Related Artifacts
124
+
125
+ - AgDR Specification
126
+ - AgDR-Phoenix (the AKI Implementation)
127
+ - Eternal Witness v3.0 (forensic permanence layer)
128
+
129
+ ## License
130
+
131
+ Dual-licensed under your choice of:
132
+
133
+ - Creative Commons Zero v1.0 Universal (CC0 1.0)
134
+ - Apache License 2.0
135
+
136
+ See the LICENSE file for full terms.
137
+
138
+ ## About
139
+
140
+ AgDR-Mantle is published by the Genesis Glass Foundation (Fondation Genese Cristal), a federally incorporated Canadian not-for-profit stewarding the AgDR open standard through accountability.ai.
@@ -0,0 +1,114 @@
1
+ # AgDR-Mantle v1.0.1
2
+
3
+ Sovereign post-quantum fortification for AgDR records.
4
+
5
+ ## Architecture
6
+
7
+ AgDR-Mantle is the Fortification tier of the AgDR standard. It operates within a three-tier lineage:
8
+
9
+ - **AKI** is the Core. Atomic Kernel Inference is the architectural principle defined in the AgDR specification. It is captured at the moment of decision and carries the PPP triplet (Provenance, Place, Purpose).
10
+ - **AgDR-Phoenix** is the Implementation. The reference Rust engine that realizes the AKI Core in running code at sub-microsecond latency, with kernel monotonic timestamps, Byzantine fault tolerance, and the critic pre-filter.
11
+ - **AgDR-Mantle** is the Fortification. It wraps AgDR-Phoenix output with an optional ML-DSA-65 post-quantum envelope, a sovereign sparse Merkle tree witness, and Brotli-compressed forensic archives for Commonwealth and bandwidth-constrained deployments.
12
+
13
+ ```
14
+ +---------------------------------------------------+
15
+ | AgDR-Mantle : FORTIFICATION |
16
+ | - ML-DSA-65 (FIPS 204) post-quantum envelope |
17
+ | - Sovereign Sparse Merkle Tree witness |
18
+ | - Brotli-compressed forensic archive |
19
+ +---------------------------------------------------+
20
+ | AgDR-Phoenix : IMPLEMENTATION |
21
+ | - Rust AKI engine, sub-microsecond latency |
22
+ | - BFT, critic, PPP capture, kernel timestamps |
23
+ +---------------------------------------------------+
24
+ | AKI : CORE |
25
+ | The architectural invariant. Defined in the |
26
+ | AgDR specification. Captured at decision time. |
27
+ +---------------------------------------------------+
28
+ ```
29
+
30
+ The Phoenix hot path remains classical Ed25519 and is not modified by Mantle. Mantle runs after Phoenix completes. Its operations therefore do not affect AKI latency.
31
+
32
+ ## Features
33
+
34
+ - Optional ML-DSA-65 (FIPS 204) quantum-resistant signature envelope via the pqcrypto library. Opt-in, disabled by default.
35
+ - Sovereign forensic archive using a 256-bit sparse Merkle tree with Brotli compression.
36
+ - Self-learning coherence weighting via exponential moving average (feature-gated).
37
+ - Designed for Commonwealth, Northern, and other bandwidth-constrained jurisdictions requiring quantum-resistant evidentiary signatures today.
38
+
39
+ ## Install
40
+
41
+ ~~~bash
42
+ pip install agdr-mantle
43
+
44
+ # With the post-quantum fortification enabled
45
+ pip install agdr-mantle[post-quantum]
46
+
47
+ # With all optional features
48
+ pip install agdr-mantle[post-quantum,self-learning,sovereign]
49
+ ~~~
50
+
51
+ ## Quick Start
52
+
53
+ ~~~python
54
+ from agdr_mantle import AgDRMantle
55
+
56
+ # Classical AKI only (fastest configuration)
57
+ engine = AgDRMantle(fo_i="Accountability (Toronto)")
58
+
59
+ # With ML-DSA-65 post-quantum fortification enabled
60
+ engine = AgDRMantle(
61
+ fo_i="Accountability (Toronto)",
62
+ enable_pq=True,
63
+ enable_self_learning=True,
64
+ enable_sovereign=True,
65
+ )
66
+
67
+ ppp = {"provenance": "...", "place": "Toronto, ON", "purpose": "Accountability review"}
68
+ sealed_record = engine.seal(ppp)
69
+
70
+ # Verify the post-quantum fortification envelope
71
+ if sealed_record["pq_applied"]:
72
+ envelope = bytes.fromhex(sealed_record["aki_seal"])
73
+ assert engine.pq.verify(envelope)
74
+ ~~~
75
+
76
+ ## Post-Quantum Fortification Notes
77
+
78
+ - Algorithm: ML-DSA-65 (NIST FIPS 204, Security Level 3, 192-bit classical equivalent strength).
79
+ - Signature size: 3,309 bytes per envelope.
80
+ - Public key size: 1,952 bytes. Private key size: 4,032 bytes.
81
+ - Library: pqcrypto v0.4.0 or later. The pqcrypto package wraps the pqclean reference C implementations and ships pre-compiled wheels for common platforms.
82
+ - Envelope format: `[seal_length][classical_seal][MAGIC][pubkey_length][pubkey][sig_length][signature]`.
83
+ - Keys: ephemeral per-instance by default. Production deployments should inject long-term keys through the `pq_keypair` constructor parameter.
84
+
85
+ ## Performance
86
+
87
+ Measured on commodity hardware:
88
+
89
+ | Operation | Latency |
90
+ |---|---|
91
+ | ML-DSA-65 keygen | around 0.3 ms |
92
+ | Sign and wrap | around 1 ms |
93
+ | Verify | around 0.2 ms |
94
+
95
+ The fortification layer runs downstream of AgDR-Phoenix. The Phoenix hot path latency is unaffected.
96
+
97
+ ## Related Artifacts
98
+
99
+ - AgDR Specification
100
+ - AgDR-Phoenix (the AKI Implementation)
101
+ - Eternal Witness v3.0 (forensic permanence layer)
102
+
103
+ ## License
104
+
105
+ Dual-licensed under your choice of:
106
+
107
+ - Creative Commons Zero v1.0 Universal (CC0 1.0)
108
+ - Apache License 2.0
109
+
110
+ See the LICENSE file for full terms.
111
+
112
+ ## About
113
+
114
+ AgDR-Mantle is published by the Genesis Glass Foundation (Fondation Genese Cristal), a federally incorporated Canadian not-for-profit stewarding the AgDR open standard through accountability.ai.
@@ -0,0 +1,35 @@
1
+ [project]
2
+ name = "agdr-mantle"
3
+ version = "1.0.2"
4
+ description = "AgDR-Mantle: Sovereign post-quantum fortification for AgDR-Phoenix output (ML-DSA-65, Sparse Merkle, Brotli)"
5
+ readme = "README.md"
6
+ license = "Apache-2.0 OR CC0-1.0"
7
+ authors = [{name = "Genesis Glass Foundation", email = "founding@accountability.ai"}]
8
+ requires-python = ">=3.9"
9
+ keywords = ["agdr", "accountability", "post-quantum", "ml-dsa", "fips-204", "evidentiary", "sovereign"]
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Programming Language :: Rust",
13
+ "Topic :: Security :: Cryptography",
14
+ ]
15
+ dependencies = [
16
+ "numpy",
17
+ "pydantic",
18
+ "blake3",
19
+ "brotli",
20
+ ]
21
+
22
+ [project.optional-dependencies]
23
+ post-quantum = ["pqcrypto>=0.4.0"]
24
+ self-learning = []
25
+ sovereign = []
26
+
27
+ [project.urls]
28
+ Homepage = "https://accountability.ai"
29
+ Repository = "https://github.com/aiccountability-source/AgDR-Mantle"
30
+ Specification = "https://accountability.ai/agdr-spec"
31
+
32
+ [tool.maturin]
33
+ bindings = "pyo3"
34
+ module-name = "agdr_mantle._core"
35
+ python-source = "python"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: agdr-mantle
3
+ Version: 1.0.2
4
+ Summary: AgDR-Mantle: Sovereign post-quantum fortification for AgDR-Phoenix output (ML-DSA-65, Sparse Merkle, Brotli)
5
+ Author-email: Genesis Glass Foundation <founding@accountability.ai>
6
+ License-Expression: Apache-2.0 OR CC0-1.0
7
+ Project-URL: Homepage, https://accountability.ai
8
+ Project-URL: Repository, https://github.com/aiccountability-source/AgDR-Mantle
9
+ Project-URL: Specification, https://accountability.ai/agdr-spec
10
+ Keywords: agdr,accountability,post-quantum,ml-dsa,fips-204,evidentiary,sovereign
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Rust
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: numpy
18
+ Requires-Dist: pydantic
19
+ Requires-Dist: blake3
20
+ Requires-Dist: brotli
21
+ Provides-Extra: post-quantum
22
+ Requires-Dist: pqcrypto>=0.4.0; extra == "post-quantum"
23
+ Provides-Extra: self-learning
24
+ Provides-Extra: sovereign
25
+ Dynamic: license-file
26
+
27
+ # AgDR-Mantle v1.0.1
28
+
29
+ Sovereign post-quantum fortification for AgDR records.
30
+
31
+ ## Architecture
32
+
33
+ AgDR-Mantle is the Fortification tier of the AgDR standard. It operates within a three-tier lineage:
34
+
35
+ - **AKI** is the Core. Atomic Kernel Inference is the architectural principle defined in the AgDR specification. It is captured at the moment of decision and carries the PPP triplet (Provenance, Place, Purpose).
36
+ - **AgDR-Phoenix** is the Implementation. The reference Rust engine that realizes the AKI Core in running code at sub-microsecond latency, with kernel monotonic timestamps, Byzantine fault tolerance, and the critic pre-filter.
37
+ - **AgDR-Mantle** is the Fortification. It wraps AgDR-Phoenix output with an optional ML-DSA-65 post-quantum envelope, a sovereign sparse Merkle tree witness, and Brotli-compressed forensic archives for Commonwealth and bandwidth-constrained deployments.
38
+
39
+ ```
40
+ +---------------------------------------------------+
41
+ | AgDR-Mantle : FORTIFICATION |
42
+ | - ML-DSA-65 (FIPS 204) post-quantum envelope |
43
+ | - Sovereign Sparse Merkle Tree witness |
44
+ | - Brotli-compressed forensic archive |
45
+ +---------------------------------------------------+
46
+ | AgDR-Phoenix : IMPLEMENTATION |
47
+ | - Rust AKI engine, sub-microsecond latency |
48
+ | - BFT, critic, PPP capture, kernel timestamps |
49
+ +---------------------------------------------------+
50
+ | AKI : CORE |
51
+ | The architectural invariant. Defined in the |
52
+ | AgDR specification. Captured at decision time. |
53
+ +---------------------------------------------------+
54
+ ```
55
+
56
+ The Phoenix hot path remains classical Ed25519 and is not modified by Mantle. Mantle runs after Phoenix completes. Its operations therefore do not affect AKI latency.
57
+
58
+ ## Features
59
+
60
+ - Optional ML-DSA-65 (FIPS 204) quantum-resistant signature envelope via the pqcrypto library. Opt-in, disabled by default.
61
+ - Sovereign forensic archive using a 256-bit sparse Merkle tree with Brotli compression.
62
+ - Self-learning coherence weighting via exponential moving average (feature-gated).
63
+ - Designed for Commonwealth, Northern, and other bandwidth-constrained jurisdictions requiring quantum-resistant evidentiary signatures today.
64
+
65
+ ## Install
66
+
67
+ ~~~bash
68
+ pip install agdr-mantle
69
+
70
+ # With the post-quantum fortification enabled
71
+ pip install agdr-mantle[post-quantum]
72
+
73
+ # With all optional features
74
+ pip install agdr-mantle[post-quantum,self-learning,sovereign]
75
+ ~~~
76
+
77
+ ## Quick Start
78
+
79
+ ~~~python
80
+ from agdr_mantle import AgDRMantle
81
+
82
+ # Classical AKI only (fastest configuration)
83
+ engine = AgDRMantle(fo_i="Accountability (Toronto)")
84
+
85
+ # With ML-DSA-65 post-quantum fortification enabled
86
+ engine = AgDRMantle(
87
+ fo_i="Accountability (Toronto)",
88
+ enable_pq=True,
89
+ enable_self_learning=True,
90
+ enable_sovereign=True,
91
+ )
92
+
93
+ ppp = {"provenance": "...", "place": "Toronto, ON", "purpose": "Accountability review"}
94
+ sealed_record = engine.seal(ppp)
95
+
96
+ # Verify the post-quantum fortification envelope
97
+ if sealed_record["pq_applied"]:
98
+ envelope = bytes.fromhex(sealed_record["aki_seal"])
99
+ assert engine.pq.verify(envelope)
100
+ ~~~
101
+
102
+ ## Post-Quantum Fortification Notes
103
+
104
+ - Algorithm: ML-DSA-65 (NIST FIPS 204, Security Level 3, 192-bit classical equivalent strength).
105
+ - Signature size: 3,309 bytes per envelope.
106
+ - Public key size: 1,952 bytes. Private key size: 4,032 bytes.
107
+ - Library: pqcrypto v0.4.0 or later. The pqcrypto package wraps the pqclean reference C implementations and ships pre-compiled wheels for common platforms.
108
+ - Envelope format: `[seal_length][classical_seal][MAGIC][pubkey_length][pubkey][sig_length][signature]`.
109
+ - Keys: ephemeral per-instance by default. Production deployments should inject long-term keys through the `pq_keypair` constructor parameter.
110
+
111
+ ## Performance
112
+
113
+ Measured on commodity hardware:
114
+
115
+ | Operation | Latency |
116
+ |---|---|
117
+ | ML-DSA-65 keygen | around 0.3 ms |
118
+ | Sign and wrap | around 1 ms |
119
+ | Verify | around 0.2 ms |
120
+
121
+ The fortification layer runs downstream of AgDR-Phoenix. The Phoenix hot path latency is unaffected.
122
+
123
+ ## Related Artifacts
124
+
125
+ - AgDR Specification
126
+ - AgDR-Phoenix (the AKI Implementation)
127
+ - Eternal Witness v3.0 (forensic permanence layer)
128
+
129
+ ## License
130
+
131
+ Dual-licensed under your choice of:
132
+
133
+ - Creative Commons Zero v1.0 Universal (CC0 1.0)
134
+ - Apache License 2.0
135
+
136
+ See the LICENSE file for full terms.
137
+
138
+ ## About
139
+
140
+ AgDR-Mantle is published by the Genesis Glass Foundation (Fondation Genese Cristal), a federally incorporated Canadian not-for-profit stewarding the AgDR open standard through accountability.ai.
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/agdr_mantle.egg-info/PKG-INFO
5
+ src/agdr_mantle.egg-info/SOURCES.txt
6
+ src/agdr_mantle.egg-info/dependency_links.txt
7
+ src/agdr_mantle.egg-info/requires.txt
8
+ src/agdr_mantle.egg-info/top_level.txt
9
+ tests/test_mantle.py
@@ -0,0 +1,11 @@
1
+ numpy
2
+ pydantic
3
+ blake3
4
+ brotli
5
+
6
+ [post-quantum]
7
+ pqcrypto>=0.4.0
8
+
9
+ [self-learning]
10
+
11
+ [sovereign]
@@ -0,0 +1,105 @@
1
+ """Tests for AgDR-Mantle v1.0.1."""
2
+ import pytest
3
+ from agdr_mantle import CommonwealthEternalWitness
4
+ from agdr_mantle.brotli_compress import (
5
+ compress_forensic_bundle,
6
+ decompress_forensic_bundle,
7
+ )
8
+
9
+ try:
10
+ from agdr_mantle.pq_fortification import (
11
+ PQFortification,
12
+ PQCRYPTO_AVAILABLE,
13
+ PQ_MAGIC,
14
+ ML_DSA_65_PUBKEY_SIZE,
15
+ )
16
+ except ImportError:
17
+ PQCRYPTO_AVAILABLE = False
18
+
19
+ try:
20
+ from agdr_mantle import AgDRMantle
21
+ AGDR_CORE_AVAILABLE = True
22
+ except ImportError:
23
+ AGDR_CORE_AVAILABLE = False
24
+
25
+
26
+ # ----- Fortification layer tests (pure Python, no Rust required) -----
27
+
28
+ def test_brotli_roundtrip():
29
+ """Brotli compression round-trips AgDR forensic data."""
30
+ original = b"AgDR-Mantle forensic data " * 100
31
+ compressed = compress_forensic_bundle(original)
32
+ decompressed = decompress_forensic_bundle(compressed)
33
+ assert decompressed == original
34
+ assert len(compressed) < len(original)
35
+
36
+
37
+ def test_sovereign_witness_basic():
38
+ """Sovereign witness produces 32-byte SMT root for captured records."""
39
+ witness = CommonwealthEternalWitness(nemoclaw_mode=False)
40
+ rec = witness.capture_medical("agent_doctor_1", "patient_001", "Clinical reasoning trace")
41
+ assert rec["adr_id"] == "adr_med_0"
42
+ assert len(bytes.fromhex(rec["smt_root"])) == 32
43
+ assert rec["compression_ratio"] < 1.0
44
+
45
+
46
+ @pytest.mark.skipif(not PQCRYPTO_AVAILABLE, reason="pqcrypto not installed")
47
+ def test_pq_fortification_sizes():
48
+ """ML-DSA-65 keypair matches FIPS 204 specification sizes."""
49
+ fortification = PQFortification()
50
+ assert len(fortification.public_key) == ML_DSA_65_PUBKEY_SIZE
51
+
52
+
53
+ @pytest.mark.skipif(not PQCRYPTO_AVAILABLE, reason="pqcrypto not installed")
54
+ def test_pq_fortification_wrap_and_verify():
55
+ """ML-DSA-65 envelope wraps, verifies, and extracts correctly."""
56
+ fortification = PQFortification()
57
+ aki_seal = b"ATOMIC_KERNEL_INFERENCE_SEAL_PLACEHOLDER"
58
+ envelope = fortification.wrap(aki_seal)
59
+
60
+ assert PQ_MAGIC in envelope
61
+ assert fortification.verify(envelope) is True
62
+
63
+ extracted = PQFortification.extract_aki_seal(envelope)
64
+ assert extracted == aki_seal
65
+
66
+
67
+ @pytest.mark.skipif(not PQCRYPTO_AVAILABLE, reason="pqcrypto not installed")
68
+ def test_pq_fortification_tamper_detection():
69
+ """Tampered envelopes fail verification."""
70
+ fortification = PQFortification()
71
+ aki_seal = b"original_seal_bytes"
72
+ envelope = bytearray(fortification.wrap(aki_seal))
73
+
74
+ envelope[-10] ^= 0xFF
75
+ assert fortification.verify(bytes(envelope)) is False
76
+
77
+
78
+ # ----- Full engine tests (require Rust _core extension) -----
79
+
80
+ @pytest.mark.skipif(not AGDR_CORE_AVAILABLE, reason="Rust _core extension not built")
81
+ def test_mantle_engine_classical_only():
82
+ """AgDRMantle engine with fortification disabled."""
83
+ engine = AgDRMantle(enable_pq=False, enable_self_learning=False, enable_sovereign=False)
84
+ result = engine.seal({"provenance": "test", "place": "Toronto", "purpose": "test"})
85
+ assert "aki_seal" in result
86
+ assert result["pq_applied"] is False
87
+ assert result["tier_breakdown"]["core_aki"] == "captured"
88
+ assert result["tier_breakdown"]["implementation_phoenix"] == "sealed"
89
+ assert result["tier_breakdown"]["fortification_mantle"] == "not_applied"
90
+
91
+
92
+ @pytest.mark.skipif(
93
+ not (AGDR_CORE_AVAILABLE and PQCRYPTO_AVAILABLE),
94
+ reason="Rust _core and pqcrypto both required",
95
+ )
96
+ def test_mantle_engine_with_fortification():
97
+ """End-to-end: AgDRMantle with full fortification enabled."""
98
+ engine = AgDRMantle(enable_pq=True, enable_sovereign=True)
99
+ result = engine.seal({"provenance": "agent", "place": "Toronto", "purpose": "test"})
100
+ assert result["pq_applied"] is True
101
+ assert result["pq_algorithm"] == "ML-DSA-65"
102
+ assert result["tier_breakdown"]["fortification_mantle"] == "applied"
103
+
104
+ envelope = bytes.fromhex(result["aki_seal"])
105
+ assert engine.pq.verify(envelope) is True