genesys-memory 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 (87) hide show
  1. genesys_memory-0.1.0/.claude/settings.local.json +3 -0
  2. genesys_memory-0.1.0/.dockerignore +19 -0
  3. genesys_memory-0.1.0/.env.example +41 -0
  4. genesys_memory-0.1.0/.gitignore +66 -0
  5. genesys_memory-0.1.0/CONTRIBUTING.md +35 -0
  6. genesys_memory-0.1.0/Dockerfile +15 -0
  7. genesys_memory-0.1.0/LICENSE +190 -0
  8. genesys_memory-0.1.0/PKG-INFO +223 -0
  9. genesys_memory-0.1.0/README.md +177 -0
  10. genesys_memory-0.1.0/alembic/env.py +37 -0
  11. genesys_memory-0.1.0/alembic/script.py.mako +22 -0
  12. genesys_memory-0.1.0/alembic/versions/001_initial_schema.py +83 -0
  13. genesys_memory-0.1.0/alembic/versions/002_add_reactivation_timestamps.py +29 -0
  14. genesys_memory-0.1.0/alembic/versions/003_add_stability_column.py +24 -0
  15. genesys_memory-0.1.0/alembic/versions/004_add_irrelevance_counter.py +21 -0
  16. genesys_memory-0.1.0/alembic.ini +36 -0
  17. genesys_memory-0.1.0/benchmarks/README.md +54 -0
  18. genesys_memory-0.1.0/benchmarks/__init__.py +0 -0
  19. genesys_memory-0.1.0/benchmarks/baseline_flat.py +67 -0
  20. genesys_memory-0.1.0/benchmarks/locomo_eval.py +180 -0
  21. genesys_memory-0.1.0/benchmarks/locomo_ingest.py +150 -0
  22. genesys_memory-0.1.0/benchmarks/locomo_judge.py +216 -0
  23. genesys_memory-0.1.0/benchmarks/locomo_judged.json +22456 -0
  24. genesys_memory-0.1.0/benchmarks/locomo_run.py +351 -0
  25. genesys_memory-0.1.0/benchmarks/run_benchmark.py +705 -0
  26. genesys_memory-0.1.0/benchmarks/scenarios/__init__.py +0 -0
  27. genesys_memory-0.1.0/benchmarks/scenarios/causal_reasoning.json +156 -0
  28. genesys_memory-0.1.0/benchmarks/scenarios/outdated_info.json +146 -0
  29. genesys_memory-0.1.0/benchmarks/scenarios/structural_importance.json +145 -0
  30. genesys_memory-0.1.0/benchmarks/scenarios/temporal_awareness.json +140 -0
  31. genesys_memory-0.1.0/config/default_core_categories.json +20 -0
  32. genesys_memory-0.1.0/config/init.sql +2 -0
  33. genesys_memory-0.1.0/docker-compose.yml +20 -0
  34. genesys_memory-0.1.0/pyproject.toml +84 -0
  35. genesys_memory-0.1.0/scripts/migrate_to_postgres.py +129 -0
  36. genesys_memory-0.1.0/src/genesys/__init__.py +0 -0
  37. genesys_memory-0.1.0/src/genesys/__main__.py +5 -0
  38. genesys_memory-0.1.0/src/genesys/api.py +841 -0
  39. genesys_memory-0.1.0/src/genesys/auth.py +345 -0
  40. genesys_memory-0.1.0/src/genesys/background/__init__.py +0 -0
  41. genesys_memory-0.1.0/src/genesys/background/workers.py +202 -0
  42. genesys_memory-0.1.0/src/genesys/context.py +6 -0
  43. genesys_memory-0.1.0/src/genesys/core_memory/__init__.py +0 -0
  44. genesys_memory-0.1.0/src/genesys/core_memory/preferences.py +60 -0
  45. genesys_memory-0.1.0/src/genesys/core_memory/promoter.py +97 -0
  46. genesys_memory-0.1.0/src/genesys/engine/__init__.py +0 -0
  47. genesys_memory-0.1.0/src/genesys/engine/consolidation.py +65 -0
  48. genesys_memory-0.1.0/src/genesys/engine/contradiction.py +71 -0
  49. genesys_memory-0.1.0/src/genesys/engine/forgetting.py +31 -0
  50. genesys_memory-0.1.0/src/genesys/engine/llm_provider.py +122 -0
  51. genesys_memory-0.1.0/src/genesys/engine/reactivation.py +55 -0
  52. genesys_memory-0.1.0/src/genesys/engine/scoring.py +103 -0
  53. genesys_memory-0.1.0/src/genesys/engine/transitions.py +88 -0
  54. genesys_memory-0.1.0/src/genesys/ingestion/__init__.py +0 -0
  55. genesys_memory-0.1.0/src/genesys/ingestion/chatgpt.py +152 -0
  56. genesys_memory-0.1.0/src/genesys/ingestion/claude.py +139 -0
  57. genesys_memory-0.1.0/src/genesys/main.py +46 -0
  58. genesys_memory-0.1.0/src/genesys/mcp/__init__.py +0 -0
  59. genesys_memory-0.1.0/src/genesys/mcp/tools.py +431 -0
  60. genesys_memory-0.1.0/src/genesys/models/__init__.py +5 -0
  61. genesys_memory-0.1.0/src/genesys/models/edge.py +18 -0
  62. genesys_memory-0.1.0/src/genesys/models/enums.py +30 -0
  63. genesys_memory-0.1.0/src/genesys/models/node.py +47 -0
  64. genesys_memory-0.1.0/src/genesys/providers.py +90 -0
  65. genesys_memory-0.1.0/src/genesys/retrieval/__init__.py +0 -0
  66. genesys_memory-0.1.0/src/genesys/retrieval/embedding.py +48 -0
  67. genesys_memory-0.1.0/src/genesys/server.py +138 -0
  68. genesys_memory-0.1.0/src/genesys/static/favicon.ico +0 -0
  69. genesys_memory-0.1.0/src/genesys/static/icon-96.png +0 -0
  70. genesys_memory-0.1.0/src/genesys/storage/__init__.py +0 -0
  71. genesys_memory-0.1.0/src/genesys/storage/base.py +65 -0
  72. genesys_memory-0.1.0/src/genesys/storage/cache.py +35 -0
  73. genesys_memory-0.1.0/src/genesys/storage/db.py +50 -0
  74. genesys_memory-0.1.0/src/genesys/storage/falkordb.py +399 -0
  75. genesys_memory-0.1.0/src/genesys/storage/memory.py +283 -0
  76. genesys_memory-0.1.0/src/genesys/storage/postgres.py +478 -0
  77. genesys_memory-0.1.0/tests/__init__.py +0 -0
  78. genesys_memory-0.1.0/tests/test_benchmark.py +255 -0
  79. genesys_memory-0.1.0/tests/test_contradiction.py +113 -0
  80. genesys_memory-0.1.0/tests/test_core_memory.py +131 -0
  81. genesys_memory-0.1.0/tests/test_forgetting.py +99 -0
  82. genesys_memory-0.1.0/tests/test_ingestion.py +145 -0
  83. genesys_memory-0.1.0/tests/test_integration.py +544 -0
  84. genesys_memory-0.1.0/tests/test_mcp_tools.py +218 -0
  85. genesys_memory-0.1.0/tests/test_retrieval.py +177 -0
  86. genesys_memory-0.1.0/tests/test_scoring.py +223 -0
  87. genesys_memory-0.1.0/tests/test_transitions.py +95 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ "outputStyle": "default"
3
+ }
@@ -0,0 +1,19 @@
1
+ __pycache__
2
+ *.pyc
3
+ .git
4
+ .env
5
+ .venv
6
+ venv
7
+ node_modules
8
+ genesys-ui/node_modules
9
+ genesys-ui/.next
10
+ tests
11
+ benchmarks
12
+ phases
13
+ schemas
14
+ *.md
15
+ !README.md
16
+ .mypy_cache
17
+ .pytest_cache
18
+ .ruff_cache
19
+ docker-compose.yml
@@ -0,0 +1,41 @@
1
+ # Required: AI providers
2
+ OPENAI_API_KEY=sk-...
3
+ ANTHROPIC_API_KEY=sk-ant-...
4
+
5
+ # Storage backend: memory | postgres
6
+ # "memory" = zero-dependency in-memory store (good for trying it out)
7
+ # "postgres" = Postgres + pgvector (production)
8
+ GENESYS_BACKEND=memory
9
+
10
+ # Persist path for in-memory backend (saves state across restarts)
11
+ # GENESYS_PERSIST_PATH=.genesys_state.json
12
+
13
+ # Postgres (required when GENESYS_BACKEND=postgres)
14
+ DATABASE_URL=postgresql://genesys:genesys@localhost:5432/genesys
15
+
16
+ # Default user ID (used in single-tenant / dev mode)
17
+ GENESYS_USER_ID=default_user
18
+
19
+ # Public URL for MCP OAuth (set to your domain in production)
20
+ GENESYS_PUBLIC_URL=http://localhost:8000
21
+
22
+ # CORS origins (comma-separated, for production UI domain)
23
+ # CORS_ORIGINS=https://your-ui.example.com
24
+
25
+ # Clerk auth (optional — auto-approve dev mode when not set)
26
+ # CLERK_SECRET_KEY=sk_live_...
27
+ # CLERK_PUBLISHABLE_KEY=pk_live_...
28
+ # CLERK_JWKS_URL=https://your-clerk-domain/.well-known/jwks.json
29
+ # CLERK_DOMAIN=your-clerk-domain.clerk.accounts.dev
30
+
31
+ # UI URL (for OAuth redirects)
32
+ # GENESYS_UI_URL=http://localhost:3000
33
+
34
+ # Security overrides (for local dev / benchmarks)
35
+ # GENESYS_DEV_MODE=true # Enables x-user-id header bypass, relaxes admin auth
36
+ # GENESYS_BYPASS_RATE_LIMITS=true # Disables all rate limiting
37
+ # GENESYS_ADMIN_API_KEY= # Required in production for /admin/* and /backfill-edges
38
+
39
+ # Rate limits (requests per minute, per user)
40
+ # GENESYS_RATE_LIMIT_GENERAL=60 # Store, recall, search, etc.
41
+ # GENESYS_RATE_LIMIT_ADMIN=5 # Admin endpoints
@@ -0,0 +1,66 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .venv/
9
+ venv/
10
+ .mypy_cache/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+
14
+ # Node / Next.js
15
+ node_modules/
16
+ .next/
17
+ out/
18
+ .pnp.*
19
+ *.tsbuildinfo
20
+
21
+ # Environment
22
+ .env
23
+ .env.*
24
+ !.env.example
25
+
26
+ # OS
27
+ .DS_Store
28
+
29
+ # Benchmark logs
30
+ benchmarks/logs/
31
+
32
+ claude_desktop_config.json
33
+
34
+ # Project-specific exclusions
35
+ /ui/
36
+ /genesys-ui/
37
+ Dockerfile.ui
38
+ data/
39
+
40
+ # IDE
41
+ .idea/
42
+ .vscode/
43
+
44
+ # Benchmark data files (large datasets)
45
+ benchmarks/locomo10.json
46
+ benchmarks/locomo_eval_results.json
47
+
48
+ # Internal docs (not for OSS)
49
+ phases/
50
+ schemas/
51
+
52
+ # Stitch design files
53
+ *.html
54
+
55
+ # Claude config
56
+ CLAUDE.md
57
+
58
+ # Internal notes
59
+ lessons.md
60
+ prompts/
61
+
62
+ # State snapshots
63
+ .genesys_state*.json
64
+
65
+ # Handoff docs
66
+ genesys-neuro-handoff/
@@ -0,0 +1,35 @@
1
+ # Contributing to Genesys
2
+
3
+ Thanks for your interest in contributing! Genesys is open source under the Apache 2.0 license.
4
+
5
+ ## Getting started
6
+
7
+ 1. Fork the repo and clone it
8
+ 2. Copy `.env.example` to `.env` and fill in your API keys
9
+ 3. Install dependencies: `pip install -e ".[dev]"`
10
+ 4. Run tests: `pytest`
11
+
12
+ ## Development
13
+
14
+ ```bash
15
+ # In-memory mode (no Docker needed)
16
+ uvicorn genesys.api:app --reload --port 8000
17
+
18
+ # With Postgres
19
+ docker compose up -d postgres
20
+ GENESYS_BACKEND=postgres uvicorn genesys.api:app --reload --port 8000
21
+ ```
22
+
23
+ ## Pull requests
24
+
25
+ - Keep PRs focused — one feature or fix per PR
26
+ - Add tests for new functionality
27
+ - Make sure `pytest` passes before submitting
28
+
29
+ ## Reporting issues
30
+
31
+ Open an issue on GitHub with steps to reproduce. Include your Python version and backend (`memory` or `postgres`).
32
+
33
+ ## Code of conduct
34
+
35
+ Be kind. We're all here to build something useful.
@@ -0,0 +1,15 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY pyproject.toml README.md ./
6
+ COPY src/ src/
7
+
8
+ RUN pip install --no-cache-dir ".[postgres]"
9
+
10
+ COPY alembic/ alembic/
11
+ COPY alembic.ini .
12
+
13
+ EXPOSE 8000
14
+
15
+ CMD ["sh", "-c", "uvicorn genesys.api:app --host 0.0.0.0 --port ${PORT:-8000}"]
@@ -0,0 +1,190 @@
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 the 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 the 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 any 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
+ Copyright 2024 Astrix Labs
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: genesys-memory
3
+ Version: 0.1.0
4
+ Summary: The intelligence layer for AI memory — scoring, causal inference, lifecycle management, and active forgetting
5
+ Project-URL: Homepage, https://github.com/rishimeka/genesys
6
+ Project-URL: Repository, https://github.com/rishimeka/genesys
7
+ Project-URL: Issues, https://github.com/rishimeka/genesys/issues
8
+ Author: Genesys Contributors
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: agents,ai,causal-graph,mcp,memory
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: anthropic>=0.30.0
20
+ Requires-Dist: cryptography>=42.0.0
21
+ Requires-Dist: fastapi>=0.110.0
22
+ Requires-Dist: httpx>=0.27.0
23
+ Requires-Dist: mcp>=1.0.0
24
+ Requires-Dist: numpy>=1.26.0
25
+ Requires-Dist: openai>=1.30.0
26
+ Requires-Dist: pydantic>=2.7.0
27
+ Requires-Dist: pyjwt>=2.8.0
28
+ Requires-Dist: python-dotenv>=1.0.0
29
+ Requires-Dist: sse-starlette>=2.0.0
30
+ Requires-Dist: uvicorn[standard]>=0.29.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
33
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
34
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
35
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
37
+ Provides-Extra: falkordb
38
+ Requires-Dist: falkordb>=1.0.0; extra == 'falkordb'
39
+ Requires-Dist: redis>=5.0.0; extra == 'falkordb'
40
+ Provides-Extra: postgres
41
+ Requires-Dist: alembic>=1.13.0; extra == 'postgres'
42
+ Requires-Dist: asyncpg>=0.29.0; extra == 'postgres'
43
+ Requires-Dist: pgvector>=0.3.0; extra == 'postgres'
44
+ Requires-Dist: redis>=5.0.0; extra == 'postgres'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # Genesys
48
+
49
+ **The intelligence layer for AI memory.**
50
+
51
+ > Scoring engine + causal graph + lifecycle manager for AI agent memory. Speaks MCP natively.
52
+
53
+ ## What is this
54
+
55
+ Genesys is not another vector database. It's a scoring engine + causal graph + lifecycle manager that makes AI memory actually *work*. Memories are scored by a multiplicative formula (relevance × connectivity × reactivation), connected in a causal graph, and actively forgotten when they become irrelevant. It plugs into any storage backend and speaks MCP natively.
56
+
57
+ ## Why
58
+
59
+ - **Flat memory doesn't scale.** Dumping everything into a vector store gives you recall with zero understanding. The 500th memory buries the 5 that matter.
60
+ - **No forgetting = no intelligence.** Real memory systems forget. Without active pruning, your AI drowns in stale context.
61
+ - **No causal reasoning.** Vector similarity can't answer "why did I choose X?" — you need a graph.
62
+
63
+ Your AI remembers everything but understands nothing. Genesys fixes that.
64
+
65
+ ## Quick Start
66
+
67
+ ### Local mode (in-memory, no Docker)
68
+
69
+ ```bash
70
+ git clone https://github.com/rishimeka/genesys.git
71
+ cd genesys
72
+ pip install -e . # publishes as genesys-memory on PyPI
73
+ cp .env.example .env
74
+ # Set OPENAI_API_KEY in .env
75
+
76
+ uvicorn genesys.api:app --port 8000
77
+ ```
78
+
79
+ ### With Postgres + pgvector
80
+
81
+ ```bash
82
+ git clone https://github.com/rishimeka/genesys.git
83
+ cd genesys
84
+ pip install -e ".[postgres]" # or: pip install genesys-memory[postgres]
85
+ cp .env.example .env
86
+ # Set OPENAI_API_KEY and DATABASE_URL in .env
87
+
88
+ docker compose up -d postgres
89
+ alembic upgrade head
90
+ GENESYS_BACKEND=postgres uvicorn genesys.api:app --port 8000
91
+ ```
92
+
93
+ ## Connect to your AI
94
+
95
+ ### Claude Code
96
+
97
+ ```bash
98
+ claude mcp add --transport http genesys http://localhost:8000/mcp
99
+ ```
100
+
101
+ ### Claude Desktop
102
+
103
+ Add to your `claude_desktop_config.json`:
104
+
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "genesys": {
109
+ "url": "http://localhost:8000/mcp"
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ ### Any MCP client
116
+
117
+ Point your client at the MCP endpoint:
118
+
119
+ ```
120
+ http://localhost:8000/mcp
121
+ ```
122
+
123
+ ## MCP Tools
124
+
125
+ | Tool | Description |
126
+ |------|-------------|
127
+ | `memory_store` | Store a new memory, optionally linking to related memories |
128
+ | `memory_recall` | Recall memories by natural language query (vector + graph) |
129
+ | `memory_search` | Search memories with filters (status, date range, keyword) |
130
+ | `memory_traverse` | Walk the causal graph from a given memory node |
131
+ | `memory_explain` | Explain why a memory exists and its causal chain |
132
+ | `memory_stats` | Get memory system statistics |
133
+ | `pin_memory` | Pin a memory so it's never forgotten |
134
+ | `unpin_memory` | Unpin a previously pinned memory |
135
+ | `delete_memory` | Permanently delete a memory |
136
+ | `list_core_memories` | List core memories, optionally filtered by category |
137
+ | `set_core_preferences` | Set user preferences for core memory categories |
138
+
139
+ ## How it works
140
+
141
+ Every memory is scored by three forces multiplied together:
142
+
143
+ ```
144
+ decay_score = relevance × connectivity × reactivation
145
+ ```
146
+
147
+ - **Relevance** decays over time. Old memories fade unless reinforced.
148
+ - **Connectivity** rewards memories with many causal links. Hub memories survive.
149
+ - **Reactivation** boosts memories that keep getting recalled. Frequency matters.
150
+
151
+ Because the formula is multiplicative, a memory must score on *all three* axes to survive. A highly connected but never-accessed memory still decays. A frequently recalled but causally orphaned memory still fades.
152
+
153
+ ```
154
+ ┌─────────┐
155
+ │ STORE │
156
+ └────┬────┘
157
+
158
+ ┌────▼────┐
159
+ │ ACTIVE │◄──── reactivation
160
+ └────┬────┘
161
+ │ decay
162
+ ┌────▼────┐
163
+ │ DORMANT │
164
+ └────┬────┘
165
+ │ continued decay
166
+ ┌────▼────┐
167
+ ┌───────│ FADING │
168
+ │ └─────────┘
169
+ │ score=0, orphan,
170
+ │ not pinned
171
+ ┌────▼────┐
172
+ │ PRUNED │
173
+ └─────────┘
174
+ ```
175
+
176
+ Memories can also be promoted to **core** status — structurally important memories that are auto-pinned and never pruned.
177
+
178
+ ## Benchmark Results
179
+
180
+ Tested on the [LoCoMo](https://arxiv.org/abs/2402.06397) long-conversation memory benchmark (1,540 questions across 10 conversations, category 5 excluded):
181
+
182
+ | Category | J-Score |
183
+ |----------|---------|
184
+ | Single-hop | 94.3% |
185
+ | Temporal | 87.5% |
186
+ | Multi-hop | 69.8% |
187
+ | Open-domain | 91.7% |
188
+ | **Overall** | **89.9%** |
189
+
190
+ Answer model: `gpt-4o-mini` | Judge model: `gpt-4o-mini` | Retrieval k=20
191
+
192
+ Full results and reproduction steps in [`benchmarks/`](benchmarks/).
193
+
194
+ ## Storage backends
195
+
196
+ | Backend | Status | Use case |
197
+ |---------|--------|----------|
198
+ | `memory` | Built-in | Zero deps, try it out |
199
+ | `postgres` + pgvector | Production | Persistent, scalable |
200
+ | Obsidian | Coming soon | Local-first knowledge base |
201
+ | Custom | Bring your own | Implement `GraphStorageProvider` |
202
+
203
+ ## Configuration
204
+
205
+ Copy `.env.example` to `.env` and set:
206
+
207
+ | Variable | Required | Description |
208
+ |----------|----------|-------------|
209
+ | `OPENAI_API_KEY` | Yes | Embeddings |
210
+ | `ANTHROPIC_API_KEY` | No | LLM memory processing (consolidation, contradiction detection) |
211
+ | `GENESYS_BACKEND` | No | `memory` (default) or `postgres` |
212
+ | `DATABASE_URL` | If postgres | Postgres connection string |
213
+ | `GENESYS_USER_ID` | No | Default user ID for single-tenant mode |
214
+
215
+ See [`.env.example`](.env.example) for all options.
216
+
217
+ ## Contributing
218
+
219
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
220
+
221
+ ## License
222
+
223
+ [Apache 2.0](LICENSE)