governance-ledger 0.1.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.
- governance_ledger-0.1.1/LICENSE +201 -0
- governance_ledger-0.1.1/PKG-INFO +435 -0
- governance_ledger-0.1.1/README.md +421 -0
- governance_ledger-0.1.1/governance_ledger/__init__.py +50 -0
- governance_ledger-0.1.1/governance_ledger/checks.py +65 -0
- governance_ledger-0.1.1/governance_ledger/cli.py +152 -0
- governance_ledger-0.1.1/governance_ledger/contract_linkage.py +60 -0
- governance_ledger-0.1.1/governance_ledger/deployment.py +55 -0
- governance_ledger-0.1.1/governance_ledger/diff.py +114 -0
- governance_ledger-0.1.1/governance_ledger/extract.py +103 -0
- governance_ledger-0.1.1/governance_ledger/inspect.py +55 -0
- governance_ledger-0.1.1/governance_ledger/lifecycle.py +68 -0
- governance_ledger-0.1.1/governance_ledger/paths.py +10 -0
- governance_ledger-0.1.1/governance_ledger/patterns.py +31 -0
- governance_ledger-0.1.1/governance_ledger/pipeline.py +52 -0
- governance_ledger-0.1.1/governance_ledger/provenance.py +36 -0
- governance_ledger-0.1.1/governance_ledger/publish.py +224 -0
- governance_ledger-0.1.1/governance_ledger/registry.py +90 -0
- governance_ledger-0.1.1/governance_ledger/report.py +35 -0
- governance_ledger-0.1.1/governance_ledger/review.py +104 -0
- governance_ledger-0.1.1/governance_ledger/rollback.py +62 -0
- governance_ledger-0.1.1/governance_ledger/runner.py +96 -0
- governance_ledger-0.1.1/governance_ledger/snapshot.py +38 -0
- governance_ledger-0.1.1/governance_ledger/summary.py +169 -0
- governance_ledger-0.1.1/governance_ledger/validation.py +264 -0
- governance_ledger-0.1.1/governance_ledger.egg-info/PKG-INFO +435 -0
- governance_ledger-0.1.1/governance_ledger.egg-info/SOURCES.txt +41 -0
- governance_ledger-0.1.1/governance_ledger.egg-info/dependency_links.txt +1 -0
- governance_ledger-0.1.1/governance_ledger.egg-info/entry_points.txt +2 -0
- governance_ledger-0.1.1/governance_ledger.egg-info/requires.txt +4 -0
- governance_ledger-0.1.1/governance_ledger.egg-info/top_level.txt +1 -0
- governance_ledger-0.1.1/pyproject.toml +39 -0
- governance_ledger-0.1.1/setup.cfg +4 -0
- governance_ledger-0.1.1/tests/test_contract_linkage.py +160 -0
- governance_ledger-0.1.1/tests/test_deployment.py +148 -0
- governance_ledger-0.1.1/tests/test_diff.py +173 -0
- governance_ledger-0.1.1/tests/test_extract_compile.py +107 -0
- governance_ledger-0.1.1/tests/test_lifecycle.py +144 -0
- governance_ledger-0.1.1/tests/test_review.py +87 -0
- governance_ledger-0.1.1/tests/test_rollback.py +156 -0
- governance_ledger-0.1.1/tests/test_runner_publish.py +463 -0
- governance_ledger-0.1.1/tests/test_snapshot.py +107 -0
- governance_ledger-0.1.1/tests/test_validation.py +120 -0
|
@@ -0,0 +1,201 @@
|
|
|
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.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding 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
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: governance-ledger
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Deterministic governance ledger, provenance, and policy translation for CRI-CORE.
|
|
5
|
+
Author: Waveframe Labs
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: cricore-contract-compiler
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
title: "Governance-Ledger"
|
|
17
|
+
document_type: "overview"
|
|
18
|
+
system: "Governance-Ledger"
|
|
19
|
+
component: "core"
|
|
20
|
+
version: "0.1.1"
|
|
21
|
+
status: "draft"
|
|
22
|
+
|
|
23
|
+
created: "2026-05-08"
|
|
24
|
+
updated: "2026-05-10"
|
|
25
|
+
|
|
26
|
+
authors:
|
|
27
|
+
- "Waveframe Labs"
|
|
28
|
+
|
|
29
|
+
maintainers:
|
|
30
|
+
- "Waveframe Labs"
|
|
31
|
+
|
|
32
|
+
license: "Apache-2.0"
|
|
33
|
+
|
|
34
|
+
repository: "https://github.com/Waveframe-Labs/Governance-Ledger"
|
|
35
|
+
|
|
36
|
+
summary: >
|
|
37
|
+
Conceptual entry point for Governance-Ledger, including purpose,
|
|
38
|
+
boundaries, architecture, supported primitives, and basic usage.
|
|
39
|
+
|
|
40
|
+
related_components:
|
|
41
|
+
- "CRI-CORE"
|
|
42
|
+
- "Waveframe Guard"
|
|
43
|
+
- "Proposal Normalizer"
|
|
44
|
+
- "CRI-CORE Contract Compiler"
|
|
45
|
+
|
|
46
|
+
related_documents:
|
|
47
|
+
- "GOVERNANCE_OBJECT_MODEL.md"
|
|
48
|
+
- "LIFECYCLE.md"
|
|
49
|
+
- "PROVENANCE.md"
|
|
50
|
+
- "NON_GOALS.md"
|
|
51
|
+
|
|
52
|
+
governance_primitives:
|
|
53
|
+
- "review_artifact"
|
|
54
|
+
- "lifecycle_transition"
|
|
55
|
+
- "deployment_provenance"
|
|
56
|
+
- "snapshot"
|
|
57
|
+
- "rollback"
|
|
58
|
+
- "governance_diff"
|
|
59
|
+
|
|
60
|
+
determinism:
|
|
61
|
+
deterministic_ids: true
|
|
62
|
+
canonical_hashing: true
|
|
63
|
+
mutable_history: false
|
|
64
|
+
|
|
65
|
+
provenance:
|
|
66
|
+
review_lineage: true
|
|
67
|
+
deployment_traceability: true
|
|
68
|
+
rollback_traceability: true
|
|
69
|
+
snapshot_integrity: true
|
|
70
|
+
|
|
71
|
+
ai_assisted: "partial"
|
|
72
|
+
|
|
73
|
+
notes: >
|
|
74
|
+
Governance-Ledger is deterministic infrastructure for governance state
|
|
75
|
+
evolution, not an autonomous policy reasoning system.
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
# Governance-Ledger
|
|
79
|
+
|
|
80
|
+
Governance-Ledger is a deterministic governance operationalization layer for transforming human governance text into traceable, reviewable, executable governance artifacts compatible with CRI-CORE enforcement systems.
|
|
81
|
+
|
|
82
|
+
## Why This Exists
|
|
83
|
+
|
|
84
|
+
Modern AI systems can generate probabilistic proposals, but execution authority must remain deterministic.
|
|
85
|
+
|
|
86
|
+
Governance-Ledger operationalizes organizational governance into reviewable, versioned contract artifacts used by runtime enforcement systems such as Waveframe Guard and CRI-CORE.
|
|
87
|
+
|
|
88
|
+
## Setup
|
|
89
|
+
|
|
90
|
+
Create a virtual environment and install the release package:
|
|
91
|
+
|
|
92
|
+
```powershell
|
|
93
|
+
python -m venv venv
|
|
94
|
+
.\venv\Scripts\Activate.ps1
|
|
95
|
+
pip install governance-ledger
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Quickstart
|
|
99
|
+
|
|
100
|
+
Run the full first-pass operator workflow:
|
|
101
|
+
|
|
102
|
+
```powershell
|
|
103
|
+
governance-ledger run policies
|
|
104
|
+
governance-ledger check generated
|
|
105
|
+
governance-ledger approve reviews/finance_policy.review.json --actor governance-team
|
|
106
|
+
governance-ledger publish reviews/finance_policy.review.json
|
|
107
|
+
governance-ledger list contracts
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The generated publication manifest and `contracts/index.json` store artifact paths in POSIX style, for example `contracts/finance-policy-0.1.0.contract.json`, even on Windows.
|
|
111
|
+
|
|
112
|
+
## Governance Ecosystem
|
|
113
|
+
|
|
114
|
+
- Governance-Ledger: governance operationalization.
|
|
115
|
+
- CRI-CORE Contract Compiler: canonical runtime contract semantics.
|
|
116
|
+
- Waveframe Guard: runtime SDK integration.
|
|
117
|
+
- Proposal Normalizer: canonical proposal assembly.
|
|
118
|
+
- CRI-CORE: deterministic admissibility enforcement.
|
|
119
|
+
|
|
120
|
+
Policy language enters as text. Governance-Ledger extracts supported primitives, surfaces unsupported language as warnings, tracks lifecycle state, links compiled contracts, records deployment lineage, and creates snapshots for audit and rollback.
|
|
121
|
+
|
|
122
|
+
## What It Does
|
|
123
|
+
|
|
124
|
+
- Extraction of supported governance constraints.
|
|
125
|
+
- Structured review artifacts with source text attribution.
|
|
126
|
+
- Authoring validation with explicit warnings.
|
|
127
|
+
- Lifecycle transitions for review, approval, compilation, and deployment.
|
|
128
|
+
- Lightweight compiled contract linkage by identity, version, and hash.
|
|
129
|
+
- Deployment traceability.
|
|
130
|
+
- Snapshots of governance state.
|
|
131
|
+
- Rollback from snapshots without erasing history.
|
|
132
|
+
- Governance diffs across review versions, warnings, and deployments.
|
|
133
|
+
|
|
134
|
+
## What It Is Not
|
|
135
|
+
|
|
136
|
+
Governance-Ledger is not:
|
|
137
|
+
|
|
138
|
+
- An AI governance engine.
|
|
139
|
+
- Autonomous policy reasoning.
|
|
140
|
+
- Runtime enforcement.
|
|
141
|
+
- Semantic governance inference.
|
|
142
|
+
- Legal interpretation AI.
|
|
143
|
+
- A replacement for human governance ownership.
|
|
144
|
+
- A runtime admissibility evaluator.
|
|
145
|
+
- A system that executes mutations.
|
|
146
|
+
|
|
147
|
+
It does not infer unsupported governance meaning. If language is unsupported or ambiguous, it becomes a warning instead of hidden structure.
|
|
148
|
+
|
|
149
|
+
## Architecture
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
Policy Text
|
|
153
|
+
|
|
|
154
|
+
v
|
|
155
|
+
Extraction
|
|
156
|
+
|
|
|
157
|
+
v
|
|
158
|
+
Review Artifact
|
|
159
|
+
|
|
|
160
|
+
v
|
|
161
|
+
Validation Warnings
|
|
162
|
+
|
|
|
163
|
+
v
|
|
164
|
+
Lifecycle Approval
|
|
165
|
+
|
|
|
166
|
+
v
|
|
167
|
+
Compiled Contract Linkage
|
|
168
|
+
|
|
|
169
|
+
v
|
|
170
|
+
Deployment Provenance
|
|
171
|
+
|
|
|
172
|
+
v
|
|
173
|
+
Snapshot / Rollback
|
|
174
|
+
|
|
|
175
|
+
v
|
|
176
|
+
CRI-CORE Enforcement Compatibility
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```mermaid
|
|
180
|
+
flowchart TD
|
|
181
|
+
A["Policy Text"] --> B["Extraction"]
|
|
182
|
+
B --> C["Review Artifact"]
|
|
183
|
+
C --> D["Validation Warnings"]
|
|
184
|
+
D --> E["Lifecycle Approval"]
|
|
185
|
+
E --> F["Compiled Contract Linkage"]
|
|
186
|
+
F --> G["Deployment Provenance"]
|
|
187
|
+
G --> H["Snapshot"]
|
|
188
|
+
H --> I["Rollback Lineage"]
|
|
189
|
+
F --> J["CRI-CORE Enforcement Compatibility"]
|
|
190
|
+
G --> J
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
```mermaid
|
|
194
|
+
stateDiagram-v2
|
|
195
|
+
[*] --> pending
|
|
196
|
+
pending --> reviewed
|
|
197
|
+
pending --> rejected
|
|
198
|
+
reviewed --> approved
|
|
199
|
+
reviewed --> rejected
|
|
200
|
+
approved --> compiled
|
|
201
|
+
compiled --> deployed
|
|
202
|
+
rejected --> [*]
|
|
203
|
+
deployed --> [*]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Governance-Ledger produces upstream governance objects. The canonical CRI-CORE compiler remains the authority for compiled contract semantics.
|
|
207
|
+
|
|
208
|
+
Generated policy artifacts use the canonical CRI-CORE compiler ingestion schema. Ledger does not maintain a separate runtime governance dialect or fallback compiler mode.
|
|
209
|
+
|
|
210
|
+
## Supported v0.1 Primitives
|
|
211
|
+
|
|
212
|
+
Role requirement:
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
Only managers may approve transfers.
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Structured output:
|
|
219
|
+
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"authority": {
|
|
223
|
+
"required_roles": ["manager"]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Separation of duties:
|
|
229
|
+
|
|
230
|
+
```text
|
|
231
|
+
Proposer and approver must be separate.
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Structured output:
|
|
235
|
+
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"authority": {
|
|
239
|
+
"separation_of_duties": true
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Transfer threshold:
|
|
245
|
+
|
|
246
|
+
```text
|
|
247
|
+
Transfers above $1M require manager approval.
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Structured output:
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"approvals": {
|
|
255
|
+
"thresholds": [
|
|
256
|
+
{
|
|
257
|
+
"field": "amount",
|
|
258
|
+
"operator": ">",
|
|
259
|
+
"value": 1000000,
|
|
260
|
+
"requires_role": "manager"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Review Artifacts
|
|
268
|
+
|
|
269
|
+
Review artifacts explain what was detected and where it came from:
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"review_id": "review-001",
|
|
274
|
+
"created_at": "2026-05-07T20:14:00Z",
|
|
275
|
+
"source_document": "finance_policy.txt",
|
|
276
|
+
"review_status": "pending",
|
|
277
|
+
"detected_constraints": [
|
|
278
|
+
{
|
|
279
|
+
"type": "required_role",
|
|
280
|
+
"value": "manager",
|
|
281
|
+
"source_text": "require manager approval"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"warnings": []
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Why Unsupported Governance Becomes Warnings
|
|
289
|
+
|
|
290
|
+
Unsupported governance language must not silently disappear, and it must not be guessed into executable structure.
|
|
291
|
+
|
|
292
|
+
For example:
|
|
293
|
+
|
|
294
|
+
```text
|
|
295
|
+
Transfers require reasonable approval timing.
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
This becomes:
|
|
299
|
+
|
|
300
|
+
```json
|
|
301
|
+
{
|
|
302
|
+
"warnings": [
|
|
303
|
+
{
|
|
304
|
+
"type": "unsupported_constraint",
|
|
305
|
+
"text": "reasonable approval timing"
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
That preserves auditability. A human reviewer can decide whether to rewrite, approve, reject, or extend the deterministic extraction rules.
|
|
312
|
+
|
|
313
|
+
## Basic Usage
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
from governance_ledger import (
|
|
317
|
+
attach_compiled_contract,
|
|
318
|
+
attach_deployment,
|
|
319
|
+
create_snapshot,
|
|
320
|
+
extract_constraints,
|
|
321
|
+
review_constraints,
|
|
322
|
+
transition_review_status,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
text = """
|
|
326
|
+
Transfers above $1M require manager approval.
|
|
327
|
+
Proposer and approver must be separate.
|
|
328
|
+
"""
|
|
329
|
+
|
|
330
|
+
policy = extract_constraints(text)
|
|
331
|
+
review = review_constraints(text, source_document="finance_policy.txt")
|
|
332
|
+
|
|
333
|
+
review = transition_review_status(review, "reviewed", actor="governance-team")
|
|
334
|
+
review = transition_review_status(review, "approved", actor="governance-team")
|
|
335
|
+
|
|
336
|
+
review = attach_compiled_contract(
|
|
337
|
+
review,
|
|
338
|
+
{
|
|
339
|
+
"contract_id": "finance-core",
|
|
340
|
+
"contract_version": "1.0.0",
|
|
341
|
+
"contract_hash": "abc123",
|
|
342
|
+
},
|
|
343
|
+
actor="compiler-service",
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
review = attach_deployment(
|
|
347
|
+
review,
|
|
348
|
+
environment="production",
|
|
349
|
+
runtime="waveframe-guard",
|
|
350
|
+
deployed_by="ops-team",
|
|
351
|
+
enforcement_engine_version="0.12.0",
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
snapshot = create_snapshot(review)
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Operational Workflow
|
|
358
|
+
|
|
359
|
+
Primary repository layout:
|
|
360
|
+
|
|
361
|
+
```text
|
|
362
|
+
policies/ source governance text
|
|
363
|
+
generated/ extraction and validation drafts
|
|
364
|
+
reviews/ pending, approved, and deployed review artifacts
|
|
365
|
+
contracts/ runtime contract artifacts only
|
|
366
|
+
snapshots/ deterministic governance snapshots
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Draft generation reads policy text from `policies/` and writes machine-generated constraints plus pending review artifacts:
|
|
370
|
+
|
|
371
|
+
```powershell
|
|
372
|
+
governance-ledger run policies/
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Draft output:
|
|
376
|
+
|
|
377
|
+
- `generated/<policy>.generated.json`
|
|
378
|
+
- `generated/<policy>.validation.json`
|
|
379
|
+
- `reviews/<policy>.review.json`
|
|
380
|
+
|
|
381
|
+
Draft generation also validates extracted policy JSON against the canonical CRI-CORE compiler ingestion schema. Schema errors are emitted into `generated/<policy>.validation.json` with `severity == "error"`.
|
|
382
|
+
|
|
383
|
+
Draft generation does not approve, compile, deploy, publish, or create runtime contracts.
|
|
384
|
+
|
|
385
|
+
Human approval is explicit:
|
|
386
|
+
|
|
387
|
+
```powershell
|
|
388
|
+
governance-ledger approve reviews/finance_policy.review.json --actor governance-team
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Publishing requires an approved review and generated policy JSON that passes compiler-ingestion schema validation:
|
|
392
|
+
|
|
393
|
+
```powershell
|
|
394
|
+
governance-ledger publish reviews/finance_policy.review.json
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
Publish output:
|
|
398
|
+
|
|
399
|
+
- `contracts/<contract-id>-<version>.contract.json`
|
|
400
|
+
- `contracts/<policy>.publication_manifest.json`
|
|
401
|
+
- `contracts/index.json`
|
|
402
|
+
- `reviews/<policy>.deployed.review.json`
|
|
403
|
+
- `snapshots/<snapshot-id>.json`
|
|
404
|
+
|
|
405
|
+
Runtime contracts should only exist in `contracts/`. They should not be written to `generated/`, `reviews/`, or `policies/`.
|
|
406
|
+
|
|
407
|
+
Files in `contracts/` are immutable publication outputs. Publishing is idempotent when the existing content is identical, but Governance-Ledger refuses to overwrite an existing contract or publication manifest with different content.
|
|
408
|
+
|
|
409
|
+
Generated validation artifacts include warning severity. CI can block publication workflows with:
|
|
410
|
+
|
|
411
|
+
```powershell
|
|
412
|
+
governance-ledger check generated
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
The check fails when any generated validation artifact contains `severity == "error"`.
|
|
416
|
+
|
|
417
|
+
Published contracts can be listed:
|
|
418
|
+
|
|
419
|
+
```powershell
|
|
420
|
+
governance-ledger list contracts
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Any JSON artifact can be inspected:
|
|
424
|
+
|
|
425
|
+
```powershell
|
|
426
|
+
governance-ledger show contracts/finance-policy-0.1.0.contract.json
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
## Documentation
|
|
430
|
+
|
|
431
|
+
- [GOVERNANCE_OBJECT_MODEL.md](GOVERNANCE_OBJECT_MODEL.md)
|
|
432
|
+
- [LIFECYCLE.md](LIFECYCLE.md)
|
|
433
|
+
- [PROVENANCE.md](PROVENANCE.md)
|
|
434
|
+
- [NON_GOALS.md](NON_GOALS.md)
|
|
435
|
+
- [schemas/](schemas/)
|