memorant 1.0.0rc1__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.
- memorant-1.0.0rc1/.github/workflows/tests.yml +27 -0
- memorant-1.0.0rc1/.gitignore +21 -0
- memorant-1.0.0rc1/LICENSE +201 -0
- memorant-1.0.0rc1/PKG-INFO +378 -0
- memorant-1.0.0rc1/README.md +344 -0
- memorant-1.0.0rc1/RELEASE_NOTES.md +16 -0
- memorant-1.0.0rc1/conftest.py +9 -0
- memorant-1.0.0rc1/docs/context-tuner.md +28 -0
- memorant-1.0.0rc1/docs/expectation-ledger.md +28 -0
- memorant-1.0.0rc1/docs/ontology.md +123 -0
- memorant-1.0.0rc1/docs/suite.md +27 -0
- memorant-1.0.0rc1/eval/__init__.py +1 -0
- memorant-1.0.0rc1/eval/run_gold_eval.py +206 -0
- memorant-1.0.0rc1/plans/elle-palace-memorant-upgrade.md +612 -0
- memorant-1.0.0rc1/pyproject.toml +54 -0
- memorant-1.0.0rc1/reference/readme-rewrite-instructions.md +20 -0
- memorant-1.0.0rc1/references/_glm-doctrine-full.md +705 -0
- memorant-1.0.0rc1/references/_glm_runner.py +43 -0
- memorant-1.0.0rc1/references/architecture-remediation-plan.md +347 -0
- memorant-1.0.0rc1/references/architecture-root-cause-analysis.md +215 -0
- memorant-1.0.0rc1/references/claude-doctrine-analysis-prompt.md +254 -0
- memorant-1.0.0rc1/references/glm-doctrine-analysis.md +603 -0
- memorant-1.0.0rc1/references/glm-doctrine-review-prompt.md +67 -0
- memorant-1.0.0rc1/reports/elle-palace-memorant-deployment-2026-06-22.md +307 -0
- memorant-1.0.0rc1/reports/memorant-v1-architecture-remediation-report.md +358 -0
- memorant-1.0.0rc1/scripts/archive/patch_mcp_for_memorant.py +145 -0
- memorant-1.0.0rc1/scripts/fix_andre_ship_conftest.py +33 -0
- memorant-1.0.0rc1/scripts/fix_andre_ship_imports.py +12 -0
- memorant-1.0.0rc1/scripts/fix_andre_ship_imports_v2.py +19 -0
- memorant-1.0.0rc1/scripts/fix_audit_log_query.py +9 -0
- memorant-1.0.0rc1/scripts/fix_resonance_log_key.py +40 -0
- memorant-1.0.0rc1/scripts/migrate_palace_v2.py +261 -0
- memorant-1.0.0rc1/scripts/patch_mcp_for_memorant.py +18 -0
- memorant-1.0.0rc1/scripts/patch_memory_palace_status.py +18 -0
- memorant-1.0.0rc1/scripts/test_ssrf_fixed.py +62 -0
- memorant-1.0.0rc1/src/context_tuner/__init__.py +44 -0
- memorant-1.0.0rc1/src/context_tuner/compressor.py +652 -0
- memorant-1.0.0rc1/src/context_tuner/core.py +426 -0
- memorant-1.0.0rc1/src/context_tuner/errors.py +29 -0
- memorant-1.0.0rc1/src/context_tuner/recovery.py +541 -0
- memorant-1.0.0rc1/src/context_tuner/schema.py +41 -0
- memorant-1.0.0rc1/src/expectation_ledger/__init__.py +29 -0
- memorant-1.0.0rc1/src/expectation_ledger/core.py +968 -0
- memorant-1.0.0rc1/src/expectation_ledger/schema.py +105 -0
- memorant-1.0.0rc1/src/expectation_ledger/trust.py +24 -0
- memorant-1.0.0rc1/src/memorant/__init__.py +28 -0
- memorant-1.0.0rc1/src/memorant/_vendor/agent-event.schema.json +85 -0
- memorant-1.0.0rc1/src/memorant/_vendor/doctor.py +131 -0
- memorant-1.0.0rc1/src/memorant/_vendor/event.py +55 -0
- memorant-1.0.0rc1/src/memorant/_vendor/flight_recorder.py +132 -0
- memorant-1.0.0rc1/src/memorant/_vendor/schema_validator.py +135 -0
- memorant-1.0.0rc1/src/memorant/_vendor/sqlcipher.py +13 -0
- memorant-1.0.0rc1/src/memorant/_vendor/steward.py +298 -0
- memorant-1.0.0rc1/src/memorant/adapters/hermes.py +40 -0
- memorant-1.0.0rc1/src/memorant/cli.py +326 -0
- memorant-1.0.0rc1/src/memorant/core.py +1168 -0
- memorant-1.0.0rc1/src/memorant/retriever.py +250 -0
- memorant-1.0.0rc1/src/memorant/schema.py +268 -0
- memorant-1.0.0rc1/src/memorant/suite.py +72 -0
- memorant-1.0.0rc1/src/memorant/trust.py +152 -0
- memorant-1.0.0rc1/src/memorant_ontology/__init__.py +253 -0
- memorant-1.0.0rc1/src/memorant_ontology/__main__.py +7 -0
- memorant-1.0.0rc1/src/memorant_ontology/cli.py +274 -0
- memorant-1.0.0rc1/src/memorant_ontology/config.py +68 -0
- memorant-1.0.0rc1/src/memorant_ontology/contradict.py +129 -0
- memorant-1.0.0rc1/src/memorant_ontology/extractor.py +255 -0
- memorant-1.0.0rc1/src/memorant_ontology/hygiene.py +176 -0
- memorant-1.0.0rc1/src/memorant_ontology/normalizer.py +112 -0
- memorant-1.0.0rc1/src/memorant_ontology/pii.py +67 -0
- memorant-1.0.0rc1/src/memorant_ontology/prompt.py +73 -0
- memorant-1.0.0rc1/src/memorant_ontology/queue.py +254 -0
- memorant-1.0.0rc1/src/memorant_ontology/resonance.py +168 -0
- memorant-1.0.0rc1/src/memorant_ontology/retriever.py +116 -0
- memorant-1.0.0rc1/src/memorant_ontology/schema.py +187 -0
- memorant-1.0.0rc1/src/memorant_ontology/store.py +149 -0
- memorant-1.0.0rc1/src/memorant_ontology/worker.py +233 -0
- memorant-1.0.0rc1/tests/conftest.py +53 -0
- memorant-1.0.0rc1/tests/fixtures/adversarial.jsonl +10 -0
- memorant-1.0.0rc1/tests/fixtures/extraction_fixtures/sample_extraction.json +14 -0
- memorant-1.0.0rc1/tests/fixtures/gold_set.jsonl +51 -0
- memorant-1.0.0rc1/tests/test_adversarial.py +155 -0
- memorant-1.0.0rc1/tests/test_cli.py +99 -0
- memorant-1.0.0rc1/tests/test_config.py +49 -0
- memorant-1.0.0rc1/tests/test_context_tuner.py +1707 -0
- memorant-1.0.0rc1/tests/test_contradict.py +178 -0
- memorant-1.0.0rc1/tests/test_core.py +1046 -0
- memorant-1.0.0rc1/tests/test_deployment_patch_scripts.py +80 -0
- memorant-1.0.0rc1/tests/test_expectation_ledger.py +544 -0
- memorant-1.0.0rc1/tests/test_extractor.py +243 -0
- memorant-1.0.0rc1/tests/test_hygiene.py +224 -0
- memorant-1.0.0rc1/tests/test_normalizer.py +108 -0
- memorant-1.0.0rc1/tests/test_patch.py +188 -0
- memorant-1.0.0rc1/tests/test_queue.py +289 -0
- memorant-1.0.0rc1/tests/test_resonance.py +187 -0
- memorant-1.0.0rc1/tests/test_retriever.py +208 -0
- memorant-1.0.0rc1/tests/test_schema.py +255 -0
- memorant-1.0.0rc1/tests/test_schema_validator.py +29 -0
- memorant-1.0.0rc1/tests/test_store.py +135 -0
- memorant-1.0.0rc1/tests/test_suite.py +34 -0
- memorant-1.0.0rc1/tests/test_worker.py +128 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
python -m pip install -e ".[test]"
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: python -m pytest tests/ -q
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.db
|
|
4
|
+
*.db-wal
|
|
5
|
+
*.db-shm
|
|
6
|
+
*.sqlite
|
|
7
|
+
*.sqlite3
|
|
8
|
+
.env
|
|
9
|
+
.venv/
|
|
10
|
+
build/
|
|
11
|
+
dist/
|
|
12
|
+
*.egg-info/
|
|
13
|
+
*.report.md
|
|
14
|
+
AUDIT_*.md
|
|
15
|
+
IMPLEMENTATION_REPORT.md
|
|
16
|
+
_audit_*.py
|
|
17
|
+
.coverage
|
|
18
|
+
.coveragerc
|
|
19
|
+
memorant.dead-letter.jsonl
|
|
20
|
+
kimi27fixreport.md
|
|
21
|
+
deepseekreport.md
|
|
@@ -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 2026 Miguel Johnson and contributors
|
|
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,378 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memorant
|
|
3
|
+
Version: 1.0.0rc1
|
|
4
|
+
Summary: Local-first agent memory without a vector database — claims, provenance, trust tiers, and atomic corrections in one SQLite file.
|
|
5
|
+
Project-URL: Homepage, https://github.com/tier4research/memorant
|
|
6
|
+
Project-URL: Documentation, https://github.com/tier4research/memorant#readme
|
|
7
|
+
Project-URL: Source, https://github.com/tier4research/memorant
|
|
8
|
+
Project-URL: Changelog, https://github.com/tier4research/memorant/blob/master/RELEASE_NOTES.md
|
|
9
|
+
Project-URL: Issues, https://github.com/tier4research/memorant/issues
|
|
10
|
+
Author: Tier 4 Research
|
|
11
|
+
License: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agent-memory,ai-agents,fts5,knowledge-base,llm,llm-memory,local-first,long-term-memory,provenance,rag,sqlite,zero-dependency
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Provides-Extra: embeddings
|
|
27
|
+
Requires-Dist: numpy>=1.24; extra == 'embeddings'
|
|
28
|
+
Requires-Dist: sentence-transformers>=3.0; extra == 'embeddings'
|
|
29
|
+
Provides-Extra: encryption
|
|
30
|
+
Requires-Dist: sqlcipher3; extra == 'encryption'
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Memorant
|
|
36
|
+
|
|
37
|
+
[](https://github.com/tier4research/memorant/actions/workflows/tests.yml)
|
|
38
|
+
[](https://www.python.org/downloads/)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
[](RELEASE_NOTES.md)
|
|
41
|
+
|
|
42
|
+
**Agent memory that knows where every fact came from — one SQLite file, zero dependencies.**
|
|
43
|
+
|
|
44
|
+
Memorant is an open-source Python library that stores an AI agent's long-term memory as
|
|
45
|
+
individual claims in a single SQLite database, each tagged with its source, a trust tier,
|
|
46
|
+
and a validity window — with no vector database, embedding model, or external service
|
|
47
|
+
required.
|
|
48
|
+
|
|
49
|
+
Memorant stores what your agent knows as individual **claims**.
|
|
50
|
+
source, how far you trust that source, and the window of time it was true. When a fact
|
|
51
|
+
turns out to be wrong, you correct *that claim*: Memorant invalidates the old version,
|
|
52
|
+
links the two, and flags everything derived from it for review.
|
|
53
|
+
|
|
54
|
+
Memorant installs on a bare Python interpreter. No embedding model, no vector server, no GPU,
|
|
55
|
+
no 400 MB dependency tree — SQLite with FTS5 and the standard library.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install memorant
|
|
59
|
+
|
|
60
|
+
memorant init --db ./memorant.db
|
|
61
|
+
memorant add "Deploys go out Thursdays." --source manual --trust verified --db ./memorant.db
|
|
62
|
+
memorant search "deploy schedule" --min-trust verified --db ./memorant.db
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Why not just use a vector store?
|
|
66
|
+
|
|
67
|
+
For pure recall, use one — Memorant isn't trying to beat a vector index at similarity
|
|
68
|
+
search. It solves the problem that shows up *after* recall works: what to do when a
|
|
69
|
+
stored fact is wrong, stale, or was never reliable to begin with.
|
|
70
|
+
|
|
71
|
+
A vector store has one move for a bad fact: add a contradicting chunk and hope the
|
|
72
|
+
embedding wins. Nothing marks the old chunk as retracted. Nothing records that three
|
|
73
|
+
other memories were built on top of it. Nothing distinguishes "the user told me this"
|
|
74
|
+
from "the model guessed this at 2am."
|
|
75
|
+
|
|
76
|
+
Here's the same situation in Memorant:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from memorant import MemorantStore
|
|
80
|
+
|
|
81
|
+
store = MemorantStore("memory.db")
|
|
82
|
+
store.init()
|
|
83
|
+
|
|
84
|
+
# The agent infers something. It's a guess, and it's stored as one.
|
|
85
|
+
guess = store.add_claim(
|
|
86
|
+
"The user deploys on Fridays.",
|
|
87
|
+
source_pointer="inferred:session-41",
|
|
88
|
+
trust_tier="derived",
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# Later, the user says otherwise. That's operator-tier truth.
|
|
92
|
+
store.correct_claim(guess, "The user deploys on Thursdays.")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
After the correction:
|
|
96
|
+
|
|
97
|
+
- the Friday claim is invalidated, not deleted — the history stays auditable
|
|
98
|
+
- a `corrects` relation links old to new
|
|
99
|
+
- anything with `derived_from` pointing at the old claim is flagged for review
|
|
100
|
+
- background retrieval stops surfacing the retracted version immediately
|
|
101
|
+
|
|
102
|
+
That's the whole pitch. Everything below is detail.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## What a claim looks like
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"id": "clm_7a3f",
|
|
111
|
+
"content": "Deploys go out Thursdays.",
|
|
112
|
+
"trust_tier": "operator",
|
|
113
|
+
"source_type": "manual",
|
|
114
|
+
"source_pointer": "chat:2026-03-04",
|
|
115
|
+
"valid_from": "2026-03-04",
|
|
116
|
+
"valid_until": null,
|
|
117
|
+
"reinforcement": 3,
|
|
118
|
+
"relations": [
|
|
119
|
+
{"type": "corrects", "target": "clm_2b91"}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Trust tiers
|
|
125
|
+
|
|
126
|
+
Four tiers, highest to lowest: `operator`, `verified`, `derived`, `untrusted`.
|
|
127
|
+
|
|
128
|
+
Trust is assigned by *provenance*, not by fact-checking. You declare a policy mapping
|
|
129
|
+
sources to tiers, and Memorant enforces it consistently everywhere afterward.
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from memorant import TrustPolicy
|
|
133
|
+
|
|
134
|
+
policy = TrustPolicy(rules=[
|
|
135
|
+
{"source_type": "manual", "tier": "verified"},
|
|
136
|
+
{"source_type": "correction", "tier": "operator"},
|
|
137
|
+
])
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
That distinction matters in practice. Background context injection (*resonance* — an
|
|
141
|
+
FTS5 query run against the claim store on every turn, filtered to `operator` +
|
|
142
|
+
`verified`, returning the top N results) only pulls from the top two tiers. A guess
|
|
143
|
+
the model made three sessions ago stays searchable if you go looking for it, but it
|
|
144
|
+
never quietly reappears as though it were established fact.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## At a glance
|
|
149
|
+
|
|
150
|
+
| Feature | What it does |
|
|
151
|
+
|---------|-------------|
|
|
152
|
+
| Trust tiers | `operator` > `verified` > `derived` > `untrusted` — resonance auto-injects only top tiers |
|
|
153
|
+
| Field-aware redaction | Secret values replaced with `[REDACTED:...]` |
|
|
154
|
+
| Atomic dedup | Identical claims increment a reinforcement counter instead of duplicating |
|
|
155
|
+
| FTS5 scoring | Rank × log(reinforcement) — trust-filtered at query time |
|
|
156
|
+
| Temporal validity | `valid_from` / `valid_until` — query "as of" any date |
|
|
157
|
+
| Correction propagation | `correct_claim()` → invalidates old, creates new, records `corrects` relation — atomic |
|
|
158
|
+
| Relation tracking | `supersedes`, `corrects`, `derived_from` — full audit trail |
|
|
159
|
+
| Digest governance | `pending` → `promoted` / `rejected` — atomic promotion |
|
|
160
|
+
| Doctor contract | `doctor --json` → exit code 0/1/2, component status, check list |
|
|
161
|
+
| Hygiene reports | Stale claims, broken derivation chains, contradiction candidates |
|
|
162
|
+
| SQLite steward | Vendored schema migration manager — pre-migration integrity checks, canary-based recovery |
|
|
163
|
+
| Zero dependencies | Pure Python + stdlib + bundled steward |
|
|
164
|
+
| Optional encryption | SQLCipher support via `pip install memorant[encryption]` |
|
|
165
|
+
| Expectation Ledger | Behavioral contracts, deterministic evaluation, violation recording, fail-closed option |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Quick start
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Install
|
|
173
|
+
pip install memorant
|
|
174
|
+
|
|
175
|
+
# CLI
|
|
176
|
+
memorant init --db ./memorant.db
|
|
177
|
+
memorant add "The user prefers concise technical summaries." --db ./memorant.db --source manual --trust verified
|
|
178
|
+
memorant search "technical summaries" --db ./memorant.db --min-trust verified
|
|
179
|
+
memorant resonate "How should I answer this?" --db ./memorant.db
|
|
180
|
+
memorant doctor --json --db ./memorant.db
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from memorant import MemorantStore, StoreConfig, TrustPolicy
|
|
185
|
+
|
|
186
|
+
policy = TrustPolicy(rules=[
|
|
187
|
+
{"source_type": "manual", "tier": "verified"},
|
|
188
|
+
{"source_type": "correction", "tier": "operator"},
|
|
189
|
+
])
|
|
190
|
+
|
|
191
|
+
store = MemorantStore("memorant.db", StoreConfig(trust_policy=policy))
|
|
192
|
+
store.init()
|
|
193
|
+
|
|
194
|
+
# Add a claim
|
|
195
|
+
cid = store.add_claim("The user prefers direct answers.", source_pointer="manual", trust_tier="operator")
|
|
196
|
+
|
|
197
|
+
# Search with trust filtering
|
|
198
|
+
results = store.search("user preference", min_trust="verified")
|
|
199
|
+
for r in results:
|
|
200
|
+
print(f"[{r.trust_tier}] {r.score:.3f} | {r.content}")
|
|
201
|
+
|
|
202
|
+
# Resonance — claims surface on their own
|
|
203
|
+
context = store.resonate("What style should I use?", session_id="sess-1")
|
|
204
|
+
|
|
205
|
+
# Correct a claim — atomic, propagates
|
|
206
|
+
new_id = store.correct_claim(cid, "The user prefers thorough, evidence-backed answers.")
|
|
207
|
+
|
|
208
|
+
# Health check
|
|
209
|
+
store.doctor(json_output=True)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
> **v1.0.0-rc.1** ships three coordinated tools that work together or standalone:
|
|
215
|
+
>
|
|
216
|
+
> - **Memorant** — long-term claim store with trust tiers, provenance, corrections, and temporal validity
|
|
217
|
+
> - **Context Tuner** — recoverable compression and token-budget control for long-running conversations (also [available separately](https://github.com/tier4research/hermes-context-tuner))
|
|
218
|
+
> - **Expectation Ledger** — behavioral contracts, run tracking, and violation evidence for agent governance
|
|
219
|
+
|
|
220
|
+
## Suite workflow
|
|
221
|
+
|
|
222
|
+
The three packages work together for end-to-end agent memory governance:
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from memorant import MemorantStore
|
|
226
|
+
from memorant.suite import MemoryCycle
|
|
227
|
+
from hermes_context_tuner import ContextTunerEngine
|
|
228
|
+
from expectation_ledger import ExpectationLedger
|
|
229
|
+
|
|
230
|
+
cycle = MemoryCycle(
|
|
231
|
+
memory=MemorantStore("memory.db"),
|
|
232
|
+
tuner=ContextTunerEngine("context.db"),
|
|
233
|
+
ledger=ExpectationLedger("expectations.db"),
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
prepared = cycle.prepare(
|
|
237
|
+
"What should I remember before answering?",
|
|
238
|
+
messages=[{"role": "user", "content": "Long conversation..."}],
|
|
239
|
+
)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
This keeps short-term compression (Context Tuner) separate from trusted long-term memory (Memorant), with the Expectation Ledger governing both.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Memorant-Ontology
|
|
247
|
+
|
|
248
|
+
The `memorant-ontology` package adds automatic entity and relation extraction from
|
|
249
|
+
claims. It runs as a background worker that processes claims through an LLM,
|
|
250
|
+
extracting structured entities (people, projects, tools, concepts) and the
|
|
251
|
+
relationships between them.
|
|
252
|
+
|
|
253
|
+
**Important:** the core memorant store *never* calls a model. `memorant-ontology` is
|
|
254
|
+
an optional background worker — it's opt-in and runs off the hot path.
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
pip install memorant-ontology
|
|
258
|
+
memorant-ontology --db ./memorant.db init
|
|
259
|
+
memorant-ontology --db ./memorant.db worker --limit 10 --rpm 30
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Key features:
|
|
263
|
+
- **Entity extraction** — identifies people, places, projects, concepts, tools, organizations, and dates from claim text
|
|
264
|
+
- **Relationship discovery** — builds a knowledge graph of how entities relate
|
|
265
|
+
- **Trust propagation** — entities inherit trust tiers from source claims
|
|
266
|
+
- **Contradiction detection** — flags claims that conflict with existing knowledge
|
|
267
|
+
- **Cost control** — per-claim cost tracking with daily hard stop ($5/day default)
|
|
268
|
+
|
|
269
|
+
236 tests passing across the extraction, worker, queue, retriever, and normalizer modules.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Comparison
|
|
274
|
+
|
|
275
|
+
| | Memorant | Mem0 | Zep | pgvector / Chroma |
|
|
276
|
+
|---|---|---|---|---|
|
|
277
|
+
| Runs fully local | ✓ | partial | partial | ✓ |
|
|
278
|
+
| Zero required dependencies | ✓ | ✗ | ✗ | ✗ |
|
|
279
|
+
| Provenance per fact | ✓ | | | ✗ |
|
|
280
|
+
| Trust tiering on retrieval | ✓ | | | ✗ |
|
|
281
|
+
| Atomic correction + propagation | ✓ | | | ✗ |
|
|
282
|
+
| Query "as of" a date | ✓ | | ✓ | ✗ |
|
|
283
|
+
| No LLM call on the memory path | ✓ | ✗ | | ✓ |
|
|
284
|
+
|
|
285
|
+
Trust tiering on the retrieval path is rare, and I haven't found another zero-dependency system that does it. Some cells above are empty because I haven't verified them — corrections welcome via PR.
|
|
286
|
+
|
|
287
|
+
Memorant also ships as a pluggable storage backend for [MemPalace](https://github.com/MemPalace/mempalace) (v3.5+). See [MemPalace integration](#mempalace-integration) below.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## MemPalace integration
|
|
292
|
+
|
|
293
|
+
As a MemPalace storage backend, every write lands in the Memorant claim store — trust-tiered, deduplicated, with full provenance:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
pip install "mempalace[memorant]"
|
|
297
|
+
mempalace mine ~/projects/myapp --backend memorant # or MEMPALACE_BACKEND=memorant
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Migrate existing palaces:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
mempalace repair --mode migrate-to-memorant
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
This replaces the retired `scripts/patch_mcp_for_memorant.py` hack. See [RELEASE_NOTES.md](RELEASE_NOTES.md).
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Encryption
|
|
311
|
+
|
|
312
|
+
Optional SQLCipher support:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
pip install memorant[encryption]
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
```python
|
|
319
|
+
from memorant import MemorantStore, StoreConfig
|
|
320
|
+
store = MemorantStore("encrypted.db", StoreConfig(encryption_key="your-strong-passphrase"))
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Fail-closed: wrong key → can't open. No key → standard SQLite. Zero overhead unless you opt in.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Evaluation
|
|
328
|
+
|
|
329
|
+
No comparative benchmark against vector-based memory systems yet — planned before v1.0.
|
|
330
|
+
The project's 308 unit tests (90%+ coverage on migration, correction, trust, and
|
|
331
|
+
redaction paths) verify correctness, but they say nothing about whether claim-based
|
|
332
|
+
memory produces better answers than vector RAG in practice. A 50-question benchmark
|
|
333
|
+
with deliberately poisoned stale facts is the next priority.
|
|
334
|
+
|
|
335
|
+
Pull requests and discussion are welcome.
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Project status
|
|
340
|
+
|
|
341
|
+
**Release candidate** (v1.0.0-rc.1). APIs are stable; expect minor adjustments before 1.0.
|
|
342
|
+
308 tests, 90%+ coverage on the migration, correction, trust, and redaction paths.
|
|
343
|
+
Not yet benchmarked against vector-based memory systems.
|
|
344
|
+
Deferred to v1.1: embedding backend, advanced policy config, repair workflows.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## FAQ
|
|
349
|
+
|
|
350
|
+
### What is Memorant?
|
|
351
|
+
Memorant is an open-source Python library that stores AI agent memory as individual claims in a single SQLite file, each with provenance, a trust tier, and a validity window. It runs entirely locally and requires no external services.
|
|
352
|
+
|
|
353
|
+
### Does Memorant need a vector database or an embedding model?
|
|
354
|
+
No. Memorant uses SQLite's built-in FTS5 full-text index for retrieval. There are no required pip dependencies, no embedding model, and no GPU.
|
|
355
|
+
|
|
356
|
+
### How is Memorant different from Mem0, Zep, or Letta?
|
|
357
|
+
Those systems focus on storing and retrieving memory at scale, generally backed by a vector store and often a hosted service. Memorant focuses on the trustworthiness of each stored fact — where it came from, whether it's still valid, and what happens to downstream memories when it turns out to be wrong.
|
|
358
|
+
|
|
359
|
+
### Can you delete or correct a wrong memory in Memorant?
|
|
360
|
+
Yes. `correct_claim()` invalidates the original claim, creates the corrected version, records a `corrects` relation between them, and flags any claim derived from the original for review — atomically, in one transaction.
|
|
361
|
+
|
|
362
|
+
### What are trust tiers?
|
|
363
|
+
Four levels — `operator`, `verified`, `derived`, `untrusted` — assigned by provenance policy rather than by fact-checking. Background context injection draws only from the top two tiers, so a model's earlier guess stays searchable but never resurfaces as established fact.
|
|
364
|
+
|
|
365
|
+
### Does Memorant work offline?
|
|
366
|
+
Yes. The core library never makes a network call and never invokes an LLM. The optional `memorant-ontology` worker does call a model, but it's opt-in and runs off the hot path.
|
|
367
|
+
|
|
368
|
+
### What Python versions does Memorant support?
|
|
369
|
+
Python 3.10 and later. `pip install memorant` installs no transitive dependencies.
|
|
370
|
+
|
|
371
|
+
### Is Memorant production-ready?
|
|
372
|
+
It's a release candidate (v1.0.0-rc.1) with 308 passing tests and 90%+ coverage on the migration, correction, trust, and redaction paths. APIs are stable with minor changes expected before 1.0. It has not yet been benchmarked against vector-based memory systems.
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## License
|
|
377
|
+
|
|
378
|
+
Apache License 2.0. See `LICENSE` and `NOTICE.md`.
|