strata-agent-memory 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. strata_agent_memory-0.2.0/LICENSE +201 -0
  2. strata_agent_memory-0.2.0/PKG-INFO +202 -0
  3. strata_agent_memory-0.2.0/README.md +178 -0
  4. strata_agent_memory-0.2.0/agent_memory/__init__.py +12 -0
  5. strata_agent_memory-0.2.0/agent_memory/__main__.py +4 -0
  6. strata_agent_memory-0.2.0/agent_memory/audit.py +345 -0
  7. strata_agent_memory-0.2.0/agent_memory/cli.py +1405 -0
  8. strata_agent_memory-0.2.0/agent_memory/compact.py +83 -0
  9. strata_agent_memory-0.2.0/agent_memory/compiler.py +626 -0
  10. strata_agent_memory-0.2.0/agent_memory/contracts.py +417 -0
  11. strata_agent_memory-0.2.0/agent_memory/evidence.py +831 -0
  12. strata_agent_memory-0.2.0/agent_memory/export.py +282 -0
  13. strata_agent_memory-0.2.0/agent_memory/hooks.py +458 -0
  14. strata_agent_memory-0.2.0/agent_memory/identity.py +168 -0
  15. strata_agent_memory-0.2.0/agent_memory/ledger.py +981 -0
  16. strata_agent_memory-0.2.0/agent_memory/mcp_server.py +789 -0
  17. strata_agent_memory-0.2.0/agent_memory/memorizer.py +162 -0
  18. strata_agent_memory-0.2.0/agent_memory/pathmap.py +129 -0
  19. strata_agent_memory-0.2.0/agent_memory/recheck.py +197 -0
  20. strata_agent_memory-0.2.0/agent_memory/records.py +753 -0
  21. strata_agent_memory-0.2.0/agent_memory/reliability.py +595 -0
  22. strata_agent_memory-0.2.0/agent_memory/remote.py +316 -0
  23. strata_agent_memory-0.2.0/agent_memory/render.py +197 -0
  24. strata_agent_memory-0.2.0/agent_memory/serve.py +2277 -0
  25. strata_agent_memory-0.2.0/agent_memory/signing.py +286 -0
  26. strata_agent_memory-0.2.0/agent_memory/stats.py +177 -0
  27. strata_agent_memory-0.2.0/agent_memory/trust.py +310 -0
  28. strata_agent_memory-0.2.0/pyproject.toml +47 -0
  29. strata_agent_memory-0.2.0/setup.cfg +4 -0
  30. strata_agent_memory-0.2.0/strata_agent_memory.egg-info/PKG-INFO +202 -0
  31. strata_agent_memory-0.2.0/strata_agent_memory.egg-info/SOURCES.txt +62 -0
  32. strata_agent_memory-0.2.0/strata_agent_memory.egg-info/dependency_links.txt +1 -0
  33. strata_agent_memory-0.2.0/strata_agent_memory.egg-info/entry_points.txt +2 -0
  34. strata_agent_memory-0.2.0/strata_agent_memory.egg-info/requires.txt +3 -0
  35. strata_agent_memory-0.2.0/strata_agent_memory.egg-info/top_level.txt +1 -0
  36. strata_agent_memory-0.2.0/tests/test_audit.py +229 -0
  37. strata_agent_memory-0.2.0/tests/test_cli.py +158 -0
  38. strata_agent_memory-0.2.0/tests/test_compact.py +69 -0
  39. strata_agent_memory-0.2.0/tests/test_compiler_render.py +482 -0
  40. strata_agent_memory-0.2.0/tests/test_contracts.py +292 -0
  41. strata_agent_memory-0.2.0/tests/test_deploy_replica.py +369 -0
  42. strata_agent_memory-0.2.0/tests/test_deploy_tokens.py +288 -0
  43. strata_agent_memory-0.2.0/tests/test_evidence.py +691 -0
  44. strata_agent_memory-0.2.0/tests/test_hooks.py +556 -0
  45. strata_agent_memory-0.2.0/tests/test_identity.py +116 -0
  46. strata_agent_memory-0.2.0/tests/test_issue_bridge.py +242 -0
  47. strata_agent_memory-0.2.0/tests/test_ledger.py +1151 -0
  48. strata_agent_memory-0.2.0/tests/test_ledger_index.py +284 -0
  49. strata_agent_memory-0.2.0/tests/test_memorizer.py +202 -0
  50. strata_agent_memory-0.2.0/tests/test_packaging.py +136 -0
  51. strata_agent_memory-0.2.0/tests/test_pathmap.py +163 -0
  52. strata_agent_memory-0.2.0/tests/test_phase2.py +760 -0
  53. strata_agent_memory-0.2.0/tests/test_recheck.py +459 -0
  54. strata_agent_memory-0.2.0/tests/test_records.py +500 -0
  55. strata_agent_memory-0.2.0/tests/test_redaction.py +147 -0
  56. strata_agent_memory-0.2.0/tests/test_reliability.py +770 -0
  57. strata_agent_memory-0.2.0/tests/test_remote.py +525 -0
  58. strata_agent_memory-0.2.0/tests/test_review2_fixes.py +522 -0
  59. strata_agent_memory-0.2.0/tests/test_review_fixes.py +474 -0
  60. strata_agent_memory-0.2.0/tests/test_scale.py +217 -0
  61. strata_agent_memory-0.2.0/tests/test_serve.py +1748 -0
  62. strata_agent_memory-0.2.0/tests/test_signing.py +448 -0
  63. strata_agent_memory-0.2.0/tests/test_stats.py +132 -0
  64. strata_agent_memory-0.2.0/tests/test_trust.py +367 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
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,202 @@
1
+ Metadata-Version: 2.4
2
+ Name: strata-agent-memory
3
+ Version: 0.2.0
4
+ Summary: Portable, auditable, cross-vendor memory for LLM agents: evidence-bound claims, trust tiers, and compiled context views.
5
+ Author: Strata Intelligence
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/thagraybush/agent-memory
8
+ Project-URL: Repository, https://github.com/thagraybush/agent-memory
9
+ Keywords: agents,memory,mcp,context-engineering,multi-agent,provenance
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Provides-Extra: sign
22
+ Requires-Dist: cryptography>=42; extra == "sign"
23
+ Dynamic: license-file
24
+
25
+ # agent-memory
26
+
27
+ Portable, auditable, cross-vendor memory for LLM agents.
28
+
29
+ Memory here is not a store of facts. It is an append-only ledger of **claims**,
30
+ each made by an identified author (human, or an agent with a vendor lineage)
31
+ and bound to **evidence** that can be re-run. What any agent sees is a
32
+ **compiled view** over that ledger, and every compilation is itself recorded.
33
+ So you can always answer the three questions that matter after something goes
34
+ wrong: what did this agent see, what did it claim, and can the proof be re-run.
35
+
36
+ Works the same for Claude Code, Codex CLI, Antigravity (and the enterprise
37
+ Gemini CLI it replaced for consumers), Cursor, Grok Build, a local Qwen on
38
+ Ollama or vLLM, a CI job, and a human at a terminal. Plain files, no
39
+ service, no dependencies, Python 3.10+.
40
+
41
+ ## The rules that make it different
42
+
43
+ - **An outcome cannot be filed without a receipt.** "Tests pass" must cite an
44
+ `ev_` receipt from running the command through `agent-memory run`, or a
45
+ commit/file hash. The claim is rejected otherwise. A receipt is the
46
+ filer's record; the proof is the re-run, which `verify` and the nightly
47
+ lane perform, and the audit lists what nobody has re-run.
48
+ - **Same-vendor review is not verification.** A Claude reviewer approving a
49
+ Claude coder yields `self-verified`. Only a human or a different vendor
50
+ lineage (Codex, Gemini, a local Qwen) promotes a claim to `verified`.
51
+ - **Refuting a claim taints everything built on it.** Retractions walk the
52
+ provenance graph; nothing is deleted; the audit prints the chain.
53
+ - **Verifiers are isolated, workers fork.** A reviewer never sees the
54
+ submitter's decisions or directions; a fixer inherits the diagnosis.
55
+ - **Failures are kept.** Refuted outcomes and failed exemplars come back as a
56
+ "do not retry" list instead of vanishing in a summary.
57
+ - **Every compiled context is receipted** (unless you ask it not to be with
58
+ `--no-receipt` or `receipt=false`): included ids, exclusions with
59
+ reasons, and the hash of the rendered text.
60
+ - **A recheck that cannot ask the world is inconclusive, never a
61
+ refutation.** On another machine a receipt's path may not exist; with a
62
+ path map it can still match, and the nightly `agent-memory recheck` lane
63
+ files what it found under its own lineage.
64
+ - **Records can be signed.** Optional Ed25519 attestations (DSSE) prove who
65
+ filed a line; they never change a tier.
66
+
67
+ ## Sixty seconds
68
+
69
+ ```bash
70
+ pip install strata-agent-memory # the CLI is `agent-memory`; or, from a checkout: pip install -e .
71
+ cd your-project && agent-memory init
72
+
73
+ agent-memory run -- pytest -q # -> {"id": "ev_…", "kind": "test", "passed": 42, ...}
74
+ agent-memory claim outcome "auth tests pass" -e ev_… --commit
75
+ agent-memory claim outcome "deployed" # -> rejected: outcome claims require at least one receipt
76
+
77
+ agent-memory claim fact "sessions renew via renewSession()" --source src/auth.py
78
+ agent-memory claim decision "one review lane goes to Codex" --rationale "same-vendor review cannot see its own priors"
79
+
80
+ AGENT_MEMORY_HARNESS=codex-cli agent-memory verify clm_… # re-runs the receipt; claim becomes verified
81
+ agent-memory retract clm_… "measured on the wrong branch" # dependents become tainted
82
+
83
+ agent-memory claim fact "w3lib.get_meta_refresh takes baseurl" --source w3lib/html.py --env uv.lock
84
+ # --env binds a lockfile that exists in your project: the fact goes
85
+ # stale when deps change, not refuted (drop --env if you have none)
86
+
87
+ agent-memory compile --role worker --task "extend auth" # a fork-mode brief; reports what memory holds nothing on
88
+ agent-memory compile --role verifier --contract ctr_… --round 2 --lens security # isolated review brief with a lens
89
+ agent-memory audit # tiers, static-only outcomes, taint chains, verifier lineage matrix
90
+ agent-memory reliability # how often claims like these were refuted, with n and an interval; fitted staleness
91
+ AGENT_MEMORY_HARNESS=ollama agent-memory recheck --map /Users/craig/src=/home/chris/src # the nightly lane, from another machine
92
+ agent-memory serve # HTTP API, SSE and remote MCP on loopback; add --tokens FILE
93
+ # (see examples/remote/curl.md) to let cloud agents in behind TLS
94
+ agent-memory keygen && agent-memory claim fact "..." --source src/x.py --sign # optional: sign what you file
95
+ agent-memory export --format claim-evidence-map # or prov-json, in-toto (with DSSE envelopes for signed records)
96
+ ```
97
+
98
+ Receipts carry an assurance class (static, dynamic, adversarial) so a clean
99
+ lint exit is never mistaken for a passing test suite; the audit lists outcome
100
+ claims that rest on static evidence only.
101
+
102
+ Inside Claude Code, Codex or Gemini the same operations are MCP tools
103
+ (`memory_run`, `memory_claim`, `memory_verify`, `memory_compile`, …); see
104
+ `examples/` and [docs/INTEGRATION.md](docs/INTEGRATION.md).
105
+
106
+ ## Where this goes: measured reliability, then judged claims
107
+
108
+ Memory is often perception, not fact. The alpha separates the two
109
+ structurally: outcomes and file-bound facts are decided by re-running
110
+ receipts; decisions, directions, preferences and exemplars are judgment and
111
+ carry no verdict. The next phases add reliability signals for both, in this
112
+ order, with one rule throughout: no model ever runs inside validation, and
113
+ every score is either computed from records with authors or is itself a
114
+ record with an author.
115
+
116
+ | phase | adds | model involved |
117
+ |---|---|---|
118
+ | 3, measured reliability (built) | refutation rates per lineage and claim type with intervals; staleness fitted from recheck history instead of a 90-day constant; borne-out rates for directions and decisions; `agent-memory reliability` | none; standard library statistics over the ledger |
119
+ | 4, model-assisted review | LLM judges as authors of `assessment` records on claims no receipt can decide; panels across lineages that surface disagreement instead of voting; judges graded against later evidence; an anchor set to catch judge drift | yes, as an author with lineage, never as the validator |
120
+ | 5, learned layers | judge aggregation weighted by measured error rates, calibrated confidence, usefulness ranking for the compiler, injection anomaly flags, contradiction candidates | optional extras; the core stays dependency-free |
121
+
122
+ No statistic or judge ever promotes or demotes a claim; the one thing
123
+ history recalibrates is the staleness boundary. `verified` keeps meaning
124
+ that someone outside the author's lineage re-ran the proof. The full plan,
125
+ the record shapes and text wireframes of every new surface are in
126
+ [docs/ROADMAP.md](docs/ROADMAP.md); the phase 3 specification with tests
127
+ and acceptance is [docs/PHASE3-RELIABILITY.md](docs/PHASE3-RELIABILITY.md).
128
+
129
+ Hosting: there is no required service. Git is the database, CI or cron is
130
+ the scheduler, and every clone is a backup. `agent-memory serve` adds a
131
+ disposable replica: a SQLite index rebuilt from the shards, bearer-token
132
+ identity, an HTTP API, server-sent events, a remote MCP endpoint
133
+ (Streamable HTTP, revisions 2025-03-26, 2025-06-18 and the stateless
134
+ 2026-07-28, chosen per request) so cloud agents
135
+ reach the ledger without a clone (Claude Code on the web only through an
136
+ organization-managed connector; Codex cloud unverified), and scheduled
137
+ recheck and git-sync lanes. Losing the service never loses state
138
+ (docs/BETA-SPEC.md section 4, `examples/remote/`).
139
+
140
+ ## This repository's own ledger
141
+
142
+ `.agent-memory/` here is the ledger of building this project: decisions,
143
+ contracts, receipts of the test runs, the reviews, and the first
144
+ cross-lineage verifications. It is committed and public on purpose, with
145
+ the maintainers' emails, machine paths and command output in it
146
+ (SECURITY.md says exactly what, and why it is not rewritten). Read it with
147
+ `agent-memory audit` from a checkout; cite a record by its id.
148
+
149
+ ## Layout
150
+
151
+ ```
152
+ agent_memory/ the package (stdlib only)
153
+ records.py schemas, content ids, the filing rules
154
+ ledger.py append-only JSONL, three scopes, fsck
155
+ evidence.py receipts: run-and-capture, commit/file/diff bindings, re-check
156
+ trust.py tiers, cross-vendor rule, taint propagation, fitted staleness
157
+ stats.py Jeffreys/Wilson intervals, Kaplan-Meier survival (stdlib)
158
+ reliability.py refutation priors, same-lineage agreement, staleness fit, judgment calibration
159
+ compiler.py role/mode policy, ranking, budget, cross-check obligations, reliability annotations
160
+ render.py markdown / system / json
161
+ contracts.py the agreement layer
162
+ compact.py ancestry-preserving compaction
163
+ memorizer.py optional LLM extraction via any OpenAI-compatible endpoint
164
+ mcp_server.py stdio JSON-RPC MCP server
165
+ serve.py HTTP API, SSE, remote MCP (Streamable HTTP), SQLite index, scheduled lanes
166
+ recheck.py the nightly verifier lane as one command
167
+ pathmap.py answering another machine's receipts
168
+ signing.py optional Ed25519 attestations (DSSE); needs strata-agent-memory[sign]
169
+ hooks.py hook adapters: Claude Code, Codex CLI, Gemini CLI, Cursor
170
+ cli.py agent-memory <command>
171
+ docs/ DESIGN.md, PROTOCOL.md, RESEARCH-SYNTHESIS.md, INTEGRATION.md
172
+ schemas/ JSON Schema for the record envelope and bodies
173
+ examples/ Claude Code, Codex, Gemini, local LLM, CI
174
+ tests/ pytest suite; tests/sit/phase3/ is the CLI-driven system test
175
+ ```
176
+
177
+ ## Read next
178
+
179
+ - [docs/DESIGN.md](docs/DESIGN.md): why memory is a ledger of evidence-bound claims, and which research each decision comes from.
180
+ - [docs/PROTOCOL.md](docs/PROTOCOL.md): the normative format, filing rules, trust computation and compile semantics, for implementers in any language.
181
+ - [docs/RESEARCH-SYNTHESIS.md](docs/RESEARCH-SYNTHESIS.md): the nine sources, what was taken from each, and what none of them had.
182
+ - [docs/INTEGRATION.md](docs/INTEGRATION.md): setup per harness, the local verifier lane, the contract loop.
183
+ - [docs/LANDSCAPE.md](docs/LANDSCAPE.md): the competing systems, their verified licenses, the standards receipts align with, and what none of them do.
184
+ - [docs/UAT-PLAN.md](docs/UAT-PLAN.md): the one-week acceptance test across Claude Code, Codex, Antigravity and Grok.
185
+ - [docs/UAT-SELF.md](docs/UAT-SELF.md): the same test for one person with two subscriptions, Claude Code and Codex CLI, with `scripts/uat/` to set it up and to run the cross-lineage verification.
186
+ - [docs/STATUS.md](docs/STATUS.md): what is built and verified, the decisions in force with their ledger ids, hosting today, and what is next.
187
+ - [docs/ROADMAP.md](docs/ROADMAP.md): phases 3 to 5 (measured reliability, LLM judges as authors, learned layers), hosting, and wireframes of each new surface.
188
+ - [docs/PHASE3-RELIABILITY.md](docs/PHASE3-RELIABILITY.md): the phase 3 specification: reliability priors, fitted staleness, judgment calibration.
189
+ - [docs/BETA-SPEC.md](docs/BETA-SPEC.md): the beta specification: cross-machine rechecks, the recheck lane, `agent-memory serve` with remote MCP, signing, the issue bridge, and the review fixes.
190
+ - [docs/audits/](docs/audits/): the principal-engineer reviews of the beta, the pull request and horizon 1, kept verbatim, with every finding's resolution in the spec; plus the verified facts behind the plan.
191
+ - [docs/PLAN-NEXT.md](docs/PLAN-NEXT.md): the next horizon: self-UAT across Claude Code and Codex, the 0.2.0 release, harness reach, phase 4 judges, scale, and the experiment the product exists to run.
192
+ - [docs/PHASE4-JUDGES.md](docs/PHASE4-JUDGES.md): the phase 4 implementation plan, judges as authors, in the order that is useful before any judge can be graded.
193
+ - [docs/RELEASE-PLAN.md](docs/RELEASE-PLAN.md): what stands between the private beta and a public 0.2.0, including the decision about the committed ledger.
194
+ - [docs/RELEASE.md](docs/RELEASE.md): how a release is cut: CI, the smoke script, trusted publishing on a `v*` tag. [SECURITY.md](SECURITY.md) is the threat model and how to report; [CONTRIBUTING.md](CONTRIBUTING.md) is how work reaches main; [CHANGELOG.md](CHANGELOG.md) is what each version changed.
195
+
196
+ ## License
197
+
198
+ Apache-2.0. See LICENSE. This repository is the open core and stays that
199
+ way: the managed service and the other layers that could be sold are built
200
+ beside it in a separate repository, never under it (docs/ROADMAP.md section
201
+ 10). "agent-memory" and "strata-agent-memory" are names of Strata
202
+ Intelligence; the license grants no rights to them.
@@ -0,0 +1,178 @@
1
+ # agent-memory
2
+
3
+ Portable, auditable, cross-vendor memory for LLM agents.
4
+
5
+ Memory here is not a store of facts. It is an append-only ledger of **claims**,
6
+ each made by an identified author (human, or an agent with a vendor lineage)
7
+ and bound to **evidence** that can be re-run. What any agent sees is a
8
+ **compiled view** over that ledger, and every compilation is itself recorded.
9
+ So you can always answer the three questions that matter after something goes
10
+ wrong: what did this agent see, what did it claim, and can the proof be re-run.
11
+
12
+ Works the same for Claude Code, Codex CLI, Antigravity (and the enterprise
13
+ Gemini CLI it replaced for consumers), Cursor, Grok Build, a local Qwen on
14
+ Ollama or vLLM, a CI job, and a human at a terminal. Plain files, no
15
+ service, no dependencies, Python 3.10+.
16
+
17
+ ## The rules that make it different
18
+
19
+ - **An outcome cannot be filed without a receipt.** "Tests pass" must cite an
20
+ `ev_` receipt from running the command through `agent-memory run`, or a
21
+ commit/file hash. The claim is rejected otherwise. A receipt is the
22
+ filer's record; the proof is the re-run, which `verify` and the nightly
23
+ lane perform, and the audit lists what nobody has re-run.
24
+ - **Same-vendor review is not verification.** A Claude reviewer approving a
25
+ Claude coder yields `self-verified`. Only a human or a different vendor
26
+ lineage (Codex, Gemini, a local Qwen) promotes a claim to `verified`.
27
+ - **Refuting a claim taints everything built on it.** Retractions walk the
28
+ provenance graph; nothing is deleted; the audit prints the chain.
29
+ - **Verifiers are isolated, workers fork.** A reviewer never sees the
30
+ submitter's decisions or directions; a fixer inherits the diagnosis.
31
+ - **Failures are kept.** Refuted outcomes and failed exemplars come back as a
32
+ "do not retry" list instead of vanishing in a summary.
33
+ - **Every compiled context is receipted** (unless you ask it not to be with
34
+ `--no-receipt` or `receipt=false`): included ids, exclusions with
35
+ reasons, and the hash of the rendered text.
36
+ - **A recheck that cannot ask the world is inconclusive, never a
37
+ refutation.** On another machine a receipt's path may not exist; with a
38
+ path map it can still match, and the nightly `agent-memory recheck` lane
39
+ files what it found under its own lineage.
40
+ - **Records can be signed.** Optional Ed25519 attestations (DSSE) prove who
41
+ filed a line; they never change a tier.
42
+
43
+ ## Sixty seconds
44
+
45
+ ```bash
46
+ pip install strata-agent-memory # the CLI is `agent-memory`; or, from a checkout: pip install -e .
47
+ cd your-project && agent-memory init
48
+
49
+ agent-memory run -- pytest -q # -> {"id": "ev_…", "kind": "test", "passed": 42, ...}
50
+ agent-memory claim outcome "auth tests pass" -e ev_… --commit
51
+ agent-memory claim outcome "deployed" # -> rejected: outcome claims require at least one receipt
52
+
53
+ agent-memory claim fact "sessions renew via renewSession()" --source src/auth.py
54
+ agent-memory claim decision "one review lane goes to Codex" --rationale "same-vendor review cannot see its own priors"
55
+
56
+ AGENT_MEMORY_HARNESS=codex-cli agent-memory verify clm_… # re-runs the receipt; claim becomes verified
57
+ agent-memory retract clm_… "measured on the wrong branch" # dependents become tainted
58
+
59
+ agent-memory claim fact "w3lib.get_meta_refresh takes baseurl" --source w3lib/html.py --env uv.lock
60
+ # --env binds a lockfile that exists in your project: the fact goes
61
+ # stale when deps change, not refuted (drop --env if you have none)
62
+
63
+ agent-memory compile --role worker --task "extend auth" # a fork-mode brief; reports what memory holds nothing on
64
+ agent-memory compile --role verifier --contract ctr_… --round 2 --lens security # isolated review brief with a lens
65
+ agent-memory audit # tiers, static-only outcomes, taint chains, verifier lineage matrix
66
+ agent-memory reliability # how often claims like these were refuted, with n and an interval; fitted staleness
67
+ AGENT_MEMORY_HARNESS=ollama agent-memory recheck --map /Users/craig/src=/home/chris/src # the nightly lane, from another machine
68
+ agent-memory serve # HTTP API, SSE and remote MCP on loopback; add --tokens FILE
69
+ # (see examples/remote/curl.md) to let cloud agents in behind TLS
70
+ agent-memory keygen && agent-memory claim fact "..." --source src/x.py --sign # optional: sign what you file
71
+ agent-memory export --format claim-evidence-map # or prov-json, in-toto (with DSSE envelopes for signed records)
72
+ ```
73
+
74
+ Receipts carry an assurance class (static, dynamic, adversarial) so a clean
75
+ lint exit is never mistaken for a passing test suite; the audit lists outcome
76
+ claims that rest on static evidence only.
77
+
78
+ Inside Claude Code, Codex or Gemini the same operations are MCP tools
79
+ (`memory_run`, `memory_claim`, `memory_verify`, `memory_compile`, …); see
80
+ `examples/` and [docs/INTEGRATION.md](docs/INTEGRATION.md).
81
+
82
+ ## Where this goes: measured reliability, then judged claims
83
+
84
+ Memory is often perception, not fact. The alpha separates the two
85
+ structurally: outcomes and file-bound facts are decided by re-running
86
+ receipts; decisions, directions, preferences and exemplars are judgment and
87
+ carry no verdict. The next phases add reliability signals for both, in this
88
+ order, with one rule throughout: no model ever runs inside validation, and
89
+ every score is either computed from records with authors or is itself a
90
+ record with an author.
91
+
92
+ | phase | adds | model involved |
93
+ |---|---|---|
94
+ | 3, measured reliability (built) | refutation rates per lineage and claim type with intervals; staleness fitted from recheck history instead of a 90-day constant; borne-out rates for directions and decisions; `agent-memory reliability` | none; standard library statistics over the ledger |
95
+ | 4, model-assisted review | LLM judges as authors of `assessment` records on claims no receipt can decide; panels across lineages that surface disagreement instead of voting; judges graded against later evidence; an anchor set to catch judge drift | yes, as an author with lineage, never as the validator |
96
+ | 5, learned layers | judge aggregation weighted by measured error rates, calibrated confidence, usefulness ranking for the compiler, injection anomaly flags, contradiction candidates | optional extras; the core stays dependency-free |
97
+
98
+ No statistic or judge ever promotes or demotes a claim; the one thing
99
+ history recalibrates is the staleness boundary. `verified` keeps meaning
100
+ that someone outside the author's lineage re-ran the proof. The full plan,
101
+ the record shapes and text wireframes of every new surface are in
102
+ [docs/ROADMAP.md](docs/ROADMAP.md); the phase 3 specification with tests
103
+ and acceptance is [docs/PHASE3-RELIABILITY.md](docs/PHASE3-RELIABILITY.md).
104
+
105
+ Hosting: there is no required service. Git is the database, CI or cron is
106
+ the scheduler, and every clone is a backup. `agent-memory serve` adds a
107
+ disposable replica: a SQLite index rebuilt from the shards, bearer-token
108
+ identity, an HTTP API, server-sent events, a remote MCP endpoint
109
+ (Streamable HTTP, revisions 2025-03-26, 2025-06-18 and the stateless
110
+ 2026-07-28, chosen per request) so cloud agents
111
+ reach the ledger without a clone (Claude Code on the web only through an
112
+ organization-managed connector; Codex cloud unverified), and scheduled
113
+ recheck and git-sync lanes. Losing the service never loses state
114
+ (docs/BETA-SPEC.md section 4, `examples/remote/`).
115
+
116
+ ## This repository's own ledger
117
+
118
+ `.agent-memory/` here is the ledger of building this project: decisions,
119
+ contracts, receipts of the test runs, the reviews, and the first
120
+ cross-lineage verifications. It is committed and public on purpose, with
121
+ the maintainers' emails, machine paths and command output in it
122
+ (SECURITY.md says exactly what, and why it is not rewritten). Read it with
123
+ `agent-memory audit` from a checkout; cite a record by its id.
124
+
125
+ ## Layout
126
+
127
+ ```
128
+ agent_memory/ the package (stdlib only)
129
+ records.py schemas, content ids, the filing rules
130
+ ledger.py append-only JSONL, three scopes, fsck
131
+ evidence.py receipts: run-and-capture, commit/file/diff bindings, re-check
132
+ trust.py tiers, cross-vendor rule, taint propagation, fitted staleness
133
+ stats.py Jeffreys/Wilson intervals, Kaplan-Meier survival (stdlib)
134
+ reliability.py refutation priors, same-lineage agreement, staleness fit, judgment calibration
135
+ compiler.py role/mode policy, ranking, budget, cross-check obligations, reliability annotations
136
+ render.py markdown / system / json
137
+ contracts.py the agreement layer
138
+ compact.py ancestry-preserving compaction
139
+ memorizer.py optional LLM extraction via any OpenAI-compatible endpoint
140
+ mcp_server.py stdio JSON-RPC MCP server
141
+ serve.py HTTP API, SSE, remote MCP (Streamable HTTP), SQLite index, scheduled lanes
142
+ recheck.py the nightly verifier lane as one command
143
+ pathmap.py answering another machine's receipts
144
+ signing.py optional Ed25519 attestations (DSSE); needs strata-agent-memory[sign]
145
+ hooks.py hook adapters: Claude Code, Codex CLI, Gemini CLI, Cursor
146
+ cli.py agent-memory <command>
147
+ docs/ DESIGN.md, PROTOCOL.md, RESEARCH-SYNTHESIS.md, INTEGRATION.md
148
+ schemas/ JSON Schema for the record envelope and bodies
149
+ examples/ Claude Code, Codex, Gemini, local LLM, CI
150
+ tests/ pytest suite; tests/sit/phase3/ is the CLI-driven system test
151
+ ```
152
+
153
+ ## Read next
154
+
155
+ - [docs/DESIGN.md](docs/DESIGN.md): why memory is a ledger of evidence-bound claims, and which research each decision comes from.
156
+ - [docs/PROTOCOL.md](docs/PROTOCOL.md): the normative format, filing rules, trust computation and compile semantics, for implementers in any language.
157
+ - [docs/RESEARCH-SYNTHESIS.md](docs/RESEARCH-SYNTHESIS.md): the nine sources, what was taken from each, and what none of them had.
158
+ - [docs/INTEGRATION.md](docs/INTEGRATION.md): setup per harness, the local verifier lane, the contract loop.
159
+ - [docs/LANDSCAPE.md](docs/LANDSCAPE.md): the competing systems, their verified licenses, the standards receipts align with, and what none of them do.
160
+ - [docs/UAT-PLAN.md](docs/UAT-PLAN.md): the one-week acceptance test across Claude Code, Codex, Antigravity and Grok.
161
+ - [docs/UAT-SELF.md](docs/UAT-SELF.md): the same test for one person with two subscriptions, Claude Code and Codex CLI, with `scripts/uat/` to set it up and to run the cross-lineage verification.
162
+ - [docs/STATUS.md](docs/STATUS.md): what is built and verified, the decisions in force with their ledger ids, hosting today, and what is next.
163
+ - [docs/ROADMAP.md](docs/ROADMAP.md): phases 3 to 5 (measured reliability, LLM judges as authors, learned layers), hosting, and wireframes of each new surface.
164
+ - [docs/PHASE3-RELIABILITY.md](docs/PHASE3-RELIABILITY.md): the phase 3 specification: reliability priors, fitted staleness, judgment calibration.
165
+ - [docs/BETA-SPEC.md](docs/BETA-SPEC.md): the beta specification: cross-machine rechecks, the recheck lane, `agent-memory serve` with remote MCP, signing, the issue bridge, and the review fixes.
166
+ - [docs/audits/](docs/audits/): the principal-engineer reviews of the beta, the pull request and horizon 1, kept verbatim, with every finding's resolution in the spec; plus the verified facts behind the plan.
167
+ - [docs/PLAN-NEXT.md](docs/PLAN-NEXT.md): the next horizon: self-UAT across Claude Code and Codex, the 0.2.0 release, harness reach, phase 4 judges, scale, and the experiment the product exists to run.
168
+ - [docs/PHASE4-JUDGES.md](docs/PHASE4-JUDGES.md): the phase 4 implementation plan, judges as authors, in the order that is useful before any judge can be graded.
169
+ - [docs/RELEASE-PLAN.md](docs/RELEASE-PLAN.md): what stands between the private beta and a public 0.2.0, including the decision about the committed ledger.
170
+ - [docs/RELEASE.md](docs/RELEASE.md): how a release is cut: CI, the smoke script, trusted publishing on a `v*` tag. [SECURITY.md](SECURITY.md) is the threat model and how to report; [CONTRIBUTING.md](CONTRIBUTING.md) is how work reaches main; [CHANGELOG.md](CHANGELOG.md) is what each version changed.
171
+
172
+ ## License
173
+
174
+ Apache-2.0. See LICENSE. This repository is the open core and stays that
175
+ way: the managed service and the other layers that could be sold are built
176
+ beside it in a separate repository, never under it (docs/ROADMAP.md section
177
+ 10). "agent-memory" and "strata-agent-memory" are names of Strata
178
+ Intelligence; the license grants no rights to them.
@@ -0,0 +1,12 @@
1
+ """agent-memory: portable, auditable, cross-vendor memory for LLM agents.
2
+
3
+ The unit of memory is a *claim* made by an identified author (human or agent,
4
+ with vendor lineage) inside a scope, bound to *evidence* that can be re-run.
5
+ Context handed to any agent is a *compiled view* over that ledger, and every
6
+ compilation is itself recorded so you can always answer: what did this agent
7
+ see, what did it claim, and can the proof be re-run.
8
+
9
+ The core is dependency-free (Python 3.10+ standard library only).
10
+ """
11
+
12
+ __version__ = "0.2.0"
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+ import sys
3
+
4
+ sys.exit(main())