memultra 1.0.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 (96) hide show
  1. memultra-1.0.0/LICENSE +202 -0
  2. memultra-1.0.0/PKG-INFO +89 -0
  3. memultra-1.0.0/README.md +70 -0
  4. memultra-1.0.0/pyproject.toml +37 -0
  5. memultra-1.0.0/setup.cfg +4 -0
  6. memultra-1.0.0/src/memultra/__init__.py +22 -0
  7. memultra-1.0.0/src/memultra/cli.py +95 -0
  8. memultra-1.0.0/src/memultra/conformance/__init__.py +1 -0
  9. memultra-1.0.0/src/memultra/conformance/build_golden.py +586 -0
  10. memultra-1.0.0/src/memultra/conformance/golden/F1.json +1 -0
  11. memultra-1.0.0/src/memultra/conformance/golden/F10.json +1 -0
  12. memultra-1.0.0/src/memultra/conformance/golden/F11.json +1 -0
  13. memultra-1.0.0/src/memultra/conformance/golden/F12.json +1 -0
  14. memultra-1.0.0/src/memultra/conformance/golden/F13.json +1 -0
  15. memultra-1.0.0/src/memultra/conformance/golden/F14.json +1 -0
  16. memultra-1.0.0/src/memultra/conformance/golden/F15.json +1 -0
  17. memultra-1.0.0/src/memultra/conformance/golden/F16.json +1 -0
  18. memultra-1.0.0/src/memultra/conformance/golden/F17.json +1 -0
  19. memultra-1.0.0/src/memultra/conformance/golden/F18.json +1 -0
  20. memultra-1.0.0/src/memultra/conformance/golden/F19.json +1 -0
  21. memultra-1.0.0/src/memultra/conformance/golden/F2.json +1 -0
  22. memultra-1.0.0/src/memultra/conformance/golden/F20.json +1 -0
  23. memultra-1.0.0/src/memultra/conformance/golden/F21.json +1 -0
  24. memultra-1.0.0/src/memultra/conformance/golden/F22.json +1 -0
  25. memultra-1.0.0/src/memultra/conformance/golden/F23.json +1 -0
  26. memultra-1.0.0/src/memultra/conformance/golden/F24.json +1 -0
  27. memultra-1.0.0/src/memultra/conformance/golden/F25.json +1 -0
  28. memultra-1.0.0/src/memultra/conformance/golden/F26.json +1 -0
  29. memultra-1.0.0/src/memultra/conformance/golden/F27.json +1 -0
  30. memultra-1.0.0/src/memultra/conformance/golden/F28.json +1 -0
  31. memultra-1.0.0/src/memultra/conformance/golden/F29.json +1 -0
  32. memultra-1.0.0/src/memultra/conformance/golden/F3.json +1 -0
  33. memultra-1.0.0/src/memultra/conformance/golden/F4.json +1 -0
  34. memultra-1.0.0/src/memultra/conformance/golden/F5.json +1 -0
  35. memultra-1.0.0/src/memultra/conformance/golden/F6.json +1 -0
  36. memultra-1.0.0/src/memultra/conformance/golden/F7.json +1 -0
  37. memultra-1.0.0/src/memultra/conformance/golden/F8.json +1 -0
  38. memultra-1.0.0/src/memultra/conformance/golden/F9.json +1 -0
  39. memultra-1.0.0/src/memultra/conformance/golden/negative/manifest.json +270 -0
  40. memultra-1.0.0/src/memultra/conformance/golden/negative/n01_empty_candidates_on_pass.json +1 -0
  41. memultra-1.0.0/src/memultra/conformance/golden/negative/n02_empty_recall_with_candidates.json +1 -0
  42. memultra-1.0.0/src/memultra/conformance/golden/negative/n03_taint_action_fast_confirm.json +1 -0
  43. memultra-1.0.0/src/memultra/conformance/golden/negative/n04_taint_count_zero_with_spec_provenance.json +1 -0
  44. memultra-1.0.0/src/memultra/conformance/golden/negative/n05_untainted_with_spec_nodes.json +1 -0
  45. memultra-1.0.0/src/memultra/conformance/golden/negative/n06_missing_override_reason.json +1 -0
  46. memultra-1.0.0/src/memultra/conformance/golden/negative/n07_mode_none_with_detail.json +1 -0
  47. memultra-1.0.0/src/memultra/conformance/golden/negative/n08_degraded_without_detail.json +1 -0
  48. memultra-1.0.0/src/memultra/conformance/golden/negative/n09_dup_node_ids.json +1 -0
  49. memultra-1.0.0/src/memultra/conformance/golden/negative/n10_verified_without_verified_at.json +1 -0
  50. memultra-1.0.0/src/memultra/conformance/golden/negative/n11_absolute_candidate.json +1 -0
  51. memultra-1.0.0/src/memultra/conformance/golden/negative/n12_dup_candidates.json +1 -0
  52. memultra-1.0.0/src/memultra/conformance/golden/negative/n13_bad_schema_version.json +1 -0
  53. memultra-1.0.0/src/memultra/conformance/golden/negative/n14_six_candidates.json +1 -0
  54. memultra-1.0.0/src/memultra/conformance/golden/negative/n15_thirtythree_provenance.json +1 -0
  55. memultra-1.0.0/src/memultra/conformance/golden/negative/n16_truncated_flag_wrong.json +1 -0
  56. memultra-1.0.0/src/memultra/conformance/golden/negative/n17_band_mismatch.json +1 -0
  57. memultra-1.0.0/src/memultra/conformance/golden/negative/n18_degraded_default_mode_none.json +1 -0
  58. memultra-1.0.0/src/memultra/conformance/golden/negative/n19_taint_raises_low.json +1 -0
  59. memultra-1.0.0/src/memultra/conformance/golden/negative/n20_unknown_loop_state.json +1 -0
  60. memultra-1.0.0/src/memultra/conformance/golden/negative/n21_modes_out_of_order.json +1 -0
  61. memultra-1.0.0/src/memultra/conformance/golden/negative/n22_empty_plus_arithmetic_mode.json +1 -0
  62. memultra-1.0.0/src/memultra/conformance/golden/negative/n23_negative_score.json +1 -0
  63. memultra-1.0.0/src/memultra/conformance/golden/negative/n24_score_over_one.json +1 -0
  64. memultra-1.0.0/src/memultra/conformance/golden/negative/n25_conflicting_empty_candidates.json +1 -0
  65. memultra-1.0.0/src/memultra/conformance/golden/negative/n26_tainted_truncated_no_witness.json +1 -0
  66. memultra-1.0.0/src/memultra/conformance/golden/negative/n27_calibration_failed_no_blocks.json +1 -0
  67. memultra-1.0.0/src/memultra/conformance/golden/negative/n28_partial_above_cap.json +1 -0
  68. memultra-1.0.0/src/memultra/conformance/golden/negative/n29_unverified_with_verified_at.json +1 -0
  69. memultra-1.0.0/src/memultra/conformance/golden/negative/n30_empty_detail.json +1 -0
  70. memultra-1.0.0/src/memultra/conformance/golden/negative/n31_version_trailing_newline.json +1 -0
  71. memultra-1.0.0/src/memultra/conformance/golden/negative/n32_path_double_slash.json +1 -0
  72. memultra-1.0.0/src/memultra/conformance/golden/negative/n33_path_dot_slash.json +1 -0
  73. memultra-1.0.0/src/memultra/conformance/golden/negative/n34_huge_integer_field.json +1 -0
  74. memultra-1.0.0/src/memultra/conformance/golden/negative/n35_arithmetic_mismatch.json +1 -0
  75. memultra-1.0.0/src/memultra/conformance/golden/negative/n36_stale_missing_recompute.json +1 -0
  76. memultra-1.0.0/src/memultra/conformance/golden/negative/n37_unsorted_provenance.json +1 -0
  77. memultra-1.0.0/src/memultra/conformance/golden/negative/n38_len_over_total.json +1 -0
  78. memultra-1.0.0/src/memultra/conformance/golden/negative/n39_degraded_default_with_arith.json +1 -0
  79. memultra-1.0.0/src/memultra/conformance/golden/negative/n40_source_path_updir_segment.json +1 -0
  80. memultra-1.0.0/src/memultra/conformance/golden/negative/n41_stale_recompute_without_stale_index.json +1 -0
  81. memultra-1.0.0/src/memultra/conformance/golden/negative/n42_retained_size_below_cap.json +1 -0
  82. memultra-1.0.0/src/memultra/conformance/golden/negative/n43_provenance_total_over_binary64_cap.json +1 -0
  83. memultra-1.0.0/src/memultra/conformance/test_contract.py +754 -0
  84. memultra-1.0.0/src/memultra/contract/__init__.py +6 -0
  85. memultra-1.0.0/src/memultra/contract/consumer.py +673 -0
  86. memultra-1.0.0/src/memultra/contract/encoder.py +176 -0
  87. memultra-1.0.0/src/memultra/contract/schema.json +685 -0
  88. memultra-1.0.0/src/memultra/mcp.py +145 -0
  89. memultra-1.0.0/src/memultra/offline.py +77 -0
  90. memultra-1.0.0/src/memultra.egg-info/PKG-INFO +89 -0
  91. memultra-1.0.0/src/memultra.egg-info/SOURCES.txt +94 -0
  92. memultra-1.0.0/src/memultra.egg-info/dependency_links.txt +1 -0
  93. memultra-1.0.0/src/memultra.egg-info/entry_points.txt +2 -0
  94. memultra-1.0.0/src/memultra.egg-info/requires.txt +3 -0
  95. memultra-1.0.0/src/memultra.egg-info/top_level.txt +1 -0
  96. memultra-1.0.0/tests/test_package.py +125 -0
memultra-1.0.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: memultra
3
+ Version: 1.0.0
4
+ Summary: The memory gate, model-free tier: RecallResult verification with a frozen output contract. Zero models, zero API keys, zero network.
5
+ License: Apache-2.0
6
+ Keywords: memory,gate,verification,mcp,offline
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Topic :: Software Development :: Quality Assurance
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Provides-Extra: test
17
+ Requires-Dist: pytest>=7; extra == "test"
18
+ Dynamic: license-file
19
+
20
+ # memultra
21
+
22
+ The memory gate, model-free tier. A RecallResult verification gate with a
23
+ **frozen output contract** (v1.0.0): canonical bytes in, deterministic
24
+ routing verdict out. Zero models, zero API keys, zero network — the entire
25
+ package runs inside an empty network namespace.
26
+
27
+ ## Quickstart (under 5 minutes, no cloud)
28
+
29
+ ```sh
30
+ # 1. install (pipx from PyPI, or from a local wheel - both work offline-first)
31
+ pipx install memultra
32
+ # offline/local: pipx install ./memultra-1.0.0-py3-none-any.whl
33
+
34
+ # 2. write a RecallResult (canonical form; see `memultra route` docs)
35
+ cat > result.json <<'EOF'
36
+ {"schema_version": "1.0.0", "confidence_score": 0.72,
37
+ "calibration_provenance": "k_of_c", "band": "HIGH",
38
+ "gate_decision": "pass", "prescribed_action": "engineering_loop_with_sanity_check",
39
+ "speculative_tainted": false, "speculative_node_count": 0,
40
+ "provenance": [{"node_id": "node-1", "source_path": "src/gate.py",
41
+ "content_hash": "sha256:9f2c4e71a0b3d58f", "verified": true,
42
+ "verified_at": "2026-11-27T18:03:12Z", "speculative": false}],
43
+ "provenance_total": 1, "provenance_truncated": false,
44
+ "candidates": ["src/gate.py"], "degraded_modes": [],
45
+ "loop_state": "unrouted"}
46
+ EOF
47
+
48
+ # 3. verify + route - fully offline
49
+ memultra verify # conformance suite: 41 tests, PASS
50
+ memultra route result.json # deterministic verdict JSON
51
+
52
+ # 4. prove it cannot phone home
53
+ memultra offline --verify -- memultra verify # PASS: 0 network syscalls
54
+ ```
55
+
56
+ MCP stdio server (zero network, zero keys):
57
+
58
+ ```json
59
+ {"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}
60
+ {"jsonrpc":"2.0","id":2,"method":"tools/list"}
61
+ {"jsonrpc":"2.0","id":3,"method":"tools/call",
62
+ "params":{"name":"memultra_route","arguments":{"payload":{...}}}}
63
+ ```
64
+
65
+ ```sh
66
+ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | memultra serve
67
+ ```
68
+
69
+ ## What's inside
70
+
71
+ | piece | what it is |
72
+ |---|---|
73
+ | `memultra.contract` | the frozen contract engine: `schema.json` (v1.0.0), canonical byte encoder, reference consumer/route() |
74
+ | `memultra.conformance` | the conformance suite (41 tests) + golden fixtures + the mutation suite |
75
+ | `memultra.mcp` | MCP stdio server: `memultra_verify`, `memultra_route`, `memultra_schema` |
76
+ | `memultra.offline` | network-enforcement wrapper (`unshare -n` / `bwrap --unshare-net` + strace evidence) |
77
+
78
+ Runtime dependencies: **none**. Test dependency: pytest only.
79
+
80
+ ## Contract
81
+
82
+ Output contract `hippocampus/epistemic-gate` v1.0.0, version-locked: the
83
+ package asserts on import that its schema matches the frozen contract
84
+ version. Any threshold, band or semantic change is a major bump.
85
+
86
+ ## License
87
+
88
+ Apache-2.0 (see LICENSE). Verification tooling and evidence bundles also
89
+ Apache-2.0; nothing phones home anywhere — asserted in CI.
@@ -0,0 +1,70 @@
1
+ # memultra
2
+
3
+ The memory gate, model-free tier. A RecallResult verification gate with a
4
+ **frozen output contract** (v1.0.0): canonical bytes in, deterministic
5
+ routing verdict out. Zero models, zero API keys, zero network — the entire
6
+ package runs inside an empty network namespace.
7
+
8
+ ## Quickstart (under 5 minutes, no cloud)
9
+
10
+ ```sh
11
+ # 1. install (pipx from PyPI, or from a local wheel - both work offline-first)
12
+ pipx install memultra
13
+ # offline/local: pipx install ./memultra-1.0.0-py3-none-any.whl
14
+
15
+ # 2. write a RecallResult (canonical form; see `memultra route` docs)
16
+ cat > result.json <<'EOF'
17
+ {"schema_version": "1.0.0", "confidence_score": 0.72,
18
+ "calibration_provenance": "k_of_c", "band": "HIGH",
19
+ "gate_decision": "pass", "prescribed_action": "engineering_loop_with_sanity_check",
20
+ "speculative_tainted": false, "speculative_node_count": 0,
21
+ "provenance": [{"node_id": "node-1", "source_path": "src/gate.py",
22
+ "content_hash": "sha256:9f2c4e71a0b3d58f", "verified": true,
23
+ "verified_at": "2026-11-27T18:03:12Z", "speculative": false}],
24
+ "provenance_total": 1, "provenance_truncated": false,
25
+ "candidates": ["src/gate.py"], "degraded_modes": [],
26
+ "loop_state": "unrouted"}
27
+ EOF
28
+
29
+ # 3. verify + route - fully offline
30
+ memultra verify # conformance suite: 41 tests, PASS
31
+ memultra route result.json # deterministic verdict JSON
32
+
33
+ # 4. prove it cannot phone home
34
+ memultra offline --verify -- memultra verify # PASS: 0 network syscalls
35
+ ```
36
+
37
+ MCP stdio server (zero network, zero keys):
38
+
39
+ ```json
40
+ {"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}
41
+ {"jsonrpc":"2.0","id":2,"method":"tools/list"}
42
+ {"jsonrpc":"2.0","id":3,"method":"tools/call",
43
+ "params":{"name":"memultra_route","arguments":{"payload":{...}}}}
44
+ ```
45
+
46
+ ```sh
47
+ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | memultra serve
48
+ ```
49
+
50
+ ## What's inside
51
+
52
+ | piece | what it is |
53
+ |---|---|
54
+ | `memultra.contract` | the frozen contract engine: `schema.json` (v1.0.0), canonical byte encoder, reference consumer/route() |
55
+ | `memultra.conformance` | the conformance suite (41 tests) + golden fixtures + the mutation suite |
56
+ | `memultra.mcp` | MCP stdio server: `memultra_verify`, `memultra_route`, `memultra_schema` |
57
+ | `memultra.offline` | network-enforcement wrapper (`unshare -n` / `bwrap --unshare-net` + strace evidence) |
58
+
59
+ Runtime dependencies: **none**. Test dependency: pytest only.
60
+
61
+ ## Contract
62
+
63
+ Output contract `hippocampus/epistemic-gate` v1.0.0, version-locked: the
64
+ package asserts on import that its schema matches the frozen contract
65
+ version. Any threshold, band or semantic change is a major bump.
66
+
67
+ ## License
68
+
69
+ Apache-2.0 (see LICENSE). Verification tooling and evidence bundles also
70
+ Apache-2.0; nothing phones home anywhere — asserted in CI.
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "memultra"
7
+ version = "1.0.0"
8
+ description = "The memory gate, model-free tier: RecallResult verification with a frozen output contract. Zero models, zero API keys, zero network."
9
+ readme = "README.md"
10
+ license = { text = "Apache-2.0" }
11
+ requires-python = ">=3.10"
12
+ dependencies = [] # zero runtime deps - the whole point
13
+ keywords = ["memory", "gate", "verification", "mcp", "offline"]
14
+ classifiers = [
15
+ "Development Status :: 5 - Production/Stable",
16
+ "License :: OSI Approved :: Apache Software License",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Topic :: Software Development :: Quality Assurance",
21
+ ]
22
+
23
+ [project.scripts]
24
+ memultra = "memultra.cli:main"
25
+
26
+ [project.optional-dependencies]
27
+ test = ["pytest>=7"]
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+
32
+ [tool.setuptools.package-data]
33
+ "memultra.contract" = ["schema.json"]
34
+ "memultra.conformance" = ["golden/*.json", "golden/negative/*.json", "golden/negative/manifest.json"]
35
+
36
+ [tool.pytest.ini_options]
37
+ testpaths = ["src", "tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,22 @@
1
+ """memultra - the memory gate, model-free tier.
2
+
3
+ (internal codename: synhippo - retained here only as provenance; the
4
+ public package, CLI and MCP server are memultra everywhere.)
5
+
6
+ A RecallResult verification gate with a frozen output contract (v1.0.0):
7
+ canonical bytes in, deterministic routing verdict out. Zero models, zero
8
+ API keys, zero network - the whole package works inside an empty network
9
+ namespace (see memultra.offline / the `memultra offline` subcommand).
10
+
11
+ Subpackages:
12
+ memultra.contract - the frozen contract engine (schema + canonical
13
+ encoder + reference consumer), vendored from
14
+ the standalone conformance tree.
15
+ memultra.conformance - the conformance suite (41 tests) + fixture
16
+ generator; `memultra verify` runs it directly,
17
+ pytest also works.
18
+ memultra.mcp - MCP stdio server exposing the gate operations.
19
+ """
20
+
21
+ __version__ = "1.0.0"
22
+ CONTRACT_SCHEMA_VERSION = "1.0.0" # version-locked to the frozen contract
@@ -0,0 +1,95 @@
1
+ """memultra.cli - `memultra` entry point.
2
+
3
+ memultra verify [--offline] run the conformance suite (41 tests)
4
+ memultra route [PAYLOAD.json] route one RecallResult (stdin or file)
5
+ memultra serve MCP stdio server (zero network)
6
+ memultra offline [--verify] -- CMD [args...]
7
+ network-enforce wrapper around any command
8
+
9
+ Zero models, zero API keys, zero network anywhere.
10
+ """
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ from . import __version__
18
+ from .contract import consumer
19
+ from .contract.encoder import encode
20
+ from .contract.consumer import ContractConformanceError
21
+
22
+ SCHEMA_PATH = Path(__file__).parent / "contract" / "schema.json"
23
+
24
+
25
+ def cmd_verify(args: list[str]) -> int:
26
+ offline = "--offline" in args
27
+ if offline:
28
+ args = [a for a in args if a != "--offline"]
29
+ if args:
30
+ print(f"memultra verify: unexpected args {args}", file=sys.stderr)
31
+ return 2
32
+ from .offline import run_offline
33
+ return run_offline([sys.executable, "-m", "memultra.cli", "verify"])
34
+ from .mcp import _run_conformance
35
+ r = _run_conformance()
36
+ print(f"memultra conformance: {r['verdict']} "
37
+ f"({r['total'] - r['failed']}/{r['total']} tests)")
38
+ for f in r["failures"]:
39
+ print(f" FAIL {f['test']}: {f['error']}")
40
+ print(f"contract schema_version: {consumer.load_schema(SCHEMA_PATH)['schema_version']} "
41
+ f"(package {__version__}, version-locked)")
42
+ return 0 if r["verdict"] == "PASS" else 1
43
+
44
+
45
+ def cmd_route(args: list[str]) -> int:
46
+ if not args:
47
+ data = sys.stdin.read()
48
+ elif args[0] == "-":
49
+ data = sys.stdin.read()
50
+ else:
51
+ data = Path(args[0]).read_text()
52
+ payload = json.loads(data)
53
+ schema = consumer.load_schema(SCHEMA_PATH)
54
+ try:
55
+ verdict = consumer.route(encode(payload) if isinstance(payload, dict) else payload,
56
+ schema)
57
+ except ContractConformanceError as exc:
58
+ print(f"REJECT: {exc}", file=sys.stderr)
59
+ return 1
60
+ print(json.dumps(verdict, indent=2))
61
+ return 0
62
+
63
+
64
+ def main(argv: list[str] | None = None) -> int:
65
+ argv = list(sys.argv[1:] if argv is None else argv)
66
+ if not argv or argv[0] in ("-h", "--help", "help"):
67
+ print(__doc__.strip())
68
+ return 0
69
+ cmd, rest = argv[0], argv[1:]
70
+ if cmd == "verify":
71
+ return cmd_verify(rest)
72
+ if cmd == "route":
73
+ return cmd_route(rest)
74
+ if cmd == "serve":
75
+ from .mcp import serve
76
+ return serve()
77
+ if cmd == "offline":
78
+ if "--verify" in rest:
79
+ rest = [a for a in rest if a != "--verify"]
80
+ i = rest.index("--") if "--" in rest else -1
81
+ target = rest[i + 1:] if i >= 0 else rest
82
+ from .offline import verify_offline
83
+ ok, evidence = verify_offline(target)
84
+ print(("PASS " if ok else "FAIL ") + f"memultra offline ({evidence})")
85
+ return 0 if ok else 1
86
+ i = rest.index("--") if "--" in rest else -1
87
+ target = rest[i + 1:] if i >= 0 else rest
88
+ from .offline import run_offline
89
+ return run_offline(target)
90
+ print(f"memultra: unknown command {cmd!r}\n\n{__doc__.strip()}", file=sys.stderr)
91
+ return 2
92
+
93
+
94
+ if __name__ == "__main__":
95
+ raise SystemExit(main())
@@ -0,0 +1 @@
1
+ """memultra.conformance - the frozen-contract conformance suite."""