memorisdk 1.0.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.

Potentially problematic release.


This version of memorisdk might be problematic. Click here for more details.

Files changed (49) hide show
  1. memorisdk-1.0.0/LICENSE +203 -0
  2. memorisdk-1.0.0/PKG-INFO +386 -0
  3. memorisdk-1.0.0/README.md +314 -0
  4. memorisdk-1.0.0/memoriai/__init__.py +140 -0
  5. memorisdk-1.0.0/memoriai/agents/__init__.py +7 -0
  6. memorisdk-1.0.0/memoriai/agents/conscious_agent.py +506 -0
  7. memorisdk-1.0.0/memoriai/agents/memory_agent.py +322 -0
  8. memorisdk-1.0.0/memoriai/agents/retrieval_agent.py +579 -0
  9. memorisdk-1.0.0/memoriai/config/__init__.py +14 -0
  10. memorisdk-1.0.0/memoriai/config/manager.py +281 -0
  11. memorisdk-1.0.0/memoriai/config/settings.py +287 -0
  12. memorisdk-1.0.0/memoriai/core/__init__.py +6 -0
  13. memorisdk-1.0.0/memoriai/core/database.py +966 -0
  14. memorisdk-1.0.0/memoriai/core/memory.py +1349 -0
  15. memorisdk-1.0.0/memoriai/database/__init__.py +5 -0
  16. memorisdk-1.0.0/memoriai/database/connectors/__init__.py +9 -0
  17. memorisdk-1.0.0/memoriai/database/connectors/mysql_connector.py +159 -0
  18. memorisdk-1.0.0/memoriai/database/connectors/postgres_connector.py +158 -0
  19. memorisdk-1.0.0/memoriai/database/connectors/sqlite_connector.py +148 -0
  20. memorisdk-1.0.0/memoriai/database/queries/__init__.py +15 -0
  21. memorisdk-1.0.0/memoriai/database/queries/base_queries.py +204 -0
  22. memorisdk-1.0.0/memoriai/database/queries/chat_queries.py +157 -0
  23. memorisdk-1.0.0/memoriai/database/queries/entity_queries.py +236 -0
  24. memorisdk-1.0.0/memoriai/database/queries/memory_queries.py +178 -0
  25. memorisdk-1.0.0/memoriai/database/templates/__init__.py +0 -0
  26. memorisdk-1.0.0/memoriai/database/templates/basic_template.py +0 -0
  27. memorisdk-1.0.0/memoriai/database/templates/schemas/__init__.py +0 -0
  28. memorisdk-1.0.0/memoriai/integrations/__init__.py +68 -0
  29. memorisdk-1.0.0/memoriai/integrations/anthropic_integration.py +194 -0
  30. memorisdk-1.0.0/memoriai/integrations/litellm_integration.py +11 -0
  31. memorisdk-1.0.0/memoriai/integrations/openai_integration.py +273 -0
  32. memorisdk-1.0.0/memoriai/scripts/llm_text.py +50 -0
  33. memorisdk-1.0.0/memoriai/tools/__init__.py +5 -0
  34. memorisdk-1.0.0/memoriai/tools/memory_tool.py +544 -0
  35. memorisdk-1.0.0/memoriai/utils/__init__.py +89 -0
  36. memorisdk-1.0.0/memoriai/utils/exceptions.py +418 -0
  37. memorisdk-1.0.0/memoriai/utils/helpers.py +433 -0
  38. memorisdk-1.0.0/memoriai/utils/logging.py +204 -0
  39. memorisdk-1.0.0/memoriai/utils/pydantic_models.py +258 -0
  40. memorisdk-1.0.0/memoriai/utils/schemas.py +0 -0
  41. memorisdk-1.0.0/memoriai/utils/validators.py +339 -0
  42. memorisdk-1.0.0/memorisdk.egg-info/PKG-INFO +386 -0
  43. memorisdk-1.0.0/memorisdk.egg-info/SOURCES.txt +47 -0
  44. memorisdk-1.0.0/memorisdk.egg-info/dependency_links.txt +1 -0
  45. memorisdk-1.0.0/memorisdk.egg-info/entry_points.txt +2 -0
  46. memorisdk-1.0.0/memorisdk.egg-info/requires.txt +46 -0
  47. memorisdk-1.0.0/memorisdk.egg-info/top_level.txt +1 -0
  48. memorisdk-1.0.0/pyproject.toml +228 -0
  49. memorisdk-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,203 @@
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 granting the License.
13
+
14
+ "Legal Entity" shall mean the union of the acting entity and all
15
+ other entities that control, are controlled by, or are under common
16
+ control with that entity. For the purposes of this definition,
17
+ "control" means (i) the power, direct or indirect, to cause the
18
+ direction or management of such entity, whether by contract or
19
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity
23
+ exercising permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications,
26
+ including but not limited to software source code, documentation
27
+ source, and configuration files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical
30
+ transformation or translation of a Source form, including but
31
+ not limited to compiled object code, generated documentation,
32
+ and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or
35
+ Object form, made available under the License, as indicated by a
36
+ copyright notice that is included in or attached to the work
37
+ (which shall not include communications that are reasonably
38
+ considered separate from, or merely to link to (or bind by name)
39
+ the interfaces of, the Work and separate works which communicate
40
+ with the Work solely through the Work's public interfaces).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based upon (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and separate works which communicate with the Work solely
49
+ through the Work's public interfaces.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control
60
+ systems, and issue tracking systems that are managed by, or on behalf
61
+ of, the Licensor for the purpose of discussing and improving the Work,
62
+ but excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to use, reproduce, modify, distribute, and prepare
73
+ Derivative Works of the Work, and to publicly display and perform the
74
+ Work and such Derivative Works in all media and formats whether now
75
+ known or hereafter devised.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ (except as stated in this section) patent license to make, have made,
81
+ use, offer to sell, sell, import, and otherwise transfer the Work,
82
+ where such license applies only to those patent claims licensable
83
+ by such Contributor that are necessarily infringed by their
84
+ Contribution(s) alone or by combination of their Contribution(s)
85
+ with the Work to which such Contribution(s) was submitted. If You
86
+ institute patent litigation against any entity (including a
87
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
88
+ or a Contribution incorporated within the Work constitutes direct
89
+ or contributory patent infringement, then any patent licenses
90
+ granted to You under this License for that Work shall terminate
91
+ as of the date such litigation is filed.
92
+
93
+ 4. Redistribution. You may reproduce and distribute copies of the
94
+ Work or Derivative Works thereof in any medium, with or without
95
+ modifications, and in Source or Object form, provided that You
96
+ meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or
99
+ Derivative Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, trademark, patent,
106
+ attribution and other notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, then any Derivative Works that You distribute must
112
+ include a readable copy of the attribution notices contained
113
+ within such NOTICE file, excluding those notices that do not
114
+ pertain to any part of the Derivative Works, in at least one
115
+ of the following places: within a NOTICE text file distributed
116
+ as part of the Derivative Works; within the Source form or
117
+ documentation, if provided along with the Derivative Works; or,
118
+ within a display generated by the Derivative Works, if and
119
+ wherever such third-party notices normally appear. The contents
120
+ of the NOTICE file are for informational purposes only and
121
+ do not modify the License. You may add Your own attribution
122
+ notices within Derivative Works that You distribute, alongside
123
+ or as an addendum to the NOTICE text from the Work, provided
124
+ that such additional attribution notices cannot be construed
125
+ as modifying the License.
126
+
127
+ You may add Your own copyright notice to Your modifications and
128
+ may provide additional or different license terms and conditions
129
+ for use, reproduction, or distribution of Your modifications, or
130
+ for any such Derivative Works as a whole, provided Your use,
131
+ reproduction, and distribution of the Work otherwise complies with
132
+ the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
135
+ any Contribution intentionally submitted for inclusion in the Work
136
+ by You to the Licensor shall be under the terms and conditions of
137
+ this License, without any additional terms or conditions.
138
+ Notwithstanding the above, nothing herein shall supersede or modify
139
+ the terms of any separate license agreement you may have executed
140
+ with Licensor regarding such Contributions.
141
+
142
+ 6. Trademarks. This License does not grant permission to use the trade
143
+ names, trademarks, service marks, or product names of the Licensor,
144
+ except as required for reasonable and customary use in describing the
145
+ origin of the Work and reproducing the content of the NOTICE file.
146
+
147
+ 7. Disclaimer of Warranty. Unless required by applicable law or
148
+ agreed to in writing, Licensor provides the Work (and each
149
+ Contributor provides its Contributions) on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151
+ implied, including, without limitation, any warranties or conditions
152
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153
+ PARTICULAR PURPOSE. You are solely responsible for determining the
154
+ appropriateness of using or redistributing the Work and assume any
155
+ risks associated with Your exercise of permissions under this License.
156
+
157
+ 8. Limitation of Liability. In no event and under no legal theory,
158
+ whether in tort (including negligence), contract, or otherwise,
159
+ unless required by applicable law (such as deliberate and grossly
160
+ negligent acts) or agreed to in writing, shall any Contributor be
161
+ liable to You for damages, including any direct, indirect, special,
162
+ incidental, or consequential damages of any character arising as a
163
+ result of this License or out of the use or inability to use the
164
+ Work (including but not limited to damages for loss of goodwill,
165
+ work stoppage, computer failure or malfunction, or any and all
166
+ other commercial damages or losses), even if such Contributor
167
+ has been advised of the possibility of such damages.
168
+
169
+ 9. Accepting Warranty or Support. You may choose to offer, and to
170
+ charge a fee for, warranty, support, indemnity or other liability
171
+ obligations and/or rights consistent with this License. However, in
172
+ accepting such obligations, You may act only on Your own behalf and on
173
+ Your sole responsibility, not on behalf of any other Contributor, and
174
+ only if You agree to indemnify, defend, and hold each Contributor
175
+ harmless for any liability incurred by, or claims asserted against,
176
+ such Contributor by reason of your accepting any such warranty or support.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [2025] [Memori Team]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
@@ -0,0 +1,386 @@
1
+ Metadata-Version: 2.4
2
+ Name: memorisdk
3
+ Version: 1.0.0
4
+ Summary: The Open-Source Memory Layer for AI Agents & Multi-Agent Systems
5
+ Author-email: Memori Team <contact@memoriai.dev>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/GibsonAI/memoriai
8
+ Project-URL: Documentation, https://gibsonai.github.io/memoriai
9
+ Project-URL: Repository, https://github.com/GibsonAI/memoriai.git
10
+ Project-URL: Bug Tracker, https://github.com/GibsonAI/memoriai/issues
11
+ Project-URL: Changelog, https://github.com/GibsonAI/memoriai/blob/main/CHANGELOG.md
12
+ Project-URL: Contributing, https://github.com/GibsonAI/memoriai/blob/main/CONTRIBUTING.md
13
+ Keywords: ai,memory,agents,llm,artificial-intelligence,multi-agent
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Topic :: Database :: Database Engines/Servers
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: loguru>=0.6.0
32
+ Requires-Dist: pydantic>=2.0.0
33
+ Requires-Dist: python-dotenv>=1.0.0
34
+ Requires-Dist: click>=8.0.0
35
+ Requires-Dist: openai>=1.0.0
36
+ Provides-Extra: dev
37
+ Requires-Dist: black>=23.0; extra == "dev"
38
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
39
+ Requires-Dist: isort>=5.9.0; extra == "dev"
40
+ Requires-Dist: mypy>=1.0; extra == "dev"
41
+ Requires-Dist: pre-commit>=2.15; extra == "dev"
42
+ Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
43
+ Provides-Extra: docs
44
+ Requires-Dist: mkdocs>=1.5.0; extra == "docs"
45
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
46
+ Requires-Dist: mkdocs-git-revision-date-localized-plugin>=1.2.0; extra == "docs"
47
+ Requires-Dist: mkdocs-minify-plugin>=0.7.0; extra == "docs"
48
+ Requires-Dist: mkdocs-redirects>=1.2.0; extra == "docs"
49
+ Provides-Extra: postgres
50
+ Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
51
+ Provides-Extra: mysql
52
+ Requires-Dist: PyMySQL>=1.0.0; extra == "mysql"
53
+ Provides-Extra: integrations
54
+ Requires-Dist: litellm>=1.0.0; extra == "integrations"
55
+ Requires-Dist: anthropic>=0.3.0; extra == "integrations"
56
+ Provides-Extra: all
57
+ Requires-Dist: black>=23.0; extra == "all"
58
+ Requires-Dist: ruff>=0.1.0; extra == "all"
59
+ Requires-Dist: isort>=5.9.0; extra == "all"
60
+ Requires-Dist: mypy>=1.0; extra == "all"
61
+ Requires-Dist: pre-commit>=2.15; extra == "all"
62
+ Requires-Dist: mkdocs>=1.5.0; extra == "all"
63
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "all"
64
+ Requires-Dist: mkdocs-git-revision-date-localized-plugin>=1.2.0; extra == "all"
65
+ Requires-Dist: mkdocs-minify-plugin>=0.7.0; extra == "all"
66
+ Requires-Dist: mkdocs-redirects>=1.2.0; extra == "all"
67
+ Requires-Dist: psycopg2-binary>=2.9.0; extra == "all"
68
+ Requires-Dist: PyMySQL>=1.0.0; extra == "all"
69
+ Requires-Dist: litellm>=1.0.0; extra == "all"
70
+ Requires-Dist: anthropic>=0.3.0; extra == "all"
71
+ Dynamic: license-file
72
+
73
+ # Memoriai
74
+
75
+ **The Open-Source Memory Layer for AI Agents & Multi-Agent Systems v1.2**
76
+
77
+ *Give your AI agents structured, persistent memory with intelligent context injection - no more repeating yourself!*
78
+
79
+ [![PyPI version](https://badge.fury.io/py/memoriai.svg)](https://badge.fury.io/py/memoriai)
80
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
81
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
82
+
83
+ ---
84
+
85
+ ## 🎯 Philosophy
86
+
87
+ - **Second-memory for all your LLM work** - Never repeat context again
88
+ - **Dual-mode memory injection** - Conscious short-term memory + Auto intelligent search
89
+ - **Flexible database connections** - SQLite, PostgreSQL, MySQL support
90
+ - **Pydantic-based intelligence** - Structured memory processing with validation
91
+ - **Simple, reliable architecture** - Just works out of the box
92
+
93
+ ## ⚡ Quick Start
94
+
95
+ ```bash
96
+ pip install memoriai
97
+ ```
98
+
99
+ ```python
100
+ from memoriai import Memori
101
+
102
+ # Create your workspace memory with conscious mode
103
+ office_work = Memori(
104
+ database_connect="sqlite:///office_memory.db",
105
+ conscious_ingest=True, # Short-term working memory (one-shot context)
106
+ openai_api_key="your-key"
107
+ )
108
+
109
+ office_work.enable() # Start recording conversations
110
+
111
+ # Use ANY LLM library - context automatically injected!
112
+ from litellm import completion
113
+
114
+ response = completion(
115
+ model="gpt-4o",
116
+ messages=[{"role": "user", "content": "Help me with Python testing"}]
117
+ )
118
+ # ✨ Short-term working memory automatically included once per session
119
+ ```
120
+
121
+ ## 🧠 How It Works
122
+
123
+ ### 1. **Universal Recording**
124
+ ```python
125
+ office_work.enable() # Records ALL LLM conversations automatically
126
+ ```
127
+
128
+ ### 2. **Intelligent Processing**
129
+ - **Entity Extraction**: Extracts people, technologies, projects
130
+ - **Smart Categorization**: Facts, preferences, skills, rules
131
+ - **Pydantic Validation**: Structured, type-safe memory storage
132
+
133
+ ### 3. **Dual Memory Modes**
134
+
135
+ #### **🧠 Conscious Mode** - Short-Term Working Memory
136
+ ```python
137
+ conscious_ingest=True # One-shot short-term memory injection
138
+ ```
139
+ - **At Startup**: Conscious agent analyzes long-term memory patterns
140
+ - **Memory Promotion**: Moves essential conversations to short-term storage
141
+ - **One-Shot Injection**: Injects working memory once at conversation start
142
+ - **Like Human Short-Term Memory**: Names, current projects, preferences readily available
143
+
144
+ #### **🔍 Auto Mode** - Dynamic Database Search
145
+ ```python
146
+ auto_ingest=True # Continuous intelligent memory retrieval
147
+ ```
148
+ - **Every LLM Call**: Retrieval agent analyzes user query intelligently
149
+ - **Full Database Search**: Searches through entire memory database
150
+ - **Context-Aware**: Injects relevant memories based on current conversation
151
+ - **Performance Optimized**: Caching, async processing, background threads
152
+
153
+ ## 🧠 Memory Modes Explained
154
+
155
+ ### **Conscious Mode** - Short-Term Working Memory
156
+ ```python
157
+ # Mimics human conscious memory - essential info readily available
158
+ memori = Memori(
159
+ database_connect="sqlite:///my_memory.db",
160
+ conscious_ingest=True, # 🧠 Short-term working memory
161
+ openai_api_key="sk-..."
162
+ )
163
+ ```
164
+
165
+ **How Conscious Mode Works:**
166
+ 1. **At Startup**: Conscious agent analyzes long-term memory patterns
167
+ 2. **Essential Selection**: Promotes 5-10 most important conversations to short-term
168
+ 3. **One-Shot Injection**: Injects this working memory once at conversation start
169
+ 4. **No Repeats**: Won't inject again during the same session
170
+
171
+ ### **Auto Mode** - Dynamic Intelligent Search
172
+ ```python
173
+ # Searches entire database dynamically based on user queries
174
+ memori = Memori(
175
+ database_connect="sqlite:///my_memory.db",
176
+ auto_ingest=True, # 🔍 Smart database search
177
+ openai_api_key="sk-..."
178
+ )
179
+ ```
180
+
181
+ **How Auto Mode Works:**
182
+ 1. **Every LLM Call**: Retrieval agent analyzes user input
183
+ 2. **Query Planning**: Uses AI to understand what memories are needed
184
+ 3. **Smart Search**: Searches through entire database (short-term + long-term)
185
+ 4. **Context Injection**: Injects 3-5 most relevant memories per call
186
+
187
+ ### **Combined Mode** - Best of Both Worlds
188
+ ```python
189
+ # Get both working memory AND dynamic search
190
+ memori = Memori(
191
+ conscious_ingest=True, # Working memory once
192
+ auto_ingest=True, # Dynamic search every call
193
+ openai_api_key="sk-..."
194
+ )
195
+ ```
196
+
197
+ ### **Intelligence Layers:**
198
+
199
+ 1. **Memory Agent** - Processes every conversation with Pydantic structured outputs
200
+ 2. **Conscious Agent** - Analyzes patterns, promotes long-term → short-term memories
201
+ 3. **Retrieval Agent** - Intelligently searches and selects relevant context
202
+
203
+ ### **What gets prioritized in Conscious Mode:**
204
+ - 👤 **Personal Identity**: Your name, role, location, basic info
205
+ - ❤️ **Preferences & Habits**: What you like, work patterns, routines
206
+ - 🛠️ **Skills & Tools**: Technologies you use, expertise areas
207
+ - 📊 **Current Projects**: Ongoing work, learning goals
208
+ - 🤝 **Relationships**: Important people, colleagues, connections
209
+ - 🔄 **Repeated References**: Information you mention frequently
210
+
211
+ ## 🗄️ Memory Types
212
+
213
+ | Type | Purpose | Example | Auto-Promoted |
214
+ |------|---------|---------|---------------|
215
+ | **Facts** | Objective information | "I use PostgreSQL for databases" | ✅ High frequency |
216
+ | **Preferences** | User choices | "I prefer clean, readable code" | ✅ Personal identity |
217
+ | **Skills** | Abilities & knowledge | "Experienced with FastAPI" | ✅ Expertise areas |
218
+ | **Rules** | Constraints & guidelines | "Always write tests first" | ✅ Work patterns |
219
+ | **Context** | Session information | "Working on e-commerce project" | ✅ Current projects |
220
+
221
+ ## 🔧 Configuration
222
+
223
+ ### Simple Setup
224
+ ```python
225
+ from memoriai import Memori
226
+
227
+ # Conscious mode - Short-term working memory
228
+ memori = Memori(
229
+ database_connect="sqlite:///my_memory.db",
230
+ template="basic",
231
+ conscious_ingest=True, # One-shot context injection
232
+ openai_api_key="sk-..."
233
+ )
234
+
235
+ # Auto mode - Dynamic database search
236
+ memori = Memori(
237
+ database_connect="sqlite:///my_memory.db",
238
+ auto_ingest=True, # Continuous memory retrieval
239
+ openai_api_key="sk-..."
240
+ )
241
+
242
+ # Combined mode - Best of both worlds
243
+ memori = Memori(
244
+ conscious_ingest=True, # Working memory +
245
+ auto_ingest=True, # Dynamic search
246
+ openai_api_key="sk-..."
247
+ )
248
+ ```
249
+
250
+ ### Advanced Configuration
251
+ ```python
252
+ from memoriai import Memori, ConfigManager
253
+
254
+ # Load from memori.json or environment
255
+ config = ConfigManager()
256
+ config.auto_load()
257
+
258
+ memori = Memori()
259
+ memori.enable()
260
+ ```
261
+
262
+ Create `memori.json`:
263
+ ```json
264
+ {
265
+ "database": {
266
+ "connection_string": "postgresql://user:pass@localhost/memori"
267
+ },
268
+ "agents": {
269
+ "openai_api_key": "sk-...",
270
+ "conscious_ingest": true,
271
+ "auto_ingest": false
272
+ },
273
+ "memory": {
274
+ "namespace": "my_project",
275
+ "retention_policy": "30_days"
276
+ }
277
+ }
278
+ ```
279
+
280
+ ## 🔌 Universal Integration
281
+
282
+ Works with **ANY** LLM library:
283
+
284
+ ```python
285
+ memori.enable() # Enable universal recording
286
+
287
+ # LiteLLM (recommended)
288
+ from litellm import completion
289
+ completion(model="gpt-4", messages=[...])
290
+
291
+ # OpenAI
292
+ import openai
293
+ client = openai.OpenAI()
294
+ client.chat.completions.create(...)
295
+
296
+ # Anthropic
297
+ import anthropic
298
+ client = anthropic.Anthropic()
299
+ client.messages.create(...)
300
+
301
+ # All automatically recorded and contextualized!
302
+ ```
303
+
304
+ ## 🛠️ Memory Management
305
+
306
+ ### **Automatic Background Analysis**
307
+ ```python
308
+ # Automatic analysis every 6 hours (when conscious_ingest=True)
309
+ memori.enable() # Starts background conscious agent
310
+
311
+ # Manual analysis trigger
312
+ memori.trigger_conscious_analysis()
313
+
314
+ # Get essential conversations
315
+ essential = memori.get_essential_conversations(limit=5)
316
+ ```
317
+
318
+ ### **Memory Retrieval Tools**
319
+ ```python
320
+ from memoriai.tools import create_memory_tool
321
+
322
+ # Create memory search tool for your LLM
323
+ memory_tool = create_memory_tool(memori)
324
+
325
+ # Use in function calling
326
+ tools = [memory_tool]
327
+ completion(model="gpt-4", messages=[...], tools=tools)
328
+ ```
329
+
330
+ ### **Context Control**
331
+ ```python
332
+ # Get relevant context for a query
333
+ context = memori.retrieve_context("Python testing", limit=5)
334
+ # Returns: 3 essential + 2 specific memories
335
+
336
+ # Search by category
337
+ skills = memori.search_memories_by_category("skill", limit=10)
338
+
339
+ # Get memory statistics
340
+ stats = memori.get_memory_stats()
341
+ ```
342
+
343
+ ## 📋 Database Schema
344
+
345
+ ```sql
346
+ -- Core tables created automatically
347
+ chat_history # All conversations
348
+ short_term_memory # Recent context (expires)
349
+ long_term_memory # Permanent insights
350
+ rules_memory # User preferences
351
+ memory_entities # Extracted entities
352
+ memory_relationships # Entity connections
353
+ ```
354
+
355
+ ## 📁 Project Structure
356
+
357
+ ```
358
+ memoriai/
359
+ ├── core/ # Main Memori class, database manager
360
+ ├── agents/ # Memory processing with Pydantic
361
+ ├── database/ # SQLite/PostgreSQL/MySQL support
362
+ ├── integrations/ # LiteLLM, OpenAI, Anthropic
363
+ ├── config/ # Configuration management
364
+ ├── utils/ # Helpers, validation, logging
365
+ └── tools/ # Memory search tools
366
+ ```
367
+
368
+ ## 🚀 Examples
369
+
370
+ - **[Basic Usage](./examples/basic_usage.py)** - Simple memory setup with conscious ingestion
371
+ - **[Personal Assistant](./examples/personal_assistant.py)** - AI assistant with intelligent memory
372
+ - **[Memory Retrieval](./memory_retrival_example.py)** - Function calling with memory tools
373
+ - **[Advanced Config](./examples/advanced_config.py)** - Production configuration
374
+ - **[Interactive Demo](./memori_example.py)** - Live conscious ingestion showcase
375
+
376
+ ## 🤝 Contributing
377
+
378
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup and guidelines.
379
+
380
+ ## 📄 License
381
+
382
+ MIT License - see [LICENSE](./LICENSE) for details.
383
+
384
+ ---
385
+
386
+ *Made for developers who want their AI agents to remember and learn*