memledger 0.5.0a0__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 (106) hide show
  1. memledger-0.5.0a0/.gitignore +18 -0
  2. memledger-0.5.0a0/CHANGELOG.md +89 -0
  3. memledger-0.5.0a0/LICENSE +201 -0
  4. memledger-0.5.0a0/PKG-INFO +169 -0
  5. memledger-0.5.0a0/README.md +76 -0
  6. memledger-0.5.0a0/charts/memledger/Chart.yaml +16 -0
  7. memledger-0.5.0a0/charts/memledger/templates/configmap.yaml +46 -0
  8. memledger-0.5.0a0/charts/memledger/templates/migration-job.yaml +198 -0
  9. memledger-0.5.0a0/charts/memledger/templates/postgres.yaml +113 -0
  10. memledger-0.5.0a0/charts/memledger/values.yaml +97 -0
  11. memledger-0.5.0a0/demo/scenarios/__init__.py +0 -0
  12. memledger-0.5.0a0/demo/scenarios/cascade_failure.py +306 -0
  13. memledger-0.5.0a0/docker-compose.yaml +19 -0
  14. memledger-0.5.0a0/docs/architecture.md +259 -0
  15. memledger-0.5.0a0/docs/test-plan.md +143 -0
  16. memledger-0.5.0a0/docs/v1-feature-gap-check.md +305 -0
  17. memledger-0.5.0a0/evaluators/__init__.py +53 -0
  18. memledger-0.5.0a0/evaluators/agentcore_eval_runner.py +238 -0
  19. memledger-0.5.0a0/evaluators/agentcore_evaluator.py +76 -0
  20. memledger-0.5.0a0/evaluators/agentcore_harness.py +134 -0
  21. memledger-0.5.0a0/evaluators/attribution_integrity.py +191 -0
  22. memledger-0.5.0a0/evaluators/attribution_integrity_ragas.py +319 -0
  23. memledger-0.5.0a0/evaluators/attribution_integrity_structural.py +304 -0
  24. memledger-0.5.0a0/evaluators/calibration/dataset.jsonl +30 -0
  25. memledger-0.5.0a0/evaluators/calibration/replay.py +223 -0
  26. memledger-0.5.0a0/evaluators/calibration/replay_results.json +240 -0
  27. memledger-0.5.0a0/evaluators/calibration/results.csv +31 -0
  28. memledger-0.5.0a0/evaluators/calibration/results_summary.json +37 -0
  29. memledger-0.5.0a0/evaluators/calibration/score_agreement.py +228 -0
  30. memledger-0.5.0a0/evaluators/ragas_harness.py +240 -0
  31. memledger-0.5.0a0/infra/grafana/memory-dashboard.json +445 -0
  32. memledger-0.5.0a0/infra/phoenix/README.md +49 -0
  33. memledger-0.5.0a0/infra/phoenix/docker-compose.yml +27 -0
  34. memledger-0.5.0a0/infra/prometheus/scrape-config.yaml +7 -0
  35. memledger-0.5.0a0/memledger.yaml +57 -0
  36. memledger-0.5.0a0/pyproject.toml +142 -0
  37. memledger-0.5.0a0/scripts/seed_demo_data.py +147 -0
  38. memledger-0.5.0a0/scripts/smoke_test.py +416 -0
  39. memledger-0.5.0a0/src/memledger/__init__.py +66 -0
  40. memledger-0.5.0a0/src/memledger/backends/__init__.py +0 -0
  41. memledger-0.5.0a0/src/memledger/backends/base.py +125 -0
  42. memledger-0.5.0a0/src/memledger/backends/composition.py +270 -0
  43. memledger-0.5.0a0/src/memledger/backends/dynamodb.py +596 -0
  44. memledger-0.5.0a0/src/memledger/backends/opensearch.py +597 -0
  45. memledger-0.5.0a0/src/memledger/backends/pgvector.py +746 -0
  46. memledger-0.5.0a0/src/memledger/backends/sqlite.py +700 -0
  47. memledger-0.5.0a0/src/memledger/cli/__init__.py +1 -0
  48. memledger-0.5.0a0/src/memledger/cli/dashboard.py +601 -0
  49. memledger-0.5.0a0/src/memledger/cli/demo.py +442 -0
  50. memledger-0.5.0a0/src/memledger/cli/eval.py +659 -0
  51. memledger-0.5.0a0/src/memledger/cli/eval_report.py +336 -0
  52. memledger-0.5.0a0/src/memledger/cli/main.py +1153 -0
  53. memledger-0.5.0a0/src/memledger/demo/__init__.py +0 -0
  54. memledger-0.5.0a0/src/memledger/demo/app.py +353 -0
  55. memledger-0.5.0a0/src/memledger/embeddings.py +106 -0
  56. memledger-0.5.0a0/src/memledger/integrations/__init__.py +0 -0
  57. memledger-0.5.0a0/src/memledger/integrations/langgraph.py +126 -0
  58. memledger-0.5.0a0/src/memledger/mcp/__init__.py +1 -0
  59. memledger-0.5.0a0/src/memledger/mcp/server.py +331 -0
  60. memledger-0.5.0a0/src/memledger/memledger.py +1834 -0
  61. memledger-0.5.0a0/src/memledger/models.py +248 -0
  62. memledger-0.5.0a0/src/memledger/policies/__init__.py +5 -0
  63. memledger-0.5.0a0/src/memledger/policies/confidence_policy.py +98 -0
  64. memledger-0.5.0a0/src/memledger/policies/conflict_resolution.py +197 -0
  65. memledger-0.5.0a0/src/memledger/policies/namespace_rbac.py +149 -0
  66. memledger-0.5.0a0/src/memledger/policies/temporal_decay.py +67 -0
  67. memledger-0.5.0a0/src/memledger/provenance/__init__.py +3 -0
  68. memledger-0.5.0a0/src/memledger/provenance/chain.py +176 -0
  69. memledger-0.5.0a0/src/memledger/provenance/chain_store.py +113 -0
  70. memledger-0.5.0a0/src/memledger/provenance/effective_confidence.py +61 -0
  71. memledger-0.5.0a0/src/memledger/provenance/models.py +58 -0
  72. memledger-0.5.0a0/src/memledger/provenance/schema.sql +32 -0
  73. memledger-0.5.0a0/src/memledger/strategies/__init__.py +200 -0
  74. memledger-0.5.0a0/src/memledger/strategies/audit.py +108 -0
  75. memledger-0.5.0a0/src/memledger/strategies/llm.py +490 -0
  76. memledger-0.5.0a0/src/memledger/strategies/policies.py +238 -0
  77. memledger-0.5.0a0/src/memledger/strategies/retrieval.py +73 -0
  78. memledger-0.5.0a0/src/memledger/strategies/scoring.py +220 -0
  79. memledger-0.5.0a0/src/memledger/telemetry/__init__.py +8 -0
  80. memledger-0.5.0a0/src/memledger/telemetry/instrument.py +570 -0
  81. memledger-0.5.0a0/src/memledger/telemetry/memory_spans.py +203 -0
  82. memledger-0.5.0a0/src/memledger/telemetry/otel.py +549 -0
  83. memledger-0.5.0a0/src/memledger/telemetry/phoenix.py +141 -0
  84. memledger-0.5.0a0/tests/test_attribution_integrity.py +83 -0
  85. memledger-0.5.0a0/tests/test_batch_apis.py +177 -0
  86. memledger-0.5.0a0/tests/test_composition.py +169 -0
  87. memledger-0.5.0a0/tests/test_composition_aws.py +303 -0
  88. memledger-0.5.0a0/tests/test_default_backend.py +36 -0
  89. memledger-0.5.0a0/tests/test_dynamodb_integration.py +265 -0
  90. memledger-0.5.0a0/tests/test_embeddings_local.py +59 -0
  91. memledger-0.5.0a0/tests/test_eval_harness.py +334 -0
  92. memledger-0.5.0a0/tests/test_eval_report.py +209 -0
  93. memledger-0.5.0a0/tests/test_feature_validation.py +598 -0
  94. memledger-0.5.0a0/tests/test_feedback_loop.py +239 -0
  95. memledger-0.5.0a0/tests/test_golden_replay.py +103 -0
  96. memledger-0.5.0a0/tests/test_models.py +106 -0
  97. memledger-0.5.0a0/tests/test_namespace_rbac_wireup.py +192 -0
  98. memledger-0.5.0a0/tests/test_no_direct_llm_calls.py +111 -0
  99. memledger-0.5.0a0/tests/test_opensearch_integration.py +276 -0
  100. memledger-0.5.0a0/tests/test_pgvector_integration.py +293 -0
  101. memledger-0.5.0a0/tests/test_phoenix_logging.py +111 -0
  102. memledger-0.5.0a0/tests/test_provenance_chain.py +166 -0
  103. memledger-0.5.0a0/tests/test_scoring.py +225 -0
  104. memledger-0.5.0a0/tests/test_sqlite_integration.py +222 -0
  105. memledger-0.5.0a0/tests/test_strategies.py +518 -0
  106. memledger-0.5.0a0/tests/test_weakest_link_gating.py +229 -0
@@ -0,0 +1,18 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ *.db
5
+ .env
6
+ .env.local
7
+ .env.eks
8
+ .DS_Store
9
+ node_modules/
10
+ dist/
11
+ *.egg-info/
12
+ _scratch/
13
+ *.DS_Store
14
+ smoke_test_results.json
15
+
16
+ # AWS-specific runtime artifacts (never commit; may contain account IDs/ARNs)
17
+ config/evaluator_arns.json
18
+ config/*.local.json
@@ -0,0 +1,89 @@
1
+ # Changelog
2
+
3
+ All notable changes to memledger will be documented in this file. The format
4
+ follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
5
+ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.5.0a0] — 2026-05-12 — **alpha (name-reservation release)**
8
+
9
+ First public alpha. Reserves the `memledger` name on PyPI and signals that
10
+ the v1 OSS launch is imminent. Use at your own risk; the stable `0.5.0`
11
+ release will follow when the launch checklist in
12
+ [docs/test-plan.md](docs/test-plan.md) is fully signed off.
13
+
14
+ ### Added
15
+
16
+ - **Local fastembed embedding default** (`provider=local`,
17
+ `BAAI/bge-small-en-v1.5`, 384 dims) so `pip install memledger[local,pgvector]`
18
+ works without any cloud credentials.
19
+ - **`[aws]` umbrella extra** that pulls Bedrock + DynamoDB + SigV4 OpenSearch
20
+ in one shot for AWS users.
21
+ - **Three-tier evaluator suite**:
22
+ - Tier 1 — deterministic Memory Attribution Integrity (no LLM).
23
+ - Tier 2 — RAGAS LLM-as-judge via LiteLLM (provider-agnostic;
24
+ `MEMLEDGER_JUDGE_MODEL=openai/gpt-4o-mini` / `bedrock/...` / `anthropic/...`
25
+ / `ollama/...`).
26
+ - Tier 3 — AWS Bedrock AgentCore evaluator (behind `[aws]` extra).
27
+ - **Arize Phoenix wiring** (`memledger.telemetry.phoenix.log_evaluation`) —
28
+ best-effort, deployment-agnostic over OTLP + `arize-phoenix-client`.
29
+ - **OpenTelemetry promoted to core dependency** — observability ships by
30
+ default with `pip install memledger`.
31
+ - **Weakest-link confidence gating** (`provenance/effective_confidence.py`)
32
+ — a memory's effective confidence for retrieval is bounded by the weakest
33
+ link in its upstream provenance chain. Wired into `search()` and
34
+ `search_hybrid()`.
35
+ - **`ChainStore` abstraction seam** (`provenance/chain_store.py`) so v1.5+
36
+ can swap the JSON-array chain walker for a graph-native implementation
37
+ (Apache AGE / RecursiveCTE / Neo4j) without touching gating code.
38
+ - **`NamespaceRBAC` auto-enforcement** in `add()` and `search()` —
39
+ caller-supplied agent identity, opt-in policy. (v2 will derive identity
40
+ from kagent ServiceAccount / IRSA.)
41
+ - **User-facing CLI surface** (Typer): `init`, `add`, `search`, `get`,
42
+ `status`, `eval`, `trace show`, `conflict check`. Demo / kagent-narrative
43
+ commands hidden behind `--help`.
44
+ - **Golden-dataset replay harness** at `evaluators/calibration/replay.py`
45
+ reporting accuracy, per-class accuracy, confusion matrix, MAE; the
46
+ deterministic tier has a CI floor of 0.70 categorical accuracy.
47
+
48
+ ### Changed
49
+
50
+ - AWS region across all modules now reads `$AWS_REGION` (defaulting to
51
+ `us-west-2`); no more hardcoded literals.
52
+ - AWS-coupled integration tests live behind `pytest.mark.aws`; the default
53
+ `pytest` run is AWS-free.
54
+ - `scripts/smoke_test.py` rewritten with OSS gates (L1–L4) as the default
55
+ and AWS gates (A1–A4) behind `--with-aws` / `--aws-only`.
56
+ - AgentCore evaluator registration helper moved from
57
+ `evaluators/attribution_integrity.py` into the AWS-only
58
+ `evaluators/agentcore_evaluator.py` so the deterministic tier file
59
+ has no boto3 or AWS dependencies.
60
+
61
+ ### Removed
62
+
63
+ - The committed `config/evaluator_arns.json` artifact (contained an AWS
64
+ account ID). The file is now gitignored. Git history has been rewritten
65
+ to scrub the account ID from every commit.
66
+
67
+ ### Deferred to v1.5 / v2 (not in this alpha)
68
+
69
+ - Graph-native chain storage (Apache AGE / Neo4j). The JSON-array walker
70
+ is acceptable up to ~5 hops; the abstraction seam makes the swap a
71
+ drop-in.
72
+ - Temporal decay and conflict detection at the SDK boundary
73
+ (implementations exist; not wired into `add()` / `search()`).
74
+ - IRSA-based identity for `NamespaceRBAC`. v1 RBAC is
75
+ agent-claimed-identity — best-effort, not a hard security boundary.
76
+ - AgentCore Evaluations + CloudWatch OTEL sink first-class wiring.
77
+
78
+ ### Known limitations
79
+
80
+ - One pgvector integration test (`test_semantic_record`) is flaky due to
81
+ float-precision in the storage round-trip (asserts `confidence == 0.95`
82
+ exactly; the round-trip yields `0.949999988…`). Tracked.
83
+ - Test plan rows requiring manual sign-off (RAGAS LLM-judge end-to-end,
84
+ Bedrock embedding full validation, kagent EKS Helm deploy, TestPyPI
85
+ install round-trip, multi-Python-version testing) are open. The full
86
+ list is in [docs/test-plan.md](docs/test-plan.md) and
87
+ [docs/v1-feature-gap-check.md](docs/v1-feature-gap-check.md).
88
+
89
+ [0.5.0a0]: https://github.com/memledger-ai/memledger-core/releases/tag/v0.5.0a0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,169 @@
1
+ Metadata-Version: 2.4
2
+ Name: memledger
3
+ Version: 0.5.0a0
4
+ Summary: Memory governance and trust layer for AI agents — provenance, attribution, confidence gating
5
+ Project-URL: Homepage, https://github.com/memledger-ai/memledger-core
6
+ Project-URL: Documentation, https://memledger.dev
7
+ Project-URL: Repository, https://github.com/memledger-ai/memledger-core
8
+ Project-URL: Issues, https://github.com/memledger-ai/memledger-core/issues
9
+ Author: Ratnopam Chakrabarti
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
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: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: litellm>=1.40.0
23
+ Requires-Dist: numpy>=1.24.0
24
+ Requires-Dist: opentelemetry-api>=1.20
25
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20
26
+ Requires-Dist: opentelemetry-sdk>=1.20
27
+ Requires-Dist: pydantic>=2.0
28
+ Requires-Dist: pyyaml>=6.0
29
+ Requires-Dist: rich>=13.0
30
+ Requires-Dist: typer>=0.9.0
31
+ Provides-Extra: all
32
+ Requires-Dist: aiosqlite>=0.19.0; extra == 'all'
33
+ Requires-Dist: arize-phoenix-client>=2.0; extra == 'all'
34
+ Requires-Dist: arize-phoenix-otel>=0.6; extra == 'all'
35
+ Requires-Dist: asyncpg>=0.29.0; extra == 'all'
36
+ Requires-Dist: boto3>=1.35.0; extra == 'all'
37
+ Requires-Dist: datasets>=2.0.0; extra == 'all'
38
+ Requires-Dist: fastembed<1.0,>=0.5; extra == 'all'
39
+ Requires-Dist: httpx>=0.27.0; extra == 'all'
40
+ Requires-Dist: langchain-community>=0.3.0; extra == 'all'
41
+ Requires-Dist: langchain>=0.3.0; extra == 'all'
42
+ Requires-Dist: langgraph-checkpoint>=2.0.0; extra == 'all'
43
+ Requires-Dist: langgraph>=0.2.0; extra == 'all'
44
+ Requires-Dist: matplotlib>=3.7.0; extra == 'all'
45
+ Requires-Dist: mcp>=1.0.0; extra == 'all'
46
+ Requires-Dist: opensearch-py>=2.4.0; extra == 'all'
47
+ Requires-Dist: pgvector>=0.3.0; extra == 'all'
48
+ Requires-Dist: ragas>=0.2.0; extra == 'all'
49
+ Requires-Dist: sqlite-vec>=0.1.0; extra == 'all'
50
+ Provides-Extra: aws
51
+ Requires-Dist: boto3>=1.35.0; extra == 'aws'
52
+ Requires-Dist: httpx>=0.27.0; extra == 'aws'
53
+ Requires-Dist: opensearch-py>=2.4.0; extra == 'aws'
54
+ Provides-Extra: bedrock
55
+ Requires-Dist: boto3>=1.35.0; extra == 'bedrock'
56
+ Provides-Extra: dev
57
+ Requires-Dist: aiosqlite>=0.19.0; extra == 'dev'
58
+ Requires-Dist: boto3>=1.35.0; extra == 'dev'
59
+ Requires-Dist: fastembed<1.0,>=0.5; extra == 'dev'
60
+ Requires-Dist: mypy>=1.10; extra == 'dev'
61
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
62
+ Requires-Dist: pytest>=8.0; extra == 'dev'
63
+ Requires-Dist: ruff>=0.5.0; extra == 'dev'
64
+ Provides-Extra: dynamodb
65
+ Requires-Dist: boto3>=1.35.0; extra == 'dynamodb'
66
+ Provides-Extra: eval
67
+ Requires-Dist: arize-phoenix-client>=2.0; extra == 'eval'
68
+ Requires-Dist: datasets>=2.0.0; extra == 'eval'
69
+ Requires-Dist: langchain-community>=0.3.0; extra == 'eval'
70
+ Requires-Dist: langchain>=0.3.0; extra == 'eval'
71
+ Requires-Dist: matplotlib>=3.7.0; extra == 'eval'
72
+ Requires-Dist: ragas>=0.2.0; extra == 'eval'
73
+ Provides-Extra: langgraph
74
+ Requires-Dist: langgraph-checkpoint>=2.0.0; extra == 'langgraph'
75
+ Requires-Dist: langgraph>=0.2.0; extra == 'langgraph'
76
+ Provides-Extra: local
77
+ Requires-Dist: fastembed<1.0,>=0.5; extra == 'local'
78
+ Provides-Extra: mcp
79
+ Requires-Dist: mcp>=1.0.0; extra == 'mcp'
80
+ Provides-Extra: opensearch
81
+ Requires-Dist: boto3>=1.35.0; extra == 'opensearch'
82
+ Requires-Dist: httpx>=0.27.0; extra == 'opensearch'
83
+ Requires-Dist: opensearch-py>=2.4.0; extra == 'opensearch'
84
+ Provides-Extra: pgvector
85
+ Requires-Dist: asyncpg>=0.29.0; extra == 'pgvector'
86
+ Requires-Dist: pgvector>=0.3.0; extra == 'pgvector'
87
+ Provides-Extra: sqlite
88
+ Requires-Dist: aiosqlite>=0.19.0; extra == 'sqlite'
89
+ Requires-Dist: sqlite-vec>=0.1.0; extra == 'sqlite'
90
+ Provides-Extra: telemetry
91
+ Requires-Dist: arize-phoenix-otel>=0.6; extra == 'telemetry'
92
+ Description-Content-Type: text/markdown
93
+
94
+ # memledger
95
+
96
+ **Memory governance and trust layer for multi-agent AI systems.**
97
+
98
+ memledger adds attribution, provenance, confidence gating, and quality measurement on top of any vector-backed memory store. Every memory carries a source, a confidence score, a derivation chain, and an audit trail — so when agents share memory, trust transfers become legible instead of invisible.
99
+
100
+ > ⚠️ **v0.5.0a0 — alpha release (name-reservation).** Phase A + B of the v1 OSS launch are done; Phase C/D/E are in flight. `pip install memledger` (no `--pre`) will not pick this up — you must explicitly opt in (`pip install memledger==0.5.0a0` or `--pre`). The stable `v1.0.0` will follow when the launch checklist signs off. See [CHANGELOG.md](CHANGELOG.md) and [docs/test-plan.md](docs/test-plan.md) for what's verified vs. what's still on the runway. **Do not use in production.**
101
+
102
+ ## Why memledger
103
+
104
+ Existing memory frameworks (Mem0, Zep, Letta, AgentCore Memory) optimize for *recall quality* — how accurately the system retrieves relevant memory. None of them address *accountability* — who wrote this memory, how confident were they, what did they derive it from, and how has it been used since.
105
+
106
+ In a single-agent system, the accountability gap is academic. In a multi-agent system where agents read and act on each other's beliefs, it is the fault line where systems fail at scale.
107
+
108
+ ## What it does
109
+
110
+ - **Attribution** — every memory carries `created_by`, `confidence`, `session_id`, `derived_from`, `supersedes`, `workflow_id`, `triggered_by`, `hedged`, `namespace`
111
+ - **Cross-agent lineage chains** — derivation chains tracked across agent boundaries; effective confidence is the weakest link in the chain
112
+ - **Confidence-gated retrieval** — per-namespace `PASS` / `FLAG` / `FILTER` policy applied at search time
113
+ - **Outcome feedback loop** — `record_outcome()` updates memory confidence based on observed downstream outcomes
114
+ - **Namespace RBAC** — declarative per-agent access control over hierarchical namespaces
115
+ - **Memory Attribution Integrity (MAI) evaluation** — calibrated scorer (deterministic + LLM-as-judge) for memory quality
116
+ - **OpenTelemetry observability** — every operation emits spans with memory trust attributes
117
+ - **MCP server** — framework-agnostic adoption via Model Context Protocol
118
+
119
+ ## Install
120
+
121
+ ```bash
122
+ pip install memledger
123
+ ```
124
+
125
+ Backend extras (pick one or more):
126
+
127
+ ```bash
128
+ pip install memledger[local,pgvector] # zero-cloud OSS quickstart: local fastembed + Postgres+pgvector
129
+ pip install memledger[pgvector] # bring your own LLM/embedding provider via LiteLLM
130
+ pip install memledger[sqlite] # local SQLite (tests/demos only)
131
+ pip install memledger[aws] # AWS path: Bedrock, OpenSearch SigV4, DynamoDB
132
+ ```
133
+
134
+ **Backend contract (v1):** the only required backend is **open-source PostgreSQL ≥ 14 with the [pgvector](https://github.com/pgvector/pgvector) extension ≥ 0.5**. Aurora, RDS, Supabase, Neon and any other Postgres flavor work with the same backend class — only the DSN changes. See [docs/architecture.md](docs/architecture.md#memory-backend-contract-v1) for verified deployment patterns (Docker, Kubernetes, AWS).
135
+
136
+ ## Quick start
137
+
138
+ ```python
139
+ from memledger import Memledger
140
+
141
+ ml = await Memledger.create(backend_name="sqlite", connection_string=":memory:")
142
+
143
+ await ml.add(
144
+ content="HikariCP maxPoolSize=50 fixes payment-service OOM",
145
+ namespace="/ops/incidents/payment-svc",
146
+ confidence=0.9,
147
+ created_by="ops-agent",
148
+ )
149
+
150
+ results = await ml.search(query="connection pool fix", namespace="/ops/incidents/payment-svc")
151
+ for r in results:
152
+ print(r.content, r.confidence, r.created_by)
153
+ ```
154
+
155
+ ## Architecture
156
+
157
+ System architecture, data model, and observability pipeline are documented in [docs/architecture.md](docs/architecture.md).
158
+
159
+ ## Companion repositories
160
+
161
+ memledger is split across three repositories under the [memledger-ai](https://github.com/memledger-ai) organization:
162
+
163
+ - **[memledger-core](https://github.com/memledger-ai/memledger-core)** — Python SDK, MCP server, Helm chart (this repo)
164
+ - **[memledger-ui](https://github.com/memledger-ai/memledger-ui)** — Trust graph visualization (FastAPI + React)
165
+ - **[memledger-docs](https://github.com/memledger-ai/memledger-docs)** — Documentation site (Docusaurus)
166
+
167
+ ## License
168
+
169
+ Apache 2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,76 @@
1
+ # memledger
2
+
3
+ **Memory governance and trust layer for multi-agent AI systems.**
4
+
5
+ memledger adds attribution, provenance, confidence gating, and quality measurement on top of any vector-backed memory store. Every memory carries a source, a confidence score, a derivation chain, and an audit trail — so when agents share memory, trust transfers become legible instead of invisible.
6
+
7
+ > ⚠️ **v0.5.0a0 — alpha release (name-reservation).** Phase A + B of the v1 OSS launch are done; Phase C/D/E are in flight. `pip install memledger` (no `--pre`) will not pick this up — you must explicitly opt in (`pip install memledger==0.5.0a0` or `--pre`). The stable `v1.0.0` will follow when the launch checklist signs off. See [CHANGELOG.md](CHANGELOG.md) and [docs/test-plan.md](docs/test-plan.md) for what's verified vs. what's still on the runway. **Do not use in production.**
8
+
9
+ ## Why memledger
10
+
11
+ Existing memory frameworks (Mem0, Zep, Letta, AgentCore Memory) optimize for *recall quality* — how accurately the system retrieves relevant memory. None of them address *accountability* — who wrote this memory, how confident were they, what did they derive it from, and how has it been used since.
12
+
13
+ In a single-agent system, the accountability gap is academic. In a multi-agent system where agents read and act on each other's beliefs, it is the fault line where systems fail at scale.
14
+
15
+ ## What it does
16
+
17
+ - **Attribution** — every memory carries `created_by`, `confidence`, `session_id`, `derived_from`, `supersedes`, `workflow_id`, `triggered_by`, `hedged`, `namespace`
18
+ - **Cross-agent lineage chains** — derivation chains tracked across agent boundaries; effective confidence is the weakest link in the chain
19
+ - **Confidence-gated retrieval** — per-namespace `PASS` / `FLAG` / `FILTER` policy applied at search time
20
+ - **Outcome feedback loop** — `record_outcome()` updates memory confidence based on observed downstream outcomes
21
+ - **Namespace RBAC** — declarative per-agent access control over hierarchical namespaces
22
+ - **Memory Attribution Integrity (MAI) evaluation** — calibrated scorer (deterministic + LLM-as-judge) for memory quality
23
+ - **OpenTelemetry observability** — every operation emits spans with memory trust attributes
24
+ - **MCP server** — framework-agnostic adoption via Model Context Protocol
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ pip install memledger
30
+ ```
31
+
32
+ Backend extras (pick one or more):
33
+
34
+ ```bash
35
+ pip install memledger[local,pgvector] # zero-cloud OSS quickstart: local fastembed + Postgres+pgvector
36
+ pip install memledger[pgvector] # bring your own LLM/embedding provider via LiteLLM
37
+ pip install memledger[sqlite] # local SQLite (tests/demos only)
38
+ pip install memledger[aws] # AWS path: Bedrock, OpenSearch SigV4, DynamoDB
39
+ ```
40
+
41
+ **Backend contract (v1):** the only required backend is **open-source PostgreSQL ≥ 14 with the [pgvector](https://github.com/pgvector/pgvector) extension ≥ 0.5**. Aurora, RDS, Supabase, Neon and any other Postgres flavor work with the same backend class — only the DSN changes. See [docs/architecture.md](docs/architecture.md#memory-backend-contract-v1) for verified deployment patterns (Docker, Kubernetes, AWS).
42
+
43
+ ## Quick start
44
+
45
+ ```python
46
+ from memledger import Memledger
47
+
48
+ ml = await Memledger.create(backend_name="sqlite", connection_string=":memory:")
49
+
50
+ await ml.add(
51
+ content="HikariCP maxPoolSize=50 fixes payment-service OOM",
52
+ namespace="/ops/incidents/payment-svc",
53
+ confidence=0.9,
54
+ created_by="ops-agent",
55
+ )
56
+
57
+ results = await ml.search(query="connection pool fix", namespace="/ops/incidents/payment-svc")
58
+ for r in results:
59
+ print(r.content, r.confidence, r.created_by)
60
+ ```
61
+
62
+ ## Architecture
63
+
64
+ System architecture, data model, and observability pipeline are documented in [docs/architecture.md](docs/architecture.md).
65
+
66
+ ## Companion repositories
67
+
68
+ memledger is split across three repositories under the [memledger-ai](https://github.com/memledger-ai) organization:
69
+
70
+ - **[memledger-core](https://github.com/memledger-ai/memledger-core)** — Python SDK, MCP server, Helm chart (this repo)
71
+ - **[memledger-ui](https://github.com/memledger-ai/memledger-ui)** — Trust graph visualization (FastAPI + React)
72
+ - **[memledger-docs](https://github.com/memledger-ai/memledger-docs)** — Documentation site (Docusaurus)
73
+
74
+ ## License
75
+
76
+ Apache 2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,16 @@
1
+ apiVersion: v2
2
+ name: memledger-memory
3
+ description: Memledger memory layer for kagent — enables pgvector-backed persistent memory for AI agents
4
+ type: application
5
+ version: 0.1.0
6
+ appVersion: "0.1.0"
7
+ keywords:
8
+ - ai
9
+ - agents
10
+ - memory
11
+ - kagent
12
+ - pgvector
13
+ - opensearch
14
+ home: https://github.com/memledger/memledger
15
+ maintainers:
16
+ - name: Memledger Contributors
@@ -0,0 +1,46 @@
1
+ apiVersion: v1
2
+ kind: ConfigMap
3
+ metadata:
4
+ name: memledger-config
5
+ namespace: {{ .Release.Namespace }}
6
+ labels:
7
+ app.kubernetes.io/name: memledger-memory
8
+ app.kubernetes.io/instance: {{ .Release.Name }}
9
+ data:
10
+ memledger.yaml: |
11
+ version: "1.0"
12
+ embeddings:
13
+ provider: {{ .Values.embeddings.provider }}
14
+ model: {{ .Values.embeddings.model }}
15
+ dimensions: {{ .Values.embeddings.dimensions }}
16
+ backends:
17
+ pgvector:
18
+ provider: pgvector
19
+ config:
20
+ {{- if .Values.database.deploy }}
21
+ host: {{ .Release.Name }}-pgvector
22
+ port: 5432
23
+ database: {{ .Values.database.inClusterDatabase }}
24
+ user: {{ .Values.database.inClusterUser }}
25
+ {{- else }}
26
+ host: {{ .Values.database.host }}
27
+ port: {{ .Values.database.port }}
28
+ database: {{ .Values.database.database }}
29
+ user: {{ .Values.database.user }}
30
+ {{- end }}
31
+ password: ${PGVECTOR_PASSWORD}
32
+ dimensions: {{ .Values.database.migration.vectorDimensions }}
33
+ table_name: {{ .Values.database.migration.tableName }}
34
+ pool_min_size: 2
35
+ pool_max_size: 10
36
+ {{- if .Values.opensearch.enabled }}
37
+ opensearch:
38
+ provider: opensearch
39
+ config:
40
+ hosts: ["{{ .Values.opensearch.endpoint }}"]
41
+ auth_type: {{ .Values.opensearch.auth.type }}
42
+ index_name: {{ .Values.opensearch.indexName }}
43
+ dimensions: {{ .Values.embeddings.dimensions }}
44
+ {{- end }}
45
+ default_backend: {{ .Values.memledger.defaultBackend }}
46
+ default_namespace: {{ .Values.memledger.defaultNamespace }}