mnemo-engine 0.12.3__tar.gz → 0.13.1__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 (160) hide show
  1. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/PKG-INFO +48 -11
  2. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/README.md +47 -10
  3. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/Cargo.lock +4 -3
  4. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/Cargo.toml +31 -31
  5. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/README.md +130 -8
  6. mnemo_engine-0.13.1/mnemo/src/bin/mnemo/export.rs +332 -0
  7. mnemo_engine-0.13.1/mnemo/src/bin/mnemo/inspect.html +308 -0
  8. mnemo_engine-0.13.1/mnemo/src/bin/mnemo/inspect.rs +1007 -0
  9. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/bin/mnemo.rs +293 -36
  10. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/embed.rs +69 -13
  11. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/error.rs +53 -1
  12. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/format.rs +13 -7
  13. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/index.rs +3 -0
  14. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/lib.rs +3 -1
  15. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/mcp.rs +3 -0
  16. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/ann.rs +6 -1
  17. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/cache_api.rs +74 -2
  18. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/crud.rs +68 -34
  19. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/flush.rs +1 -0
  20. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/hooks.rs +12 -0
  21. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/maintenance.rs +86 -31
  22. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/mod.rs +62 -5
  23. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/open.rs +86 -16
  24. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/records.rs +24 -3
  25. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/snapshots.rs +17 -0
  26. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/text.rs +71 -0
  27. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo-python/Cargo.lock +2 -2
  28. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo-python/Cargo.toml +8 -1
  29. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo-python/README.md +47 -10
  30. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo-python/src/lib.rs +184 -6
  31. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo-python/test_mnemo.py +121 -0
  32. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/pyproject.toml +1 -1
  33. mnemo_engine-0.12.3/mnemo/benches/cache.rs +0 -218
  34. mnemo_engine-0.12.3/mnemo/benches/embed_overhead.rs +0 -154
  35. mnemo_engine-0.12.3/mnemo/benches/open.rs +0 -151
  36. mnemo_engine-0.12.3/mnemo/benches/recall.rs +0 -121
  37. mnemo_engine-0.12.3/mnemo/benches/thread.rs +0 -162
  38. mnemo_engine-0.12.3/mnemo/benches/write.rs +0 -107
  39. mnemo_engine-0.12.3/mnemo/bindings/kotlin/.gitignore +0 -14
  40. mnemo_engine-0.12.3/mnemo/bindings/kotlin/NOTICE +0 -19
  41. mnemo_engine-0.12.3/mnemo/bindings/kotlin/README.md +0 -386
  42. mnemo_engine-0.12.3/mnemo/bindings/kotlin/build.gradle.kts +0 -174
  43. mnemo_engine-0.12.3/mnemo/bindings/kotlin/consumer-rules.pro +0 -11
  44. mnemo_engine-0.12.3/mnemo/bindings/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
  45. mnemo_engine-0.12.3/mnemo/bindings/kotlin/gradle/wrapper/gradle-wrapper.properties +0 -10
  46. mnemo_engine-0.12.3/mnemo/bindings/kotlin/gradle.properties +0 -6
  47. mnemo_engine-0.12.3/mnemo/bindings/kotlin/gradlew +0 -248
  48. mnemo_engine-0.12.3/mnemo/bindings/kotlin/gradlew.bat +0 -82
  49. mnemo_engine-0.12.3/mnemo/bindings/kotlin/release-check/build.gradle.kts +0 -52
  50. mnemo_engine-0.12.3/mnemo/bindings/kotlin/release-check/settings.gradle.kts +0 -25
  51. mnemo_engine-0.12.3/mnemo/bindings/kotlin/release-check/src/main/AndroidManifest.xml +0 -2
  52. mnemo_engine-0.12.3/mnemo/bindings/kotlin/release-check/src/test/kotlin/io/github/toarchkumar/mnemo/check/ConsumerTest.kt +0 -45
  53. mnemo_engine-0.12.3/mnemo/bindings/kotlin/scripts/build-native.sh +0 -82
  54. mnemo_engine-0.12.3/mnemo/bindings/kotlin/scripts/central-dry-run.sh +0 -84
  55. mnemo_engine-0.12.3/mnemo/bindings/kotlin/scripts/check-elf.py +0 -94
  56. mnemo_engine-0.12.3/mnemo/bindings/kotlin/scripts/check-package.py +0 -120
  57. mnemo_engine-0.12.3/mnemo/bindings/kotlin/scripts/emulator-tests.sh +0 -112
  58. mnemo_engine-0.12.3/mnemo/bindings/kotlin/settings.gradle.kts +0 -19
  59. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/androidTest/AndroidManifest.xml +0 -10
  60. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/androidTest/kotlin/io/github/toarchkumar/mnemo/AndroidTests.kt +0 -192
  61. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/androidTest/kotlin/io/github/toarchkumar/mnemo/TestActivity.kt +0 -6
  62. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/AndroidManifest.xml +0 -2
  63. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/FlushPolicy.kt +0 -100
  64. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/KeyId.kt +0 -80
  65. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoKeyStorage.kt +0 -30
  66. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoKeystore.kt +0 -344
  67. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStore.kt +0 -649
  68. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStoreConfiguration.kt +0 -72
  69. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/MnemoStoreException.kt +0 -45
  70. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/main/kotlin/io/github/toarchkumar/mnemo/ProcessStopObserver.kt +0 -48
  71. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/sharedTest/kotlin/io/github/toarchkumar/mnemo/Support.kt +0 -142
  72. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/EmbedderLockTests.kt +0 -153
  73. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/FlushPolicyTests.kt +0 -185
  74. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/KeystoreErrorTests.kt +0 -126
  75. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/KeystoreFileTests.kt +0 -85
  76. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/StoreHardeningTests.kt +0 -108
  77. mnemo_engine-0.12.3/mnemo/bindings/kotlin/src/test/kotlin/io/github/toarchkumar/mnemo/StoreTests.kt +0 -343
  78. mnemo_engine-0.12.3/mnemo/bindings/kotlin/uniffi.toml +0 -27
  79. mnemo_engine-0.12.3/mnemo/bindings/swift/.gitignore +0 -9
  80. mnemo_engine-0.12.3/mnemo/bindings/swift/Package.swift +0 -31
  81. mnemo_engine-0.12.3/mnemo/bindings/swift/README.md +0 -384
  82. mnemo_engine-0.12.3/mnemo/bindings/swift/Sources/Mnemo/FilePolicy.swift +0 -76
  83. mnemo_engine-0.12.3/mnemo/bindings/swift/Sources/Mnemo/FlushPolicy.swift +0 -102
  84. mnemo_engine-0.12.3/mnemo/bindings/swift/Sources/Mnemo/Lifecycle.swift +0 -220
  85. mnemo_engine-0.12.3/mnemo/bindings/swift/Sources/Mnemo/MnemoKeychain.swift +0 -153
  86. mnemo_engine-0.12.3/mnemo/bindings/swift/Sources/Mnemo/MnemoStore.swift +0 -878
  87. mnemo_engine-0.12.3/mnemo/bindings/swift/Sources/Mnemo/MnemoStoreError.swift +0 -73
  88. mnemo_engine-0.12.3/mnemo/bindings/swift/TestHost/App/MnemoTestHostApp.swift +0 -74
  89. mnemo_engine-0.12.3/mnemo/bindings/swift/TestHost/project.yml +0 -55
  90. mnemo_engine-0.12.3/mnemo/bindings/swift/Tests/MnemoTests/EmbedQueueTests.swift +0 -120
  91. mnemo_engine-0.12.3/mnemo/bindings/swift/Tests/MnemoTests/EmbedderLockTests.swift +0 -125
  92. mnemo_engine-0.12.3/mnemo/bindings/swift/Tests/MnemoTests/FlushPolicyTests.swift +0 -165
  93. mnemo_engine-0.12.3/mnemo/bindings/swift/Tests/MnemoTests/StoreHardeningTests.swift +0 -146
  94. mnemo_engine-0.12.3/mnemo/bindings/swift/Tests/MnemoTests/StoreTests.swift +0 -360
  95. mnemo_engine-0.12.3/mnemo/bindings/swift/Tests/MnemoTests/Support.swift +0 -115
  96. mnemo_engine-0.12.3/mnemo/bindings/swift/Tests/MnemoTests/iOSTests.swift +0 -263
  97. mnemo_engine-0.12.3/mnemo/bindings/swift/scripts/build-xcframework.sh +0 -137
  98. mnemo_engine-0.12.3/mnemo/bindings/swift/scripts/check-published-package.sh +0 -140
  99. mnemo_engine-0.12.3/mnemo/bindings/swift/scripts/check-release-package.sh +0 -136
  100. mnemo_engine-0.12.3/mnemo/bindings/swift/scripts/kill-test.sh +0 -78
  101. mnemo_engine-0.12.3/mnemo/bindings/swift/scripts/make-release-package.sh +0 -109
  102. mnemo_engine-0.12.3/mnemo/examples/device_budget.rs +0 -771
  103. mnemo_engine-0.12.3/mnemo/examples/fmt9_proto.rs +0 -783
  104. mnemo_engine-0.12.3/mnemo/tests/cli_smoke.rs +0 -2222
  105. mnemo_engine-0.12.3/mnemo/tests/dur1_torn_header.rs +0 -52
  106. mnemo_engine-0.12.3/mnemo/tests/engine_safety.rs +0 -277
  107. mnemo_engine-0.12.3/mnemo/tests/fix1_correctness_sweep.rs +0 -31
  108. mnemo_engine-0.12.3/mnemo/tests/fixtures/v0_10_0_memories.jsonl +0 -240
  109. mnemo_engine-0.12.3/mnemo/tests/fmt9_skeleton.rs +0 -543
  110. mnemo_engine-0.12.3/mnemo/tests/fmt9b_column.rs +0 -641
  111. mnemo_engine-0.12.3/mnemo/tests/fmt9c_commit.rs +0 -345
  112. mnemo_engine-0.12.3/mnemo/tests/fmt9d_bm25.rs +0 -358
  113. mnemo_engine-0.12.3/mnemo/tests/fmt9e_zstd.rs +0 -362
  114. mnemo_engine-0.12.3/mnemo/tests/integration.rs +0 -18
  115. mnemo_engine-0.12.3/mnemo/tests/lock_release.rs +0 -115
  116. mnemo_engine-0.12.3/mnemo/tests/proptest_store.proptest-regressions +0 -9
  117. mnemo_engine-0.12.3/mnemo/tests/proptest_store.rs +0 -1109
  118. mnemo_engine-0.12.3/mnemo/tests/rekey_export.rs +0 -208
  119. mnemo_engine-0.12.3/mnemo/tests/sec1_nonce_uniqueness.rs +0 -43
  120. mnemo_engine-0.12.3/mnemo/tests/suites/dur1_torn_header.rs +0 -390
  121. mnemo_engine-0.12.3/mnemo/tests/suites/fix1_correctness_sweep.rs +0 -371
  122. mnemo_engine-0.12.3/mnemo/tests/suites/integration.rs +0 -5295
  123. mnemo_engine-0.12.3/mnemo/tests/suites/sec1_nonce_uniqueness.rs +0 -234
  124. mnemo_engine-0.12.3/mnemo/tests/v0_10_fixture.rs +0 -151
  125. mnemo_engine-0.12.3/mnemo/tests/wal_recover_alloc.rs +0 -77
  126. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/.gitignore +0 -0
  127. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/benches/corpus.rs +0 -0
  128. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/deny.toml +0 -0
  129. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/ann_defaults_v0_6_0.rs +0 -0
  130. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/ann_diagnose.rs +0 -0
  131. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/ann_recall_grid.rs +0 -0
  132. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/ann_recall_grid_v2.rs +0 -0
  133. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/embedder_server.py +0 -0
  134. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/file_size_breakdown.rs +0 -0
  135. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/open_rss.rs +0 -0
  136. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/quickstart.rs +0 -0
  137. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/ranking_v2.rs +0 -0
  138. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/session.rs +0 -0
  139. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/examples/thread_profile.rs +0 -0
  140. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/cache.rs +0 -0
  141. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/crypto.rs +0 -0
  142. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/embed_cmd.rs +0 -0
  143. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/freelist.rs +0 -0
  144. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/keyslot.rs +0 -0
  145. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/memory.rs +0 -0
  146. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/pager.rs +0 -0
  147. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/result_cache.rs +0 -0
  148. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/session.rs +0 -0
  149. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/continuation.rs +0 -0
  150. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/essence.rs +0 -0
  151. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/header_graft_tests.rs +0 -0
  152. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/keyed.rs +0 -0
  153. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/load.rs +0 -0
  154. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/recall.rs +0 -0
  155. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/store/threads.rs +0 -0
  156. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/transcript.rs +0 -0
  157. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/veccol.rs +0 -0
  158. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo/src/wal.rs +0 -0
  159. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/mnemo-python/.gitignore +0 -0
  160. {mnemo_engine-0.12.3 → mnemo_engine-0.13.1}/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.3
3
+ Version: 0.13.1
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -188,12 +188,12 @@ its own agent.
188
188
  | `set_turn_compress_after(secs)` | v9 files: compress thread turns once they're older than `secs` (default 7 days; `0` compresses at write). This handle only |
189
189
  | `memories()` | Enumerate every live (non-deleted, non-expired) memory as a list of dicts |
190
190
  | `dimensions()` | Embedding dimensionality this database was created with (also on `stats()["dimensions"]`) |
191
- | `rekey(new_passphrase, fast=False)` | Change the passphrase. Re-derives the KEK and re-wraps the DEK; encrypted pages are not rewritten (O(1) in db size). `fast=True` uses the cheap-Argon2 test params — omit for production |
191
+ | `rekey(new_passphrase, fast=False)` | Change the passphrase. Re-derives the KEK and re-wraps the DEK; encrypted pages are not rewritten (O(1) in db size). `fast=True` uses the cheap-Argon2 test params — omit for production. If it raises, the file may already be under the new secret, or may move to it at the next write: close without writing more, then try both secrets |
192
192
  | `set_embedder(fn, *, name, dimensions, normalize=True)` | Register a Python callable `embed(texts: list[str]) -> list[list[float]]` as this handle's text embedder (Phase 3). Dimension-checks against the database's width; identity-checks against (and on first use upserts) the scaffold manifest's `embedder_name` / `embedder_dimensions` / `embedder_normalize` keys, so swapping embedders between opens fails loudly |
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
 
@@ -202,6 +202,7 @@ Plus two module-level functions:
202
202
  | Function | Purpose |
203
203
  |---|---|
204
204
  | `mnemo.compact_file(path, passphrase)` | Rewrite the file out-of-place, dropping tombstoned and expired memories and reclaiming stale pages. Caller's own handle must be closed first. Returns `{"before": int, "after": int}` |
205
+ | `mnemo.compact_file_with_key(path, key)` | The same for a raw-key file (`key`: 32 bytes, as from `generate_key()`), under the same key; converts a v8 file to v9 (since v0.13.1) |
205
206
  | `mnemo.build_info()` | Returns `{"version", "target", "aes_backend", "polyval_backend"}` for the installed wheel. Lets you verify an ARM wheel picked up the hardware AES path — `aes_backend` should read `"armv8 hardware"` on Apple Silicon / Graviton (anything else, like `"armv8 software (constant-time fallback)"`, means the compile missed the fix). PR 11.0, v0.5.1+ |
206
207
 
207
208
  `Session` methods: `add_turn(turn)`, `recall(query, top_k=10, memory_types=None)`,
@@ -211,6 +212,41 @@ context manager (exiting consolidates).
211
212
  Memories and results are returned as plain dicts; `metadata` round-trips as a
212
213
  nested dict.
213
214
 
215
+ ### Errors
216
+
217
+ Since v0.13.1 every engine error is an `mnemo_engine.MnemoError`, which
218
+ subclasses `RuntimeError`, so `except RuntimeError` keeps working. The
219
+ subclasses tell the cases apart (argument errors the binding catches itself,
220
+ before the engine sees them, are still `ValueError`):
221
+
222
+ | Exception | What happened | What to do |
223
+ |---|---|---|
224
+ | `FormatTooOldError` | the file predates v9: a v8 file opens only with `read_only=True`, v4–v7 not at all | run `mnemo compact <file>` once (`--key-file` for a raw-key file, or `compact_file_with_key`); it keeps every live memory |
225
+ | `NeedsWriteOpenError` | 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 |
226
+ | `EmbedderMismatchError` | 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 |
227
+ | `WrongPassphraseError` | the passphrase or key doesn't open this file | check the secret |
228
+ | `LockedError` | another handle (another process, or one not yet closed) has the file | close it, or open read-only alongside a reader |
229
+ | `ReadOnlyError` | a write on a `read_only=True` handle | reopen read-write |
230
+ | `DimensionMismatchError` | a vector of the wrong width | embed with the file's model |
231
+ | `InvalidArgumentError` | a bad argument the engine refused (an all-zero vector, say) | fix the call |
232
+ | `NotFoundError` | the id isn't in the file | |
233
+ | `UnsupportedVersionError` | a file from a newer engine | upgrade `mnemo-engine` |
234
+ | `NotAMnemoFileError` | not a `.mnemo` file | check the path |
235
+ | `CorruptError` | a page or the header failed its integrity check: corrupt or tampered | restore from a backup or an export |
236
+ | `MnemoError` (only) | I/O, cryptography, key derivation or serialization | the message says which |
237
+
238
+ ```python
239
+ import mnemo_engine as mnemo
240
+
241
+ try:
242
+ db = mnemo.open(path, passphrase)
243
+ except mnemo.FormatTooOldError:
244
+ db = mnemo.open(path, passphrase, read_only=True) # a v8 file; compact it later
245
+ ```
246
+
247
+ Each message is the engine's own, unchanged from before, so code that
248
+ matched on a message's start keeps working too.
249
+
214
250
  ## Result caching
215
251
 
216
252
  MNemo doubles as a durable result cache — memoize LLM tool-call outputs,
@@ -445,14 +481,15 @@ db.set_embedder(embed, name="text-embedding-3-small",
445
481
  dimensions=1536, normalize=False)
446
482
  ```
447
483
 
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.`
484
+ The identity (`name`, `dimensions`, `normalize`) is recorded in the file
485
+ the first time you `set_embedder` (since v0.13 on every file, with or
486
+ without a manifest; a file with a manifest also keeps it there).
487
+ Reopening with a *different* embedder — say you swap MiniLM for BGE on
488
+ the same file — raises `RuntimeError: embedder identity mismatch: this
489
+ file's vectors come from embedder (name="all-MiniLM-L6-v2", …), but the
490
+ embedder given is (name="bge-large-en-v1.5", …). Open the file with its
491
+ original embedder, or create a new store for the new model.` A file from
492
+ before v0.13 records the first embedder attached after the upgrade.
456
493
 
457
494
  Mnemo also now refuses any `remember` call with an all-zero vector,
458
495
  so a mis-wired embedder (returning `[0.0] * dims`) fails loudly on
@@ -174,12 +174,12 @@ its own agent.
174
174
  | `set_turn_compress_after(secs)` | v9 files: compress thread turns once they're older than `secs` (default 7 days; `0` compresses at write). This handle only |
175
175
  | `memories()` | Enumerate every live (non-deleted, non-expired) memory as a list of dicts |
176
176
  | `dimensions()` | Embedding dimensionality this database was created with (also on `stats()["dimensions"]`) |
177
- | `rekey(new_passphrase, fast=False)` | Change the passphrase. Re-derives the KEK and re-wraps the DEK; encrypted pages are not rewritten (O(1) in db size). `fast=True` uses the cheap-Argon2 test params — omit for production |
177
+ | `rekey(new_passphrase, fast=False)` | Change the passphrase. Re-derives the KEK and re-wraps the DEK; encrypted pages are not rewritten (O(1) in db size). `fast=True` uses the cheap-Argon2 test params — omit for production. If it raises, the file may already be under the new secret, or may move to it at the next write: close without writing more, then try both secrets |
178
178
  | `set_embedder(fn, *, name, dimensions, normalize=True)` | Register a Python callable `embed(texts: list[str]) -> list[list[float]]` as this handle's text embedder (Phase 3). Dimension-checks against the database's width; identity-checks against (and on first use upserts) the scaffold manifest's `embedder_name` / `embedder_dimensions` / `embedder_normalize` keys, so swapping embedders between opens fails loudly |
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
 
@@ -188,6 +188,7 @@ Plus two module-level functions:
188
188
  | Function | Purpose |
189
189
  |---|---|
190
190
  | `mnemo.compact_file(path, passphrase)` | Rewrite the file out-of-place, dropping tombstoned and expired memories and reclaiming stale pages. Caller's own handle must be closed first. Returns `{"before": int, "after": int}` |
191
+ | `mnemo.compact_file_with_key(path, key)` | The same for a raw-key file (`key`: 32 bytes, as from `generate_key()`), under the same key; converts a v8 file to v9 (since v0.13.1) |
191
192
  | `mnemo.build_info()` | Returns `{"version", "target", "aes_backend", "polyval_backend"}` for the installed wheel. Lets you verify an ARM wheel picked up the hardware AES path — `aes_backend` should read `"armv8 hardware"` on Apple Silicon / Graviton (anything else, like `"armv8 software (constant-time fallback)"`, means the compile missed the fix). PR 11.0, v0.5.1+ |
192
193
 
193
194
  `Session` methods: `add_turn(turn)`, `recall(query, top_k=10, memory_types=None)`,
@@ -197,6 +198,41 @@ context manager (exiting consolidates).
197
198
  Memories and results are returned as plain dicts; `metadata` round-trips as a
198
199
  nested dict.
199
200
 
201
+ ### Errors
202
+
203
+ Since v0.13.1 every engine error is an `mnemo_engine.MnemoError`, which
204
+ subclasses `RuntimeError`, so `except RuntimeError` keeps working. The
205
+ subclasses tell the cases apart (argument errors the binding catches itself,
206
+ before the engine sees them, are still `ValueError`):
207
+
208
+ | Exception | What happened | What to do |
209
+ |---|---|---|
210
+ | `FormatTooOldError` | the file predates v9: a v8 file opens only with `read_only=True`, v4–v7 not at all | run `mnemo compact <file>` once (`--key-file` for a raw-key file, or `compact_file_with_key`); it keeps every live memory |
211
+ | `NeedsWriteOpenError` | 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 |
212
+ | `EmbedderMismatchError` | 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 |
213
+ | `WrongPassphraseError` | the passphrase or key doesn't open this file | check the secret |
214
+ | `LockedError` | another handle (another process, or one not yet closed) has the file | close it, or open read-only alongside a reader |
215
+ | `ReadOnlyError` | a write on a `read_only=True` handle | reopen read-write |
216
+ | `DimensionMismatchError` | a vector of the wrong width | embed with the file's model |
217
+ | `InvalidArgumentError` | a bad argument the engine refused (an all-zero vector, say) | fix the call |
218
+ | `NotFoundError` | the id isn't in the file | |
219
+ | `UnsupportedVersionError` | a file from a newer engine | upgrade `mnemo-engine` |
220
+ | `NotAMnemoFileError` | not a `.mnemo` file | check the path |
221
+ | `CorruptError` | a page or the header failed its integrity check: corrupt or tampered | restore from a backup or an export |
222
+ | `MnemoError` (only) | I/O, cryptography, key derivation or serialization | the message says which |
223
+
224
+ ```python
225
+ import mnemo_engine as mnemo
226
+
227
+ try:
228
+ db = mnemo.open(path, passphrase)
229
+ except mnemo.FormatTooOldError:
230
+ db = mnemo.open(path, passphrase, read_only=True) # a v8 file; compact it later
231
+ ```
232
+
233
+ Each message is the engine's own, unchanged from before, so code that
234
+ matched on a message's start keeps working too.
235
+
200
236
  ## Result caching
201
237
 
202
238
  MNemo doubles as a durable result cache — memoize LLM tool-call outputs,
@@ -431,14 +467,15 @@ db.set_embedder(embed, name="text-embedding-3-small",
431
467
  dimensions=1536, normalize=False)
432
468
  ```
433
469
 
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.`
470
+ The identity (`name`, `dimensions`, `normalize`) is recorded in the file
471
+ the first time you `set_embedder` (since v0.13 on every file, with or
472
+ without a manifest; a file with a manifest also keeps it there).
473
+ Reopening with a *different* embedder — say you swap MiniLM for BGE on
474
+ the same file — raises `RuntimeError: embedder identity mismatch: this
475
+ file's vectors come from embedder (name="all-MiniLM-L6-v2", …), but the
476
+ embedder given is (name="bge-large-en-v1.5", …). Open the file with its
477
+ original embedder, or create a new store for the new model.` A file from
478
+ before v0.13 records the first embedder attached after the upgrade.
442
479
 
443
480
  Mnemo also now refuses any `remember` call with an all-zero vector,
444
481
  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.3"
824
+ version = "0.13.1"
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.3"
853
+ version = "0.13.1"
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.3"
863
+ version = "0.13.1"
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.3"
13
+ version = "0.13.1"
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 |
@@ -821,6 +862,13 @@ The passphrase is resolved in this priority order:
821
862
  passphrase follows the same chain via `--new-passphrase`,
822
863
  `MNEMO_NEW_PASSPHRASE`, or a double-prompt.
823
864
 
865
+ **Raw-key files** (what `Mnemo::create_with_key` writes, and what the
866
+ phone libraries keep) open with `--key-file <path>` instead, on `info`,
867
+ `about`, `list`, `verify`, `recall`, `export`, `compact` and `inspect`
868
+ (since v0.13.1). The file holds the 32-byte key, raw or as 64 hex digits;
869
+ it can't be combined with `--passphrase`. `mnemo compact --key-file` is
870
+ how a raw-key v8 file becomes v9.
871
+
824
872
  For real applications, prefer the library API and supply the passphrase
825
873
  in-process.
826
874
 
@@ -830,6 +878,80 @@ cargo run --bin mnemo -- init agent.mnemo --dimensions 768
830
878
  cargo run --bin mnemo -- demo # try it without any setup
831
879
  ```
832
880
 
881
+ ### Readable export
882
+
883
+ `mnemo export` writes a file's live memories as plaintext: Markdown (a
884
+ section per memory, content in a fenced block) or JSON Lines (one object
885
+ per memory). It opens the file read-only, so the file never changes.
886
+
887
+ ```sh
888
+ # to stdout; a warning on stderr says the output isn't encrypted
889
+ cargo run --bin mnemo -- export agent.mnemo --type semantic,procedural --agent ops
890
+
891
+ # diff-clean, for committing beside the project
892
+ cargo run --bin mnemo -- export agent.mnemo --git -o memory.md
893
+ ```
894
+
895
+ - Vectors are always left out; superseded keyed versions are included.
896
+ - It writes a file only with `-o`, and replaces it whole: a new
897
+ owner-only file (on Unix) renamed over the old one, never over the
898
+ `.mnemo` file itself.
899
+ - **`--git`** orders records by key, then id (keyed memories first), and
900
+ leaves out thread turns, access stats and counts. The same unchanged file
901
+ exports to the same bytes, a recall doesn't change the output, and one new
902
+ memory adds only its own lines (a new version of a keyed fact also
903
+ changes the line of the version it supersedes).
904
+ - The result cache (and so the embedder-identity record) is never exported.
905
+ - **A committed export is world-readable elsewhere.** Git stores no file
906
+ mode beyond the executable bit, so another checkout of a committed
907
+ export is `0644` whatever `-o` wrote. Commit one only where everyone who
908
+ can read the repository may read the memories.
909
+
910
+ ### The inspector
911
+
912
+ `mnemo inspect` serves a read-only web view of a file on your machine:
913
+
914
+ ```sh
915
+ cargo run --bin mnemo -- inspect agent.mnemo # prints a URL with a token: open it in your browser
916
+ cargo run --bin mnemo -- inspect app.mnemo --key-file app.key # a raw-key file (32 bytes or 64 hex digits)
917
+ cargo run --bin mnemo -- inspect agent.mnemo --open # opens the browser for you
918
+ ```
919
+
920
+ The passphrase comes from the prompt or `MNEMO_PASSPHRASE`. Copy the
921
+ printed URL into your browser, or pass `--open`, which hands the browser a
922
+ private local page (owner-only, deleted once it has loaded) that forwards
923
+ to the URL.
924
+
925
+ - **Views:** memories (filter by type, agent, keyed or not, and thread;
926
+ keyword search with BM25, no embedder needed), keyed history (each
927
+ key's versions, oldest first, with when each stopped being current),
928
+ threads (the essence render, and the turn archive on demand), snapshots
929
+ (the restore points `stats` reports) and about (format, recall mode,
930
+ embedder identity, sizes).
931
+ - **It never holds the file.** It reads it once, read-only, and closes it,
932
+ so an agent writing to the file is never blocked. **Reload** in the page
933
+ reads it again (one passphrase derivation). If a writer has the file
934
+ open at that moment, it says so and keeps the last read.
935
+ - **It stays on your machine.** It binds `127.0.0.1` only (a random free
936
+ port unless `--port`), and the printed URL carries a random token. Every
937
+ data request must carry that token and a `Host` of the loopback address and
938
+ port, which stops other sites' pages (DNS rebinding included). Only `GET`
939
+ is served, with no CORS, and no endpoint writes the file. Nothing is
940
+ written to disk. Once the page has loaded, it keeps the token for that
941
+ tab only and takes it out of the address bar. The browser's history
942
+ still records the first visit; the token stops working when the
943
+ inspector stops.
944
+ - **It stops when it's left alone.** After `--idle-timeout` without a
945
+ request from the page (30 minutes by default; `90s`, `1h`, or `0` for
946
+ never) it wipes the passphrase or key from memory and exits. It holds
947
+ the secret only so that Reload works.
948
+ - It works on v8 files too, and on passphrase exports from the phone
949
+ libraries.
950
+
951
+ `mnemo_engine::KeywordIndex` is the in-memory keyword index it searches
952
+ with: the tokenizer and BM25 scoring of v9's keyword recall, over texts
953
+ you already hold.
954
+
833
955
  ## Build and test
834
956
 
835
957
  ```sh