epistemic-engine 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. epistemic_engine-1.2.0/LICENSE +201 -0
  2. epistemic_engine-1.2.0/NOTICE +7 -0
  3. epistemic_engine-1.2.0/PKG-INFO +213 -0
  4. epistemic_engine-1.2.0/README.md +177 -0
  5. epistemic_engine-1.2.0/pyproject.toml +66 -0
  6. epistemic_engine-1.2.0/setup.cfg +4 -0
  7. epistemic_engine-1.2.0/src/epistemic_engine/__init__.py +19 -0
  8. epistemic_engine-1.2.0/src/epistemic_engine/analyze.py +433 -0
  9. epistemic_engine-1.2.0/src/epistemic_engine/beliefs/__init__.py +24 -0
  10. epistemic_engine-1.2.0/src/epistemic_engine/beliefs/extract.py +495 -0
  11. epistemic_engine-1.2.0/src/epistemic_engine/beliefs/mapper.py +109 -0
  12. epistemic_engine-1.2.0/src/epistemic_engine/beliefs/model.py +107 -0
  13. epistemic_engine-1.2.0/src/epistemic_engine/bench.py +141 -0
  14. epistemic_engine-1.2.0/src/epistemic_engine/cli.py +1425 -0
  15. epistemic_engine-1.2.0/src/epistemic_engine/compare.py +133 -0
  16. epistemic_engine-1.2.0/src/epistemic_engine/config.py +250 -0
  17. epistemic_engine-1.2.0/src/epistemic_engine/dashboard/__init__.py +5 -0
  18. epistemic_engine-1.2.0/src/epistemic_engine/dashboard/server.py +533 -0
  19. epistemic_engine-1.2.0/src/epistemic_engine/doctor.py +151 -0
  20. epistemic_engine-1.2.0/src/epistemic_engine/forecast.py +102 -0
  21. epistemic_engine-1.2.0/src/epistemic_engine/forge/__init__.py +12 -0
  22. epistemic_engine-1.2.0/src/epistemic_engine/forge/cache.py +50 -0
  23. epistemic_engine-1.2.0/src/epistemic_engine/forge/client.py +139 -0
  24. epistemic_engine-1.2.0/src/epistemic_engine/forge/sync.py +100 -0
  25. epistemic_engine-1.2.0/src/epistemic_engine/guard.py +487 -0
  26. epistemic_engine-1.2.0/src/epistemic_engine/guardbench.py +332 -0
  27. epistemic_engine-1.2.0/src/epistemic_engine/ingestion/__init__.py +17 -0
  28. epistemic_engine-1.2.0/src/epistemic_engine/ingestion/change_events.py +85 -0
  29. epistemic_engine-1.2.0/src/epistemic_engine/ingestion/git_extractor.py +265 -0
  30. epistemic_engine-1.2.0/src/epistemic_engine/ingestion/ingest.py +315 -0
  31. epistemic_engine-1.2.0/src/epistemic_engine/ingestion/parsers.py +250 -0
  32. epistemic_engine-1.2.0/src/epistemic_engine/justifications.py +229 -0
  33. epistemic_engine-1.2.0/src/epistemic_engine/net.py +142 -0
  34. epistemic_engine-1.2.0/src/epistemic_engine/ontology/__init__.py +17 -0
  35. epistemic_engine-1.2.0/src/epistemic_engine/ontology/data/po1-1.0.yaml +79 -0
  36. epistemic_engine-1.2.0/src/epistemic_engine/ontology/po1.py +325 -0
  37. epistemic_engine-1.2.0/src/epistemic_engine/packaging/__init__.py +5 -0
  38. epistemic_engine-1.2.0/src/epistemic_engine/packaging/eepkg.py +130 -0
  39. epistemic_engine-1.2.0/src/epistemic_engine/predict/__init__.py +25 -0
  40. epistemic_engine-1.2.0/src/epistemic_engine/predict/calibration.py +186 -0
  41. epistemic_engine-1.2.0/src/epistemic_engine/predict/causal.py +400 -0
  42. epistemic_engine-1.2.0/src/epistemic_engine/predict/patterns.py +283 -0
  43. epistemic_engine-1.2.0/src/epistemic_engine/progress.py +64 -0
  44. epistemic_engine-1.2.0/src/epistemic_engine/repo.py +33 -0
  45. epistemic_engine-1.2.0/src/epistemic_engine/report.py +343 -0
  46. epistemic_engine-1.2.0/src/epistemic_engine/reproducibility.py +63 -0
  47. epistemic_engine-1.2.0/src/epistemic_engine/revision/__init__.py +27 -0
  48. epistemic_engine-1.2.0/src/epistemic_engine/revision/agm.py +116 -0
  49. epistemic_engine-1.2.0/src/epistemic_engine/revision/confidence.py +106 -0
  50. epistemic_engine-1.2.0/src/epistemic_engine/revision/engine.py +565 -0
  51. epistemic_engine-1.2.0/src/epistemic_engine/revision/entrenchment.py +92 -0
  52. epistemic_engine-1.2.0/src/epistemic_engine/revision/falsification.py +105 -0
  53. epistemic_engine-1.2.0/src/epistemic_engine/security/__init__.py +14 -0
  54. epistemic_engine-1.2.0/src/epistemic_engine/security/cve.py +209 -0
  55. epistemic_engine-1.2.0/src/epistemic_engine/security/secrets.py +112 -0
  56. epistemic_engine-1.2.0/src/epistemic_engine/storage/__init__.py +9 -0
  57. epistemic_engine-1.2.0/src/epistemic_engine/storage/graph.py +290 -0
  58. epistemic_engine-1.2.0/src/epistemic_engine/temporal/__init__.py +17 -0
  59. epistemic_engine-1.2.0/src/epistemic_engine/temporal/engine.py +212 -0
  60. epistemic_engine-1.2.0/src/epistemic_engine/validation/__init__.py +27 -0
  61. epistemic_engine-1.2.0/src/epistemic_engine/validation/corpus.py +142 -0
  62. epistemic_engine-1.2.0/src/epistemic_engine/validation/gates.py +98 -0
  63. epistemic_engine-1.2.0/src/epistemic_engine/validation/kappa.py +59 -0
  64. epistemic_engine-1.2.0/src/epistemic_engine/validation/manifest.py +135 -0
  65. epistemic_engine-1.2.0/src/epistemic_engine/validation/release_gates.py +251 -0
  66. epistemic_engine-1.2.0/src/epistemic_engine/validation/stats.py +97 -0
  67. epistemic_engine-1.2.0/src/epistemic_engine/validation/validate.py +306 -0
  68. epistemic_engine-1.2.0/src/epistemic_engine/verify.py +81 -0
  69. epistemic_engine-1.2.0/src/epistemic_engine.egg-info/PKG-INFO +213 -0
  70. epistemic_engine-1.2.0/src/epistemic_engine.egg-info/SOURCES.txt +100 -0
  71. epistemic_engine-1.2.0/src/epistemic_engine.egg-info/dependency_links.txt +1 -0
  72. epistemic_engine-1.2.0/src/epistemic_engine.egg-info/entry_points.txt +2 -0
  73. epistemic_engine-1.2.0/src/epistemic_engine.egg-info/requires.txt +12 -0
  74. epistemic_engine-1.2.0/src/epistemic_engine.egg-info/top_level.txt +1 -0
  75. epistemic_engine-1.2.0/tests/test_agm.py +72 -0
  76. epistemic_engine-1.2.0/tests/test_analyze.py +121 -0
  77. epistemic_engine-1.2.0/tests/test_beliefs.py +102 -0
  78. epistemic_engine-1.2.0/tests/test_cli.py +61 -0
  79. epistemic_engine-1.2.0/tests/test_cli_ux.py +53 -0
  80. epistemic_engine-1.2.0/tests/test_compare.py +68 -0
  81. epistemic_engine-1.2.0/tests/test_confidence.py +100 -0
  82. epistemic_engine-1.2.0/tests/test_core.py +108 -0
  83. epistemic_engine-1.2.0/tests/test_corpus.py +132 -0
  84. epistemic_engine-1.2.0/tests/test_dashboard.py +109 -0
  85. epistemic_engine-1.2.0/tests/test_extra_sources.py +109 -0
  86. epistemic_engine-1.2.0/tests/test_falsification.py +55 -0
  87. epistemic_engine-1.2.0/tests/test_forge.py +136 -0
  88. epistemic_engine-1.2.0/tests/test_guard.py +181 -0
  89. epistemic_engine-1.2.0/tests/test_guardbench.py +49 -0
  90. epistemic_engine-1.2.0/tests/test_ingestion.py +93 -0
  91. epistemic_engine-1.2.0/tests/test_justifications.py +74 -0
  92. epistemic_engine-1.2.0/tests/test_net.py +120 -0
  93. epistemic_engine-1.2.0/tests/test_ontology.py +108 -0
  94. epistemic_engine-1.2.0/tests/test_polyglot.py +96 -0
  95. epistemic_engine-1.2.0/tests/test_predict_calibration.py +65 -0
  96. epistemic_engine-1.2.0/tests/test_predict_causal.py +132 -0
  97. epistemic_engine-1.2.0/tests/test_predict_patterns.py +98 -0
  98. epistemic_engine-1.2.0/tests/test_release_gates.py +46 -0
  99. epistemic_engine-1.2.0/tests/test_reports.py +109 -0
  100. epistemic_engine-1.2.0/tests/test_security.py +127 -0
  101. epistemic_engine-1.2.0/tests/test_temporal.py +127 -0
  102. epistemic_engine-1.2.0/tests/test_validation.py +106 -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 Derivative
95
+ 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 2026 Aswin S
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,7 @@
1
+ The Epistemic Engine
2
+ Copyright 2026 Aswin S
3
+
4
+ This product includes software developed by Aswin S.
5
+
6
+ Licensed under the Apache License, Version 2.0. See the LICENSE file
7
+ for the full terms.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: epistemic-engine
3
+ Version: 1.2.0
4
+ Summary: Computational epistemology for software: extract code beliefs, verify AI-generated changes, and forecast where confidence will collapse.
5
+ Author: Aswin S
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://pypi.org/project/epistemic-engine/
8
+ Project-URL: Documentation, https://pypi.org/project/epistemic-engine/
9
+ Project-URL: Source, https://pypi.org/project/epistemic-engine/
10
+ Keywords: epistemology,belief-revision,agm,static-analysis,software-quality,security,sast,ai-code-review,pre-commit
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Quality Assurance
20
+ Classifier: Topic :: Security
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: NOTICE
26
+ Requires-Dist: PyYAML>=6.0
27
+ Provides-Extra: parsing
28
+ Requires-Dist: tree-sitter>=0.21; extra == "parsing"
29
+ Requires-Dist: tree-sitter-language-pack>=0.2; extra == "parsing"
30
+ Provides-Extra: rocksdb
31
+ Requires-Dist: rocksdict>=0.3; extra == "rocksdb"
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.4; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # The Epistemic Engine
38
+
39
+ **Computational epistemology for software.** It reads a codebase as a system of
40
+ *justified beliefs* — claims the code makes about itself ("this function
41
+ authenticates the caller", "this value is never null", "this uses approved
42
+ crypto") — reconstructs how well-justified each one is from git history, and
43
+ tracks how that confidence changes over time.
44
+
45
+ On top of that foundation it ships two tools you can use today:
46
+
47
+ - **`ee guard`** — a pre-commit / CI verifier that **blocks unsafe or
48
+ unjustified code before it lands** (great for reviewing AI-generated changes).
49
+ - **`ee predict-chain`** — forecasts **which beliefs are about to collapse**,
50
+ why, roughly when, and what it would cost to fix now vs. later — and it
51
+ **tells you when it can't trust its own forecast.**
52
+
53
+ Everything is **deterministic** (no LLM, no network, no wall-clock in any
54
+ computed value), runs **offline**, and is backed by **167 tests**.
55
+
56
+ ```bash
57
+ pip install epistemic-engine
58
+ ```
59
+
60
+ Requires Python 3.10+. Apache-2.0 licensed.
61
+
62
+ ---
63
+
64
+ ## What it does, in one screen
65
+
66
+ ```bash
67
+ ee ingest ./my-repo # read git history into a local graph
68
+ ee analyze ./my-repo # extract beliefs, justifications, trajectories
69
+
70
+ ee guard ./my-repo --all # find unsafe / unjustified code
71
+ ee predict-chain ./my-repo # forecast which beliefs will collapse
72
+ ee dashboard ./my-repo # explore all of it in your browser
73
+ ```
74
+
75
+ ---
76
+
77
+ ## 1. Verify code before it ships — `ee guard`
78
+
79
+ `ee guard` extracts the beliefs a change makes about itself and **blocks** on
80
+ risky ones, then layers on direct OWASP-class scanners and known-CVE matches.
81
+ Each finding carries a severity, the reason, a concrete fix, and a stable
82
+ fingerprint.
83
+
84
+ It catches, among others:
85
+
86
+ | Class | Examples |
87
+ |-------|----------|
88
+ | Weak crypto | `md5`/`sha1`/`mt_rand` used as a security primitive |
89
+ | Injection | SQL built by string concatenation, `os.system`/`popen` on user input |
90
+ | Unsafe sinks | `eval`, `innerHTML`, `unserialize`, `pickle.loads` on untrusted data |
91
+ | Secrets | hardcoded API keys / tokens (the value is never printed or stored) |
92
+ | Misconfig | TLS verification off, `Access-Control-Allow-Origin: *`, debug enabled |
93
+
94
+ ```bash
95
+ ee guard ./repo --staged # verify staged changes (exit 1 = would block the commit)
96
+ ee guard ./repo --all # verify the whole tree
97
+ ee guard ./repo --format sarif # SARIF 2.1.0 for GitHub code scanning
98
+ ee guard ./repo --emit-workflow # print a ready .github/workflows/ee-guard.yml
99
+ ee hook install ./repo # run it automatically on every `git commit`
100
+ ```
101
+
102
+ **Adoption features** so it fits a real team: inline `# ee-ignore[rule]`
103
+ suppression, a `disabled_rules` config, and a **baseline** mode
104
+ (`--update-baseline` / `--baseline FILE`) that fails only on *new* findings so
105
+ you can adopt on an existing repo without fixing everything first.
106
+
107
+ Field-tested on 1,500+ real production files: precision / recall / false-positive
108
+ rate of **1.0 / 1.0 / 0.0** (95% CI lower bound 0.92 on a 114-sample corpus).
109
+
110
+ ---
111
+
112
+ ## 2. Forecast what's about to break — `ee predict-chain`
113
+
114
+ The engine already knows how each belief's confidence is eroding. `predict-chain`
115
+ projects that forward and, for each at-risk belief, gives you:
116
+
117
+ - a **causal chain** — the ranked factors driving the predicted collapse, each
118
+ tagged **measured** (from your repo's history) or **assumption** (your cost model);
119
+ - a **collapse probability** within a horizon, from a seeded Monte Carlo;
120
+ - a **calendar ETA** from your repo's own commit cadence;
121
+ - a **fix + ROI**, computed under *your* cost assumptions and labelled as such.
122
+
123
+ ```bash
124
+ ee predict-chain ./repo --horizon 30 # forecasts with causes, ETA, ROI
125
+ ee calibrate ./repo # is the forecast trustworthy on THIS repo?
126
+ ```
127
+
128
+ **It refuses to lie.** `ee calibrate` runs a leakage-free back-test against your
129
+ repo's own history and reports a Brier **skill score** vs. a base-rate baseline.
130
+ If the model doesn't beat guessing on your repo, the report says so — and
131
+ `predict-chain` prints that verdict above every forecast. It never fabricates
132
+ probabilities for undisclosed future CVEs, and never presents a dollar figure as
133
+ fact.
134
+
135
+ ---
136
+
137
+ ## 3. See everything — `ee dashboard`
138
+
139
+ ```bash
140
+ ee dashboard ./repo # loopback-only web UI; Ctrl-C to stop
141
+ ```
142
+
143
+ A local, offline, self-contained dashboard with three tabs:
144
+
145
+ - **Beliefs** — every claim the code makes, by domain, coloured by confidence.
146
+ - **🔮 Predictions** — the collapse forecasts, with the calibration verdict on top.
147
+ - **🛡 Guard** — the `ee guard` findings, grouped by severity, with a BLOCK/PASS
148
+ banner. Scans the whole repo by default and caches the result.
149
+
150
+ ---
151
+
152
+ ## Why you can trust the output
153
+
154
+ - **Deterministic.** Identical inputs produce byte-identical output. No LLM, no
155
+ sampling, no wall-clock in any computed value — so results are reproducible
156
+ and diffable in CI.
157
+ - **Honest about uncertainty.** Gates are evaluated on the *lower bound* of a
158
+ Wilson confidence interval, not a point estimate. Predictions ship with a
159
+ calibration verdict. Cost/ROI figures are labelled assumptions.
160
+ - **Offline-first.** No network access except an explicit `ee sync`.
161
+ - **Bounded formalism.** Beliefs outside the closed PO-1 predicate ontology are
162
+ recorded as `unformalised` and excluded from reasoning — never silently coerced.
163
+
164
+ ---
165
+
166
+ ## Install
167
+
168
+ ```bash
169
+ pip install epistemic-engine # core (zero heavy dependencies)
170
+ pip install "epistemic-engine[parsing]" # + tree-sitter for entity-level beliefs
171
+ ```
172
+
173
+ Without the `parsing` extra the engine degrades gracefully to file-granularity
174
+ analysis. Python 3.10+.
175
+
176
+ ## Command reference
177
+
178
+ | Command | What it does |
179
+ |---------|--------------|
180
+ | `ee ingest <repo>` | Read git history into the local epistemic graph |
181
+ | `ee analyze <repo>` | Extract beliefs, justifications, change events, trajectories |
182
+ | `ee guard <repo>` | Verify changed/all code; block unsafe or unjustified beliefs |
183
+ | `ee hook install <repo>` | Install a git pre-commit hook running `ee guard --staged` |
184
+ | `ee predict-chain <repo>` | Forecast belief collapse with causes, ETA, and ROI |
185
+ | `ee calibrate <repo>` | Back-test the forecast model against the repo's own history |
186
+ | `ee dashboard <repo>` | Serve the local web dashboard |
187
+ | `ee report <repo>` | Epistemic health report (text / json / markdown / html) |
188
+ | `ee beliefs / falsifiers / debt / timeline` | Inspect specific slices |
189
+ | `ee doctor` | Validate environment, ontology, and configuration |
190
+
191
+ Run `ee <command> --help` for options, or `ee man` for a full man page.
192
+
193
+ ## Development
194
+
195
+ ```bash
196
+ git clone <your-repo> && cd epistemic-engine
197
+ pip install -e ".[parsing,dev]"
198
+ pytest # 167 tests
199
+ ```
200
+
201
+ ## Documented deviations from the design spec
202
+
203
+ Both are portability choices for a single-developer, offline-first,
204
+ cross-platform (incl. Windows) build; neither changes observable semantics.
205
+
206
+ - **Graph store** is abstracted behind `storage.GraphStore` with a **SQLite**
207
+ default backend (zero-install, deterministic); RocksDB is optional.
208
+ - **Git access** goes through the **git CLI** via subprocess, abstracted behind
209
+ `ingestion.GitExtractor`.
210
+
211
+ ## License
212
+
213
+ Apache-2.0 © 2026 Aswin S. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,177 @@
1
+ # The Epistemic Engine
2
+
3
+ **Computational epistemology for software.** It reads a codebase as a system of
4
+ *justified beliefs* — claims the code makes about itself ("this function
5
+ authenticates the caller", "this value is never null", "this uses approved
6
+ crypto") — reconstructs how well-justified each one is from git history, and
7
+ tracks how that confidence changes over time.
8
+
9
+ On top of that foundation it ships two tools you can use today:
10
+
11
+ - **`ee guard`** — a pre-commit / CI verifier that **blocks unsafe or
12
+ unjustified code before it lands** (great for reviewing AI-generated changes).
13
+ - **`ee predict-chain`** — forecasts **which beliefs are about to collapse**,
14
+ why, roughly when, and what it would cost to fix now vs. later — and it
15
+ **tells you when it can't trust its own forecast.**
16
+
17
+ Everything is **deterministic** (no LLM, no network, no wall-clock in any
18
+ computed value), runs **offline**, and is backed by **167 tests**.
19
+
20
+ ```bash
21
+ pip install epistemic-engine
22
+ ```
23
+
24
+ Requires Python 3.10+. Apache-2.0 licensed.
25
+
26
+ ---
27
+
28
+ ## What it does, in one screen
29
+
30
+ ```bash
31
+ ee ingest ./my-repo # read git history into a local graph
32
+ ee analyze ./my-repo # extract beliefs, justifications, trajectories
33
+
34
+ ee guard ./my-repo --all # find unsafe / unjustified code
35
+ ee predict-chain ./my-repo # forecast which beliefs will collapse
36
+ ee dashboard ./my-repo # explore all of it in your browser
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 1. Verify code before it ships — `ee guard`
42
+
43
+ `ee guard` extracts the beliefs a change makes about itself and **blocks** on
44
+ risky ones, then layers on direct OWASP-class scanners and known-CVE matches.
45
+ Each finding carries a severity, the reason, a concrete fix, and a stable
46
+ fingerprint.
47
+
48
+ It catches, among others:
49
+
50
+ | Class | Examples |
51
+ |-------|----------|
52
+ | Weak crypto | `md5`/`sha1`/`mt_rand` used as a security primitive |
53
+ | Injection | SQL built by string concatenation, `os.system`/`popen` on user input |
54
+ | Unsafe sinks | `eval`, `innerHTML`, `unserialize`, `pickle.loads` on untrusted data |
55
+ | Secrets | hardcoded API keys / tokens (the value is never printed or stored) |
56
+ | Misconfig | TLS verification off, `Access-Control-Allow-Origin: *`, debug enabled |
57
+
58
+ ```bash
59
+ ee guard ./repo --staged # verify staged changes (exit 1 = would block the commit)
60
+ ee guard ./repo --all # verify the whole tree
61
+ ee guard ./repo --format sarif # SARIF 2.1.0 for GitHub code scanning
62
+ ee guard ./repo --emit-workflow # print a ready .github/workflows/ee-guard.yml
63
+ ee hook install ./repo # run it automatically on every `git commit`
64
+ ```
65
+
66
+ **Adoption features** so it fits a real team: inline `# ee-ignore[rule]`
67
+ suppression, a `disabled_rules` config, and a **baseline** mode
68
+ (`--update-baseline` / `--baseline FILE`) that fails only on *new* findings so
69
+ you can adopt on an existing repo without fixing everything first.
70
+
71
+ Field-tested on 1,500+ real production files: precision / recall / false-positive
72
+ rate of **1.0 / 1.0 / 0.0** (95% CI lower bound 0.92 on a 114-sample corpus).
73
+
74
+ ---
75
+
76
+ ## 2. Forecast what's about to break — `ee predict-chain`
77
+
78
+ The engine already knows how each belief's confidence is eroding. `predict-chain`
79
+ projects that forward and, for each at-risk belief, gives you:
80
+
81
+ - a **causal chain** — the ranked factors driving the predicted collapse, each
82
+ tagged **measured** (from your repo's history) or **assumption** (your cost model);
83
+ - a **collapse probability** within a horizon, from a seeded Monte Carlo;
84
+ - a **calendar ETA** from your repo's own commit cadence;
85
+ - a **fix + ROI**, computed under *your* cost assumptions and labelled as such.
86
+
87
+ ```bash
88
+ ee predict-chain ./repo --horizon 30 # forecasts with causes, ETA, ROI
89
+ ee calibrate ./repo # is the forecast trustworthy on THIS repo?
90
+ ```
91
+
92
+ **It refuses to lie.** `ee calibrate` runs a leakage-free back-test against your
93
+ repo's own history and reports a Brier **skill score** vs. a base-rate baseline.
94
+ If the model doesn't beat guessing on your repo, the report says so — and
95
+ `predict-chain` prints that verdict above every forecast. It never fabricates
96
+ probabilities for undisclosed future CVEs, and never presents a dollar figure as
97
+ fact.
98
+
99
+ ---
100
+
101
+ ## 3. See everything — `ee dashboard`
102
+
103
+ ```bash
104
+ ee dashboard ./repo # loopback-only web UI; Ctrl-C to stop
105
+ ```
106
+
107
+ A local, offline, self-contained dashboard with three tabs:
108
+
109
+ - **Beliefs** — every claim the code makes, by domain, coloured by confidence.
110
+ - **🔮 Predictions** — the collapse forecasts, with the calibration verdict on top.
111
+ - **🛡 Guard** — the `ee guard` findings, grouped by severity, with a BLOCK/PASS
112
+ banner. Scans the whole repo by default and caches the result.
113
+
114
+ ---
115
+
116
+ ## Why you can trust the output
117
+
118
+ - **Deterministic.** Identical inputs produce byte-identical output. No LLM, no
119
+ sampling, no wall-clock in any computed value — so results are reproducible
120
+ and diffable in CI.
121
+ - **Honest about uncertainty.** Gates are evaluated on the *lower bound* of a
122
+ Wilson confidence interval, not a point estimate. Predictions ship with a
123
+ calibration verdict. Cost/ROI figures are labelled assumptions.
124
+ - **Offline-first.** No network access except an explicit `ee sync`.
125
+ - **Bounded formalism.** Beliefs outside the closed PO-1 predicate ontology are
126
+ recorded as `unformalised` and excluded from reasoning — never silently coerced.
127
+
128
+ ---
129
+
130
+ ## Install
131
+
132
+ ```bash
133
+ pip install epistemic-engine # core (zero heavy dependencies)
134
+ pip install "epistemic-engine[parsing]" # + tree-sitter for entity-level beliefs
135
+ ```
136
+
137
+ Without the `parsing` extra the engine degrades gracefully to file-granularity
138
+ analysis. Python 3.10+.
139
+
140
+ ## Command reference
141
+
142
+ | Command | What it does |
143
+ |---------|--------------|
144
+ | `ee ingest <repo>` | Read git history into the local epistemic graph |
145
+ | `ee analyze <repo>` | Extract beliefs, justifications, change events, trajectories |
146
+ | `ee guard <repo>` | Verify changed/all code; block unsafe or unjustified beliefs |
147
+ | `ee hook install <repo>` | Install a git pre-commit hook running `ee guard --staged` |
148
+ | `ee predict-chain <repo>` | Forecast belief collapse with causes, ETA, and ROI |
149
+ | `ee calibrate <repo>` | Back-test the forecast model against the repo's own history |
150
+ | `ee dashboard <repo>` | Serve the local web dashboard |
151
+ | `ee report <repo>` | Epistemic health report (text / json / markdown / html) |
152
+ | `ee beliefs / falsifiers / debt / timeline` | Inspect specific slices |
153
+ | `ee doctor` | Validate environment, ontology, and configuration |
154
+
155
+ Run `ee <command> --help` for options, or `ee man` for a full man page.
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ git clone <your-repo> && cd epistemic-engine
161
+ pip install -e ".[parsing,dev]"
162
+ pytest # 167 tests
163
+ ```
164
+
165
+ ## Documented deviations from the design spec
166
+
167
+ Both are portability choices for a single-developer, offline-first,
168
+ cross-platform (incl. Windows) build; neither changes observable semantics.
169
+
170
+ - **Graph store** is abstracted behind `storage.GraphStore` with a **SQLite**
171
+ default backend (zero-install, deterministic); RocksDB is optional.
172
+ - **Git access** goes through the **git CLI** via subprocess, abstracted behind
173
+ `ingestion.GitExtractor`.
174
+
175
+ ## License
176
+
177
+ Apache-2.0 © 2026 Aswin S. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "epistemic-engine"
7
+ version = "1.2.0"
8
+ description = "Computational epistemology for software: extract code beliefs, verify AI-generated changes, and forecast where confidence will collapse."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "Aswin S" }]
13
+ keywords = [
14
+ "epistemology", "belief-revision", "agm", "static-analysis",
15
+ "software-quality", "security", "sast", "ai-code-review", "pre-commit",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Software Development :: Quality Assurance",
27
+ "Topic :: Security",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = [
31
+ "PyYAML>=6.0",
32
+ ]
33
+
34
+ [project.urls]
35
+ # Fill these in when you create the hosting page/repo, then re-upload.
36
+ Homepage = "https://pypi.org/project/epistemic-engine/"
37
+ Documentation = "https://pypi.org/project/epistemic-engine/"
38
+ "Source" = "https://pypi.org/project/epistemic-engine/"
39
+
40
+ [project.optional-dependencies]
41
+ # Tree-sitter grammars are optional: without them the engine degrades to
42
+ # file-granularity analysis (SRS A-3 / degradation modes 3.4), which is required
43
+ # behaviour anyway.
44
+ parsing = [
45
+ "tree-sitter>=0.21",
46
+ "tree-sitter-language-pack>=0.2",
47
+ ]
48
+ # Optional RocksDB backend (SI-3). SQLite backend is the zero-install default.
49
+ rocksdb = ["rocksdict>=0.3"]
50
+ dev = [
51
+ "pytest>=7.4",
52
+ "pytest-cov>=4.1",
53
+ ]
54
+
55
+ [project.scripts]
56
+ ee = "epistemic_engine.cli:main"
57
+
58
+ [tool.setuptools.packages.find]
59
+ where = ["src"]
60
+
61
+ [tool.setuptools.package-data]
62
+ epistemic_engine = ["ontology/data/*.yaml"]
63
+
64
+ [tool.pytest.ini_options]
65
+ testpaths = ["tests"]
66
+ addopts = "-q"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+