sigil-profile 0.22.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.
- sigil_profile-0.22.2/LICENSE +201 -0
- sigil_profile-0.22.2/PKG-INFO +15 -0
- sigil_profile-0.22.2/README.md +230 -0
- sigil_profile-0.22.2/pyproject.toml +40 -0
- sigil_profile-0.22.2/setup.cfg +4 -0
- sigil_profile-0.22.2/sigil/SPEC.md +158 -0
- sigil_profile-0.22.2/sigil/__init__.py +5 -0
- sigil_profile-0.22.2/sigil/a2a.py +56 -0
- sigil_profile-0.22.2/sigil/anchor.py +144 -0
- sigil_profile-0.22.2/sigil/client.py +88 -0
- sigil_profile-0.22.2/sigil/common.py +278 -0
- sigil_profile-0.22.2/sigil/conformance.py +1159 -0
- sigil_profile-0.22.2/sigil/context_gateway.py +120 -0
- sigil_profile-0.22.2/sigil/ctx.py +132 -0
- sigil_profile-0.22.2/sigil/gate.py +685 -0
- sigil_profile-0.22.2/sigil/handoff.py +81 -0
- sigil_profile-0.22.2/sigil/kms.py +53 -0
- sigil_profile-0.22.2/sigil/kms_backends.py +50 -0
- sigil_profile-0.22.2/sigil/kms_rotate.py +48 -0
- sigil_profile-0.22.2/sigil/lease.py +102 -0
- sigil_profile-0.22.2/sigil/lease_witness.py +103 -0
- sigil_profile-0.22.2/sigil/mcp.py +168 -0
- sigil_profile-0.22.2/sigil/mcp_proxy.py +15 -0
- sigil_profile-0.22.2/sigil/quorum_lease.py +108 -0
- sigil_profile-0.22.2/sigil/remote_replica.py +76 -0
- sigil_profile-0.22.2/sigil/replica.py +115 -0
- sigil_profile-0.22.2/sigil/standby.py +26 -0
- sigil_profile-0.22.2/sigil/tsa.py +63 -0
- sigil_profile-0.22.2/sigil/vector_check.py +62 -0
- sigil_profile-0.22.2/sigil/vectors.json +242 -0
- sigil_profile-0.22.2/sigil/verify.py +92 -0
- sigil_profile-0.22.2/sigil_profile.egg-info/PKG-INFO +15 -0
- sigil_profile-0.22.2/sigil_profile.egg-info/SOURCES.txt +39 -0
- sigil_profile-0.22.2/sigil_profile.egg-info/dependency_links.txt +1 -0
- sigil_profile-0.22.2/sigil_profile.egg-info/entry_points.txt +12 -0
- sigil_profile-0.22.2/sigil_profile.egg-info/requires.txt +9 -0
- sigil_profile-0.22.2/sigil_profile.egg-info/top_level.txt +1 -0
- sigil_profile-0.22.2/tests/test_approval_identity.py +30 -0
- sigil_profile-0.22.2/tests/test_conformance_offline.py +18 -0
- sigil_profile-0.22.2/tests/test_conformance_stack.py +514 -0
- sigil_profile-0.22.2/tests/test_version.py +17 -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,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sigil-profile
|
|
3
|
+
Version: 0.22.2
|
|
4
|
+
Summary: SIGIL/1 proof-carrying execution profile: gate, verify, anchor, MCP middleware, A2A helpers
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: fastapi>=0.110
|
|
8
|
+
Requires-Dist: uvicorn>=0.30
|
|
9
|
+
Requires-Dist: httpx>=0.27
|
|
10
|
+
Requires-Dist: rfc8785>=0.1.4
|
|
11
|
+
Requires-Dist: cryptography>=42
|
|
12
|
+
Requires-Dist: jsonschema>=4
|
|
13
|
+
Provides-Extra: a2a
|
|
14
|
+
Requires-Dist: a2a-sdk; extra == "a2a"
|
|
15
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
[](https://pypi.org/project/sigil-profile/)
|
|
2
|
+
[](https://github.com/gamai-io/sigil/actions/workflows/ci.yml)
|
|
3
|
+
|
|
4
|
+
> **Live evidence dashboard:** https://gamai-io.github.io/demo/
|
|
5
|
+
> **Install:** `pip install sigil-profile`
|
|
6
|
+
|
|
7
|
+
# SIGIL/1 — Proof-Carrying Execution for AI Agents
|
|
8
|
+
|
|
9
|
+
> **ProofGate Runtime v0.1** is the local claim/receipt core: [`proofgate-runtime`](https://github.com/gamai-io/proofgate-runtime). SIGIL remains the grant/anchor/MCP middleware service.
|
|
10
|
+
|
|
11
|
+
SIGIL/1 is a **profile over existing transports** (MCP, A2A, HTTP), not a new wire protocol.
|
|
12
|
+
It makes every consequential agent action answerable with a verifiable receipt:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
intent -> grant -> decision -> effect -> receipt -> anchor
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If an action cannot be granted, executed, or proven, it is **denied by default**.
|
|
19
|
+
The reference implementation ships a gate, a verifier, an append-only anchor log,
|
|
20
|
+
an MCP middleware, A2A helpers, quorum leases, and a conformance suite.
|
|
21
|
+
|
|
22
|
+
## Why
|
|
23
|
+
|
|
24
|
+
Agent frameworks log *traces*. Traces show what the agent said it did.
|
|
25
|
+
SIGIL produces a *receipt*: canonicalized intent, policy decision, effect hash,
|
|
26
|
+
idempotency key, lease fencing token, and an inclusion proof against an anchor root.
|
|
27
|
+
A verifier can reject a receipt without trusting the agent, the model, or the log store.
|
|
28
|
+
|
|
29
|
+
## Components
|
|
30
|
+
|
|
31
|
+
| Component | Role |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `sigil-gate` | grants, policy, approvals, idempotency, effects, receipts, hash chain |
|
|
34
|
+
| `sigil-verify` | canonicalization, receipt/grant/chain/anchor verification, replay check |
|
|
35
|
+
| `sigil-anchor` | append-only anchor log, inclusion proofs, anchor tokens |
|
|
36
|
+
| `sigil-mcp-proxy` | meters `tools/call`, `resources/read`, `prompts/get`; attaches `_meta.sigil` |
|
|
37
|
+
| `sigil-lease-witness` | quorum lease witnesses (fencing tokens) |
|
|
38
|
+
| `sigil-conformance` | end-to-end conformance suite |
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python3 -m venv .venv && . .venv/bin/activate
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Optional A2A helpers: `pip install -e '.[a2a]'`.
|
|
48
|
+
|
|
49
|
+
## Quickstart (in-process SDK)
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from sigil import SigilClient
|
|
53
|
+
|
|
54
|
+
c = SigilClient()
|
|
55
|
+
intent = {
|
|
56
|
+
"id": "1",
|
|
57
|
+
"op": "echo",
|
|
58
|
+
"args": {"text": "hi"},
|
|
59
|
+
"contract": {"id": "echo/v1", "version": "1"},
|
|
60
|
+
}
|
|
61
|
+
grant = c.grant(intent, [{"id": "echo", "constraints": {}}])
|
|
62
|
+
result = c.execute(intent, grant, "idem-1")
|
|
63
|
+
assert c.verify(result["receipt"])["valid"]
|
|
64
|
+
anchor = c.anchor_root(result["receipt_hash"], 1)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Run services (lab)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
sigil-gate --port 18100
|
|
71
|
+
sigil-verify --port 18101
|
|
72
|
+
sigil-anchor --port 18102
|
|
73
|
+
sigil-conformance --base http://127.0.0.1:18100
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Each service is a small FastAPI app; see `deploy/` for Docker and compose examples.
|
|
77
|
+
|
|
78
|
+
## Docker image
|
|
79
|
+
|
|
80
|
+
The image is self-contained: `deploy/Dockerfile` is a multi-stage build that
|
|
81
|
+
packages the wheel **inside** the image from the checkout, so a fresh clone
|
|
82
|
+
needs no prebuilt `dist/*.whl` (and no version is hard-coded in the Dockerfile).
|
|
83
|
+
The base image is pinned by digest and the runtime runs as uid `65534`.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# build + smoke test (read-only rootfs, non-root, waits for /health)
|
|
87
|
+
bash deploy/build.sh
|
|
88
|
+
|
|
89
|
+
# or just build
|
|
90
|
+
docker build -f deploy/Dockerfile -t sigil:0.22 .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
CI runs the same build and smoke test in the `docker` job (5-minute cap).
|
|
94
|
+
Deployment details: `deploy/PRODUCTION.md`.
|
|
95
|
+
|
|
96
|
+
## Security model (what it does and does not do)
|
|
97
|
+
|
|
98
|
+
- **Does**: canonical JSON (RFC 8785), Ed25519 signatures, hash-chained receipts,
|
|
99
|
+
idempotency keys, lease fencing, quorum witnesses, replay rejection,
|
|
100
|
+
tamper detection, inclusion proofs.
|
|
101
|
+
- **Does not**: sandbox the workload. Pair SIGIL with a sandbox
|
|
102
|
+
(bubblewrap, gVisor, containers) for isolation. SIGIL proves *what happened*;
|
|
103
|
+
it does not prevent a compromised runtime from trying.
|
|
104
|
+
- **Trust boundary**: the KMS/keys and the anchor log are the roots of trust.
|
|
105
|
+
Protect them; rotate keys with `sigil-rotate`.
|
|
106
|
+
|
|
107
|
+
## Invoice-to-ERP demo (proof, not a claim)
|
|
108
|
+
|
|
109
|
+
`examples/invoice_erp_demo.py` is a self-contained synthetic workflow:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
invoice math -> capability grant -> idempotent claim -> ERP write
|
|
113
|
+
-> signed receipt -> anchor -> independent verify -> replay/tamper
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Run it with services started in a temporary runtime:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python3 examples/invoice_erp_demo.py --start
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Measured output on 2026-10-29 (Python 3.12, Linux x86_64):
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
[1] invoice MOCK-2026-001: net=64.50 vat=10.97 total=75.47 -> math ok
|
|
126
|
+
[2] grant ... bound to intent, max_uses=1
|
|
127
|
+
[3] idempotent claim reserved: invoice-MOCK-2026-001
|
|
128
|
+
[4] ERP write: /tmp/sigil-erp-.../MOCK-2026-001.json
|
|
129
|
+
[5] receipt 57e5836ccf38c642... recorded
|
|
130
|
+
[6] independent verify: valid=True errors=[]
|
|
131
|
+
[7] anchor ... verify={'valid': True, ...}
|
|
132
|
+
[8] same idempotency key -> replayed=True (no second effect)
|
|
133
|
+
[9] tampered receipt -> valid=False errors=['E_SIGNATURE', 'E_RESULT_DIGEST']
|
|
134
|
+
RESULT: PASS
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
It uses synthetic data and a temporary JSON "ERP"; it does not connect to a
|
|
138
|
+
production ERP and does not claim OCR accuracy. The point is the trust path:
|
|
139
|
+
the same invoice cannot be posted twice, the result is signed, and a changed
|
|
140
|
+
receipt is rejected.
|
|
141
|
+
|
|
142
|
+
## Conformance
|
|
143
|
+
|
|
144
|
+
`sigil-conformance` runs 49 numbered checks: grants, idempotency, replay,
|
|
145
|
+
tampering, chain breaks, anchor inclusion, MCP/A2A receipts, TSA, replica
|
|
146
|
+
failover and lease/quorum behaviour.
|
|
147
|
+
|
|
148
|
+
There are two honest, separately reported suites:
|
|
149
|
+
|
|
150
|
+
| Command | What it runs | Needs | Result CI reproduces |
|
|
151
|
+
|---|---|---|---|
|
|
152
|
+
| `pytest -q tests/ --ignore=tests/test_conformance_stack.py` | 7 unit tests + `run_offline()` | nothing (temp dir) | **8 passed** (7 unit + 1 offline test); CI matrix runs it on 3.10 and 3.12 |
|
|
153
|
+
| `python -m sigil.conformance --offline` | 12 library checks `O1`–`O12` | nothing (temp dir) | **12/12 passed** |
|
|
154
|
+
| `sigil-vectors` | 13 fixed vectors | nothing | **13/13 passed** |
|
|
155
|
+
| `pytest -q tests/test_conformance_stack.py -s` | stack checks `1`–`49` | gate/verify/anchor/KMS/replica/3 lease witnesses/MCP middleware/A2A/context gateway | **46 passed, 0 failed, 3 skipped** of 49 (~60 s, Python 3.12) |
|
|
156
|
+
|
|
157
|
+
Measured on 2026-11-26 with Python 3.12.3, Linux x86_64, in a fresh clone
|
|
158
|
+
(`SIGIL_CI_PORT_BASE=18300` was used locally because a host service already
|
|
159
|
+
held :18100; CI uses the defaults). The 3.10 leg is the CI matrix only — it was
|
|
160
|
+
not re-run on the machine where these numbers were taken. The stack job
|
|
161
|
+
generates all Ed25519/P-256 keys, control/approver/lease tokens and a
|
|
162
|
+
throw-away RFC3161 TSA certificate in the job — **no repository secrets and no
|
|
163
|
+
pre-existing `/tmp/sigil_lab`**.
|
|
164
|
+
|
|
165
|
+
The three skips are explicit, not silent passes:
|
|
166
|
+
|
|
167
|
+
| # | Check | Why it cannot run in CI |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| 17 | `anchor.remote_anchor` | The development lab pointed the anchor at an Oracle-hosted second anchor that stamps `node: "remote"`. That service is not in this repo and not in `deploy/docker-compose.yml`. Enable with `SIGIL_CONFORMANCE_REMOTE_ANCHOR` + a matching anchor. |
|
|
170
|
+
| 21 | `keys.isolation` | Asserts gate/anchor/verify cannot see private keys through container mounts. A process runner cannot prove container isolation, so it is skipped rather than faked. It runs under the docker lab driver. |
|
|
171
|
+
| 24 | `anchor.public_rfc3161` | Third-party FreeTSA (`https://freetsa.org/tsr`) needs network and CA/cert files that are not in the repo. Enable with `SIGIL_CONFORMANCE_PUBLIC_TSA=1` after installing those files. |
|
|
172
|
+
|
|
173
|
+
### What needs what
|
|
174
|
+
|
|
175
|
+
| Service (default port) | Checks that need it | CI-feasible |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| gate :18100 | 3–16, 18–20, 22–23, 25–29, 31–45, 47–49 | **yes** (uvicorn, generated keys) |
|
|
178
|
+
| verify :18101 | 1, 2, 8–11, 15, 16, 36, 43 | **yes** |
|
|
179
|
+
| anchor :18102 + local TSA | 11, 17, 20, 24, 41, 42 | **yes** for local TSA; **no** for 17/24 |
|
|
180
|
+
| KMS :18103 | signing for every executed receipt; 47 rotation; 21 isolation | **yes** for signing/rotation; **no** for isolation without containers |
|
|
181
|
+
| replica :18104 | 25, 26 | **yes** |
|
|
182
|
+
| lease witnesses :18106–18108 | 27–29, 40, 48 | **yes** |
|
|
183
|
+
| MCP middleware :18110 + upstream :18080 | 18, 22, 23, 39, 45 | **yes** (small upstream fixture in the test) |
|
|
184
|
+
| A2A endpoint :18082 | 19 | **yes** (fixture uses `sigil.a2a`) |
|
|
185
|
+
| context gateway :18120 | 44 | **yes** |
|
|
186
|
+
| P-256 key file (no service) | 30 | **yes** (generated in job) |
|
|
187
|
+
| external Oracle anchor | 17 | **no** — service not in repo |
|
|
188
|
+
| public FreeTSA | 24 | **no** — third party + missing CA files |
|
|
189
|
+
| container key isolation | 21 | **no** — requires mount namespaces/`docker exec` |
|
|
190
|
+
|
|
191
|
+
Files the suite needs are generated per run under a temp dir
|
|
192
|
+
(`SIGIL_CONFORMANCE_KEYS/EFFECTS/DATA`): gate/anchor Ed25519 keys, a P-256
|
|
193
|
+
signer, a lease witness key shared by the three witnesses, control/approver/
|
|
194
|
+
lease/KMS tokens, `lease_public.pem`, `p256_cloud_public.pem`, and a local TSA
|
|
195
|
+
cert+config. The docker driver still uses the original `/tmp/sigil_lab` and
|
|
196
|
+
`/tmp/gama_proto_lab/{sigil,deps}` layout.
|
|
197
|
+
|
|
198
|
+
`deploy/docker-compose.yml` is **not** sufficient for conformance: it defines
|
|
199
|
+
only `kms`, `gate`, `verify`, `anchor` and `context` (no replica, no lease
|
|
200
|
+
witnesses, no MCP middleware/A2A upstream), builds the image from the checkout
|
|
201
|
+
during `docker compose build` (the wheel is packaged inside the image — a fresh
|
|
202
|
+
clone needs no `dist/` artefact), maps services to 191xx, and sets
|
|
203
|
+
`SIGIL_TSA_ENABLE=0` with no remote anchor — so checks 17, 20, 24, 25–29, 40,
|
|
204
|
+
48 and the MCP/A2A ones cannot pass from compose alone. That is why the CI job
|
|
205
|
+
starts uvicorn processes directly instead.
|
|
206
|
+
|
|
207
|
+
Checks 7, 25, 27, 29 and 40 are timing-sensitive by nature: they stop/restart
|
|
208
|
+
gate or witness processes and wait for lease expiry (check 29 alone is ~30 s
|
|
209
|
+
because `execute()` retries 503 for up to 12 s). The suite waits on health
|
|
210
|
+
endpoints rather than fixed sleeps where possible, but these five are the ones
|
|
211
|
+
to suspect first if the job flakes; they are not reported green unless the
|
|
212
|
+
observed state matches. The stack job runs on Python 3.12 only to keep CI
|
|
213
|
+
under ~5 minutes; the offline suite runs on 3.10 and 3.12.
|
|
214
|
+
|
|
215
|
+
## Status
|
|
216
|
+
|
|
217
|
+
Reference implementation, actively hardened. Interfaces may change before 1.0.
|
|
218
|
+
Two specs are included:
|
|
219
|
+
|
|
220
|
+
- `SIGIL_SPEC_1.0.md` — core receipt/grant/anchor model
|
|
221
|
+
- `SIGIL_SPEC_1.1.md` — quorum lease, context gateway, A2A/MCP profile
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
Apache-2.0. See `LICENSE`.
|
|
226
|
+
## Sold on its own, or inside the suite? (asked on AI Lounge, 24 Nov 2026)
|
|
227
|
+
|
|
228
|
+
Both, deliberately: receipts are the unit a customer can adopt alone (a verifier is 30 lines), while
|
|
229
|
+
the fleet audit is what they buy once the receipts exist. Selling only the suite would hide the one
|
|
230
|
+
artefact that proves the claim; selling only receipts leaves the replay and the audit unsold.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sigil-profile"
|
|
7
|
+
version = "0.22.2"
|
|
8
|
+
description = "SIGIL/1 proof-carrying execution profile: gate, verify, anchor, MCP middleware, A2A helpers"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"fastapi>=0.110",
|
|
12
|
+
"uvicorn>=0.30",
|
|
13
|
+
"httpx>=0.27",
|
|
14
|
+
"rfc8785>=0.1.4",
|
|
15
|
+
"cryptography>=42",
|
|
16
|
+
"jsonschema>=4",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.optional-dependencies]
|
|
20
|
+
a2a = ["a2a-sdk"]
|
|
21
|
+
|
|
22
|
+
[project.scripts]
|
|
23
|
+
sigil-gate = "sigil.gate:main"
|
|
24
|
+
sigil-verify = "sigil.verify:main"
|
|
25
|
+
sigil-anchor = "sigil.anchor:main"
|
|
26
|
+
sigil-mcp-proxy = "sigil.mcp_proxy:main"
|
|
27
|
+
sigil-conformance = "sigil.conformance:main"
|
|
28
|
+
sigil-standby = "sigil.standby:main"
|
|
29
|
+
sigil-remote-replica = "sigil.remote_replica:main"
|
|
30
|
+
sigil-lease-witness = "sigil.lease_witness:main"
|
|
31
|
+
sigil-context-gateway = "sigil.context_gateway:main"
|
|
32
|
+
sigil-vectors = "sigil.vector_check:main"
|
|
33
|
+
sigil-rotate = "sigil.kms_rotate:main"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools]
|
|
36
|
+
packages = ["sigil"]
|
|
37
|
+
include-package-data = true
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.package-data]
|
|
40
|
+
sigil = ["SPEC.md", "vectors.json"]
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# SIGIL/1 — Signed Intent, Grant, and Invariant Ledger
|
|
2
|
+
**Version:** 1.0 (profile over MCP / A2A / HTTP)
|
|
3
|
+
**Status:** reference implementation + conformance suite
|
|
4
|
+
|
|
5
|
+
## 1. Scope
|
|
6
|
+
|
|
7
|
+
SIGIL/1 defines a semantic contract for agent actions:
|
|
8
|
+
**intent → grant → decision → effect → receipt → anchor**.
|
|
9
|
+
|
|
10
|
+
It does **not** define a new wire protocol. The envelope is carried in existing
|
|
11
|
+
metadata:
|
|
12
|
+
- MCP: `params._meta.sigil` / `result._meta.sigil`
|
|
13
|
+
- A2A: `Message.metadata.sigil` / `Artifact.metadata.sigil`
|
|
14
|
+
- HTTP: `SIGIL-Intent` / `SIGIL-Receipt` headers (base64url JCS)
|
|
15
|
+
|
|
16
|
+
## 2. Canonicalization and hashes
|
|
17
|
+
|
|
18
|
+
- JSON Canonicalization Scheme (RFC 8785 / JCS); UTF-8.
|
|
19
|
+
- `intent_hash = SHA-256(JCS(intent + contract))`
|
|
20
|
+
- `route_hash = SHA-256(JCS(decision_trace))`
|
|
21
|
+
- `result_digest = SHA-256(JCS(result))`
|
|
22
|
+
- `receipt_hash = SHA-256(JCS(receipt − sig − anchor))`
|
|
23
|
+
- Chain: `prev_hash` of first receipt is `"GENESIS"`.
|
|
24
|
+
|
|
25
|
+
## 3. Envelope
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"sigil": "1",
|
|
30
|
+
"id": "uuid",
|
|
31
|
+
"idem": "string",
|
|
32
|
+
"parent": "uuid|null",
|
|
33
|
+
"issued_at": 0, "expires_at": 0,
|
|
34
|
+
"actor": {"id": "string", "kind": "human|agent|service", "key_id": "string"},
|
|
35
|
+
"target": {"kind": "tool|agent|executor", "id": "string", "version": "string"},
|
|
36
|
+
"intent": {"op": "string", "args": {}, "schema_ref": "string"},
|
|
37
|
+
"contract": {"contract_id": "string", "version": "string", "equivalence_domain": "string"},
|
|
38
|
+
"caps_required": ["capability_id"],
|
|
39
|
+
"determinism": {"mode": "strict|seeded|best_effort", "seed": null},
|
|
40
|
+
"policy": {"profile": "string", "grant_id": "string|null", "approval_id": "string|null"},
|
|
41
|
+
"evidence": {"level": "none|digest|signed|anchored", "chain_id": "string", "prev_hash": "string"}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 4. Grant (capability authorization)
|
|
46
|
+
|
|
47
|
+
A grant is **bound to one intent hash**; it is not a bearer token.
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{"grant_id":"uuid","subject":"string","issuer":"string",
|
|
51
|
+
"capabilities":[{"id":"capability","scope":"string","constraints":{"path_prefix":"/ok"}}],
|
|
52
|
+
"bound_to":"<intent_hash>","not_before":0,"not_after":0,"max_uses":10,"nonce":"hex",
|
|
53
|
+
"sig":{"alg":"ed25519","key_id":"gate-ed25519-1","value":"base64"}}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Rules: deny-by-default; signature; `bound_to` equality; expiry; capability presence;
|
|
57
|
+
constraint checks (e.g. `path_prefix`); single-use approval.
|
|
58
|
+
|
|
59
|
+
## 5. Approval
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{"approval_id":"uuid","intent_hash":"...","policy_hash":"...","approver":"human:...",
|
|
63
|
+
"not_after":0,"nonce":"hex","sig":{...}}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
An approval is valid only for the exact `intent_hash` + `policy_hash`, before expiry,
|
|
67
|
+
and once. Mutating any bound field invalidates it.
|
|
68
|
+
|
|
69
|
+
## 6. Lease and fencing (single writer)
|
|
70
|
+
|
|
71
|
+
A writer must hold a valid lease from a witness:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{"lease_id":"uuid","holder":"gate-primary","fencing_token":7,
|
|
75
|
+
"issuer":"remote-lease","not_after":0,
|
|
76
|
+
"sig":{"alg":"ed25519","key_id":"remote-lease-1","value":"base64"}}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- Lease TTL 6s, renew every 2s (reference values).
|
|
80
|
+
- Every write (`execute`, `record`) requires a valid lease; otherwise `503 E_LEASE_LOST`.
|
|
81
|
+
- `fencing_token` is monotonic; it is included in the receipt.
|
|
82
|
+
- On primary loss, a standby acquires a **higher** fencing token before writing.
|
|
83
|
+
- **Quorum mode:** acquire/renew from N witnesses; require Q (reference 3 witnesses, Q=2).
|
|
84
|
+
Each witness signs its own token; the receipt carries the max `fencing_token` and
|
|
85
|
+
`quorum: {required, acquired, witnesses}`. One witness may fail without losing the lease;
|
|
86
|
+
with only one witness left, writes fail closed (`E_LEASE_LOST`).
|
|
87
|
+
- A single witness is a SPOF; quorum mode removes that SPOF but the reference witness
|
|
88
|
+
implementation is not a consensus protocol (no Raft/Paxos).
|
|
89
|
+
|
|
90
|
+
## 7. Receipt
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{"v":"1","receipt_id":"uuid","intent_id":"...","intent_hash":"...","route_hash":"...",
|
|
94
|
+
"grant_id":"...","lease":{"holder":"...","fencing_token":7},
|
|
95
|
+
"policy":{"decision":"allow|deny|require_approval","rule_ids":[],"policy_hash":"..."},
|
|
96
|
+
"executor":{"kind":"local|mcp|a2a","id":"...","version":"...","sandbox":"..."},
|
|
97
|
+
"effects":[{"kind":"fs.write|tool.call|mcp.tools.call|a2a.message","target":"...",
|
|
98
|
+
"before_digest":null,"after_digest":"...","bytes":0}],
|
|
99
|
+
"result":{},"result_digest":"...","status":"ok|denied|error",
|
|
100
|
+
"nondet_used":[],"chain_id":"...","prev_hash":"...",
|
|
101
|
+
"sig":{"alg":"ed25519","key_id":"gate-ed25519-1","value":"base64"},
|
|
102
|
+
"anchor":null}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Denials are receipts too: `status="denied"`, `effects=[]`, fail-closed.
|
|
106
|
+
|
|
107
|
+
## 8. Determinism
|
|
108
|
+
|
|
109
|
+
- `strict`: only deterministic executors (`echo`, `read_file`, `increment_counter`,
|
|
110
|
+
`sql`, `skill`, `fastpath`); LLM executors fail `E_CONTRACT_VIOLATION`.
|
|
111
|
+
- `seeded`: nondeterministic fields are declared and recorded; replay substitutes
|
|
112
|
+
recorded values.
|
|
113
|
+
- `best_effort`: no replay guarantee.
|
|
114
|
+
- Determinism applies to intent, route, policy, and effects — **not** to model tokens.
|
|
115
|
+
|
|
116
|
+
## 9. Idempotency and crash recovery
|
|
117
|
+
|
|
118
|
+
- `idem` key + `intent_hash` uniqueness.
|
|
119
|
+
- Same key + same intent → stored receipt, `replayed: true`.
|
|
120
|
+
- Same key + different intent → `409 E_IDEMPOTENCY_CONFLICT`, no effect.
|
|
121
|
+
- Effects use a journal written before execution; on restart, a matching effect
|
|
122
|
+
digest finalizes the receipt without re-applying (`recovered: true`).
|
|
123
|
+
|
|
124
|
+
## 10. Anchoring and timestamps
|
|
125
|
+
|
|
126
|
+
- Local chain is tamper-evident only after anchoring.
|
|
127
|
+
- Remote anchor (reference: Oracle) signs `chain root + seq` with Ed25519.
|
|
128
|
+
- RFC3161 timestamp token is bound to the chain root; public FreeTSA and a local
|
|
129
|
+
TSA are supported.
|
|
130
|
+
- `verify` recomputes all hashes/signatures and validates local + remote + TSA.
|
|
131
|
+
|
|
132
|
+
## 11. Errors
|
|
133
|
+
|
|
134
|
+
Transport (retryable): `E_TRANSPORT`, `E_TIMEOUT`, `E_UNAVAILABLE`.
|
|
135
|
+
Semantic (terminal): `E_POLICY_DENIED`, `E_CAPABILITY_MISSING`, `E_CAPABILITY_SCOPE`,
|
|
136
|
+
`E_APPROVAL_REQUIRED`, `E_APPROVAL_INVALID`, `E_IDEMPOTENCY_CONFLICT`,
|
|
137
|
+
`E_REPLAY_DIVERGENCE`, `E_EVIDENCE_INVALID`, `E_CONTRACT_VIOLATION`,
|
|
138
|
+
`E_UNSUPPORTED_FEATURE`, `E_LEASE_LOST`, `E_GRANT_*`, `E_TSA`, `E_REMOTE_ANCHOR`.
|
|
139
|
+
|
|
140
|
+
## 12. Signatures / KMS
|
|
141
|
+
|
|
142
|
+
- Ed25519 (`ed25519`) is the reference local algorithm.
|
|
143
|
+
- ECDSA P-256 (`ecdsa-p256-sha256`) is supported for cloud KMS/HSM compatibility.
|
|
144
|
+
- Adapters: AWS KMS (`ECDSA_SHA_256`), GCP KMS (`EC_SIGN_P256_SHA256`),
|
|
145
|
+
Azure Key Vault (`ES256`); credentials are external and not part of the repo.
|
|
146
|
+
- The local P-256 backend is tested (`kms.p256_cloud_compatible`); cloud adapters
|
|
147
|
+
require credentials and are not tested live in this lab.
|
|
148
|
+
|
|
149
|
+
## 13. Conformance (30 tests)
|
|
150
|
+
|
|
151
|
+
Canonical JCS · cross-transport intent hash · route hash · strict rejection ·
|
|
152
|
+
idem same/conflict/crash · replay/tamper/truncation · local+public RFC3161 ·
|
|
153
|
+
remote anchor · Ed25519 · KMS isolation · MCP tools/resources/prompts ·
|
|
154
|
+
A2A metadata · replica read failover · replica auto-sync · write failover with
|
|
155
|
+
lease fencing · lease witness token · **quorum lease (3 witnesses, Q=2)** ·
|
|
156
|
+
**P-256 cloud-KMS-compatible signature**.
|
|
157
|
+
|
|
158
|
+
Reference implementation: `sigil-profile` wheel; conformance: `sigil-conformance`.
|