echo-mem 0.1.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 (59) hide show
  1. echo_mem-0.1.0/LICENSE +202 -0
  2. echo_mem-0.1.0/PKG-INFO +140 -0
  3. echo_mem-0.1.0/README.md +118 -0
  4. echo_mem-0.1.0/pyproject.toml +53 -0
  5. echo_mem-0.1.0/setup.cfg +4 -0
  6. echo_mem-0.1.0/src/echo_mem.egg-info/PKG-INFO +140 -0
  7. echo_mem-0.1.0/src/echo_mem.egg-info/SOURCES.txt +57 -0
  8. echo_mem-0.1.0/src/echo_mem.egg-info/dependency_links.txt +1 -0
  9. echo_mem-0.1.0/src/echo_mem.egg-info/entry_points.txt +2 -0
  10. echo_mem-0.1.0/src/echo_mem.egg-info/requires.txt +13 -0
  11. echo_mem-0.1.0/src/echo_mem.egg-info/top_level.txt +1 -0
  12. echo_mem-0.1.0/src/echo_memory/__init__.py +0 -0
  13. echo_mem-0.1.0/src/echo_memory/audit/__init__.py +0 -0
  14. echo_mem-0.1.0/src/echo_memory/audit/get_audit_log.py +118 -0
  15. echo_mem-0.1.0/src/echo_memory/cli/__init__.py +0 -0
  16. echo_mem-0.1.0/src/echo_memory/cli/analyse.py +122 -0
  17. echo_mem-0.1.0/src/echo_memory/cli/benchmark.py +170 -0
  18. echo_mem-0.1.0/src/echo_memory/cli/dashboard.py +208 -0
  19. echo_mem-0.1.0/src/echo_memory/cli/dashboard_html.py +660 -0
  20. echo_mem-0.1.0/src/echo_memory/cli/export.py +110 -0
  21. echo_mem-0.1.0/src/echo_memory/cli/graph.py +87 -0
  22. echo_mem-0.1.0/src/echo_memory/cli/install.py +155 -0
  23. echo_mem-0.1.0/src/echo_memory/cli/main.py +427 -0
  24. echo_mem-0.1.0/src/echo_memory/cli/queue.py +63 -0
  25. echo_mem-0.1.0/src/echo_memory/cli/reattribute.py +74 -0
  26. echo_mem-0.1.0/src/echo_memory/cli/reattribute_cmd.py +16 -0
  27. echo_mem-0.1.0/src/echo_memory/cli/recall.py +100 -0
  28. echo_mem-0.1.0/src/echo_memory/cli/session_start.py +150 -0
  29. echo_mem-0.1.0/src/echo_memory/cli/status.py +86 -0
  30. echo_mem-0.1.0/src/echo_memory/cli/trial.py +259 -0
  31. echo_mem-0.1.0/src/echo_memory/cli/why.py +15 -0
  32. echo_mem-0.1.0/src/echo_memory/client.py +65 -0
  33. echo_mem-0.1.0/src/echo_memory/infra/__init__.py +0 -0
  34. echo_mem-0.1.0/src/echo_memory/infra/config.py +56 -0
  35. echo_mem-0.1.0/src/echo_memory/infra/db.py +21 -0
  36. echo_mem-0.1.0/src/echo_memory/infra/logging.py +117 -0
  37. echo_mem-0.1.0/src/echo_memory/infra/pool.py +20 -0
  38. echo_mem-0.1.0/src/echo_memory/infra/project.py +147 -0
  39. echo_mem-0.1.0/src/echo_memory/ingestion/__init__.py +0 -0
  40. echo_mem-0.1.0/src/echo_memory/ingestion/bootstrap.py +236 -0
  41. echo_mem-0.1.0/src/echo_memory/ingestion/capture.py +85 -0
  42. echo_mem-0.1.0/src/echo_memory/ingestion/embeddings.py +41 -0
  43. echo_mem-0.1.0/src/echo_memory/ingestion/resolution.py +211 -0
  44. echo_mem-0.1.0/src/echo_memory/ingestion/write_episode.py +312 -0
  45. echo_mem-0.1.0/src/echo_memory/migrations/env.py +53 -0
  46. echo_mem-0.1.0/src/echo_memory/migrations/versions/0001_initial_schema.py +170 -0
  47. echo_mem-0.1.0/src/echo_memory/migrations/versions/0002_trial_observations.py +93 -0
  48. echo_mem-0.1.0/src/echo_memory/migrations/versions/0003_project_and_agent_provenance.py +107 -0
  49. echo_mem-0.1.0/src/echo_memory/migrations/versions/0004_bootstrap_state.py +43 -0
  50. echo_mem-0.1.0/src/echo_memory/migrations/versions/0005_recall_save_guards.py +48 -0
  51. echo_mem-0.1.0/src/echo_memory/migrations/versions/0006_project_analysis.py +50 -0
  52. echo_mem-0.1.0/src/echo_memory/retrieval/__init__.py +0 -0
  53. echo_mem-0.1.0/src/echo_memory/retrieval/fusion.py +21 -0
  54. echo_mem-0.1.0/src/echo_memory/retrieval/query_memory.py +257 -0
  55. echo_mem-0.1.0/src/echo_memory/server.py +301 -0
  56. echo_mem-0.1.0/src/echo_memory/skill/SKILL.md +134 -0
  57. echo_mem-0.1.0/src/echo_memory/trial/__init__.py +0 -0
  58. echo_mem-0.1.0/src/echo_memory/trial/check.py +244 -0
  59. echo_mem-0.1.0/src/echo_memory/trial/observations.py +179 -0
echo_mem-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: echo-mem
3
+ Version: 0.1.0
4
+ Summary: A long-horizon memory architecture for AI agents
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: psycopg[binary]<4,>=3.2
10
+ Requires-Dist: psycopg-pool<4,>=3.2
11
+ Requires-Dist: pgvector<1,>=0.3
12
+ Requires-Dist: alembic<2,>=1.13
13
+ Requires-Dist: sqlalchemy<3,>=2
14
+ Requires-Dist: mcp<3,>=2.0
15
+ Requires-Dist: sentence-transformers<4,>=3
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest<9,>=8; extra == "dev"
18
+ Requires-Dist: ruff<1,>=0.6; extra == "dev"
19
+ Requires-Dist: build<2,>=1; extra == "dev"
20
+ Requires-Dist: twine<7,>=5; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # Echo Memory
24
+
25
+ A long-horizon memory architecture for AI agents. Echo Memory is built to remember
26
+ everything an agent has ever learned, in the best possible way, and to keep fetching and
27
+ writing that memory efficiently no matter how much history accumulates, for coding
28
+ tools, chatbots, DevOps agents, or any other agentic system, local or deployed.
29
+
30
+ ## Why
31
+
32
+ Every AI agent starts from zero unless something remembers what happened last time, and
33
+ remembers it well enough and fast enough to still be useful after months or years of
34
+ accumulated history. Most memory tools solve short-term recall with plain vector search
35
+ over stored facts. That degrades as history grows: more candidates, more noise, slower
36
+ retrieval. Echo Memory is built around the read/write algorithm and the data structure
37
+ that keeps working at long horizons, not just at day one:
38
+
39
+ - **A temporal, self-consolidating memory graph.** Facts are edges between entities, not
40
+ flat vector rows. Old, rarely-accessed memory doesn't just accumulate: it gets
41
+ consolidated into higher-level summaries over time (never deleted, always traceable
42
+ back to the original), so retrieval cost stays bounded by what's *currently relevant*,
43
+ not by everything that's *ever* been written. See
44
+ [`docs/designs/echo-memory-design.md`](docs/designs/echo-memory-design.md#long-horizon-memory-architecture)
45
+ for the actual mechanism.
46
+ - **Real graph structure, not just similarity.** Multi-hop queries like "how did we end
47
+ up here?", answerable because facts are connected, not just individually embedded.
48
+ - **Causal typing, not just similarity.** Edges can be tagged `caused_by`, `led_to`,
49
+ `blocked_by`, `contradicts`, set by the agent's own read of the conversation, not
50
+ inferred statistically. Honest about what's tractable today and what isn't.
51
+ - **Auditable by design.** Every change to memory is logged, with a plain-language reason
52
+ you can read back (`echo-memory why <fact_id>`). Memory that consolidates and edits
53
+ itself is only trustworthy if you can see why.
54
+ - **A write path that costs nothing to run.** Extraction happens in the calling agent,
55
+ never on the server, so recording a memory makes zero LLM calls. Measured locally with
56
+ `echo-memory benchmark`: **write 15ms median, query 8ms, digest 1ms, $0.00 inference
57
+ cost per episode.** The tradeoff is explicit and worth stating: the agent must arrive
58
+ with entities and facts already extracted, which is more work for the caller and the
59
+ reason the [MCP tool contract](docs/DEVELOPMENT.md) spells the shape out. The
60
+ comparison that makes this matter is Zep/Graphiti, the closest architectural match
61
+ (bi-temporal edges, fact invalidation, episode provenance): its own published
62
+ description of ingestion is that "every episode triggers multiple LLM calls for
63
+ extraction, entity resolution, and invalidation" and that "write cost scales with
64
+ volume". Here it doesn't.
65
+ - **One storage engine, every scale.** Postgres + pgvector + Apache AGE, from a single
66
+ local agent up to an organization-wide shared graph spanning every agent a business
67
+ runs. No forced migration later. (The novel work is the memory structure and algorithm
68
+ running on top of Postgres, not a new database engine; see the design doc for why.)
69
+ - **Any agent, not one vendor's.** The interface is [MCP](https://modelcontextprotocol.io):
70
+ any MCP-compatible agent can read and write the same memory graph, whether that's a
71
+ coding assistant, a chatbot, an ops agent, or something built in-house.
72
+
73
+ ## Who this is for
74
+
75
+ - **A developer running local agents** who wants Claude Code, Cursor, or anything else to
76
+ stop losing context between sessions and tools.
77
+ - **A team or organization running agentic systems in production** (support bots, DevOps
78
+ agents, internal tooling) that needs a shared memory layer instead of N disconnected
79
+ ones, with the tenancy model (below) to keep it scoped correctly per agent, per team, or
80
+ org-wide.
81
+
82
+ ## Status
83
+
84
+ Early and staged. See [`docs/designs/`](docs/designs/) for the full architecture and the
85
+ v1a → v1b build plan. **The validated wedge driving v1a is specifically cross-tool coding
86
+ agent memory** (the founder's own daily pain, real and tested). The broader vision above
87
+ is the target this architecture is built toward, not yet something v1a itself proves. v1a
88
+ proves basic recall works before v1b adds causal typing and multi-hop graph retrieval, and
89
+ before v1.1 adds the org-wide tenancy the broader vision depends on.
90
+
91
+ ## Getting started
92
+
93
+ The core recall loop is built and running: `write_episode`, `query_memory`,
94
+ `get_audit_log`, an MCP server wiring them together, and an `echo-memory` CLI (`why`,
95
+ `export`). Full setup is in [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md); short version:
96
+
97
+ ```bash
98
+ git clone git@github.com:ayushcodes10/echo-mem.git && cd echo-mem
99
+ docker compose up -d # Postgres + pgvector + Apache AGE
100
+ python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"
101
+ alembic upgrade head
102
+
103
+ claude mcp add --scope user echo-memory \
104
+ -e ECHO_MEMORY_USER_ID=your-user-id \
105
+ -e ECHO_MEMORY_AGENT_ID=claude-code \
106
+ -e ECHO_MEMORY_DATABASE_URL="postgresql://postgres:postgres@localhost:5433/echo_memory" \
107
+ -- "$(pwd)/.venv/bin/python" -m echo_memory.server
108
+ ```
109
+
110
+ Start a new Claude Code session and `write_episode`/`query_memory`/`get_audit_log` are
111
+ available across every project, not just this repo.
112
+
113
+ Prefer it scoped to one project - a single Claude project, a Cursor workspace, a repo
114
+ whose memory shouldn't mingle with the rest? `echo-memory install [path] --for
115
+ claude|cursor|both` writes a project-scoped MCP config plus a skill (or, for Cursor, an
116
+ always-applied rule) telling the agent when to record and when to recall. See
117
+ [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) for Cursor/per-repo setup, the
118
+ `echo-memory` CLI, and running tests; see
119
+ [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md) for using Echo Memory from an agent
120
+ that doesn't speak MCP (a chatbot, a DevOps agent, a booking agent, or any custom
121
+ tool-calling loop); and see
122
+ [`docs/designs/echo-memory-design.md`](docs/designs/echo-memory-design.md) for the
123
+ current build plan and progress.
124
+
125
+ ## Architecture
126
+
127
+ - **Storage:** PostgreSQL with the `pgvector` and Apache AGE extensions
128
+ - **Retrieval:** hybrid vector + full-text search (v1a), with Personalized PageRank via
129
+ `networkx` added in v1b for multi-hop associative retrieval
130
+ - **Interface:** [Model Context Protocol](https://modelcontextprotocol.io) server:
131
+ `write_episode`, `query_memory`, `get_audit_log`
132
+
133
+ ## Contributing
134
+
135
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md). Issues and PRs welcome; please read the design
136
+ docs first so proposals fit the staged build plan.
137
+
138
+ ## License
139
+
140
+ Apache License 2.0. See [`LICENSE`](LICENSE).
@@ -0,0 +1,118 @@
1
+ # Echo Memory
2
+
3
+ A long-horizon memory architecture for AI agents. Echo Memory is built to remember
4
+ everything an agent has ever learned, in the best possible way, and to keep fetching and
5
+ writing that memory efficiently no matter how much history accumulates, for coding
6
+ tools, chatbots, DevOps agents, or any other agentic system, local or deployed.
7
+
8
+ ## Why
9
+
10
+ Every AI agent starts from zero unless something remembers what happened last time, and
11
+ remembers it well enough and fast enough to still be useful after months or years of
12
+ accumulated history. Most memory tools solve short-term recall with plain vector search
13
+ over stored facts. That degrades as history grows: more candidates, more noise, slower
14
+ retrieval. Echo Memory is built around the read/write algorithm and the data structure
15
+ that keeps working at long horizons, not just at day one:
16
+
17
+ - **A temporal, self-consolidating memory graph.** Facts are edges between entities, not
18
+ flat vector rows. Old, rarely-accessed memory doesn't just accumulate: it gets
19
+ consolidated into higher-level summaries over time (never deleted, always traceable
20
+ back to the original), so retrieval cost stays bounded by what's *currently relevant*,
21
+ not by everything that's *ever* been written. See
22
+ [`docs/designs/echo-memory-design.md`](docs/designs/echo-memory-design.md#long-horizon-memory-architecture)
23
+ for the actual mechanism.
24
+ - **Real graph structure, not just similarity.** Multi-hop queries like "how did we end
25
+ up here?", answerable because facts are connected, not just individually embedded.
26
+ - **Causal typing, not just similarity.** Edges can be tagged `caused_by`, `led_to`,
27
+ `blocked_by`, `contradicts`, set by the agent's own read of the conversation, not
28
+ inferred statistically. Honest about what's tractable today and what isn't.
29
+ - **Auditable by design.** Every change to memory is logged, with a plain-language reason
30
+ you can read back (`echo-memory why <fact_id>`). Memory that consolidates and edits
31
+ itself is only trustworthy if you can see why.
32
+ - **A write path that costs nothing to run.** Extraction happens in the calling agent,
33
+ never on the server, so recording a memory makes zero LLM calls. Measured locally with
34
+ `echo-memory benchmark`: **write 15ms median, query 8ms, digest 1ms, $0.00 inference
35
+ cost per episode.** The tradeoff is explicit and worth stating: the agent must arrive
36
+ with entities and facts already extracted, which is more work for the caller and the
37
+ reason the [MCP tool contract](docs/DEVELOPMENT.md) spells the shape out. The
38
+ comparison that makes this matter is Zep/Graphiti, the closest architectural match
39
+ (bi-temporal edges, fact invalidation, episode provenance): its own published
40
+ description of ingestion is that "every episode triggers multiple LLM calls for
41
+ extraction, entity resolution, and invalidation" and that "write cost scales with
42
+ volume". Here it doesn't.
43
+ - **One storage engine, every scale.** Postgres + pgvector + Apache AGE, from a single
44
+ local agent up to an organization-wide shared graph spanning every agent a business
45
+ runs. No forced migration later. (The novel work is the memory structure and algorithm
46
+ running on top of Postgres, not a new database engine; see the design doc for why.)
47
+ - **Any agent, not one vendor's.** The interface is [MCP](https://modelcontextprotocol.io):
48
+ any MCP-compatible agent can read and write the same memory graph, whether that's a
49
+ coding assistant, a chatbot, an ops agent, or something built in-house.
50
+
51
+ ## Who this is for
52
+
53
+ - **A developer running local agents** who wants Claude Code, Cursor, or anything else to
54
+ stop losing context between sessions and tools.
55
+ - **A team or organization running agentic systems in production** (support bots, DevOps
56
+ agents, internal tooling) that needs a shared memory layer instead of N disconnected
57
+ ones, with the tenancy model (below) to keep it scoped correctly per agent, per team, or
58
+ org-wide.
59
+
60
+ ## Status
61
+
62
+ Early and staged. See [`docs/designs/`](docs/designs/) for the full architecture and the
63
+ v1a → v1b build plan. **The validated wedge driving v1a is specifically cross-tool coding
64
+ agent memory** (the founder's own daily pain, real and tested). The broader vision above
65
+ is the target this architecture is built toward, not yet something v1a itself proves. v1a
66
+ proves basic recall works before v1b adds causal typing and multi-hop graph retrieval, and
67
+ before v1.1 adds the org-wide tenancy the broader vision depends on.
68
+
69
+ ## Getting started
70
+
71
+ The core recall loop is built and running: `write_episode`, `query_memory`,
72
+ `get_audit_log`, an MCP server wiring them together, and an `echo-memory` CLI (`why`,
73
+ `export`). Full setup is in [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md); short version:
74
+
75
+ ```bash
76
+ git clone git@github.com:ayushcodes10/echo-mem.git && cd echo-mem
77
+ docker compose up -d # Postgres + pgvector + Apache AGE
78
+ python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"
79
+ alembic upgrade head
80
+
81
+ claude mcp add --scope user echo-memory \
82
+ -e ECHO_MEMORY_USER_ID=your-user-id \
83
+ -e ECHO_MEMORY_AGENT_ID=claude-code \
84
+ -e ECHO_MEMORY_DATABASE_URL="postgresql://postgres:postgres@localhost:5433/echo_memory" \
85
+ -- "$(pwd)/.venv/bin/python" -m echo_memory.server
86
+ ```
87
+
88
+ Start a new Claude Code session and `write_episode`/`query_memory`/`get_audit_log` are
89
+ available across every project, not just this repo.
90
+
91
+ Prefer it scoped to one project - a single Claude project, a Cursor workspace, a repo
92
+ whose memory shouldn't mingle with the rest? `echo-memory install [path] --for
93
+ claude|cursor|both` writes a project-scoped MCP config plus a skill (or, for Cursor, an
94
+ always-applied rule) telling the agent when to record and when to recall. See
95
+ [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) for Cursor/per-repo setup, the
96
+ `echo-memory` CLI, and running tests; see
97
+ [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md) for using Echo Memory from an agent
98
+ that doesn't speak MCP (a chatbot, a DevOps agent, a booking agent, or any custom
99
+ tool-calling loop); and see
100
+ [`docs/designs/echo-memory-design.md`](docs/designs/echo-memory-design.md) for the
101
+ current build plan and progress.
102
+
103
+ ## Architecture
104
+
105
+ - **Storage:** PostgreSQL with the `pgvector` and Apache AGE extensions
106
+ - **Retrieval:** hybrid vector + full-text search (v1a), with Personalized PageRank via
107
+ `networkx` added in v1b for multi-hop associative retrieval
108
+ - **Interface:** [Model Context Protocol](https://modelcontextprotocol.io) server:
109
+ `write_episode`, `query_memory`, `get_audit_log`
110
+
111
+ ## Contributing
112
+
113
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md). Issues and PRs welcome; please read the design
114
+ docs first so proposals fit the staged build plan.
115
+
116
+ ## License
117
+
118
+ Apache License 2.0. See [`LICENSE`](LICENSE).
@@ -0,0 +1,53 @@
1
+ [project]
2
+ # The distribution is "echo-mem", not "echo-memory": that name is already taken
3
+ # on PyPI by an unrelated hosted product in this same category (Textstone Labs,
4
+ # published 2026-03-29), so `pip install echo-memory` installs theirs. The
5
+ # import package stays `echo_memory` - the CLI, the MCP registration command
6
+ # (`-m echo_memory.server`) and every existing install reference it, and
7
+ # renaming the module would break live configuration to fix a cosmetic mismatch.
8
+ name = "echo-mem"
9
+ version = "0.1.0"
10
+ description = "A long-horizon memory architecture for AI agents"
11
+ readme = "README.md"
12
+ license = "Apache-2.0"
13
+ requires-python = ">=3.11"
14
+ dependencies = [
15
+ "psycopg[binary]>=3.2,<4",
16
+ "psycopg-pool>=3.2,<4",
17
+ "pgvector>=0.3,<1",
18
+ "alembic>=1.13,<2",
19
+ "sqlalchemy>=2,<3",
20
+ "mcp>=2.0,<3",
21
+ "sentence-transformers>=3,<4",
22
+ ]
23
+
24
+ [project.scripts]
25
+ echo-memory = "echo_memory.cli.main:main"
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "pytest>=8,<9",
30
+ "ruff>=0.6,<1",
31
+ "build>=1,<2",
32
+ "twine>=5,<7",
33
+ ]
34
+
35
+ [build-system]
36
+ requires = ["setuptools>=68"]
37
+ build-backend = "setuptools.build_meta"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
41
+
42
+ [tool.setuptools.package-data]
43
+ "echo_memory.skill" = ["SKILL.md"]
44
+
45
+ [tool.pytest.ini_options]
46
+ markers = [
47
+ "eval: retrieval-quality evals against real data (reserved, not in use yet)",
48
+ ]
49
+ testpaths = ["tests"]
50
+
51
+ [tool.ruff]
52
+ line-length = 100
53
+ target-version = "py311"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: echo-mem
3
+ Version: 0.1.0
4
+ Summary: A long-horizon memory architecture for AI agents
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: psycopg[binary]<4,>=3.2
10
+ Requires-Dist: psycopg-pool<4,>=3.2
11
+ Requires-Dist: pgvector<1,>=0.3
12
+ Requires-Dist: alembic<2,>=1.13
13
+ Requires-Dist: sqlalchemy<3,>=2
14
+ Requires-Dist: mcp<3,>=2.0
15
+ Requires-Dist: sentence-transformers<4,>=3
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest<9,>=8; extra == "dev"
18
+ Requires-Dist: ruff<1,>=0.6; extra == "dev"
19
+ Requires-Dist: build<2,>=1; extra == "dev"
20
+ Requires-Dist: twine<7,>=5; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # Echo Memory
24
+
25
+ A long-horizon memory architecture for AI agents. Echo Memory is built to remember
26
+ everything an agent has ever learned, in the best possible way, and to keep fetching and
27
+ writing that memory efficiently no matter how much history accumulates, for coding
28
+ tools, chatbots, DevOps agents, or any other agentic system, local or deployed.
29
+
30
+ ## Why
31
+
32
+ Every AI agent starts from zero unless something remembers what happened last time, and
33
+ remembers it well enough and fast enough to still be useful after months or years of
34
+ accumulated history. Most memory tools solve short-term recall with plain vector search
35
+ over stored facts. That degrades as history grows: more candidates, more noise, slower
36
+ retrieval. Echo Memory is built around the read/write algorithm and the data structure
37
+ that keeps working at long horizons, not just at day one:
38
+
39
+ - **A temporal, self-consolidating memory graph.** Facts are edges between entities, not
40
+ flat vector rows. Old, rarely-accessed memory doesn't just accumulate: it gets
41
+ consolidated into higher-level summaries over time (never deleted, always traceable
42
+ back to the original), so retrieval cost stays bounded by what's *currently relevant*,
43
+ not by everything that's *ever* been written. See
44
+ [`docs/designs/echo-memory-design.md`](docs/designs/echo-memory-design.md#long-horizon-memory-architecture)
45
+ for the actual mechanism.
46
+ - **Real graph structure, not just similarity.** Multi-hop queries like "how did we end
47
+ up here?", answerable because facts are connected, not just individually embedded.
48
+ - **Causal typing, not just similarity.** Edges can be tagged `caused_by`, `led_to`,
49
+ `blocked_by`, `contradicts`, set by the agent's own read of the conversation, not
50
+ inferred statistically. Honest about what's tractable today and what isn't.
51
+ - **Auditable by design.** Every change to memory is logged, with a plain-language reason
52
+ you can read back (`echo-memory why <fact_id>`). Memory that consolidates and edits
53
+ itself is only trustworthy if you can see why.
54
+ - **A write path that costs nothing to run.** Extraction happens in the calling agent,
55
+ never on the server, so recording a memory makes zero LLM calls. Measured locally with
56
+ `echo-memory benchmark`: **write 15ms median, query 8ms, digest 1ms, $0.00 inference
57
+ cost per episode.** The tradeoff is explicit and worth stating: the agent must arrive
58
+ with entities and facts already extracted, which is more work for the caller and the
59
+ reason the [MCP tool contract](docs/DEVELOPMENT.md) spells the shape out. The
60
+ comparison that makes this matter is Zep/Graphiti, the closest architectural match
61
+ (bi-temporal edges, fact invalidation, episode provenance): its own published
62
+ description of ingestion is that "every episode triggers multiple LLM calls for
63
+ extraction, entity resolution, and invalidation" and that "write cost scales with
64
+ volume". Here it doesn't.
65
+ - **One storage engine, every scale.** Postgres + pgvector + Apache AGE, from a single
66
+ local agent up to an organization-wide shared graph spanning every agent a business
67
+ runs. No forced migration later. (The novel work is the memory structure and algorithm
68
+ running on top of Postgres, not a new database engine; see the design doc for why.)
69
+ - **Any agent, not one vendor's.** The interface is [MCP](https://modelcontextprotocol.io):
70
+ any MCP-compatible agent can read and write the same memory graph, whether that's a
71
+ coding assistant, a chatbot, an ops agent, or something built in-house.
72
+
73
+ ## Who this is for
74
+
75
+ - **A developer running local agents** who wants Claude Code, Cursor, or anything else to
76
+ stop losing context between sessions and tools.
77
+ - **A team or organization running agentic systems in production** (support bots, DevOps
78
+ agents, internal tooling) that needs a shared memory layer instead of N disconnected
79
+ ones, with the tenancy model (below) to keep it scoped correctly per agent, per team, or
80
+ org-wide.
81
+
82
+ ## Status
83
+
84
+ Early and staged. See [`docs/designs/`](docs/designs/) for the full architecture and the
85
+ v1a → v1b build plan. **The validated wedge driving v1a is specifically cross-tool coding
86
+ agent memory** (the founder's own daily pain, real and tested). The broader vision above
87
+ is the target this architecture is built toward, not yet something v1a itself proves. v1a
88
+ proves basic recall works before v1b adds causal typing and multi-hop graph retrieval, and
89
+ before v1.1 adds the org-wide tenancy the broader vision depends on.
90
+
91
+ ## Getting started
92
+
93
+ The core recall loop is built and running: `write_episode`, `query_memory`,
94
+ `get_audit_log`, an MCP server wiring them together, and an `echo-memory` CLI (`why`,
95
+ `export`). Full setup is in [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md); short version:
96
+
97
+ ```bash
98
+ git clone git@github.com:ayushcodes10/echo-mem.git && cd echo-mem
99
+ docker compose up -d # Postgres + pgvector + Apache AGE
100
+ python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"
101
+ alembic upgrade head
102
+
103
+ claude mcp add --scope user echo-memory \
104
+ -e ECHO_MEMORY_USER_ID=your-user-id \
105
+ -e ECHO_MEMORY_AGENT_ID=claude-code \
106
+ -e ECHO_MEMORY_DATABASE_URL="postgresql://postgres:postgres@localhost:5433/echo_memory" \
107
+ -- "$(pwd)/.venv/bin/python" -m echo_memory.server
108
+ ```
109
+
110
+ Start a new Claude Code session and `write_episode`/`query_memory`/`get_audit_log` are
111
+ available across every project, not just this repo.
112
+
113
+ Prefer it scoped to one project - a single Claude project, a Cursor workspace, a repo
114
+ whose memory shouldn't mingle with the rest? `echo-memory install [path] --for
115
+ claude|cursor|both` writes a project-scoped MCP config plus a skill (or, for Cursor, an
116
+ always-applied rule) telling the agent when to record and when to recall. See
117
+ [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) for Cursor/per-repo setup, the
118
+ `echo-memory` CLI, and running tests; see
119
+ [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md) for using Echo Memory from an agent
120
+ that doesn't speak MCP (a chatbot, a DevOps agent, a booking agent, or any custom
121
+ tool-calling loop); and see
122
+ [`docs/designs/echo-memory-design.md`](docs/designs/echo-memory-design.md) for the
123
+ current build plan and progress.
124
+
125
+ ## Architecture
126
+
127
+ - **Storage:** PostgreSQL with the `pgvector` and Apache AGE extensions
128
+ - **Retrieval:** hybrid vector + full-text search (v1a), with Personalized PageRank via
129
+ `networkx` added in v1b for multi-hop associative retrieval
130
+ - **Interface:** [Model Context Protocol](https://modelcontextprotocol.io) server:
131
+ `write_episode`, `query_memory`, `get_audit_log`
132
+
133
+ ## Contributing
134
+
135
+ See [`CONTRIBUTING.md`](CONTRIBUTING.md). Issues and PRs welcome; please read the design
136
+ docs first so proposals fit the staged build plan.
137
+
138
+ ## License
139
+
140
+ Apache License 2.0. See [`LICENSE`](LICENSE).