endoxa 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- endoxa-0.0.1/LICENSE +201 -0
- endoxa-0.0.1/NOTICE +14 -0
- endoxa-0.0.1/PKG-INFO +121 -0
- endoxa-0.0.1/README.md +96 -0
- endoxa-0.0.1/pyproject.toml +106 -0
- endoxa-0.0.1/pyproject.toml.orig +128 -0
- endoxa-0.0.1/src/endoxa/__init__.py +23 -0
- endoxa-0.0.1/src/endoxa/governance/__init__.py +122 -0
- endoxa-0.0.1/src/endoxa/governance/derive.py +528 -0
- endoxa-0.0.1/src/endoxa/governance/knowledge.py +20 -0
- endoxa-0.0.1/src/endoxa/governance/ledger.py +231 -0
- endoxa-0.0.1/src/endoxa/governance/provenance.py +84 -0
- endoxa-0.0.1/src/endoxa/governance/resolution.py +380 -0
- endoxa-0.0.1/src/endoxa/governance/revision/__init__.py +50 -0
- endoxa-0.0.1/src/endoxa/governance/revision/engine.py +533 -0
- endoxa-0.0.1/src/endoxa/governance/revision/facts.py +41 -0
- endoxa-0.0.1/src/endoxa/governance/revision/links.py +509 -0
- endoxa-0.0.1/src/endoxa/governance/revision/preference.py +153 -0
- endoxa-0.0.1/src/endoxa/governance/revision/tie.py +214 -0
- endoxa-0.0.1/src/endoxa/governance/support.py +102 -0
- endoxa-0.0.1/src/endoxa/governance/view.py +458 -0
- endoxa-0.0.1/src/endoxa/instruments/__init__.py +23 -0
- endoxa-0.0.1/src/endoxa/instruments/calibration/__init__.py +44 -0
- endoxa-0.0.1/src/endoxa/instruments/calibration/ask_policy.py +50 -0
- endoxa-0.0.1/src/endoxa/instruments/calibration/competence.py +45 -0
- endoxa-0.0.1/src/endoxa/instruments/calibration/knowledge.py +83 -0
- endoxa-0.0.1/src/endoxa/instruments/calibration/replay.py +111 -0
- endoxa-0.0.1/src/endoxa/instruments/calibration/snapshot.py +31 -0
- endoxa-0.0.1/src/endoxa/instruments/calibration/windowed.py +273 -0
- endoxa-0.0.1/src/endoxa/instruments/coverage/__init__.py +9 -0
- endoxa-0.0.1/src/endoxa/instruments/coverage/graph.py +122 -0
- endoxa-0.0.1/src/endoxa/instruments/coverage/snapshot.py +85 -0
- endoxa-0.0.1/src/endoxa/solver/__init__.py +71 -0
- endoxa-0.0.1/src/endoxa/solver/api.py +103 -0
- endoxa-0.0.1/src/endoxa/solver/ast/__init__.py +0 -0
- endoxa-0.0.1/src/endoxa/solver/ast/context.py +105 -0
- endoxa-0.0.1/src/endoxa/solver/ast/expr.py +151 -0
- endoxa-0.0.1/src/endoxa/solver/ast/sorts.py +30 -0
- endoxa-0.0.1/src/endoxa/solver/ast/utils.py +46 -0
- endoxa-0.0.1/src/endoxa/solver/engine.py +268 -0
- endoxa-0.0.1/src/endoxa/solver/parsers/__init__.py +3 -0
- endoxa-0.0.1/src/endoxa/solver/parsers/dimacs.py +34 -0
- endoxa-0.0.1/src/endoxa/solver/parsers/tptp.lark +53 -0
- endoxa-0.0.1/src/endoxa/solver/parsers/tptp.py +118 -0
- endoxa-0.0.1/src/endoxa/solver/quantifiers/__init__.py +3 -0
- endoxa-0.0.1/src/endoxa/solver/quantifiers/ematch.py +230 -0
- endoxa-0.0.1/src/endoxa/solver/sat/__init__.py +3 -0
- endoxa-0.0.1/src/endoxa/solver/sat/solver.py +743 -0
- endoxa-0.0.1/src/endoxa/solver/sat/types.py +25 -0
- endoxa-0.0.1/src/endoxa/solver/tactic/__init__.py +5 -0
- endoxa-0.0.1/src/endoxa/solver/tactic/encoder.py +109 -0
- endoxa-0.0.1/src/endoxa/solver/tactic/preprocess.py +102 -0
- endoxa-0.0.1/src/endoxa/solver/tactic/skolemize.py +100 -0
- endoxa-0.0.1/src/endoxa/solver/theories/__init__.py +3 -0
- endoxa-0.0.1/src/endoxa/solver/theories/base.py +22 -0
- endoxa-0.0.1/src/endoxa/solver/theories/euf.py +260 -0
- endoxa-0.0.1/src/endoxa/syntax/__init__.py +15 -0
- endoxa-0.0.1/src/endoxa/syntax/atoms.py +64 -0
- endoxa-0.0.1/src/endoxa/trace/__init__.py +20 -0
- endoxa-0.0.1/src/endoxa/trace/models.py +49 -0
- endoxa-0.0.1/src/endoxa/trace/store.py +33 -0
endoxa-0.0.1/LICENSE
ADDED
|
@@ -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.
|
endoxa-0.0.1/NOTICE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
endoxa
|
|
2
|
+
Copyright 2026 noise01
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
endoxa-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: endoxa
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Governed beliefs for LLM agents: an append-only ledger, SMT-checked consistency, defeasible revision, and calibration instruments.
|
|
5
|
+
Keywords: agent,belief-revision,calibration,llm,smt,truth-maintenance
|
|
6
|
+
Author: noise01
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: NOTICE
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Dist: lark>=1.3.1
|
|
16
|
+
Requires-Dist: networkx[default]>=3.6.1 ; extra == 'coverage'
|
|
17
|
+
Requires-Dist: pydantic>=2.12.5 ; extra == 'trace'
|
|
18
|
+
Requires-Python: >=3.14
|
|
19
|
+
Project-URL: Homepage, https://github.com/noise01/endoxa
|
|
20
|
+
Project-URL: Changelog, https://github.com/noise01/endoxa/blob/main/CHANGELOG.md
|
|
21
|
+
Project-URL: Issues, https://github.com/noise01/endoxa/issues
|
|
22
|
+
Provides-Extra: coverage
|
|
23
|
+
Provides-Extra: trace
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# endoxa
|
|
27
|
+
|
|
28
|
+
**Governed beliefs for agents.** An append-only ledger, SMT-checked consistency,
|
|
29
|
+
defeasible revision, and calibration instruments — a layer you give an agent,
|
|
30
|
+
not a framework you build one inside.
|
|
31
|
+
|
|
32
|
+
> **Status: pre-alpha.** The library was extracted whole from the research system
|
|
33
|
+
> it grew in, where it has run for months. Versions before 1.0 may move the public
|
|
34
|
+
> API: what is shown below is where the extraction landed, not a promise.
|
|
35
|
+
|
|
36
|
+
## The problem
|
|
37
|
+
|
|
38
|
+
An LLM agent will tell you Socrates is mortal, and twenty turns later that he is
|
|
39
|
+
immortal, and never notice. It has no place to put a claim other than its own
|
|
40
|
+
context, no way to check a new claim against the ones it already made, and no
|
|
41
|
+
record of why it believes any of them. Asking it to be consistent is asking the
|
|
42
|
+
thing that lost track to keep track.
|
|
43
|
+
|
|
44
|
+
endoxa is the place to put them.
|
|
45
|
+
|
|
46
|
+
## What it does
|
|
47
|
+
|
|
48
|
+
- **Checks.** Beliefs and the rules they live under go to a bundled SMT solver,
|
|
49
|
+
which answers satisfiable, unsatisfiable, or *unknown* when its deliberation
|
|
50
|
+
budget runs out — a real answer, not a failure.
|
|
51
|
+
- **Decides.** On a conflict it finds what is actually to blame and orders the
|
|
52
|
+
candidates by how readily each may be given up. A rule the agent *learned* may
|
|
53
|
+
be retracted; a rule it was given may not.
|
|
54
|
+
- **Holds.** When two beliefs are equally credible, the conflict cannot be
|
|
55
|
+
settled from the inside. That is a state with a name, not a coin flip.
|
|
56
|
+
- **Records.** Every operation is an entry in an append-only ledger. A retracted
|
|
57
|
+
belief keeps its row and stops counting, so the history of what the agent
|
|
58
|
+
believed survives the change.
|
|
59
|
+
- **Measures.** Whether the agent's confidence matched its accuracy, over what it
|
|
60
|
+
claims to know, what it claims to be able to do, and when it chooses to ask.
|
|
61
|
+
|
|
62
|
+
## Example
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from endoxa.governance import Belief, Constraints, Rule, govern
|
|
66
|
+
|
|
67
|
+
constraints = Constraints(
|
|
68
|
+
rules=(
|
|
69
|
+
Rule(
|
|
70
|
+
name="mortality",
|
|
71
|
+
axiom="fof(m, axiom, ![X]: (human(X) => mortal(X))).",
|
|
72
|
+
confidence=0.9,
|
|
73
|
+
),
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
beliefs = [
|
|
77
|
+
Belief(target="human(socrates)", truth_value=True, confidence=1.0, context="user"),
|
|
78
|
+
Belief(target="mortal(socrates)", truth_value=False, confidence=0.6, context="agent"),
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
outcome = govern(beliefs, constraints)
|
|
82
|
+
|
|
83
|
+
outcome.consistent # False
|
|
84
|
+
|
|
85
|
+
# The operations to perform, in order: here, retracting the 0.6-confidence
|
|
86
|
+
# claim -- not the rule, and not the one the user asserted.
|
|
87
|
+
outcome.ops
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`govern` decides; it does not mutate. The operations it returns are what you
|
|
91
|
+
append to the ledger and apply to your own store.
|
|
92
|
+
|
|
93
|
+
## Install
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install endoxa
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The core takes one dependency. Two packages need more and are opt-in:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install "endoxa[trace]" # the ordered series of an agent's propositions
|
|
103
|
+
pip install "endoxa[coverage]" # how densely rules connect predicates
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Design notes
|
|
107
|
+
|
|
108
|
+
- **The solver is bundled and frozen.** endoxa answers about consistency without
|
|
109
|
+
reaching for an external prover. Its correctness is asserted differentially
|
|
110
|
+
against Z3 in dev-only tests rather than by its own suite alone.
|
|
111
|
+
- **The ledger is the record, not a cache.** Operations are appended; the current
|
|
112
|
+
view is folded from them. An unsettleable conflict appears in that view as
|
|
113
|
+
`UNRESOLVED` rather than as a silent choice.
|
|
114
|
+
- **Instruments are imported by nothing else.** A measure its subject can reach
|
|
115
|
+
is a measure its subject can move, so the dependency is forbidden by contract
|
|
116
|
+
and checked in CI.
|
|
117
|
+
- **Requires Python 3.14+.**
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
endoxa-0.0.1/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# endoxa
|
|
2
|
+
|
|
3
|
+
**Governed beliefs for agents.** An append-only ledger, SMT-checked consistency,
|
|
4
|
+
defeasible revision, and calibration instruments — a layer you give an agent,
|
|
5
|
+
not a framework you build one inside.
|
|
6
|
+
|
|
7
|
+
> **Status: pre-alpha.** The library was extracted whole from the research system
|
|
8
|
+
> it grew in, where it has run for months. Versions before 1.0 may move the public
|
|
9
|
+
> API: what is shown below is where the extraction landed, not a promise.
|
|
10
|
+
|
|
11
|
+
## The problem
|
|
12
|
+
|
|
13
|
+
An LLM agent will tell you Socrates is mortal, and twenty turns later that he is
|
|
14
|
+
immortal, and never notice. It has no place to put a claim other than its own
|
|
15
|
+
context, no way to check a new claim against the ones it already made, and no
|
|
16
|
+
record of why it believes any of them. Asking it to be consistent is asking the
|
|
17
|
+
thing that lost track to keep track.
|
|
18
|
+
|
|
19
|
+
endoxa is the place to put them.
|
|
20
|
+
|
|
21
|
+
## What it does
|
|
22
|
+
|
|
23
|
+
- **Checks.** Beliefs and the rules they live under go to a bundled SMT solver,
|
|
24
|
+
which answers satisfiable, unsatisfiable, or *unknown* when its deliberation
|
|
25
|
+
budget runs out — a real answer, not a failure.
|
|
26
|
+
- **Decides.** On a conflict it finds what is actually to blame and orders the
|
|
27
|
+
candidates by how readily each may be given up. A rule the agent *learned* may
|
|
28
|
+
be retracted; a rule it was given may not.
|
|
29
|
+
- **Holds.** When two beliefs are equally credible, the conflict cannot be
|
|
30
|
+
settled from the inside. That is a state with a name, not a coin flip.
|
|
31
|
+
- **Records.** Every operation is an entry in an append-only ledger. A retracted
|
|
32
|
+
belief keeps its row and stops counting, so the history of what the agent
|
|
33
|
+
believed survives the change.
|
|
34
|
+
- **Measures.** Whether the agent's confidence matched its accuracy, over what it
|
|
35
|
+
claims to know, what it claims to be able to do, and when it chooses to ask.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from endoxa.governance import Belief, Constraints, Rule, govern
|
|
41
|
+
|
|
42
|
+
constraints = Constraints(
|
|
43
|
+
rules=(
|
|
44
|
+
Rule(
|
|
45
|
+
name="mortality",
|
|
46
|
+
axiom="fof(m, axiom, ![X]: (human(X) => mortal(X))).",
|
|
47
|
+
confidence=0.9,
|
|
48
|
+
),
|
|
49
|
+
),
|
|
50
|
+
)
|
|
51
|
+
beliefs = [
|
|
52
|
+
Belief(target="human(socrates)", truth_value=True, confidence=1.0, context="user"),
|
|
53
|
+
Belief(target="mortal(socrates)", truth_value=False, confidence=0.6, context="agent"),
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
outcome = govern(beliefs, constraints)
|
|
57
|
+
|
|
58
|
+
outcome.consistent # False
|
|
59
|
+
|
|
60
|
+
# The operations to perform, in order: here, retracting the 0.6-confidence
|
|
61
|
+
# claim -- not the rule, and not the one the user asserted.
|
|
62
|
+
outcome.ops
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`govern` decides; it does not mutate. The operations it returns are what you
|
|
66
|
+
append to the ledger and apply to your own store.
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install endoxa
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The core takes one dependency. Two packages need more and are opt-in:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install "endoxa[trace]" # the ordered series of an agent's propositions
|
|
78
|
+
pip install "endoxa[coverage]" # how densely rules connect predicates
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Design notes
|
|
82
|
+
|
|
83
|
+
- **The solver is bundled and frozen.** endoxa answers about consistency without
|
|
84
|
+
reaching for an external prover. Its correctness is asserted differentially
|
|
85
|
+
against Z3 in dev-only tests rather than by its own suite alone.
|
|
86
|
+
- **The ledger is the record, not a cache.** Operations are appended; the current
|
|
87
|
+
view is folded from them. An unsettleable conflict appears in that view as
|
|
88
|
+
`UNRESOLVED` rather than as a silent choice.
|
|
89
|
+
- **Instruments are imported by nothing else.** A measure its subject can reach
|
|
90
|
+
is a measure its subject can move, so the dependency is forbidden by contract
|
|
91
|
+
and checked in CI.
|
|
92
|
+
- **Requires Python 3.14+.**
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "endoxa"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "Governed beliefs for LLM agents: an append-only ledger, SMT-checked consistency, defeasible revision, and calibration instruments."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = [
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"NOTICE",
|
|
11
|
+
]
|
|
12
|
+
keywords = [
|
|
13
|
+
"agent",
|
|
14
|
+
"belief-revision",
|
|
15
|
+
"calibration",
|
|
16
|
+
"llm",
|
|
17
|
+
"smt",
|
|
18
|
+
"truth-maintenance",
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
25
|
+
"Typing :: Typed",
|
|
26
|
+
]
|
|
27
|
+
dependencies = ["lark>=1.3.1"]
|
|
28
|
+
|
|
29
|
+
[[project.authors]]
|
|
30
|
+
name = "noise01"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
trace = ["pydantic>=2.12.5"]
|
|
34
|
+
coverage = ["networkx[default]>=3.6.1"]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/noise01/endoxa"
|
|
38
|
+
Changelog = "https://github.com/noise01/endoxa/blob/main/CHANGELOG.md"
|
|
39
|
+
Issues = "https://github.com/noise01/endoxa/issues"
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["uv_build>=0.9.22,<0.13.0"]
|
|
43
|
+
build-backend = "uv_build"
|
|
44
|
+
|
|
45
|
+
[dependency-groups]
|
|
46
|
+
dev = [
|
|
47
|
+
"hypothesis>=6.100",
|
|
48
|
+
"import-linter>=2.3",
|
|
49
|
+
"pytest>=9.0.3",
|
|
50
|
+
"pytest-asyncio>=1.3.0",
|
|
51
|
+
"ruff>=0.15.17",
|
|
52
|
+
"z3-solver>=4.13",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
target-version = "py314"
|
|
57
|
+
line-length = 120
|
|
58
|
+
|
|
59
|
+
[tool.ruff.format]
|
|
60
|
+
line-ending = "lf"
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = ["ALL"]
|
|
64
|
+
ignore = [
|
|
65
|
+
"COM812",
|
|
66
|
+
"CPY001",
|
|
67
|
+
"D1",
|
|
68
|
+
"D413",
|
|
69
|
+
"PLR0911",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[tool.ruff.lint.per-file-ignores]
|
|
73
|
+
"tests/**/*.py" = [
|
|
74
|
+
"ANN001",
|
|
75
|
+
"ANN201",
|
|
76
|
+
"ANN202",
|
|
77
|
+
"D400",
|
|
78
|
+
"D415",
|
|
79
|
+
"INP001",
|
|
80
|
+
"PLR2004",
|
|
81
|
+
"S101",
|
|
82
|
+
"S311",
|
|
83
|
+
"SLF001",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[tool.pytest.ini_options]
|
|
87
|
+
testpaths = ["tests"]
|
|
88
|
+
pythonpath = ["."]
|
|
89
|
+
addopts = [
|
|
90
|
+
"--strict-markers",
|
|
91
|
+
"--strict-config",
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
[tool.importlinter]
|
|
95
|
+
root_package = "endoxa"
|
|
96
|
+
|
|
97
|
+
[[tool.importlinter.contracts]]
|
|
98
|
+
name = "The package is a DAG"
|
|
99
|
+
type = "layers"
|
|
100
|
+
layers = [
|
|
101
|
+
"endoxa.instruments",
|
|
102
|
+
"endoxa.trace",
|
|
103
|
+
"endoxa.governance",
|
|
104
|
+
"endoxa.solver",
|
|
105
|
+
"endoxa.syntax",
|
|
106
|
+
]
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "endoxa"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "Governed beliefs for LLM agents: an append-only ledger, SMT-checked consistency, defeasible revision, and calibration instruments."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
9
|
+
authors = [{ name = "noise01" }]
|
|
10
|
+
keywords = [
|
|
11
|
+
"agent",
|
|
12
|
+
"belief-revision",
|
|
13
|
+
"calibration",
|
|
14
|
+
"llm",
|
|
15
|
+
"smt",
|
|
16
|
+
"truth-maintenance",
|
|
17
|
+
]
|
|
18
|
+
# No license classifier: PEP 639 forbids pairing one with a `license`
|
|
19
|
+
# expression, and the expression above is the authoritative statement.
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
25
|
+
"Typing :: Typed",
|
|
26
|
+
]
|
|
27
|
+
# The core -- ledger, revision, solver -- takes one dependency: the TPTP grammar
|
|
28
|
+
# the solver parses rules with. The two packages that need more are optional, so
|
|
29
|
+
# governing beliefs never drags in a model framework or a graph library.
|
|
30
|
+
dependencies = ["lark>=1.3.1"]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
trace = ["pydantic>=2.12.5"]
|
|
34
|
+
coverage = ["networkx[default]>=3.6.1"]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/noise01/endoxa"
|
|
38
|
+
Changelog = "https://github.com/noise01/endoxa/blob/main/CHANGELOG.md"
|
|
39
|
+
Issues = "https://github.com/noise01/endoxa/issues"
|
|
40
|
+
|
|
41
|
+
[build-system]
|
|
42
|
+
requires = ["uv_build>=0.9.22,<0.13.0"]
|
|
43
|
+
build-backend = "uv_build"
|
|
44
|
+
|
|
45
|
+
[dependency-groups]
|
|
46
|
+
dev = [
|
|
47
|
+
"hypothesis>=6.100",
|
|
48
|
+
"import-linter>=2.3",
|
|
49
|
+
"pytest>=9.0.3",
|
|
50
|
+
# The trace store is an async port, so its contract test needs an async runner.
|
|
51
|
+
"pytest-asyncio>=1.3.0",
|
|
52
|
+
"ruff>=0.15.17",
|
|
53
|
+
# The solver's correctness is asserted against Z3 by differential tests, not
|
|
54
|
+
# by its own test suite alone.
|
|
55
|
+
"z3-solver>=4.13",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[tool.ruff]
|
|
59
|
+
target-version = "py314"
|
|
60
|
+
line-length = 120
|
|
61
|
+
|
|
62
|
+
[tool.ruff.format]
|
|
63
|
+
line-ending = "lf"
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint]
|
|
66
|
+
select = ["ALL"]
|
|
67
|
+
ignore = [
|
|
68
|
+
"COM812", # conflicts with the formatter; trailing commas are its job
|
|
69
|
+
# The Apache-2.0 grant is stated once, in LICENSE and NOTICE, rather than
|
|
70
|
+
# repeated atop every file. Per-file headers are conventional for this
|
|
71
|
+
# licence but not required by it, and a notice restated a few hundred times
|
|
72
|
+
# is a few hundred places for it to drift out of agreement with itself.
|
|
73
|
+
"CPY001",
|
|
74
|
+
"D1", # docstrings are required by review, not by lint
|
|
75
|
+
"D413", # no blank line after the last docstring section
|
|
76
|
+
"PLR0911", # dispatch functions return early per branch
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.ruff.lint.per-file-ignores]
|
|
80
|
+
"tests/**/*.py" = [
|
|
81
|
+
"ANN001",
|
|
82
|
+
"ANN201",
|
|
83
|
+
"ANN202",
|
|
84
|
+
"D400",
|
|
85
|
+
"D415",
|
|
86
|
+
"INP001",
|
|
87
|
+
"PLR2004",
|
|
88
|
+
"S101",
|
|
89
|
+
"S311", # seeded pseudo-random generation is the point of the harness, not crypto
|
|
90
|
+
"SLF001",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[tool.pytest.ini_options]
|
|
94
|
+
testpaths = ["tests"]
|
|
95
|
+
# The differential harness is a helper package under tests/, imported by the two
|
|
96
|
+
# tests that drive it; the repo root has to be importable for that to resolve.
|
|
97
|
+
pythonpath = ["."]
|
|
98
|
+
# strict-markers/strict-config: a mistyped marker or ini key must fail rather
|
|
99
|
+
# than be silently ignored -- a check that cannot fail is not a check.
|
|
100
|
+
addopts = ["--strict-markers", "--strict-config"]
|
|
101
|
+
|
|
102
|
+
[tool.importlinter]
|
|
103
|
+
root_package = "endoxa"
|
|
104
|
+
|
|
105
|
+
# The package is a DAG, and this states the whole of it: a layer may import the
|
|
106
|
+
# layers below it and never the ones above. Reading it bottom-up --
|
|
107
|
+
#
|
|
108
|
+
# syntax parses an atom's shape; depends on nothing.
|
|
109
|
+
# solver decides satisfiability; a frozen, self-contained SMT engine.
|
|
110
|
+
# governance decides what to do about beliefs, using both.
|
|
111
|
+
# trace records the series of thoughts; independent of the decision.
|
|
112
|
+
# instruments measures everything and is imported by nothing, because a
|
|
113
|
+
# measure that its subject can reach is a measure its subject can
|
|
114
|
+
# move.
|
|
115
|
+
#
|
|
116
|
+
# A new top-level package is not in this list and would escape the rule in
|
|
117
|
+
# silence, so the port owes a completeness test that every subpackage of `endoxa`
|
|
118
|
+
# appears here -- an enumeration without a check is an enumeration that rots.
|
|
119
|
+
[[tool.importlinter.contracts]]
|
|
120
|
+
name = "The package is a DAG"
|
|
121
|
+
type = "layers"
|
|
122
|
+
layers = [
|
|
123
|
+
"endoxa.instruments",
|
|
124
|
+
"endoxa.trace",
|
|
125
|
+
"endoxa.governance",
|
|
126
|
+
"endoxa.solver",
|
|
127
|
+
"endoxa.syntax",
|
|
128
|
+
]
|