engramma-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 (49) hide show
  1. engramma_memory-0.1.0/.github/workflows/ci.yml +73 -0
  2. engramma_memory-0.1.0/.gitignore +19 -0
  3. engramma_memory-0.1.0/.pre-commit-config.yaml +16 -0
  4. engramma_memory-0.1.0/CHANGELOG.md +29 -0
  5. engramma_memory-0.1.0/CONTRIBUTING.md +78 -0
  6. engramma_memory-0.1.0/LICENSE +21 -0
  7. engramma_memory-0.1.0/PKG-INFO +379 -0
  8. engramma_memory-0.1.0/README.md +327 -0
  9. engramma_memory-0.1.0/docs/api-reference.md +299 -0
  10. engramma_memory-0.1.0/docs/cloud/async.md +118 -0
  11. engramma_memory-0.1.0/docs/cloud/overview.md +375 -0
  12. engramma_memory-0.1.0/docs/getting-started/installation.md +68 -0
  13. engramma_memory-0.1.0/docs/getting-started/quickstart.md +83 -0
  14. engramma_memory-0.1.0/docs/guides/chatbot-memory.md +173 -0
  15. engramma_memory-0.1.0/docs/guides/engramma-vs-vectordbs.md +133 -0
  16. engramma_memory-0.1.0/docs/guides/migrating-to-cloud.md +235 -0
  17. engramma_memory-0.1.0/docs/index.md +72 -0
  18. engramma_memory-0.1.0/docs/integrations/crewai.md +76 -0
  19. engramma_memory-0.1.0/docs/integrations/fastapi.md +136 -0
  20. engramma_memory-0.1.0/docs/integrations/langchain.md +62 -0
  21. engramma_memory-0.1.0/docs/integrations/llamaindex.md +61 -0
  22. engramma_memory-0.1.0/docs/integrations/openai-assistants.md +84 -0
  23. engramma_memory-0.1.0/engramma_memory/__init__.py +21 -0
  24. engramma_memory-0.1.0/engramma_memory/async_core.py +418 -0
  25. engramma_memory-0.1.0/engramma_memory/backends/__init__.py +4 -0
  26. engramma_memory-0.1.0/engramma_memory/backends/async_cloud.py +403 -0
  27. engramma_memory-0.1.0/engramma_memory/backends/cloud.py +931 -0
  28. engramma_memory-0.1.0/engramma_memory/backends/local.py +89 -0
  29. engramma_memory-0.1.0/engramma_memory/core.py +192 -0
  30. engramma_memory-0.1.0/engramma_memory/engine.py +439 -0
  31. engramma_memory-0.1.0/engramma_memory/integrations/__init__.py +10 -0
  32. engramma_memory-0.1.0/engramma_memory/integrations/crewai.py +111 -0
  33. engramma_memory-0.1.0/engramma_memory/integrations/fastapi.py +169 -0
  34. engramma_memory-0.1.0/engramma_memory/integrations/langchain.py +122 -0
  35. engramma_memory-0.1.0/engramma_memory/integrations/llamaindex.py +154 -0
  36. engramma_memory-0.1.0/engramma_memory/integrations/openai_assistants.py +250 -0
  37. engramma_memory-0.1.0/engramma_memory/py.typed +0 -0
  38. engramma_memory-0.1.0/examples/chatbot_memory.py +100 -0
  39. engramma_memory-0.1.0/examples/quickstart.py +39 -0
  40. engramma_memory-0.1.0/examples/rag_agent.py +147 -0
  41. engramma_memory-0.1.0/mkdocs.yml +77 -0
  42. engramma_memory-0.1.0/notebooks/01_quickstart.ipynb +185 -0
  43. engramma_memory-0.1.0/notebooks/02_chatbot_memory.ipynb +221 -0
  44. engramma_memory-0.1.0/notebooks/03_composition_deep_dive.ipynb +115 -0
  45. engramma_memory-0.1.0/pyproject.toml +80 -0
  46. engramma_memory-0.1.0/tests/__init__.py +0 -0
  47. engramma_memory-0.1.0/tests/test_core.py +122 -0
  48. engramma_memory-0.1.0/tests/test_engine.py +215 -0
  49. engramma_memory-0.1.0/tests/test_integrations.py +70 -0
@@ -0,0 +1,73 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e ".[dev]"
28
+
29
+ - name: Run tests
30
+ run: pytest tests/ -v --cov=engramma_memory --cov-report=xml
31
+
32
+ - name: Upload coverage
33
+ if: matrix.python-version == '3.12'
34
+ uses: codecov/codecov-action@v4
35
+ with:
36
+ file: ./coverage.xml
37
+
38
+ lint:
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+
43
+ - name: Set up Python
44
+ uses: actions/setup-python@v5
45
+ with:
46
+ python-version: "3.12"
47
+
48
+ - name: Install ruff
49
+ run: pip install ruff
50
+
51
+ - name: Lint
52
+ run: ruff check engramma_memory/
53
+
54
+ - name: Format check
55
+ run: ruff format --check engramma_memory/
56
+
57
+ typecheck:
58
+ runs-on: ubuntu-latest
59
+ steps:
60
+ - uses: actions/checkout@v4
61
+
62
+ - name: Set up Python
63
+ uses: actions/setup-python@v5
64
+ with:
65
+ python-version: "3.12"
66
+
67
+ - name: Install dependencies
68
+ run: |
69
+ pip install -e ".[dev]"
70
+ pip install mypy numpy
71
+
72
+ - name: Type check
73
+ run: mypy engramma_memory/ --ignore-missing-imports
@@ -0,0 +1,19 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .pytest_cache/
10
+ .coverage
11
+ htmlcov/
12
+ .env
13
+ .venv/
14
+ venv/
15
+ *.so
16
+ .mypy_cache/
17
+ .ruff_cache/
18
+ site/
19
+ .ipynb_checkpoints/
@@ -0,0 +1,16 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.4.4
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v4.6.0
11
+ hooks:
12
+ - id: trailing-whitespace
13
+ - id: end-of-file-fixer
14
+ - id: check-yaml
15
+ - id: check-added-large-files
16
+ args: [--maxkb=500]
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-07-06
9
+
10
+ ### Added
11
+
12
+ - Initial public release of Engramma Memory SDK
13
+ - Hybrid memory engine with three pathways:
14
+ - Exact kNN Memory with importance-based eviction
15
+ - Energy-based Memory (Modern Hopfield network)
16
+ - Multi-Head Attention Memory for native composition
17
+ - Confidence-based routing between pathways
18
+ - Local backend (in-process, zero dependencies beyond NumPy)
19
+ - Cloud backend (production-grade, unlimited storage)
20
+ - Framework integrations:
21
+ - LangChain (BaseMemory adapter)
22
+ - LlamaIndex (BaseRetriever adapter)
23
+ - OpenAI Assistants (tool definitions + handler)
24
+ - CrewAI (memory integration)
25
+ - FastAPI (router middleware)
26
+ - Examples: quickstart, chatbot memory, RAG agent
27
+ - Jupyter notebooks for interactive exploration
28
+ - Full MkDocs documentation site
29
+ - MIT License
@@ -0,0 +1,78 @@
1
+ # Contributing to Engramma Memory
2
+
3
+ Thank you for your interest in contributing! This guide will help you get started.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/engramma-ai/engramma-memory.git
9
+ cd engramma-memory
10
+ python -m venv .venv
11
+ source .venv/bin/activate # or .venv\Scripts\activate on Windows
12
+ pip install -e ".[dev,docs]"
13
+ ```
14
+
15
+ ## Running Tests
16
+
17
+ ```bash
18
+ pytest tests/ -v
19
+ pytest tests/ -v --cov=engramma_memory # with coverage
20
+ ```
21
+
22
+ ## Code Style
23
+
24
+ We use [Ruff](https://docs.astral.sh/ruff/) for linting and formatting:
25
+
26
+ ```bash
27
+ ruff check engramma_memory/
28
+ ruff format engramma_memory/
29
+ ```
30
+
31
+ ## Type Checking
32
+
33
+ ```bash
34
+ mypy engramma_memory/ --ignore-missing-imports
35
+ ```
36
+
37
+ ## Pull Request Process
38
+
39
+ 1. Fork the repository and create a feature branch from `main`.
40
+ 2. Write tests for any new functionality.
41
+ 3. Ensure all tests pass and code is formatted.
42
+ 4. Update documentation if your change affects the public API.
43
+ 5. Submit a PR with a clear description of what changed and why.
44
+
45
+ ## What We're Looking For
46
+
47
+ - Bug fixes with regression tests
48
+ - Performance improvements (with benchmarks)
49
+ - New framework integrations
50
+ - Documentation improvements
51
+ - Examples and tutorials
52
+
53
+ ## Architecture Overview
54
+
55
+ ```
56
+ engramma_memory/
57
+ ├── core.py # Public API (EngrammaMemory class)
58
+ ├── engine.py # Hybrid memory engine (Exact + Energy + Attention)
59
+ ├── backends/ # Local and Cloud backend implementations
60
+ └── integrations/ # Framework adapters (LangChain, LlamaIndex, etc.)
61
+ ```
62
+
63
+ The engine uses three pathways:
64
+ - **ExactMemory** — kNN with importance-based eviction
65
+ - **EnergyMemory** — Hopfield network with temperature-scaled softmax
66
+ - **MultiHeadAttentionMemory** — Compositional retrieval via split-query attention
67
+
68
+ ## Reporting Issues
69
+
70
+ Please use [GitHub Issues](https://github.com/engramma-ai/engramma-memory/issues) and include:
71
+ - Python version
72
+ - Engramma version (`engramma_memory.__version__`)
73
+ - Minimal reproducible example
74
+ - Expected vs actual behavior
75
+
76
+ ## License
77
+
78
+ By contributing, you agree that your contributions will be licensed under the MIT License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 engramma-ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,379 @@
1
+ Metadata-Version: 2.4
2
+ Name: engramma-memory
3
+ Version: 0.1.0
4
+ Summary: A composable memory engine for AI systems that learns, adapts, and reasons - not just retrieves.
5
+ Project-URL: Homepage, https://www.engramma-memory.com
6
+ Project-URL: Documentation, https://doc.engramma-memory.com
7
+ Project-URL: Repository, https://github.com/engramma-ai/engramma-memory
8
+ Project-URL: Issues, https://github.com/engramma-ai/engramma-memory/issues
9
+ Author: Engramma Team
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,composition,llm,memory,neural,retrieval
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.9
23
+ Requires-Dist: numpy>=1.21.0
24
+ Provides-Extra: all
25
+ Requires-Dist: crewai>=0.1.0; extra == 'all'
26
+ Requires-Dist: fastapi>=0.100.0; extra == 'all'
27
+ Requires-Dist: httpx>=0.24.0; extra == 'all'
28
+ Requires-Dist: langchain-core>=0.1.0; extra == 'all'
29
+ Requires-Dist: llama-index-core>=0.10.0; extra == 'all'
30
+ Requires-Dist: openai>=1.0.0; extra == 'all'
31
+ Provides-Extra: cloud
32
+ Requires-Dist: httpx>=0.24.0; extra == 'cloud'
33
+ Provides-Extra: crewai
34
+ Requires-Dist: crewai>=0.1.0; extra == 'crewai'
35
+ Provides-Extra: dev
36
+ Requires-Dist: mypy>=1.0; extra == 'dev'
37
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
38
+ Requires-Dist: pytest>=7.0; extra == 'dev'
39
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
40
+ Provides-Extra: docs
41
+ Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
42
+ Requires-Dist: pymdown-extensions>=10.0; extra == 'docs'
43
+ Provides-Extra: fastapi
44
+ Requires-Dist: fastapi>=0.100.0; extra == 'fastapi'
45
+ Provides-Extra: langchain
46
+ Requires-Dist: langchain-core>=0.1.0; extra == 'langchain'
47
+ Provides-Extra: llamaindex
48
+ Requires-Dist: llama-index-core>=0.10.0; extra == 'llamaindex'
49
+ Provides-Extra: openai
50
+ Requires-Dist: openai>=1.0.0; extra == 'openai'
51
+ Description-Content-Type: text/markdown
52
+
53
+ <div align="center">
54
+ <!-- You can add a logo here: <img src="docs/assets/logo.png" alt="Engramma Logo" width="200"/> -->
55
+ <h1>🧠 Engramma Memory</h1>
56
+ <p><strong>The memory engine for AI that <em>thinks</em> — not just retrieves.</strong></p>
57
+ <p>Composition. Generalization. Causal reasoning. One <code>pip install</code> away.</p>
58
+
59
+ <p>
60
+ <a href="https://pypi.org/project/engramma-memory/"><img src="https://img.shields.io/pypi/v/engramma-memory?style=for-the-badge&color=5A67D8" alt="PyPI" /></a>
61
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.9+-5A67D8?style=for-the-badge&logo=python&logoColor=white" alt="Python 3.9+" /></a>
62
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="License: MIT" /></a>
63
+ <a href="https://github.com/engramma-ai/engramma-memory/actions"><img src="https://img.shields.io/badge/tests-39%20passed-brightgreen?style=for-the-badge" alt="Tests" /></a>
64
+ <a href="https://doc.engramma-memory.com"><img src="https://img.shields.io/badge/docs-engramma--memory.dev-blue?style=for-the-badge" alt="Docs" /></a>
65
+ </p>
66
+
67
+ <h4>
68
+ <a href="#-quickstart">Get Started</a> &nbsp;&bull;&nbsp;
69
+ <a href="#-why-engramma">Why Engramma?</a> &nbsp;&bull;&nbsp;
70
+ <a href="#-how-it-works">Architecture</a> &nbsp;&bull;&nbsp;
71
+ <a href="#%E2%98%81%EF%B8%8F-engramma-cloud">Cloud</a> &nbsp;&bull;&nbsp;
72
+ <a href="https://doc.engramma-memory.com">Documentation</a>
73
+ </h4>
74
+ </div>
75
+
76
+ ---
77
+
78
+ > **Vector databases retrieve. Engramma *composes*.**
79
+ > Your agent asks: "What do you know about Python AND machine learning?"
80
+ > ChromaDB returns two separate results. Engramma returns **one fused answer**.
81
+
82
+ ## 📖 Table of Contents
83
+ - [The Problem](#-the-problem)
84
+ - [Quickstart](#-quickstart)
85
+ - [Why Not Just Use a Vector DB?](#-why-not-just-use-a-vector-db)
86
+ - [How It Works](#-how-it-works)
87
+ - [Benchmarks](#-benchmarks)
88
+ - [Integrations](#-integrations)
89
+ - [Engramma Cloud](#%E2%98%81%EF%B8%8F-engramma-cloud)
90
+ - [Contributing](#-contributing)
91
+
92
+ ---
93
+
94
+ ## 🚩 The Problem
95
+
96
+ Every AI memory system today is just **retrieval** — find the nearest vector, return it. That's a search engine, not a memory. Real memory does more:
97
+
98
+ - 🧩 **Composes** — "What's the intersection of X and Y?" → a single coherent answer
99
+ - 🧠 **Generalizes** — noisy input still triggers the right pattern
100
+ - 📈 **Adapts** — frequently accessed patterns become stronger
101
+ - 🗑️ **Forgets** — outdated patterns decay naturally
102
+
103
+ Engramma does all four. In 3 lines of code.
104
+
105
+ ---
106
+
107
+ ## ⚡ Quickstart
108
+
109
+ ### Installation
110
+
111
+ ```bash
112
+ pip install engramma-memory
113
+ ```
114
+
115
+ ### Basic Usage
116
+
117
+ ```python
118
+ import numpy as np
119
+ from engramma_memory import EngrammaMemory
120
+
121
+ # Initialize local, purely in-memory engine
122
+ mem = EngrammaMemory(dim=256, backend="local")
123
+
124
+ # Store knowledge
125
+ mem.store(key=embedding_a, value="Python is a programming language")
126
+ mem.store(key=embedding_b, value="Machine learning uses data to learn")
127
+
128
+ # Retrieve — smart routing across 3 pathways
129
+ result = mem.retrieve(query_embedding)
130
+
131
+ # Compose — the killer feature ⚡
132
+ blend = mem.compose([embedding_a, embedding_b])
133
+ # Native multi-head attention fusion returns a coherent response
134
+ ```
135
+
136
+ > [!NOTE]
137
+ > That's it. No config files. No Docker. No API keys. Just `numpy`.
138
+
139
+ ---
140
+
141
+ ## 🆚 Why Not Just Use a Vector DB?
142
+
143
+ When combining concepts using traditional vector databases, you are forced to retrieve multiple results and manually piece them together. Engramma solves this with **native composition**.
144
+
145
+ ### The Vector DB Way
146
+ ```python
147
+ # ChromaDB / Pinecone / FAISS — you get TWO separate results
148
+ result_a = db.query(key_a) # "Python is a language..."
149
+ result_b = db.query(key_b) # "ML uses data to learn..."
150
+
151
+ # Now what? Average them? Concatenate? Pray?
152
+ blend = (result_a + result_b) / 2 # Meaningless arithmetic
153
+ ```
154
+
155
+ ### The Engramma Way
156
+ ```python
157
+ # Engramma — you get ONE fused answer
158
+ blend = mem.compose([key_a, key_b])
159
+ # Each head specializes: some recall A, some recall B → coherent fusion
160
+ ```
161
+
162
+ | Feature | Traditional Vector DBs | **Engramma** |
163
+ |:---|:---:|:---:|
164
+ | 🔍 Nearest-neighbor search | ✅ | ✅ |
165
+ | 🧩 **Native composition** | ❌ | **✅** |
166
+ | 🧠 Soft generalization (Hopfield)| ❌ | **✅** |
167
+ | 🔀 Adaptive routing | ❌ | **✅** |
168
+ | 📉 Importance-based eviction | ❌ | **✅** |
169
+ | 🍂 Gradual forgetting | ❌ | **✅** |
170
+ | 📦 Zero dependencies | ❌ | **✅** (numpy only) |
171
+
172
+ ---
173
+
174
+ ## 🏗️ How It Works
175
+
176
+ Engramma uses a multi-pathway architecture to route queries intelligently based on the task.
177
+
178
+ ```mermaid
179
+ graph TD
180
+ Q[Query] --> Exact[Exact kNN Memory]
181
+ Q --> Energy[Energy Hopfield]
182
+ Q --> MHA[Multi-Head Attention]
183
+
184
+ Exact --> Router[Confidence Router<br/>learned weights]
185
+ Energy --> Router
186
+ MHA --> Router
187
+
188
+ Router --> Best[Best Result]
189
+ ```
190
+
191
+ - **Exact Memory** — perfect recall via kNN with importance scoring
192
+ - **Energy Memory** — soft generalization via temperature-scaled Hopfield dynamics
193
+ - **Multi-Head Attention** — each head attends to different patterns → native composition
194
+ - **Confidence Router** — learns which pathway handles which query type
195
+
196
+ > [!TIP]
197
+ > All learning is **local** (Hebbian). No backpropagation. No GPU required. Pure NumPy.
198
+
199
+ ---
200
+
201
+ ## 📊 Benchmarks
202
+
203
+ Engramma trades a tiny bit of raw speed for massive gains in composition capability.
204
+
205
+ | Task | Engramma | FAISS | ChromaDB | Raw kNN |
206
+ |:---|:---:|:---:|:---:|:---:|
207
+ | Exact recall @1000 | 100% | 100% | 100% | 100% |
208
+ | **Composition (2-way)** | **81.4%** | 70.6% | 70.0% | 70.3% |
209
+ | **Composition (3-way)** | **68.4%** | 56.6% | 57.0% | 55.9% |
210
+ | **Continual learning** | **8.6%** | 1.1% | 1.1% | 1.1% |
211
+ | Noisy retrieval (σ=0.3)| 70.0% | 70.5% | 72.0% | 62.5% |
212
+
213
+ <details>
214
+ <summary>⏱️ <strong>Latency & memory (honest tradeoffs)</strong></summary>
215
+
216
+ | Metric | Engramma | FAISS | ChromaDB |
217
+ |:---|:---:|:---:|:---:|
218
+ | Latency p50 @1000 | 8.8ms | 0.02ms | 0.75ms |
219
+ | Memory (MB/1000) | 3.14 | 0.72 | 0.46 |
220
+
221
+ Engramma trades raw speed for composition capability. For pure nearest-neighbor at millions of vectors, use FAISS. For AI agents that need to *think* with their memory, use Engramma.
222
+ </details>
223
+
224
+ ---
225
+
226
+ ## 🔌 Integrations
227
+
228
+ Engramma drops right into your existing AI stack.
229
+
230
+ <details open>
231
+ <summary><strong>LangChain</strong></summary>
232
+
233
+ ```python
234
+ from engramma_memory.integrations.langchain import EngrammaLangChainMemory
235
+
236
+ memory = EngrammaLangChainMemory(dim=256, embed_fn=fn)
237
+ ```
238
+ </details>
239
+
240
+ <details>
241
+ <summary><strong>LlamaIndex</strong></summary>
242
+
243
+ ```python
244
+ from engramma_memory.integrations.llamaindex import EngrammaRetriever
245
+
246
+ retriever = EngrammaRetriever(dim=256, embed_fn=fn)
247
+ ```
248
+ </details>
249
+
250
+ <details>
251
+ <summary><strong>OpenAI Assistants</strong></summary>
252
+
253
+ ```python
254
+ from engramma_memory.integrations.openai_assistants import engramma_tool_definitions
255
+
256
+ tools = engramma_tool_definitions()
257
+ ```
258
+ </details>
259
+
260
+ <details>
261
+ <summary><strong>FastAPI</strong></summary>
262
+
263
+ ```python
264
+ from engramma_memory.integrations.fastapi import create_memory_router
265
+
266
+ app.include_router(create_memory_router(dim=256))
267
+ ```
268
+ </details>
269
+
270
+ ---
271
+
272
+ ## ☁️ Engramma Cloud
273
+
274
+ ### Same API. No limits. 43 premium capabilities.
275
+
276
+ **One line to production:**
277
+
278
+ ```python
279
+ # Local (free, open source, limited to 1000 patterns)
280
+ mem = EngrammaMemory(dim=256, backend="local")
281
+
282
+ # Cloud (unlimited, persistent, intelligent) — same code, one line change!
283
+ mem = EngrammaMemory(dim=256, backend="cloud", api_key="nx_live_...")
284
+ ```
285
+
286
+ > [!IMPORTANT]
287
+ > **[Get Your Free API Key →](https://www.engramma-memory.com/signup)**
288
+
289
+ ### What Cloud Unlocks
290
+
291
+ | Feature | Local (free) | Cloud |
292
+ |:---|:---:|:---:|
293
+ | 🗃️ **Max patterns** | 1,000 | **Unlimited** |
294
+ | 💾 **Storage** | RAM only | **Tiered (hot/warm/cold)** |
295
+ | ⚖️ **Composition weights** | Equal only | **Custom fractional (0.0–1.0)** |
296
+ | 🛡️ **Persistence** | None (in-process) | **Durable + snapshots** |
297
+ | 🧠 **Routing** | Confidence-based | **Active Inference + phi_B** |
298
+ | 🔗 **Causal reasoning** | — | **DAG discovery + interventions** |
299
+ | 🚨 **Anomaly detection** | — | **3-regime safety system** |
300
+ | 🔮 **Temporal prediction**| — | **Granger causality + prefetch** |
301
+ | 💬 **Text interface** | — | **HDC tokenizer (no embeddings needed)** |
302
+ | 🔬 **Explainability** | — | **Full XAI dashboard** |
303
+
304
+ ### Cloud Feature Highlights
305
+
306
+ <details>
307
+ <summary><strong>Causal Reasoning & Safety</strong></summary>
308
+
309
+ ```python
310
+ # Discover causal structure
311
+ graph = mem.get_causal_graph()
312
+
313
+ # "If I change A, what happens to B?"
314
+ effect = mem.predict_causal_effect(cause_key=a, effect_key=b)
315
+
316
+ # Fractional composition (not just 50/50)
317
+ blend = mem.compose_fractional(a, b, alpha=0.7)
318
+
319
+ # Auto-block risky OOD compositions
320
+ mem.enable_anomaly_protection(enabled=True)
321
+ ```
322
+ </details>
323
+
324
+ <details>
325
+ <summary><strong>Text Memory & Explainability</strong></summary>
326
+
327
+ ```python
328
+ # Store with natural language (no embeddings needed!)
329
+ mem.store_text("User prefers Python over JS")
330
+
331
+ # Query with natural language
332
+ results = mem.query_text("what language does the user prefer?")
333
+
334
+ # Understand WHY a result was returned
335
+ explanation = mem.explain(query)
336
+ # { pathway: "attention", confidence: ..., attention_map: [...] }
337
+ ```
338
+ </details>
339
+
340
+ <details>
341
+ <summary><strong>Async Support</strong></summary>
342
+
343
+ For production async frameworks (FastAPI, etc.):
344
+ ```python
345
+ from engramma_memory import EngrammaMemoryAsync
346
+
347
+ async with EngrammaMemoryAsync(dim=256, backend="cloud", api_key="...") as mem:
348
+ await mem.store(key=embedding, value=data)
349
+ results = await mem.query(embedding, top_k=5)
350
+ ```
351
+ </details>
352
+
353
+ ---
354
+
355
+ ## 🤝 Contributing
356
+
357
+ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
358
+
359
+ ```bash
360
+ git clone https://github.com/engramma-ai/engramma-memory.git
361
+ cd engramma-memory
362
+ pip install -e ".[dev]"
363
+ pytest # 39 tests, all green
364
+ ```
365
+
366
+ ---
367
+
368
+ <div align="center">
369
+ <h2>Ready for production?</h2>
370
+ <p><strong>Local is free forever.</strong> When you hit the wall — 1000 patterns, no persistence, no causal reasoning — Cloud is one line away.</p>
371
+ <a href="https://www.engramma-memory.com/signup"><img src="https://img.shields.io/badge/Start%20Free%20%E2%86%92-5A67D8?style=for-the-badge" alt="Start Free" /></a>
372
+ <br/><br/>
373
+ <p>
374
+ MIT License &bull;
375
+ <a href="https://doc.engramma-memory.com">Documentation</a> &bull;
376
+ <a href="https://github.com/engramma-ai/engramma-memory">GitHub</a> &bull;
377
+ <a href="https://github.com/engramma-ai/engramma-memory/issues">Issues</a>
378
+ </p>
379
+ </div>