mnemo-engine 0.12.2__tar.gz → 0.13.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 (158) hide show
  1. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/PKG-INFO +42 -10
  2. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/README.md +41 -9
  3. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/Cargo.lock +4 -3
  4. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/Cargo.toml +31 -31
  5. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/README.md +116 -8
  6. mnemo_engine-0.13.0/mnemo/src/bin/mnemo/export.rs +332 -0
  7. mnemo_engine-0.13.0/mnemo/src/bin/mnemo/inspect.html +291 -0
  8. mnemo_engine-0.13.0/mnemo/src/bin/mnemo/inspect.rs +795 -0
  9. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/bin/mnemo.rs +200 -19
  10. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/embed.rs +69 -13
  11. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/error.rs +52 -1
  12. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/format.rs +13 -7
  13. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/index.rs +3 -0
  14. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/lib.rs +3 -1
  15. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/mcp.rs +3 -0
  16. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/pager.rs +44 -3
  17. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/ann.rs +6 -1
  18. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/cache_api.rs +74 -2
  19. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/crud.rs +68 -34
  20. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/flush.rs +1 -0
  21. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/hooks.rs +12 -0
  22. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/load.rs +6 -2
  23. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/maintenance.rs +78 -31
  24. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/mod.rs +63 -6
  25. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/open.rs +33 -3
  26. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/records.rs +24 -3
  27. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/snapshots.rs +17 -0
  28. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/text.rs +71 -0
  29. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo-python/Cargo.lock +2 -2
  30. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo-python/Cargo.toml +8 -1
  31. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo-python/README.md +41 -9
  32. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo-python/src/lib.rs +10 -4
  33. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo-python/test_mnemo.py +33 -0
  34. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/pyproject.toml +1 -1
  35. mnemo_engine-0.12.2/mnemo/benches/cache.rs +0 -218
  36. mnemo_engine-0.12.2/mnemo/benches/embed_overhead.rs +0 -154
  37. mnemo_engine-0.12.2/mnemo/benches/open.rs +0 -151
  38. mnemo_engine-0.12.2/mnemo/benches/recall.rs +0 -121
  39. mnemo_engine-0.12.2/mnemo/benches/thread.rs +0 -162
  40. mnemo_engine-0.12.2/mnemo/benches/write.rs +0 -107
  41. mnemo_engine-0.12.2/mnemo/bindings/kotlin/.gitignore +0 -14
  42. mnemo_engine-0.12.2/mnemo/bindings/kotlin/NOTICE +0 -19
  43. mnemo_engine-0.12.2/mnemo/bindings/kotlin/README.md +0 -386
  44. mnemo_engine-0.12.2/mnemo/bindings/kotlin/build.gradle.kts +0 -174
  45. mnemo_engine-0.12.2/mnemo/bindings/kotlin/consumer-rules.pro +0 -11
  46. mnemo_engine-0.12.2/mnemo/bindings/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
  47. mnemo_engine-0.12.2/mnemo/bindings/kotlin/gradle/wrapper/gradle-wrapper.properties +0 -10
  48. mnemo_engine-0.12.2/mnemo/bindings/kotlin/gradle.properties +0 -6
  49. mnemo_engine-0.12.2/mnemo/bindings/kotlin/gradlew +0 -248
  50. mnemo_engine-0.12.2/mnemo/bindings/kotlin/gradlew.bat +0 -82
  51. mnemo_engine-0.12.2/mnemo/bindings/kotlin/release-check/build.gradle.kts +0 -52
  52. mnemo_engine-0.12.2/mnemo/bindings/kotlin/release-check/settings.gradle.kts +0 -25
  53. mnemo_engine-0.12.2/mnemo/bindings/kotlin/release-check/src/main/AndroidManifest.xml +0 -2
  54. mnemo_engine-0.12.2/mnemo/bindings/kotlin/release-check/src/test/kotlin/io/github/toarchkumar/mnemo/check/ConsumerTest.kt +0 -45
  55. mnemo_engine-0.12.2/mnemo/bindings/kotlin/scripts/build-native.sh +0 -82
  56. mnemo_engine-0.12.2/mnemo/bindings/kotlin/scripts/central-dry-run.sh +0 -84
  57. mnemo_engine-0.12.2/mnemo/bindings/kotlin/scripts/check-elf.py +0 -94
  58. mnemo_engine-0.12.2/mnemo/bindings/kotlin/scripts/check-package.py +0 -120
  59. mnemo_engine-0.12.2/mnemo/bindings/kotlin/scripts/emulator-tests.sh +0 -112
  60. mnemo_engine-0.12.2/mnemo/bindings/kotlin/settings.gradle.kts +0 -19
  61. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/androidTest/AndroidManifest.xml +0 -10
  62. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/androidTest/kotlin/io/github/toarchkumar/mnemo/AndroidTests.kt +0 -192
  63. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/androidTest/kotlin/io/github/toarchkumar/mnemo/TestActivity.kt +0 -6
  64. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/AndroidManifest.xml +0 -2
  65. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/FlushPolicy.kt +0 -100
  66. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/KeyId.kt +0 -80
  67. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoKeyStorage.kt +0 -30
  68. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoKeystore.kt +0 -344
  69. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStore.kt +0 -649
  70. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStoreConfiguration.kt +0 -72
  71. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStoreException.kt +0 -45
  72. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/ProcessStopObserver.kt +0 -48
  73. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/sharedTest/kotlin/io/github/toarchkumar/mnemo/Support.kt +0 -142
  74. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/EmbedderLockTests.kt +0 -112
  75. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/FlushPolicyTests.kt +0 -185
  76. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/KeystoreErrorTests.kt +0 -126
  77. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/KeystoreFileTests.kt +0 -85
  78. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/StoreHardeningTests.kt +0 -108
  79. mnemo_engine-0.12.2/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/StoreTests.kt +0 -343
  80. mnemo_engine-0.12.2/mnemo/bindings/kotlin/uniffi.toml +0 -27
  81. mnemo_engine-0.12.2/mnemo/bindings/swift/.gitignore +0 -9
  82. mnemo_engine-0.12.2/mnemo/bindings/swift/Package.swift +0 -31
  83. mnemo_engine-0.12.2/mnemo/bindings/swift/README.md +0 -374
  84. mnemo_engine-0.12.2/mnemo/bindings/swift/Sources/Mnemo/FilePolicy.swift +0 -76
  85. mnemo_engine-0.12.2/mnemo/bindings/swift/Sources/Mnemo/FlushPolicy.swift +0 -102
  86. mnemo_engine-0.12.2/mnemo/bindings/swift/Sources/Mnemo/Lifecycle.swift +0 -220
  87. mnemo_engine-0.12.2/mnemo/bindings/swift/Sources/Mnemo/MnemoKeychain.swift +0 -153
  88. mnemo_engine-0.12.2/mnemo/bindings/swift/Sources/Mnemo/MnemoStore.swift +0 -818
  89. mnemo_engine-0.12.2/mnemo/bindings/swift/Sources/Mnemo/MnemoStoreError.swift +0 -73
  90. mnemo_engine-0.12.2/mnemo/bindings/swift/TestHost/App/MnemoTestHostApp.swift +0 -74
  91. mnemo_engine-0.12.2/mnemo/bindings/swift/TestHost/project.yml +0 -55
  92. mnemo_engine-0.12.2/mnemo/bindings/swift/Tests/MnemoTests/EmbedderLockTests.swift +0 -125
  93. mnemo_engine-0.12.2/mnemo/bindings/swift/Tests/MnemoTests/FlushPolicyTests.swift +0 -165
  94. mnemo_engine-0.12.2/mnemo/bindings/swift/Tests/MnemoTests/StoreHardeningTests.swift +0 -155
  95. mnemo_engine-0.12.2/mnemo/bindings/swift/Tests/MnemoTests/StoreTests.swift +0 -360
  96. mnemo_engine-0.12.2/mnemo/bindings/swift/Tests/MnemoTests/Support.swift +0 -115
  97. mnemo_engine-0.12.2/mnemo/bindings/swift/Tests/MnemoTests/iOSTests.swift +0 -263
  98. mnemo_engine-0.12.2/mnemo/bindings/swift/scripts/build-xcframework.sh +0 -137
  99. mnemo_engine-0.12.2/mnemo/bindings/swift/scripts/check-published-package.sh +0 -140
  100. mnemo_engine-0.12.2/mnemo/bindings/swift/scripts/check-release-package.sh +0 -136
  101. mnemo_engine-0.12.2/mnemo/bindings/swift/scripts/kill-test.sh +0 -78
  102. mnemo_engine-0.12.2/mnemo/bindings/swift/scripts/make-release-package.sh +0 -109
  103. mnemo_engine-0.12.2/mnemo/examples/device_budget.rs +0 -771
  104. mnemo_engine-0.12.2/mnemo/examples/fmt9_proto.rs +0 -783
  105. mnemo_engine-0.12.2/mnemo/tests/cli_smoke.rs +0 -2222
  106. mnemo_engine-0.12.2/mnemo/tests/dur1_torn_header.rs +0 -52
  107. mnemo_engine-0.12.2/mnemo/tests/engine_safety.rs +0 -277
  108. mnemo_engine-0.12.2/mnemo/tests/fix1_correctness_sweep.rs +0 -31
  109. mnemo_engine-0.12.2/mnemo/tests/fixtures/v0_10_0_memories.jsonl +0 -240
  110. mnemo_engine-0.12.2/mnemo/tests/fmt9_skeleton.rs +0 -543
  111. mnemo_engine-0.12.2/mnemo/tests/fmt9b_column.rs +0 -641
  112. mnemo_engine-0.12.2/mnemo/tests/fmt9c_commit.rs +0 -345
  113. mnemo_engine-0.12.2/mnemo/tests/fmt9d_bm25.rs +0 -358
  114. mnemo_engine-0.12.2/mnemo/tests/fmt9e_zstd.rs +0 -362
  115. mnemo_engine-0.12.2/mnemo/tests/integration.rs +0 -18
  116. mnemo_engine-0.12.2/mnemo/tests/proptest_store.proptest-regressions +0 -9
  117. mnemo_engine-0.12.2/mnemo/tests/proptest_store.rs +0 -1109
  118. mnemo_engine-0.12.2/mnemo/tests/rekey_export.rs +0 -208
  119. mnemo_engine-0.12.2/mnemo/tests/sec1_nonce_uniqueness.rs +0 -43
  120. mnemo_engine-0.12.2/mnemo/tests/suites/dur1_torn_header.rs +0 -390
  121. mnemo_engine-0.12.2/mnemo/tests/suites/fix1_correctness_sweep.rs +0 -371
  122. mnemo_engine-0.12.2/mnemo/tests/suites/integration.rs +0 -5295
  123. mnemo_engine-0.12.2/mnemo/tests/suites/sec1_nonce_uniqueness.rs +0 -234
  124. mnemo_engine-0.12.2/mnemo/tests/v0_10_fixture.rs +0 -151
  125. mnemo_engine-0.12.2/mnemo/tests/wal_recover_alloc.rs +0 -77
  126. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/.gitignore +0 -0
  127. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/benches/corpus.rs +0 -0
  128. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/deny.toml +0 -0
  129. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/ann_defaults_v0_6_0.rs +0 -0
  130. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/ann_diagnose.rs +0 -0
  131. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/ann_recall_grid.rs +0 -0
  132. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/ann_recall_grid_v2.rs +0 -0
  133. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/embedder_server.py +0 -0
  134. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/file_size_breakdown.rs +0 -0
  135. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/open_rss.rs +0 -0
  136. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/quickstart.rs +0 -0
  137. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/ranking_v2.rs +0 -0
  138. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/session.rs +0 -0
  139. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/examples/thread_profile.rs +0 -0
  140. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/cache.rs +0 -0
  141. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/crypto.rs +0 -0
  142. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/embed_cmd.rs +0 -0
  143. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/freelist.rs +0 -0
  144. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/keyslot.rs +0 -0
  145. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/memory.rs +0 -0
  146. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/result_cache.rs +0 -0
  147. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/session.rs +0 -0
  148. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/continuation.rs +0 -0
  149. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/essence.rs +0 -0
  150. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/header_graft_tests.rs +0 -0
  151. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/keyed.rs +0 -0
  152. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/recall.rs +0 -0
  153. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/store/threads.rs +0 -0
  154. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/transcript.rs +0 -0
  155. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/veccol.rs +0 -0
  156. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo/src/wal.rs +0 -0
  157. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/mnemo-python/.gitignore +0 -0
  158. {mnemo_engine-0.12.2 → mnemo_engine-0.13.0}/python/mnemo_engine/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mnemo-engine
3
- Version: 0.12.2
3
+ Version: 0.13.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -193,7 +193,7 @@ its own agent.
193
193
  | `remember_text(content, memory_type, **kwargs)` | Embed `content` via the registered embedder and `remember` the result. Accepts the same per-memory kwargs as `remember` (`agent_id`, `importance`, `session_id`, `ttl_secs`, `shared`, `metadata`) |
194
194
  | `recall_text(query, top_k=10, memory_types=None, agent_id=None, track_access=True, n_probe=None, n_rerank=None, filter=None, max_bytes=None, keywords=None, keyword_weight=None)` | Embed `query` via the registered embedder and run `recall`. Same return shape and kwargs as `recall`. `keywords` (v9 files): identifiers or exact terms to match (a version, a PR number, a function name), not the question; their BM25 score is added with weight `keyword_weight` (default 0.5) |
195
195
  | `cache_get_semantic_text(namespace, text, threshold=0.97)` | Text-side semantic cache lookup; uses the embedder's `name` as the semantic cache's `model` component |
196
- | `stats()` | Summary statistics — includes `fsyncs_last_flush` (count of `sync_all` the most recent `flush()` on this handle issued; `0` on a fresh handle before any flush — Phase 6 instrumentation) and `recall_mode` (`"exact_resident"`: the live facts' vectors fit the vector cache budget and recall scans them in memory; `"exact_paged"`: over the budget, or a v8 file, so recall reads them from the file; `"indexed"`: an IVF+PQ index shortlists) |
196
+ | `stats()` | Summary statistics — includes `fsyncs_last_flush` (count of `sync_all` the most recent `flush()` on this handle issued; `0` on a fresh handle before any flush — Phase 6 instrumentation) and `recall_mode` (`"exact_resident"`: the live facts' vectors fit the vector cache budget and recall scans them in memory; `"exact_paged"`: over the budget, or a v8 file, so recall reads them from the file; `"indexed"`: an IVF+PQ index shortlists). Since v0.13 also `snapshots_retained`, `oldest_restorable_at` (unix seconds, or `None`) and `snapshot_pinned_bytes`: what a restore can reach now, which under churn can be far less than the retention policy |
197
197
  | `export_encrypted(dest)` | Copy the (already-encrypted) file elsewhere |
198
198
  | `len(db)` | Live memory count |
199
199
 
@@ -211,6 +211,37 @@ context manager (exiting consolidates).
211
211
  Memories and results are returned as plain dicts; `metadata` round-trips as a
212
212
  nested dict.
213
213
 
214
+ ### Errors
215
+
216
+ Every engine error is raised as `RuntimeError` (argument errors the binding
217
+ catches itself, before the engine sees them, are `ValueError`). Until the
218
+ exception subclasses arrive (v0.13.1), tell them apart by how the message
219
+ starts:
220
+
221
+ | The message starts with | What happened | What to do |
222
+ |---|---|---|
223
+ | `this file is format v` | the file predates v9: a v8 file opens only with `read_only=True`, v4–v7 not at all | run `mnemo compact <file>` once (it keeps every live memory) |
224
+ | `read-only open blocked:` | the file has pending work (a committed write to finish, a torn header to repair) | open it read-write once; on a pre-v9 file the message says to run `mnemo compact` instead |
225
+ | `embedder identity mismatch` | the embedder given isn't the one the file's vectors came from | use the original embedder, or create a new file for the new model |
226
+ | `wrong passphrase` | the passphrase or key doesn't open this file | check the secret |
227
+ | `file already locked by another handle` | another handle (another process, or one not yet closed) has the file | close it, or open read-only alongside a reader |
228
+ | `operation requires a read-write handle` | a write on a `read_only=True` handle | reopen read-write |
229
+ | `vector dimension mismatch` | a vector of the wrong width | embed with the file's model |
230
+ | `invalid argument:` | a bad argument the engine refused | fix the call |
231
+ | `memory '` | the id isn't in the file (`… not found`) | |
232
+ | `unsupported .mnemo format version` | a file from a newer engine | upgrade `mnemo-engine` |
233
+ | `bad magic bytes`, `header checksum mismatch`, `header seal authentication failed`, `page ` | not a `.mnemo` file, or a corrupt or tampered one | restore from a backup or an export |
234
+
235
+ ```python
236
+ try:
237
+ db = mnemo.open(path, passphrase)
238
+ except RuntimeError as e:
239
+ if str(e).startswith("this file is format v"):
240
+ db = mnemo.open(path, passphrase, read_only=True) # a v8 file; compact it later
241
+ else:
242
+ raise
243
+ ```
244
+
214
245
  ## Result caching
215
246
 
216
247
  MNemo doubles as a durable result cache — memoize LLM tool-call outputs,
@@ -445,14 +476,15 @@ db.set_embedder(embed, name="text-embedding-3-small",
445
476
  dimensions=1536, normalize=False)
446
477
  ```
447
478
 
448
- The identity (`name`, `dimensions`, `normalize`) is persisted on the
449
- scaffold manifest the first time you `set_embedder`. Reopening with a
450
- *different* embedder — say you swap MiniLM for BGE on the same file —
451
- raises `RuntimeError: embedder identity mismatch: database manifest
452
- records embedder (name="all-MiniLM-L6-v2", …), but this handle was
453
- passed embedder (name="bge-large-en-v1.5", …). Mixing embedders
454
- silently corrupts recall quality — open the file with the original
455
- embedder, or create a fresh database for the new one.`
479
+ The identity (`name`, `dimensions`, `normalize`) is recorded in the file
480
+ the first time you `set_embedder` (since v0.13 on every file, with or
481
+ without a manifest; a file with a manifest also keeps it there).
482
+ Reopening with a *different* embedder — say you swap MiniLM for BGE on
483
+ the same file — raises `RuntimeError: embedder identity mismatch: this
484
+ file's vectors come from embedder (name="all-MiniLM-L6-v2", …), but the
485
+ embedder given is (name="bge-large-en-v1.5", …). Open the file with its
486
+ original embedder, or create a new store for the new model.` A file from
487
+ before v0.13 records the first embedder attached after the upgrade.
456
488
 
457
489
  Mnemo also now refuses any `remember` call with an all-zero vector,
458
490
  so a mis-wired embedder (returning `[0.0] * dims`) fails loudly on
@@ -179,7 +179,7 @@ its own agent.
179
179
  | `remember_text(content, memory_type, **kwargs)` | Embed `content` via the registered embedder and `remember` the result. Accepts the same per-memory kwargs as `remember` (`agent_id`, `importance`, `session_id`, `ttl_secs`, `shared`, `metadata`) |
180
180
  | `recall_text(query, top_k=10, memory_types=None, agent_id=None, track_access=True, n_probe=None, n_rerank=None, filter=None, max_bytes=None, keywords=None, keyword_weight=None)` | Embed `query` via the registered embedder and run `recall`. Same return shape and kwargs as `recall`. `keywords` (v9 files): identifiers or exact terms to match (a version, a PR number, a function name), not the question; their BM25 score is added with weight `keyword_weight` (default 0.5) |
181
181
  | `cache_get_semantic_text(namespace, text, threshold=0.97)` | Text-side semantic cache lookup; uses the embedder's `name` as the semantic cache's `model` component |
182
- | `stats()` | Summary statistics — includes `fsyncs_last_flush` (count of `sync_all` the most recent `flush()` on this handle issued; `0` on a fresh handle before any flush — Phase 6 instrumentation) and `recall_mode` (`"exact_resident"`: the live facts' vectors fit the vector cache budget and recall scans them in memory; `"exact_paged"`: over the budget, or a v8 file, so recall reads them from the file; `"indexed"`: an IVF+PQ index shortlists) |
182
+ | `stats()` | Summary statistics — includes `fsyncs_last_flush` (count of `sync_all` the most recent `flush()` on this handle issued; `0` on a fresh handle before any flush — Phase 6 instrumentation) and `recall_mode` (`"exact_resident"`: the live facts' vectors fit the vector cache budget and recall scans them in memory; `"exact_paged"`: over the budget, or a v8 file, so recall reads them from the file; `"indexed"`: an IVF+PQ index shortlists). Since v0.13 also `snapshots_retained`, `oldest_restorable_at` (unix seconds, or `None`) and `snapshot_pinned_bytes`: what a restore can reach now, which under churn can be far less than the retention policy |
183
183
  | `export_encrypted(dest)` | Copy the (already-encrypted) file elsewhere |
184
184
  | `len(db)` | Live memory count |
185
185
 
@@ -197,6 +197,37 @@ context manager (exiting consolidates).
197
197
  Memories and results are returned as plain dicts; `metadata` round-trips as a
198
198
  nested dict.
199
199
 
200
+ ### Errors
201
+
202
+ Every engine error is raised as `RuntimeError` (argument errors the binding
203
+ catches itself, before the engine sees them, are `ValueError`). Until the
204
+ exception subclasses arrive (v0.13.1), tell them apart by how the message
205
+ starts:
206
+
207
+ | The message starts with | What happened | What to do |
208
+ |---|---|---|
209
+ | `this file is format v` | the file predates v9: a v8 file opens only with `read_only=True`, v4–v7 not at all | run `mnemo compact <file>` once (it keeps every live memory) |
210
+ | `read-only open blocked:` | the file has pending work (a committed write to finish, a torn header to repair) | open it read-write once; on a pre-v9 file the message says to run `mnemo compact` instead |
211
+ | `embedder identity mismatch` | the embedder given isn't the one the file's vectors came from | use the original embedder, or create a new file for the new model |
212
+ | `wrong passphrase` | the passphrase or key doesn't open this file | check the secret |
213
+ | `file already locked by another handle` | another handle (another process, or one not yet closed) has the file | close it, or open read-only alongside a reader |
214
+ | `operation requires a read-write handle` | a write on a `read_only=True` handle | reopen read-write |
215
+ | `vector dimension mismatch` | a vector of the wrong width | embed with the file's model |
216
+ | `invalid argument:` | a bad argument the engine refused | fix the call |
217
+ | `memory '` | the id isn't in the file (`… not found`) | |
218
+ | `unsupported .mnemo format version` | a file from a newer engine | upgrade `mnemo-engine` |
219
+ | `bad magic bytes`, `header checksum mismatch`, `header seal authentication failed`, `page ` | not a `.mnemo` file, or a corrupt or tampered one | restore from a backup or an export |
220
+
221
+ ```python
222
+ try:
223
+ db = mnemo.open(path, passphrase)
224
+ except RuntimeError as e:
225
+ if str(e).startswith("this file is format v"):
226
+ db = mnemo.open(path, passphrase, read_only=True) # a v8 file; compact it later
227
+ else:
228
+ raise
229
+ ```
230
+
200
231
  ## Result caching
201
232
 
202
233
  MNemo doubles as a durable result cache — memoize LLM tool-call outputs,
@@ -431,14 +462,15 @@ db.set_embedder(embed, name="text-embedding-3-small",
431
462
  dimensions=1536, normalize=False)
432
463
  ```
433
464
 
434
- The identity (`name`, `dimensions`, `normalize`) is persisted on the
435
- scaffold manifest the first time you `set_embedder`. Reopening with a
436
- *different* embedder — say you swap MiniLM for BGE on the same file —
437
- raises `RuntimeError: embedder identity mismatch: database manifest
438
- records embedder (name="all-MiniLM-L6-v2", …), but this handle was
439
- passed embedder (name="bge-large-en-v1.5", …). Mixing embedders
440
- silently corrupts recall quality — open the file with the original
441
- embedder, or create a fresh database for the new one.`
465
+ The identity (`name`, `dimensions`, `normalize`) is recorded in the file
466
+ the first time you `set_embedder` (since v0.13 on every file, with or
467
+ without a manifest; a file with a manifest also keeps it there).
468
+ Reopening with a *different* embedder — say you swap MiniLM for BGE on
469
+ the same file — raises `RuntimeError: embedder identity mismatch: this
470
+ file's vectors come from embedder (name="all-MiniLM-L6-v2", …), but the
471
+ embedder given is (name="bge-large-en-v1.5", …). Open the file with its
472
+ original embedder, or create a new store for the new model.` A file from
473
+ before v0.13 records the first embedder attached after the upgrade.
442
474
 
443
475
  Mnemo also now refuses any `remember` call with an all-zero vector,
444
476
  so a mis-wired embedder (returning `[0.0] * dims`) fails loudly on
@@ -821,7 +821,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
821
821
 
822
822
  [[package]]
823
823
  name = "mnemo-engine"
824
- version = "0.12.2"
824
+ version = "0.13.0"
825
825
  dependencies = [
826
826
  "aes-gcm",
827
827
  "argon2",
@@ -831,6 +831,7 @@ dependencies = [
831
831
  "fs4",
832
832
  "lz4_flex",
833
833
  "mimalloc",
834
+ "mnemo-engine",
834
835
  "proptest",
835
836
  "rand",
836
837
  "rmp",
@@ -849,7 +850,7 @@ dependencies = [
849
850
 
850
851
  [[package]]
851
852
  name = "mnemo-node"
852
- version = "0.12.2"
853
+ version = "0.13.0"
853
854
  dependencies = [
854
855
  "mnemo-engine",
855
856
  "napi",
@@ -859,7 +860,7 @@ dependencies = [
859
860
 
860
861
  [[package]]
861
862
  name = "mnemo-uniffi"
862
- version = "0.12.2"
863
+ version = "0.13.0"
863
864
  dependencies = [
864
865
  "mnemo-engine",
865
866
  "serde_json",
@@ -10,7 +10,7 @@
10
10
  # The CLI binary name stays `mnemo`, so users still invoke `mnemo` on
11
11
  # the command line after `cargo install mnemo-engine`.
12
12
  name = "mnemo-engine"
13
- version = "0.12.2"
13
+ version = "0.13.0"
14
14
  edition = "2021"
15
15
  rust-version = "1.75"
16
16
  # `benches/corpus.rs` is a shared helper module pulled into real benches
@@ -24,6 +24,23 @@ repository = "https://github.com/toarchkumar/mnemo"
24
24
  homepage = "https://toarchkumar.github.io/mnemo/"
25
25
  documentation = "https://docs.rs/mnemo-engine"
26
26
  readme = "README.md"
27
+ # RB-003.4: the published crate carries the library, the CLI and the
28
+ # examples that build from it. The tests, the benches and their fixtures
29
+ # (encrypted .mnemo files that don't compress), the Swift and Kotlin
30
+ # package sources, and the examples that need the `dev-hooks` feature stay
31
+ # in the repository: the self dev-dependency that turns it on is stripped
32
+ # from the published manifest.
33
+ exclude = [
34
+ "tests/",
35
+ "benches/*",
36
+ # The measurement examples share the benches' corpus generator.
37
+ "!benches/corpus.rs",
38
+ "fuzz/",
39
+ "bindings/",
40
+ "examples/gen_*",
41
+ "examples/device_budget.rs",
42
+ "examples/fmt9_proto.rs",
43
+ ]
27
44
  # crates.io shows 5 keywords; pick the ones most likely to match how
28
45
  # people search for this. Each keyword must be ≤20 chars and lowercase.
29
46
  keywords = ["database", "encryption", "vector", "ai", "memory"]
@@ -137,36 +154,12 @@ tempfile = "=3.10.1"
137
154
  # is Rust 1.65, well under our 1.75 floor. Kept as a dev-dep only —
138
155
  # it does not appear in the shipped library dependency set.
139
156
  proptest = "=1.5.0"
140
-
141
- [[bench]]
142
- name = "write"
143
- harness = false
144
- required-features = ["benches"]
145
-
146
- [[bench]]
147
- name = "recall"
148
- harness = false
149
- required-features = ["benches"]
150
-
151
- [[bench]]
152
- name = "open"
153
- harness = false
154
- required-features = ["benches"]
155
-
156
- [[bench]]
157
- name = "cache"
158
- harness = false
159
- required-features = ["benches"]
160
-
161
- [[bench]]
162
- name = "embed_overhead"
163
- harness = false
164
- required-features = ["benches"]
165
-
166
- [[bench]]
167
- name = "thread"
168
- harness = false
169
- required-features = ["benches"]
157
+ # HOOKS-1: the crate's own tests, benches and examples get the hidden test
158
+ # hooks and the `MNEMO_DEV_*` switches (`dev-hooks`). A dev-dependency's
159
+ # features apply only to those targets, so the library and the CLI that
160
+ # `cargo build` / `cargo install` and the release workflow make stay without
161
+ # them.
162
+ mnemo-engine = { path = ".", features = ["dev-hooks"] }
170
163
 
171
164
  [features]
172
165
  # When enabled, exposes crash-injection hooks used by the Phase 1.3
@@ -176,6 +169,13 @@ required-features = ["benches"]
176
169
  # crate) can opt into the same hooks without touching this crate's
177
170
  # tests. Not for production use — never enable in a release build.
178
171
  failpoints = []
172
+ # HOOKS-1 (RB-001.29): the `#[doc(hidden)]` `__*` test hooks on `Mnemo`
173
+ # (three of which change the file) and the `MNEMO_DEV_ANN_MIN_FACTS` /
174
+ # `MNEMO_DEV_TURN_ZSTD` switches. Off by default, so release builds (the
175
+ # CLI, the wheels, the mobile libraries) carry neither; the crate's own
176
+ # tests, benches and examples turn it on through the dev-dependency below.
177
+ # Never enable it in a release build.
178
+ dev-hooks = []
179
179
  # Phase 6 speed benchmarks. Pulls criterion (and its rayon/half/
180
180
  # ciborium subtree, which raised MSRV to 1.80+). Opt-in only — the
181
181
  # maintainer runs `cargo bench --no-run --features benches` on the
@@ -85,11 +85,24 @@ fresh child with the same argv/env/timeout. The guarantee is
85
85
  asymmetric and deliberate: **an error is allowed; a mismatched
86
86
  vector never is.**
87
87
 
88
- The `--embed-name` string is matched against (and persisted on) the
89
- scaffold manifest's `metadata.embedder = { name, dimensions, normalize }`
90
- object. Starting a server with a different `--embed-name` on an existing
91
- file fails loudly — mixing embedders in one file silently corrupts
92
- recall quality.
88
+ The `--embed-name` string is the embedder's identity, with the width and
89
+ the `normalize` flag. Every file records the identity of the first embedder
90
+ attached to it, with or without a manifest (EMBED-ID-1). Starting a server
91
+ with a different `--embed-name` on an existing file fails loudly with
92
+ `MnemoError::EmbedderMismatch`, because mixing embedders in one file
93
+ silently corrupts recall quality. A new model needs a new file.
94
+
95
+ - The record is a reserved, encrypted entry, not a memory: `len()`,
96
+ `stats()`, recall, `about()` and `get()` never see it, and the cache API
97
+ refuses its `_mnemo.*` namespace. Compaction, `export_rekeyed` and the
98
+ mobile passphrase import carry it.
99
+ - A read-only handle checks the identity and never writes one.
100
+ - A file with a manifest also keeps it at the manifest's `metadata.embedder
101
+ = { name, dimensions, normalize }`, as before. If the manifest and the
102
+ record disagree, `set_embedder` says so and names both.
103
+ - A file from before v0.13 records the first embedder attached after the
104
+ upgrade. The check protects from then on; it can't tell which model made
105
+ the older vectors.
93
106
 
94
107
  Claude Desktop config snippet (`~/Library/Application Support/Claude/claude_desktop_config.json`):
95
108
 
@@ -445,7 +458,7 @@ restored, and the cap differs by format:
445
458
  | Format | Retained by default | Override |
446
459
  |---|---|---|
447
460
  | v9 (new files) | the newest **16** snapshots, plus any from the **last 24 hours**; retained snapshots never pin more than a quarter of the file (past that, the oldest go first, whatever their age) | `max_snapshots` / `set_max_snapshots` changes the count |
448
- | v8 | the newest **256** snapshots | `max_snapshots` (`0`: no cap) |
461
+ | v8 (read-only since v0.13) | the newest **256** snapshots | — |
449
462
 
450
463
  So on a v9 file that flushes often (a phone app under the default
451
464
  coalesced flush policy commits about once a second while it's writing),
@@ -454,7 +467,33 @@ to last week" doesn't work unless you raise the count. `restore_to` a
454
467
  snapshot that's gone returns `MnemoError::NotFound`. `compact_file`
455
468
  collapses the manifest to a single snapshot, and there's no external log
456
469
  archiving, so nothing older than the last compaction is ever restorable.
457
- `snapshots()` lists exactly what's restorable now.
470
+ `snapshots()` lists exactly what's restorable now, and since v0.13
471
+ `stats()` and `stats_summary()` sum it up: `snapshots_retained`,
472
+ `oldest_restorable_at` (the furthest back a restore reaches) and
473
+ `snapshot_pinned_bytes` (what the retained snapshots keep from reuse; `0`
474
+ on v8). Under churn the pin cap can leave only a few snapshots, seconds
475
+ apart, so show these rather than the policy. `mnemo info` prints them.
476
+
477
+ ### Format versions: v9, and v8 read-only
478
+
479
+ New files are **v9**, the only format this build writes. Since v0.13 (the v8
480
+ sunset):
481
+
482
+ - **A v8 file opens read-only.** `open_read_only` (and every read command:
483
+ `info`, `about`, `get`, `list`, `search`, `recall`, `verify`, `history`,
484
+ `thread export`, `essence`) works as before.
485
+ - **A read-write open of it fails** with `MnemoError::FormatTooOld { version:
486
+ 8 }`, whose message says to run `mnemo compact`.
487
+ - **`mnemo compact` (`Mnemo::compact_file`) converts it to v9** and keeps
488
+ every live memory, the result cache, the threads and the essence. It
489
+ collapses the snapshot history to one snapshot, as any compaction does.
490
+ - **A v4–v7 file** (from v0.6 and earlier) no longer opens at all, read-only
491
+ included: `compact` converts it the same way.
492
+ - **No new v8 file can be made.** `format_version: 8` is refused, and
493
+ `compact --format v8` is gone.
494
+
495
+ The mobile packages never open a v8 file read-write either. Convert an old
496
+ file on a Mac with `mnemo compact` before copying it to a phone.
458
497
 
459
498
  ### The vector column (v9)
460
499
 
@@ -710,12 +749,14 @@ cargo run --bin mnemo -- <command>
710
749
  | `import` | Bulk-load memories from a JSON Lines file |
711
750
  | `index` | Build, rebuild, or drop the IVF+PQ index |
712
751
  | `list` | Browse live memories (table / json / jsonl, filters) |
752
+ | `export` | Readable plaintext export (Markdown or JSON Lines, filters); `--git` for diff-clean output |
753
+ | `inspect` | Browse the file in a local, read-only web view (memories, keyed history, threads and essence, snapshots, about) |
713
754
  | `get` | Fetch one memory by its ULID |
714
755
  | `search` | Exact nearest-neighbour search (similarity only) |
715
756
  | `recall` | Multi-signal ranked retrieval (sim + recency + …) |
716
757
  | `verify` | Decrypt and re-validate every live record |
717
758
  | `rekey` | Re-encrypt the data key under a new passphrase; `--rotate` also rewrites the file under a fresh data key (revokes the old passphrase) |
718
- | `compact` | Rebuild the file, dropping tombstones and expired; writes v9, which upgrades a v8 file (`--format v8` keeps v8 for one release) |
759
+ | `compact` | Rebuild the file, dropping tombstones and expired; writes v9, which converts a v8 (or older) file. Since v0.13 that's the only way to make a v8 file writable again |
719
760
  | `snapshots` | List the restorable snapshots (one per flush) |
720
761
  | `restore` | Roll the database back to a past snapshot |
721
762
  | `demo` | Self-contained end-to-end demonstration |
@@ -830,6 +871,73 @@ cargo run --bin mnemo -- init agent.mnemo --dimensions 768
830
871
  cargo run --bin mnemo -- demo # try it without any setup
831
872
  ```
832
873
 
874
+ ### Readable export
875
+
876
+ `mnemo export` writes a file's live memories as plaintext: Markdown (a
877
+ section per memory, content in a fenced block) or JSON Lines (one object
878
+ per memory). It opens the file read-only, so the file never changes.
879
+
880
+ ```sh
881
+ # to stdout; a warning on stderr says the output isn't encrypted
882
+ cargo run --bin mnemo -- export agent.mnemo --type semantic,procedural --agent ops
883
+
884
+ # diff-clean, for committing beside the project
885
+ cargo run --bin mnemo -- export agent.mnemo --git -o memory.md
886
+ ```
887
+
888
+ - Vectors are always left out; superseded keyed versions are included.
889
+ - It writes a file only with `-o`, and replaces it whole: a new
890
+ owner-only file (on Unix) renamed over the old one, never over the
891
+ `.mnemo` file itself.
892
+ - **`--git`** orders records by key, then id (keyed memories first), and
893
+ leaves out thread turns, access stats and counts. The same unchanged file
894
+ exports to the same bytes, a recall doesn't change the output, and one new
895
+ memory adds only its own lines (a new version of a keyed fact also
896
+ changes the line of the version it supersedes).
897
+ - The result cache (and so the embedder-identity record) is never exported.
898
+ - **A committed export is world-readable elsewhere.** Git stores no file
899
+ mode beyond the executable bit, so another checkout of a committed
900
+ export is `0644` whatever `-o` wrote. Commit one only where everyone who
901
+ can read the repository may read the memories.
902
+
903
+ ### The inspector
904
+
905
+ `mnemo inspect` serves a read-only web view of a file on your machine:
906
+
907
+ ```sh
908
+ cargo run --bin mnemo -- inspect agent.mnemo # prints a URL with a token: open it in your browser
909
+ cargo run --bin mnemo -- inspect app.mnemo --key-file app.key # a raw-key file (32 bytes or 64 hex digits)
910
+ cargo run --bin mnemo -- inspect agent.mnemo --open # opens the browser for you: single-user machines only
911
+ ```
912
+
913
+ The passphrase comes from the prompt or `MNEMO_PASSPHRASE`. **Copy the
914
+ printed URL** into your browser. `--open` does that for you, but it hands
915
+ the URL, token included, to the system's browser launcher, so use it only
916
+ on a machine nobody else logs into.
917
+
918
+ - **Views:** memories (filter by type, agent, keyed or not, and thread;
919
+ keyword search with BM25, no embedder needed), keyed history (each
920
+ key's versions, oldest first, with when each stopped being current),
921
+ threads (the essence render, and the turn archive on demand), snapshots
922
+ (the restore points `stats` reports) and about (format, recall mode,
923
+ embedder identity, sizes).
924
+ - **It never holds the file.** It reads it once, read-only, and closes it,
925
+ so an agent writing to the file is never blocked. **Reload** in the page
926
+ reads it again (one passphrase derivation). If a writer has the file
927
+ open at that moment, it says so and keeps the last read.
928
+ - **It stays on your machine.** It binds `127.0.0.1` only (a random free
929
+ port unless `--port`), and the printed URL carries a random token. Every
930
+ request must carry that token and a `Host` of the loopback address and
931
+ port, which stops other sites' pages (DNS rebinding included). Only `GET`
932
+ is served, with no CORS, and no endpoint writes the file. Nothing is
933
+ written to disk.
934
+ - It works on v8 files too, and on passphrase exports from the phone
935
+ libraries.
936
+
937
+ `mnemo_engine::KeywordIndex` is the in-memory keyword index it searches
938
+ with: the tokenizer and BM25 scoring of v9's keyword recall, over texts
939
+ you already hold.
940
+
833
941
  ## Build and test
834
942
 
835
943
  ```sh