mnemosyne-memory 1.9.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 (40) hide show
  1. mnemosyne_memory-1.9.0/CHANGELOG.md +76 -0
  2. mnemosyne_memory-1.9.0/CONTRIBUTING.md +75 -0
  3. mnemosyne_memory-1.9.0/LICENSE +21 -0
  4. mnemosyne_memory-1.9.0/MANIFEST.in +11 -0
  5. mnemosyne_memory-1.9.0/PKG-INFO +460 -0
  6. mnemosyne_memory-1.9.0/README.md +414 -0
  7. mnemosyne_memory-1.9.0/UPDATING.md +173 -0
  8. mnemosyne_memory-1.9.0/assets/mnemosyne.jpg +0 -0
  9. mnemosyne_memory-1.9.0/docs/SKILL.md +54 -0
  10. mnemosyne_memory-1.9.0/docs/X_MONETIZATION_ENGINE_RESEARCH.md +509 -0
  11. mnemosyne_memory-1.9.0/docs/X_MONETIZATION_ENGINE_RESEARCH_v2.md +1656 -0
  12. mnemosyne_memory-1.9.0/docs/mnemosyne-memory-override.md +36 -0
  13. mnemosyne_memory-1.9.0/hermes_memory_provider/__init__.py +445 -0
  14. mnemosyne_memory-1.9.0/hermes_memory_provider/cli.py +128 -0
  15. mnemosyne_memory-1.9.0/hermes_plugin/__init__.py +228 -0
  16. mnemosyne_memory-1.9.0/hermes_plugin/tools.py +441 -0
  17. mnemosyne_memory-1.9.0/mnemosyne/__init__.py +38 -0
  18. mnemosyne_memory-1.9.0/mnemosyne/cli.py +611 -0
  19. mnemosyne_memory-1.9.0/mnemosyne/core/__init__.py +1 -0
  20. mnemosyne_memory-1.9.0/mnemosyne/core/aaak.py +212 -0
  21. mnemosyne_memory-1.9.0/mnemosyne/core/beam.py +1161 -0
  22. mnemosyne_memory-1.9.0/mnemosyne/core/cost_log.py +78 -0
  23. mnemosyne_memory-1.9.0/mnemosyne/core/embeddings.py +159 -0
  24. mnemosyne_memory-1.9.0/mnemosyne/core/local_llm.py +192 -0
  25. mnemosyne_memory-1.9.0/mnemosyne/core/memory.py +469 -0
  26. mnemosyne_memory-1.9.0/mnemosyne/core/token_counter.py +72 -0
  27. mnemosyne_memory-1.9.0/mnemosyne/core/triples.py +192 -0
  28. mnemosyne_memory-1.9.0/mnemosyne/dr/__init__.py +1 -0
  29. mnemosyne_memory-1.9.0/mnemosyne/dr/recovery.py +314 -0
  30. mnemosyne_memory-1.9.0/mnemosyne/install.py +224 -0
  31. mnemosyne_memory-1.9.0/mnemosyne_memory.egg-info/PKG-INFO +460 -0
  32. mnemosyne_memory-1.9.0/mnemosyne_memory.egg-info/SOURCES.txt +38 -0
  33. mnemosyne_memory-1.9.0/mnemosyne_memory.egg-info/dependency_links.txt +1 -0
  34. mnemosyne_memory-1.9.0/mnemosyne_memory.egg-info/entry_points.txt +3 -0
  35. mnemosyne_memory-1.9.0/mnemosyne_memory.egg-info/requires.txt +17 -0
  36. mnemosyne_memory-1.9.0/mnemosyne_memory.egg-info/top_level.txt +5 -0
  37. mnemosyne_memory-1.9.0/pyproject.toml +60 -0
  38. mnemosyne_memory-1.9.0/setup.cfg +4 -0
  39. mnemosyne_memory-1.9.0/setup.py +73 -0
  40. mnemosyne_memory-1.9.0/tests/test_beam.py +356 -0
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ Mnemosyne uses [Simple Versioning](https://gist.github.com/jonlow/6f7610566408a8efaa4a):
4
+ given a version number **MAJOR.MINOR**, increment the:
5
+
6
+ - **MINOR** after every iteration of development, testing, and quality assurance.
7
+ - **MAJOR** for the first production release (1.0) or for significant new functionality (2.0, 3.0, etc.).
8
+
9
+ ---
10
+
11
+ ## 1.8
12
+
13
+ - Fix Hermes plugin CLI discovery: add `register(ctx)` to wire up `hermes mnemosyne stats|sleep|inspect|clear|export|import|version`
14
+ - README: clarify deploy script vs pip install paths (Option A / Option B)
15
+
16
+ ## 1.7
17
+
18
+ - Fix subagent context writes polluting persistent memory (PR #8 by @woaim65)
19
+ - Fix cross-session recall inconsistency: global memories now survive consolidation with scope preserved
20
+ - Fix fallback keyword scoring for Chinese and spaceless languages (character-level overlap)
21
+ - Fix episodic memory having no fallback scan when vector search and FTS5 both miss
22
+ - Fix plugin tools singleton using stale session_id across sessions
23
+ - Add regression tests: subagent context safety, cross-session recall, Chinese substring matching, session singleton updates
24
+
25
+ ## 1.6
26
+
27
+ - Feature request issue template
28
+ - Documentation improvement issue template
29
+ - Issue template config with links to Discussions and Security advisories
30
+
31
+ ## 1.5
32
+
33
+ - Fix 6 critical bugs from issue #6 (stats, recall tracking, vector similarity, missing methods, hardcoded session_id)
34
+ - Fix fastembed dependency in setup.py and README (was incorrectly listing sentence-transformers)
35
+ - Official bug report issue template
36
+ - Adopt simplified MAJOR.MINOR versioning
37
+
38
+ ## 1.4
39
+
40
+ - Full README rewrite: professional, community-focused, benchmarks restored
41
+ - CONTRIBUTING.md added
42
+ - FluxSpeak branding scrubbed (author/metadata corrected)
43
+ - Project image banner added
44
+
45
+ ## 1.3
46
+
47
+ - Export / import memory for cross-machine migration
48
+ - CLI subcommands: `export`, `import`, `version`
49
+
50
+ ## 1.2
51
+
52
+ - Mnemosyne as deployable MemoryProvider via Hermes plugin system
53
+ - One-command installer (`python -m mnemosyne.install`)
54
+ - CLI fix: `register_cli` correctly handles subparsers
55
+
56
+ ## 1.1
57
+
58
+ - Dense retrieval via fastembed (bge-small-en-v1.5)
59
+ - Temporal validity + global scope (`scope="global"`)
60
+ - Recall tracking + recency decay scoring
61
+ - Exact-match deduplication in working memory
62
+ - Local LLM-based sleep consolidation (TinyLlama fallback)
63
+ - BEAM scale limits for 1M+ token capacity
64
+
65
+ ## 1.0
66
+
67
+ First major release. Production-ready.
68
+
69
+ - BEAM architecture: working_memory, episodic_memory, scratchpad
70
+ - Native vector search via sqlite-vec (HNSW-style)
71
+ - FTS5 full-text hybrid search (50% vector + 30% FTS + 20% importance)
72
+ - Temporal triples (time-aware knowledge graph)
73
+ - AAAK context compression
74
+ - Configurable vector compression: float32, int8, bit
75
+ - Hermes plugin integration
76
+ - Sub-millisecond latency on CPU
@@ -0,0 +1,75 @@
1
+ # Contributing to Mnemosyne
2
+
3
+ Mnemosyne is a personal project that grew into something useful. If you're here, you're already part of the community. There are no gatekeepers — bug reports, documentation fixes, feature ideas, and code contributions are all welcome.
4
+
5
+ ## Getting Started
6
+
7
+ ```bash
8
+ git clone https://github.com/AxDSan/mnemosyne.git
9
+ cd mnemosyne
10
+ pip install -e .
11
+ python -m pytest tests/ -v
12
+ ```
13
+
14
+ ## What You Can Do
15
+
16
+ **No contribution is too small.**
17
+
18
+ - **Report bugs** — Open an issue with steps to reproduce. A clear bug report saves hours.
19
+ - **Improve docs** — Typos, unclear explanations, missing examples. If it confused you, fix it.
20
+ - **Share your use case** — Open a discussion. Real-world usage shapes the roadmap.
21
+ - **Submit code** — See below for guidelines.
22
+
23
+ ## Code Contributions
24
+
25
+ ### Versioning
26
+
27
+ Mnemosyne uses **Simple Versioning** (`MAJOR.MINOR`, no patch):
28
+
29
+ - **MINOR** bumps after every iteration: bug fixes, features, docs, refactors.
30
+ - **MAJOR** bumps only for significant new functionality (e.g., 1.0 → 2.0).
31
+
32
+ `__version__` in `mnemosyne/__init__.py` is the single source of truth. `setup.py` reads from it automatically. If you open a PR that changes user-facing behavior, bump the version and add an entry to `CHANGELOG.md`.
33
+
34
+ ### Principles
35
+
36
+ Mnemosyne is intentionally minimal. Every addition is weighed against these principles:
37
+
38
+ - **Local-first:** No cloud dependencies, no required API keys.
39
+ - **Minimal dependencies:** Prefer the Python stdlib. SQLite is the only database.
40
+ - **Zero-config:** Users should not need to edit config files to get basic functionality.
41
+ - **Fast:** Sub-millisecond reads and writes on standard hardware.
42
+
43
+ ### Before You Code
44
+
45
+ 1. **Open an issue first** for non-trivial changes. This prevents wasted effort.
46
+ 2. **Keep it focused.** One PR per logical change.
47
+ 3. **Add tests.** If you fix a bug or add a feature, include a test in `tests/`.
48
+ 4. **Update the README** if user-facing behavior changes.
49
+ 5. **Bump the version** in `mnemosyne/__init__.py` and update `CHANGELOG.md`.
50
+
51
+ ### Review Process
52
+
53
+ There is no formal review board. Pull requests are reviewed by the maintainer and merged when they:
54
+
55
+ - Pass existing tests
56
+ - Follow the principles above
57
+ - Include a clear description of what changed and why
58
+
59
+ ## Areas of Interest
60
+
61
+ These are not mandates — just directions where help would be valuable:
62
+
63
+ - Encrypted backup/sync (optional, user-controlled)
64
+ - Additional embedding model support
65
+ - Multi-language memory processing
66
+ - Better error messages and debugging tools
67
+
68
+ ## Community
69
+
70
+ - **Issues & bugs:** [GitHub Issues](https://github.com/AxDSan/mnemosyne/issues)
71
+ - **Feature ideas & questions:** [GitHub Discussions](https://github.com/AxDSan/mnemosyne/discussions)
72
+
73
+ ## License
74
+
75
+ 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 Abdias J
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,11 @@
1
+ include README.md
2
+ include CHANGELOG.md
3
+ include LICENSE
4
+ include UPDATING.md
5
+ include CONTRIBUTING.md
6
+ recursive-include docs *.md
7
+ recursive-include assets *
8
+ global-exclude *.pyc
9
+ global-exclude __pycache__
10
+ global-exclude .DS_Store
11
+ global-exclude *.db
@@ -0,0 +1,460 @@
1
+ Metadata-Version: 2.4
2
+ Name: mnemosyne-memory
3
+ Version: 1.9.0
4
+ Summary: The Zero-Dependency, Sub-Millisecond AI Memory System
5
+ Home-page: https://github.com/AxDSan/mnemosyne
6
+ Author: Abdias J
7
+ Author-email: Abdias J <abdi.moya@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/AxDSan/mnemosyne
10
+ Project-URL: Repository, https://github.com/AxDSan/mnemosyne
11
+ Project-URL: Issues, https://github.com/AxDSan/mnemosyne/issues
12
+ Project-URL: Documentation, https://github.com/AxDSan/mnemosyne/blob/main/README.md
13
+ Keywords: ai,memory,sqlite,agent,llm,context,embeddings,vector-store
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Operating System :: OS Independent
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Provides-Extra: llm
30
+ Requires-Dist: ctransformers>=0.2.27; extra == "llm"
31
+ Requires-Dist: huggingface-hub>=0.20; extra == "llm"
32
+ Provides-Extra: embeddings
33
+ Requires-Dist: fastembed>=0.3.0; extra == "embeddings"
34
+ Provides-Extra: all
35
+ Requires-Dist: ctransformers>=0.2.27; extra == "all"
36
+ Requires-Dist: huggingface-hub>=0.20; extra == "all"
37
+ Requires-Dist: fastembed>=0.3.0; extra == "all"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=7.0; extra == "dev"
40
+ Requires-Dist: build; extra == "dev"
41
+ Requires-Dist: twine; extra == "dev"
42
+ Dynamic: author
43
+ Dynamic: home-page
44
+ Dynamic: license-file
45
+ Dynamic: requires-python
46
+
47
+ # Mnemosyne
48
+
49
+ ![Mnemosyne](/assets/mnemosyne.jpg)
50
+
51
+ > Native, zero-cloud memory for AI agents. SQLite-backed. Sub-millisecond. Fully private.
52
+
53
+ [![Python](https://img.shields.io/badge/Python-3.9+-blue.svg)](https://python.org)
54
+ [![SQLite](https://img.shields.io/badge/SQLite-3.35+-green.svg)](https://sqlite.org/codeofethics.html)
55
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
56
+
57
+ Mnemosyne is a local-first memory system for the [Hermes Agent](https://github.com/AxDSan/hermes) framework. It stores conversations, preferences, and knowledge in SQLite with native vector search (sqlite-vec) and full-text search (FTS5) — no external databases, no API keys, no network calls.
58
+
59
+ ---
60
+
61
+ ## Quick Start
62
+
63
+ ### Option A: Full install (recommended)
64
+
65
+ For the CLI, Python API, and Hermes MemoryProvider:
66
+
67
+ ```bash
68
+ # 1. Clone and install
69
+ git clone https://github.com/AxDSan/mnemosyne.git
70
+ cd mnemosyne
71
+ pip install -e .
72
+ ```
73
+
74
+ > ⚠️ **Ubuntu 24.04 / Debian 12 users:** If you get `error: externally-managed-environment`, your system Python is PEP 668-protected. Use a virtual environment:
75
+ > ```bash
76
+ > python3 -m venv .venv
77
+ > source .venv/bin/activate
78
+ > pip install -e .
79
+ > ```
80
+ > Make sure to activate the venv every time you run Hermes, or install Hermes itself inside the same venv.
81
+
82
+ ```bash
83
+ # 2. Register with Hermes
84
+ python -m mnemosyne.install
85
+
86
+ # 3. Activate as your memory provider
87
+ hermes memory setup
88
+ # → Select "mnemosyne" and press Enter
89
+ ```
90
+
91
+ ### Option B: Hermes MemoryProvider only (no pip needed)
92
+
93
+ If you only need Mnemosyne as a Hermes memory backend and want to skip pip entirely:
94
+
95
+ ```bash
96
+ curl -sSL https://raw.githubusercontent.com/AxDSan/mnemosyne/main/deploy_hermes_provider.sh | bash
97
+ ```
98
+
99
+ This symlinks the provider into `~/.hermes/plugins/mnemosyne` and adds the repo to `sys.path` at runtime. No virtual environment required — works out of the box on Ubuntu 24.04.
100
+
101
+ Verify:
102
+
103
+ ```bash
104
+ hermes memory status # Should show "Provider: mnemosyne"
105
+ hermes mnemosyne stats # Shows working + episodic memory counts
106
+ ```
107
+
108
+ > **Note:** The `hermes memory setup` picker defaults to "Built-in only" every time it opens. This is normal Hermes UI behavior — your previous selection **is** saved. Just select Mnemosyne and press Enter.
109
+
110
+ ---
111
+
112
+ ## What Makes It Different
113
+
114
+ | | Mnemosyne | Cloud alternatives |
115
+ |---|---|---|
116
+ | **Latency** | < 1ms | 10-100ms |
117
+ | **Dependencies** | Python stdlib + optional ONNX | External APIs, auth, rate limits |
118
+ | **Privacy** | 100% local | Data leaves your machine |
119
+ | **Cost** | Free | Freemium / per-call |
120
+ | **Setup** | `pip install -e .` | API keys, accounts, config |
121
+
122
+ **Key capabilities:**
123
+
124
+ - **BEAM architecture** — Three tiers: hot working memory, long-term episodic memory, temporary scratchpad
125
+ - **Hybrid search** — 50% vector similarity + 30% FTS5 rank + 20% importance, all inside SQLite
126
+ - **Automatic consolidation** — Old working memories are summarized and moved to episodic memory via `mnemosyne_sleep()`
127
+ - **Temporal triples** — Time-aware knowledge graph with automatic invalidation
128
+ - **Export / import** — Move your entire memory database to a new machine with one JSON file
129
+ - **Cross-session scope** — `remember(..., scope="global")` makes facts visible everywhere
130
+ - **Configurable compression** — `float32` (default), `int8` (4x smaller), or `bit` (32x smaller) vectors
131
+
132
+ ---
133
+
134
+ ## Benchmarks
135
+
136
+ All numbers measured on CPU with `sqlite-vec` + FTS5 enabled.
137
+
138
+ ### LongMemEval (ICLR 2025)
139
+
140
+ | System | Score | Notes |
141
+ |---|---|---|
142
+ | **Mnemosyne (dense)** | **98.9% Recall@All@5** | Oracle subset, 100 instances, bge-small-en-v1.5 |
143
+ | Mempalace | 96.6% Recall@5 | AAAK + Palace architecture |
144
+ | Mastra Observational Memory | 84.23% (gpt-4o) | Three-date model |
145
+ | Full-context GPT-4o baseline | ~60.2% | No memory system |
146
+
147
+ ### Latency vs. Cloud Alternatives
148
+
149
+ | Operation | Honcho | Zep | MemGPT | **Mnemosyne** | Speedup |
150
+ |---|---|---|---|---|---|
151
+ | **Write** | 45ms | 85ms | 120ms | **0.81ms** | **56x** |
152
+ | **Read** | 38ms | 62ms | 95ms | **0.076ms** | **500x** |
153
+ | **Search** | 52ms | 78ms | 140ms | **1.2ms** | **43x** |
154
+ | **Cold Start** | 500ms | 800ms | 1200ms | **0ms** | **Instant** |
155
+
156
+ ### BEAM Architecture Scaling
157
+
158
+ **Write throughput:**
159
+
160
+ | Operation | Count | Total | Avg |
161
+ |---|---|---|---|
162
+ | Working memory writes | 500 | 8.7s | **17.4 ms** |
163
+ | Episodic inserts (with embedding) | 500 | 10.7s | **21.3 ms** |
164
+ | Sleep consolidation | 300 old items | 33 ms | — |
165
+
166
+ **Hybrid recall scaling (query latency stays flat as corpus grows):**
167
+
168
+ | Corpus Size | Query | Avg Latency | p95 |
169
+ |---|---|---|---|
170
+ | 100 | "concept 42" | **5.1 ms** | 6.9 ms |
171
+ | 500 | "concept 42" | **5.0 ms** | 5.7 ms |
172
+ | 1,000 | "concept 42" | **5.3 ms** | 6.5 ms |
173
+ | **2,000** | **"concept 42"** | **7.0 ms** | **8.6 ms** |
174
+
175
+ **Working memory recall scaling (FTS5 fast path):**
176
+
177
+ | WM Size | Query | Avg Latency | p95 |
178
+ |---|---|---|---|
179
+ | 1,000 | "concept 42" | **2.4 ms** | 3.1 ms |
180
+ | 5,000 | "domain 7" | **3.2 ms** | 3.8 ms |
181
+ | **10,000** | **"concept 42"** | **6.4 ms** | **7.2 ms** |
182
+
183
+ ---
184
+
185
+ ## Installation
186
+
187
+ ### Prerequisites
188
+
189
+ - Python 3.9+
190
+ - Hermes Agent (for plugin integration)
191
+
192
+ ### Basic
193
+
194
+ ```bash
195
+ git clone https://github.com/AxDSan/mnemosyne.git
196
+ cd mnemosyne
197
+ pip install -e .
198
+ python -m mnemosyne.install
199
+ ```
200
+
201
+ > ⚠️ **Ubuntu 24.04 / Debian 12 users:** If `pip install -e .` fails with `externally-managed-environment`, see the [Quick Start → Option A](#quick-start) note about using a virtual environment.
202
+
203
+ ### Optional dependencies
204
+
205
+ ```bash
206
+ # Dense retrieval (required for semantic search and the 98.9% LongMemEval score)
207
+ pip install fastembed>=0.3.0
208
+
209
+ # Local LLM consolidation (sleep cycle summarization)
210
+ pip install ctransformers>=0.2.27 huggingface-hub>=0.20
211
+ ```
212
+
213
+ > **Note:** Without `fastembed`, Mnemosyne falls back to keyword-only retrieval. It still works, but you won't get competitive semantic search or the benchmark scores above.
214
+
215
+ ### Uninstall
216
+
217
+ ```bash
218
+ python -m mnemosyne.install --uninstall
219
+ ```
220
+
221
+ ### Updating
222
+
223
+ Mnemosyne is installed from source, so updating is a `git pull` away.
224
+
225
+ **Option A (pip install -e .):**
226
+ ```bash
227
+ cd mnemosyne
228
+ git pull
229
+ # Only re-run pip if setup.py changed (new deps, entry points, CLI commands):
230
+ pip install -e .
231
+ ```
232
+
233
+ **Option B (deploy script / symlink only):**
234
+ ```bash
235
+ cd mnemosyne
236
+ git pull
237
+ # Nothing to reinstall — it's a live symlink
238
+ ```
239
+
240
+ **Always restart Hermes** after updating so plugin changes take effect:
241
+ ```bash
242
+ hermes gateway restart
243
+ ```
244
+
245
+ **If the update includes database schema changes**, run the migration helper:
246
+ ```bash
247
+ python scripts/migrate_from_legacy.py
248
+ ```
249
+
250
+ See [UPDATING.md](UPDATING.md) for detailed troubleshooting and rollback instructions.
251
+
252
+ ---
253
+
254
+ ## Usage
255
+
256
+ ### CLI
257
+
258
+ ```bash
259
+ # Show memory statistics
260
+ hermes mnemosyne stats
261
+
262
+ # Search memories
263
+ hermes mnemosyne inspect "dark mode preferences"
264
+
265
+ # Run consolidation (compress old working memory into episodic summaries)
266
+ hermes mnemosyne sleep
267
+
268
+ # Export all memories to a JSON file
269
+ hermes mnemosyne export --output mnemosyne_backup.json
270
+
271
+ # Import memories from a JSON file
272
+ hermes mnemosyne import --input mnemosyne_backup.json
273
+
274
+ # Clear scratchpad
275
+ hermes mnemosyne clear
276
+ ```
277
+
278
+ ### Python API
279
+
280
+ ```python
281
+ from mnemosyne import remember, recall
282
+
283
+ # Store a fact
284
+ remember(
285
+ content="User prefers dark mode interfaces",
286
+ importance=0.9,
287
+ source="preference"
288
+ )
289
+
290
+ # Store a global preference (visible in every session)
291
+ remember(
292
+ content="User email is abdi.moya@gmail.com",
293
+ importance=0.95,
294
+ source="preference",
295
+ scope="global"
296
+ )
297
+
298
+ # Store a temporary credential with expiry
299
+ remember(
300
+ content="API key: sk-abc123",
301
+ importance=0.8,
302
+ source="credential",
303
+ valid_until="2026-12-31T00:00:00"
304
+ )
305
+
306
+ # Search memories
307
+ results = recall("interface preferences", top_k=3)
308
+
309
+ # Temporal knowledge graph
310
+ from mnemosyne.core.triples import TripleStore
311
+ kg = TripleStore()
312
+ kg.add("Maya", "assigned_to", "auth-migration", valid_from="2026-01-15")
313
+ kg.query("Maya", as_of="2026-02-01")
314
+ ```
315
+
316
+ ### Advanced: BEAM direct access
317
+
318
+ ```python
319
+ from mnemosyne.core.beam import BeamMemory
320
+
321
+ beam = BeamMemory(session_id="my_session")
322
+
323
+ # Working memory (auto-injected into prompts)
324
+ beam.remember("Important context", importance=0.9)
325
+
326
+ # Episodic memory (long-term, searchable)
327
+ beam.consolidate_to_episodic(
328
+ summary="User likes Neovim",
329
+ source_wm_ids=["wm1"],
330
+ importance=0.8
331
+ )
332
+
333
+ # Scratchpad (temporary reasoning)
334
+ beam.scratchpad_write("todo: fix auth bug")
335
+
336
+ # Search both tiers
337
+ results = beam.recall("editor preferences", top_k=5)
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Architecture
343
+
344
+ ```
345
+ ┌─────────────────────────────────────────────────────────────┐
346
+ │ HERMES AGENT │
347
+ │ │
348
+ │ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐ │
349
+ │ │ pre_llm │────▶│ Mnemosyne │────▶│ SQLite │ │
350
+ │ │ hook │ │ BEAM │ │ │ │
351
+ │ └─────────────┘ └──────────────┘ │ working_mem │ │
352
+ │ ▲ │ episodic_mem│ │
353
+ │ │ │ vec_episodes│ │
354
+ │ └──────── Auto-injected context ───│ fts_episodes│ │
355
+ │ │ scratchpad │ │
356
+ │ │ triples │ │
357
+ │ └─────────────┘ │
358
+ │ │
359
+ │ No HTTP. No cloud. 100% local. │
360
+ └─────────────────────────────────────────────────────────────┘
361
+ ```
362
+
363
+ **BEAM** (Bilevel Episodic-Associative Memory):
364
+
365
+ - `working_memory` — Hot context, auto-injected before LLM calls, TTL-based eviction
366
+ - `episodic_memory` — Long-term storage with sqlite-vec + FTS5 hybrid search
367
+ - `scratchpad` — Temporary agent reasoning workspace
368
+
369
+ ---
370
+
371
+ ## Why SQLite for Hermes?
372
+
373
+ SQLite is already in your stack. Hermes uses it for session persistence. Mnemosyne extends that same file — no new dependencies, no Docker containers, no connection pooling.
374
+
375
+ | Feature | Honcho | Zep | Mnemosyne |
376
+ |---|---|---|---|
377
+ | Deployment | Docker + PostgreSQL | Docker + Postgres | `pip install` |
378
+ | Query Language | REST API | REST API | `SELECT ... WHERE MATCH` |
379
+ | Vector Store | pgvector | pgvector | sqlite-vec |
380
+ | Text Search | Separate API | Separate API | Built-in FTS5 |
381
+ | Auth Required | Yes (supabase) | Yes | No |
382
+ | Offline Mode | No | No | Yes |
383
+ | Cold Start Latency | 500-800ms | 800ms+ | **0ms** |
384
+
385
+ ---
386
+
387
+ ## Backup, Export & Migration
388
+
389
+ Mnemosyne stores everything in a single SQLite file at `~/.hermes/mnemosyne/data/mnemosyne.db`.
390
+
391
+ ```bash
392
+ # Simple backup
393
+ cp ~/.hermes/mnemosyne/data/mnemosyne.db ~/backups/mnemosyne_$(date +%Y%m%d).db
394
+
395
+ # Export to JSON (portable across machines)
396
+ hermes mnemosyne export --output mnemosyne_backup.json
397
+
398
+ # Import on a new machine
399
+ hermes mnemosyne import --input mnemosyne_backup.json
400
+ ```
401
+
402
+ ---
403
+
404
+ ## Environment Variables
405
+
406
+ | Variable | Default | Description |
407
+ |---|---|---|
408
+ | `MNEMOSYNE_DATA_DIR` | `~/.hermes/mnemosyne/data` | Database directory |
409
+ | `MNEMOSYNE_VEC_TYPE` | `float32` | Vector compression: `float32`, `int8`, or `bit` |
410
+ | `MNEMOSYNE_WM_MAX_ITEMS` | `10000` | Working memory item limit |
411
+ | `MNEMOSYNE_WM_TTL_HOURS` | `24` | Working memory TTL |
412
+ | `MNEMOSYNE_RECENCY_HALFLIFE` | `168` | Recency decay halflife in hours (1 week) |
413
+
414
+ ---
415
+
416
+ ## Testing
417
+
418
+ ```bash
419
+ # Run tests
420
+ python -m pytest tests/test_beam.py -v
421
+
422
+ # Run benchmarks
423
+ python tests/benchmark_beam_working_memory.py
424
+ ```
425
+
426
+ ---
427
+
428
+ ## Contributing
429
+
430
+ Contributions are welcome. Areas of active interest:
431
+
432
+ - [ ] Encrypted cloud sync (optional, user-controlled)
433
+ - [ ] Browser extension for web context capture
434
+ - [ ] Additional embedding models
435
+ - [ ] Multi-language support
436
+
437
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
438
+
439
+ ---
440
+
441
+ ## License
442
+
443
+ MIT License — See [LICENSE](LICENSE)
444
+
445
+ Copyright (c) 2026 Abdias J
446
+
447
+ ---
448
+
449
+ ## Acknowledgments
450
+
451
+ - [Hermes Agent Framework](https://github.com/AxDSan/hermes) — The ecosystem Mnemosyne was built for
452
+ - [Honcho](https://github.com/plasticlabs/honcho) — For defining the stateful memory space
453
+ - [Mempalace](https://github.com/thepersonalaicompany/mempalace) — For proving local-first memory can compete on benchmarks
454
+ - [SQLite](https://sqlite.org/codeofethics.html) — The world's most deployed database
455
+
456
+ ---
457
+
458
+ <p align="center">
459
+ <em>"The faintest ink is more powerful than the strongest memory." — Hermes Trismegistus</em>
460
+ </p>