mnemo-engine 0.18.1__tar.gz → 0.19.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 (95) hide show
  1. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/PKG-INFO +1 -1
  2. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/Cargo.lock +3 -3
  3. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/Cargo.toml +1 -1
  4. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/README.md +6 -0
  5. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/ann_defaults_v0_6_0.rs +61 -27
  6. mnemo_engine-0.19.0/mnemo/examples/inspect_demo_brain.rs +150 -0
  7. mnemo_engine-0.19.0/mnemo/examples/perf2_split.rs +86 -0
  8. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/guide/guide.md +2 -1
  9. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo/hook.rs +20 -31
  10. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo/inspect.html +52 -14
  11. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo/inspect.rs +67 -12
  12. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo.rs +20 -23
  13. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/crypto.rs +28 -1
  14. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/index.rs +292 -1
  15. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/pager.rs +512 -0
  16. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/coordination.rs +24 -2
  17. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/findings.rs +23 -0
  18. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/flush.rs +15 -6
  19. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/hooks.rs +79 -0
  20. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/load.rs +97 -38
  21. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/mod.rs +11 -5
  22. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/recall.rs +9 -0
  23. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/records.rs +89 -25
  24. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo-python/Cargo.lock +2 -2
  25. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo-python/Cargo.toml +1 -1
  26. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo-python/src/lib.rs +61 -36
  27. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/pyproject.toml +1 -1
  28. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/README.md +0 -0
  29. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/.gitignore +0 -0
  30. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/benches/corpus.rs +0 -0
  31. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/build.rs +0 -0
  32. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/deny.toml +0 -0
  33. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/ann_diagnose.rs +0 -0
  34. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/ann_recall_grid.rs +0 -0
  35. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/ann_recall_grid_v2.rs +0 -0
  36. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/candle_hard.rs +0 -0
  37. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/embedder_server.py +0 -0
  38. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/file_size_breakdown.rs +0 -0
  39. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/open_rss.rs +0 -0
  40. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/quickstart.rs +0 -0
  41. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/ranking_v2.rs +0 -0
  42. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/session.rs +0 -0
  43. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/shared_bench.rs +0 -0
  44. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/examples/thread_profile.rs +0 -0
  45. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo/export.rs +0 -0
  46. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo/mcp_install.rs +0 -0
  47. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo/onboard.rs +0 -0
  48. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/bin/mnemo/project.rs +0 -0
  49. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/builtin.rs +0 -0
  50. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/cache.rs +0 -0
  51. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/embed.rs +0 -0
  52. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/embed_cmd.rs +0 -0
  53. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/error.rs +0 -0
  54. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/format.rs +0 -0
  55. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/freelist.rs +0 -0
  56. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/guide.rs +0 -0
  57. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/ident.rs +0 -0
  58. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/keys/display.rs +0 -0
  59. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/keys/mod.rs +0 -0
  60. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/keys/os_store.rs +0 -0
  61. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/keys/recovery.rs +0 -0
  62. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/keyslot.rs +0 -0
  63. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/lib.rs +0 -0
  64. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/mcp/context.rs +0 -0
  65. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/mcp.rs +0 -0
  66. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/memory.rs +0 -0
  67. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/redact.rs +0 -0
  68. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/result_cache.rs +0 -0
  69. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/session.rs +0 -0
  70. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/shared/call.rs +0 -0
  71. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/shared/fscheck.rs +0 -0
  72. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/shared/lock.rs +0 -0
  73. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/shared/mod.rs +0 -0
  74. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/shared/presence.rs +0 -0
  75. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/shared/sidecar.rs +0 -0
  76. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/ann.rs +0 -0
  77. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/cache_api.rs +0 -0
  78. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/continuation.rs +0 -0
  79. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/crud.rs +0 -0
  80. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/essence.rs +0 -0
  81. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/header_graft_tests.rs +0 -0
  82. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/keyed.rs +0 -0
  83. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/maintenance.rs +0 -0
  84. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/open.rs +0 -0
  85. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/shared.rs +0 -0
  86. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/snapshots.rs +0 -0
  87. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/store/threads.rs +0 -0
  88. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/text.rs +0 -0
  89. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/transcript.rs +0 -0
  90. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/veccol.rs +0 -0
  91. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo/src/wal.rs +0 -0
  92. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo-python/.gitignore +0 -0
  93. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo-python/README.md +0 -0
  94. {mnemo_engine-0.18.1 → mnemo_engine-0.19.0}/mnemo-python/test_mnemo.py +0 -0
  95. {mnemo_engine-0.18.1 → mnemo_engine-0.19.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.18.1
3
+ Version: 0.19.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -1520,7 +1520,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
1520
1520
 
1521
1521
  [[package]]
1522
1522
  name = "mnemo-engine"
1523
- version = "0.18.1"
1523
+ version = "0.19.0"
1524
1524
  dependencies = [
1525
1525
  "aes-gcm",
1526
1526
  "apple-native-keyring-store",
@@ -1561,7 +1561,7 @@ dependencies = [
1561
1561
 
1562
1562
  [[package]]
1563
1563
  name = "mnemo-node"
1564
- version = "0.18.1"
1564
+ version = "0.19.0"
1565
1565
  dependencies = [
1566
1566
  "mnemo-engine",
1567
1567
  "napi",
@@ -1571,7 +1571,7 @@ dependencies = [
1571
1571
 
1572
1572
  [[package]]
1573
1573
  name = "mnemo-uniffi"
1574
- version = "0.18.1"
1574
+ version = "0.19.0"
1575
1575
  dependencies = [
1576
1576
  "mnemo-engine",
1577
1577
  "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.18.1"
13
+ version = "0.19.0"
14
14
  edition = "2021"
15
15
  rust-version = "1.94"
16
16
  # `benches/corpus.rs` is a shared helper module pulled into real benches
@@ -1410,6 +1410,11 @@ page, so copy the printed link instead.
1410
1410
  The tasks in a table (status, owner, the role it's for, what it waits
1411
1411
  for, its last change), filtered by status, with a click for the body and
1412
1412
  history. Everything from the file is shown as text, never as HTML.
1413
+ - **A date range** (since v0.19.0): From and To dates, inclusive, in your
1414
+ local time, on the memories, findings and tasks views (tasks by when
1415
+ they were added or last changed). It combines with the other filters,
1416
+ and the counts follow it. A link can open a view directly
1417
+ (`…/#findings`).
1413
1418
  - **It never holds the file.** It reads it once, read-only, and closes it,
1414
1419
  so an agent writing to the file is never blocked. **Reload** in the page
1415
1420
  reads it again (one passphrase derivation). If a writer has the file
@@ -1642,6 +1647,7 @@ rows stay as-is so improvements (or regressions) are visible.
1642
1647
  | v0.1.0 | 2026-05 | 31 mems, 384-dim, no index | 1.41 MB | ~330 ms | ~35 ms | Initial dogfood baseline |
1643
1648
  | v0.5.0 | 2026-10 | 10K mems, 384-dim, IVF+PQ | 82.9 MB | — (open 14.9 ms secure KDF) | 374 µs (IVF+PQ†) / 623 ms (exact‡) | Phase 6: criterion benches + ranking harness + ANN recall@10 grid + file-size breakdown. IVF+PQ ≈ 1,660× faster than exact at 10K; 10,400× at 100K. Default `IndexConfig` recovers only 40% of exact top-10 — **index-quality defect, fixed in ANN-1 below** (originally mis-filed as a scoring issue). Full numbers in `test/scripts/perf_v0.5.0.json`. |
1644
1649
  | v0.5.1 | 2026-10 | same corpus, hardware AES on ARM | — | — | 105 ms (exact 10K) / 1.05 s (exact 100K); IVF+PQ unchanged | PR 11.0: enable `--cfg aes_armv8 --cfg polyval_armv8` so aarch64 builds use hardware AES + PMULL instead of the constant-time software fallback. **6.0×** faster exact scan at 10K, **6.1×** at 100K; 1.3× on cache_put; IVF+PQ and Argon2id-bound open unchanged. See `test/scripts/perf_v0.5.0.json`'s `speed_hw_aes` block for the full set. No API or format change. If you build from crates.io see the "ARM users" section above. |
1650
+ | v0.19.0 | 2026-11 | 1K / 10K / 100K mems, 384-dim, ~300 B text, IVF+PQ at 100K (`device_budget`) | 1,417 / 1,330 / 1,447 B per memory | open 0.55 / 3.0 / 25.7 ms | first recall 0.6 / 4.2 / 11.5 ms (v0.18.1: 0.9 / 9.2 to 10.4 / 116 to 118 ms); warm 0.22 / 2.3 / 2.4 ms | PERF-2: index layout 2 (flat partition-major arrays, decode 70.8 ms to 0.7 ms at 100K), batched page reads with parallel in-place decrypt, a streamed column fill, the `id -> partition` map built only for writes. One decrypt thread: first recall 8.2 ms (10K), 17.7 ms (100K). Handle RSS 111 MB at 100K (112.5 before). ranking_v2 and recall@10 (0.978) unchanged. See `test/scripts/perf_v0.19.0.json` |
1645
1651
 
1646
1652
  > † IVF+PQ speed at the old defaults; recall@10 was ~0.40 at those
1647
1653
  > defaults, not 1.0. PR ANN-1 raises the default to ≥0.95 recall@10 at
@@ -14,14 +14,20 @@
14
14
  //! legacy sentinel `(8, 64)` triggers auto). Shows what a user
15
15
  //! gets *before* running `mnemo index --rebuild`.
16
16
  //!
17
- //! Writes `test/scripts/perf_v0.5.0.json["ann_defaults_v0_6_0"]`
18
- //! with per-tier `{fresh_install, upgrade_path}` cells carrying
19
- //! `recall_at_10` + `mean_query_ms` + the exact `n_probe` / `n_rerank`
20
- //! values the formulas picked.
17
+ //! Prints `{"ann_defaults_v0_6_0": …}` with per-tier `{fresh_install,
18
+ //! upgrade_path}` cells carrying `recall_at_10` + `mean_query_ms` + the
19
+ //! exact `n_probe` / `n_rerank` values the formulas picked. With `--out
20
+ //! <file>` it also writes that block into the JSON file (merged with what's
21
+ //! there); it never writes a tracked perf file unless asked to (PERF-2).
22
+ //!
23
+ //! On v9 a tier below `V9_ANN_MIN_FACTS` (20,000) has no index: recall is
24
+ //! an exact scan there. Such a tier is skipped and labelled, unless
25
+ //! `MNEMO_DEV_ANN_MIN_FACTS` lowers the threshold (a forced index).
21
26
  //!
22
27
  //! Run:
23
28
  //! ```sh
24
- //! cargo run --release --example ann_defaults_v0_6_0
29
+ //! cargo run --release --features benches --example ann_defaults_v0_6_0
30
+ //! cargo run --release --features benches --example ann_defaults_v0_6_0 -- --out test/scripts/perf_v0.19.0.json
25
31
  //! ```
26
32
 
27
33
  use std::collections::HashSet;
@@ -31,6 +37,7 @@ use std::time::Instant;
31
37
 
32
38
  use mnemo_engine::{
33
39
  IndexConfig, KdfParams, Memory, MemoryType, Metric, Mnemo, MnemoConfig, RecallRequest,
40
+ V9_ANN_MIN_FACTS,
34
41
  };
35
42
  use serde_json::{json, Value};
36
43
 
@@ -228,6 +235,19 @@ fn measure_scenario(
228
235
  }
229
236
 
230
237
  fn main() {
238
+ let args: Vec<String> = std::env::args().collect();
239
+ let out_path: Option<PathBuf> = args
240
+ .iter()
241
+ .position(|a| a == "--out")
242
+ .and_then(|i| args.get(i + 1))
243
+ .map(PathBuf::from);
244
+ // PERF-2: the threshold the engine uses (a forced one when the dev
245
+ // switch sets it), below which a v9 file has no index.
246
+ let ann_min: usize = std::env::var("MNEMO_DEV_ANN_MIN_FACTS")
247
+ .ok()
248
+ .and_then(|v| v.parse().ok())
249
+ .unwrap_or(V9_ANN_MIN_FACTS);
250
+ let mut skipped: Vec<Value> = Vec::new();
231
251
  // Tiers to measure. 1M is "if feasible" — the harness tries it if
232
252
  // the cached corpus is already on disk; otherwise it's skipped
233
253
  // with a note. Avoids the 20-minute first-build cost unless the
@@ -255,6 +275,14 @@ fn main() {
255
275
 
256
276
  let mut tiers_json: Vec<Value> = Vec::new();
257
277
  for n in tiers_to_measure {
278
+ if n < ann_min {
279
+ println!(
280
+ "\n[ann-defaults] tier={n}: skipped, below V9_ANN_MIN_FACTS ({ann_min}): \
281
+ v9 recalls exactly there, with no index"
282
+ );
283
+ skipped.push(json!({ "corpus_size": n, "skipped": "below V9_ANN_MIN_FACTS: exact recall, no index" }));
284
+ continue;
285
+ }
258
286
  println!("\n[ann-defaults] tier={n}");
259
287
  let cached = ensure_corpus(n);
260
288
  let cells = vec![
@@ -274,22 +302,7 @@ fn main() {
274
302
  }));
275
303
  }
276
304
 
277
- let perf_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
278
- .parent()
279
- .unwrap()
280
- .join("test/scripts/perf_v0.5.0.json");
281
- let mut out: Value = if perf_path.exists() {
282
- let txt = fs::read_to_string(&perf_path).unwrap();
283
- let v: Value = serde_json::from_str(&txt).unwrap();
284
- if v.is_array() {
285
- json!({ "legacy_rows": v })
286
- } else {
287
- v
288
- }
289
- } else {
290
- json!({})
291
- };
292
- out["ann_defaults_v0_6_0"] = json!({
305
+ let block = json!({
293
306
  "methodology":
294
307
  "Per-tier (10K, 100K, 1M-if-cached): rebuild the ANN index in \
295
308
  memory under two scenarios — 'fresh_install' = IndexConfig::default() \
@@ -301,13 +314,34 @@ fn main() {
301
314
  Index is rebuilt in memory only — cached corpus on disk is \
302
315
  untouched. See CHANGELOG `## [Unreleased]` → ANN-1.1.",
303
316
  "tiers": tiers_json,
317
+ "skipped_tiers": skipped,
318
+ "v9_ann_min_facts": ann_min,
304
319
  });
305
- fs::write(
306
- &perf_path,
307
- serde_json::to_string_pretty(&out).unwrap() + "\n",
308
- )
309
- .unwrap();
310
- println!("\n[ann-defaults] wrote {}", perf_path.display());
320
+ println!(
321
+ "{}",
322
+ serde_json::to_string_pretty(&json!({ "ann_defaults_v0_6_0": block })).unwrap()
323
+ );
324
+ // Only with `--out`: never a tracked perf file by default.
325
+ if let Some(perf_path) = out_path {
326
+ let mut out: Value = if perf_path.exists() {
327
+ let txt = fs::read_to_string(&perf_path).unwrap();
328
+ let v: Value = serde_json::from_str(&txt).unwrap();
329
+ if v.is_array() {
330
+ json!({ "legacy_rows": v })
331
+ } else {
332
+ v
333
+ }
334
+ } else {
335
+ json!({})
336
+ };
337
+ out["ann_defaults_v0_6_0"] = block;
338
+ fs::write(
339
+ &perf_path,
340
+ serde_json::to_string_pretty(&out).unwrap() + "\n",
341
+ )
342
+ .unwrap();
343
+ println!("\n[ann-defaults] wrote {}", perf_path.display());
344
+ }
311
345
  }
312
346
 
313
347
  fn round4(x: f64) -> Value {
@@ -0,0 +1,150 @@
1
+ //! A small, synthetic brain for screenshots of `mnemo inspect` (v0.19.0):
2
+ //! review findings `DEMO-1.1` onward in every status, a few tasks, and a
3
+ //! handful of memories. Nothing here comes from a real brain: the names are
4
+ //! roles and the text is made up. `test/scripts/inspect_screenshot.sh`
5
+ //! builds it and photographs the Findings tab.
6
+ //!
7
+ //! ```text
8
+ //! cargo run --release --example inspect_demo_brain -- <out.mnemo> <passphrase>
9
+ //! ```
10
+
11
+ use mnemo_engine::{FindingSpec, KdfParams, Memory, MemoryType, Mnemo, MnemoConfig, TaskSpec};
12
+
13
+ fn main() {
14
+ let args: Vec<String> = std::env::args().collect();
15
+ let (path, pw) = match (args.get(1), args.get(2)) {
16
+ (Some(p), Some(w)) => (p.clone(), w.clone()),
17
+ _ => {
18
+ eprintln!("usage: inspect_demo_brain <out.mnemo> <passphrase>");
19
+ std::process::exit(2);
20
+ }
21
+ };
22
+ let _ = std::fs::remove_file(&path);
23
+ let cfg = MnemoConfig {
24
+ dimensions: 4,
25
+ kdf: KdfParams::fast(),
26
+ ..Default::default()
27
+ };
28
+ let mut db = Mnemo::create(&path, &pw, cfg).expect("create");
29
+ db.remember(Memory::scaffold_manifest(4)).expect("manifest");
30
+ for (i, text) in [
31
+ "Deploys go out on Tuesdays, after the staging check.",
32
+ "The cache key includes the model name and its version.",
33
+ "Release notes are drafted from the merged PR titles.",
34
+ ]
35
+ .iter()
36
+ .enumerate()
37
+ {
38
+ db.remember(Memory::new(
39
+ *text,
40
+ MemoryType::Semantic,
41
+ vec![1.0 + i as f32, 0.5, 0.25, 1.0],
42
+ ))
43
+ .expect("remember");
44
+ }
45
+
46
+ let add =
47
+ |db: &mut Mnemo, id: &str, category: &str, priority: &str, title: &str, body: &str| {
48
+ let mut f = FindingSpec::new(id, category, priority, title);
49
+ f.body = body.into();
50
+ f.refs = vec![format!(
51
+ "src/demo/{}.rs:42",
52
+ id.to_lowercase().replace(['-', '.'], "_")
53
+ )];
54
+ db.finding_add(&f).expect("finding");
55
+ };
56
+ db.set_author(Some("reviewer".into()));
57
+ add(
58
+ &mut db,
59
+ "DEMO-1.1",
60
+ "CORRECTNESS",
61
+ "HIGH",
62
+ "A retry can run twice after a timeout",
63
+ "The second attempt starts before the first one is cancelled.",
64
+ );
65
+ add(
66
+ &mut db,
67
+ "DEMO-1.2",
68
+ "PERF",
69
+ "MEDIUM",
70
+ "The export reads every page twice",
71
+ "One pass would do; the second re-reads what the first had.",
72
+ );
73
+ add(
74
+ &mut db,
75
+ "DEMO-1.3",
76
+ "SECURITY",
77
+ "MEDIUM",
78
+ "A debug log line includes a request header",
79
+ "Held until the fix ships.",
80
+ );
81
+ add(
82
+ &mut db,
83
+ "DEMO-1.4",
84
+ "DX/DOCS",
85
+ "LOW",
86
+ "The quick start skips the install check",
87
+ "A new user can't tell whether the install worked.",
88
+ );
89
+ add(
90
+ &mut db,
91
+ "DEMO-1.5",
92
+ "PRODUCT",
93
+ "IDEA",
94
+ "Show a finding's history as a timeline",
95
+ "The table has the data; a timeline would read faster.",
96
+ );
97
+ add(
98
+ &mut db,
99
+ "DEMO-2.1",
100
+ "CORRECTNESS",
101
+ "LOW",
102
+ "An empty filter matches nothing instead of everything",
103
+ "Leaving the field blank should mean no filter.",
104
+ );
105
+ add(
106
+ &mut db,
107
+ "DEMO-2.2",
108
+ "PLAN-REFINEMENT",
109
+ "MEDIUM",
110
+ "Split the import step from the index rebuild",
111
+ "They have different failure modes and owners.",
112
+ );
113
+
114
+ db.set_author(Some("planner".into()));
115
+ db.finding_triage("DEMO-1.1", "accepted", "Fix in the next release.")
116
+ .expect("triage");
117
+ db.finding_triage("DEMO-1.2", "accepted", "Worth it at 100K memories.")
118
+ .expect("triage");
119
+ db.finding_triage("DEMO-1.3", "accepted", "Fix before the tag.")
120
+ .expect("triage");
121
+ db.finding_triage("DEMO-1.4", "deferred", "With the docs pass.")
122
+ .expect("triage");
123
+ db.finding_triage("DEMO-1.5", "needs-user", "A product call.")
124
+ .expect("triage");
125
+ db.finding_triage("DEMO-2.2", "rejected", "One step keeps it atomic.")
126
+ .expect("triage");
127
+ db.set_author(Some("reviewer".into()));
128
+ db.finding_verify("DEMO-1.2", "a1b2c3d").expect("verify");
129
+
130
+ db.set_author(Some("planner".into()));
131
+ for (slug, title, refs) in [
132
+ ("fix-retry", "Fix the double retry", vec!["DEMO-1.1"]),
133
+ (
134
+ "faster-export",
135
+ "Read each page once in the export",
136
+ vec!["DEMO-1.2"],
137
+ ),
138
+ ("docs-pass", "The docs pass", vec!["DEMO-1.4"]),
139
+ ] {
140
+ let mut t = TaskSpec::new(title);
141
+ t.slug = Some(slug.into());
142
+ t.role = Some("worker".into());
143
+ t.refs = refs.into_iter().map(str::to_string).collect();
144
+ db.task_add(&t).expect("task");
145
+ }
146
+ db.set_author(Some("worker".into()));
147
+ let _ = db.task_next(Some("worker")).expect("next");
148
+ db.close().expect("close");
149
+ println!("{path}");
150
+ }
@@ -0,0 +1,86 @@
1
+ //! PERF-2 (v0.19.0): where a fresh handle's first recall goes on an indexed
2
+ //! file. For each of `--cycles` fresh handles it loads the index through the
3
+ //! dev hook `Mnemo::__index_load_split` (read and decrypt, decode, the `id
4
+ //! -> partition` map, the delta chain, the reconcile), then times the first
5
+ //! recall that follows. A second set of fresh handles times a plain first
6
+ //! recall for comparison. Medians are printed as JSON.
7
+ //!
8
+ //! ```text
9
+ //! cargo run --release --features benches --example device_budget -- --sizes 100000 # builds the corpus
10
+ //! cargo run --release --features benches --example perf2_split -- --corpus target/device_budget/corpus_100000_384d_300b_v9.mnemo
11
+ //! # the same index rewritten in this build's layout, measured on a copy:
12
+ //! cargo run --release --features benches --example perf2_split -- --corpus <file> --rewrite-to /tmp/copy.mnemo
13
+ //! ```
14
+
15
+ use std::collections::BTreeMap;
16
+ use std::time::Instant;
17
+
18
+ use mnemo_engine::{Mnemo, RecallRequest};
19
+
20
+ #[path = "../benches/corpus.rs"]
21
+ mod corpus;
22
+ use corpus::{gen_clustered_vectors, DIMENSIONS, PASSPHRASE};
23
+
24
+ fn median(mut v: Vec<f64>) -> f64 {
25
+ v.sort_by(|a, b| a.partial_cmp(b).unwrap());
26
+ v[v.len() / 2]
27
+ }
28
+
29
+ fn main() {
30
+ let args: Vec<String> = std::env::args().collect();
31
+ let arg = |name: &str| {
32
+ args.iter()
33
+ .position(|a| a == name)
34
+ .and_then(|i| args.get(i + 1).cloned())
35
+ };
36
+ let corpus = arg("--corpus").expect("--corpus <file>");
37
+ // `--rewrite-to <file>`: copy the corpus there and rewrite its index base
38
+ // in this build's layout (no retraining), then measure the copy.
39
+ let path = match arg("--rewrite-to") {
40
+ Some(dst) => {
41
+ std::fs::copy(&corpus, &dst).expect("copy the corpus");
42
+ let mut db = Mnemo::open(&dst, PASSPHRASE).expect("open the copy");
43
+ db.__rewrite_index_base_for_testing()
44
+ .expect("rewrite the index");
45
+ db.close().expect("close");
46
+ dst
47
+ }
48
+ None => corpus,
49
+ };
50
+ let cycles: usize = arg("--cycles").and_then(|v| v.parse().ok()).unwrap_or(20);
51
+ let queries = gen_clustered_vectors(cycles, DIMENSIONS, 100, 0xDE71_CE00);
52
+ let req = |q: &[f32]| RecallRequest::new(q.to_vec()).top_k(10).track_access(false);
53
+
54
+ let mut stages: BTreeMap<&'static str, Vec<f64>> = BTreeMap::new();
55
+ for q in &queries {
56
+ let mut db = Mnemo::open(&path, PASSPHRASE).expect("open");
57
+ let split = db.__index_load_split().expect("split");
58
+ assert!(!split.is_empty(), "the file has no unloaded v9 index");
59
+ for (k, v) in split {
60
+ stages.entry(k).or_default().push(v);
61
+ }
62
+ let t = Instant::now();
63
+ std::hint::black_box(db.recall(&req(q)).expect("recall"));
64
+ stages
65
+ .entry("recall_after_load_ms")
66
+ .or_default()
67
+ .push(t.elapsed().as_secs_f64() * 1e3);
68
+ }
69
+ let mut plain = Vec::new();
70
+ for q in &queries {
71
+ let mut db = Mnemo::open(&path, PASSPHRASE).expect("open");
72
+ let t = Instant::now();
73
+ std::hint::black_box(db.recall(&req(q)).expect("recall"));
74
+ plain.push(t.elapsed().as_secs_f64() * 1e3);
75
+ }
76
+ let mut out = serde_json::Map::new();
77
+ for (k, v) in stages {
78
+ out.insert(k.into(), serde_json::json!(median(v)));
79
+ }
80
+ out.insert(
81
+ "first_recall_plain_ms".into(),
82
+ serde_json::json!(median(plain)),
83
+ );
84
+ out.insert("cycles".into(), serde_json::json!(cycles));
85
+ println!("{}", serde_json::Value::Object(out));
86
+ }
@@ -241,7 +241,8 @@ mnemo export --git
241
241
  ```
242
242
 
243
243
  - `mnemo inspect` opens a read-only view of the brain in your browser,
244
- with the review findings and tasks in tabs of their own.
244
+ with the review findings and tasks in tabs of their own, and a date
245
+ range on each.
245
246
  - `mnemo export` writes the brain as readable text (it isn't encrypted;
246
247
  keep it private).
247
248
  - `mnemo mcp install --client cursor` adds the MCP server to one client by
@@ -715,10 +715,8 @@ fn your_work(db: &mut Mnemo) -> String {
715
715
  }
716
716
  // v0.18.0: for a Planner, the findings that wait for its triage.
717
717
  if role.as_deref() == Some("planner") {
718
- let open = mnemo_engine::FindingFilter {
719
- status: Some(mnemo_engine::finding_status::OPEN.into()),
720
- ..Default::default()
721
- };
718
+ let mut open = mnemo_engine::FindingFilter::default();
719
+ open.status = Some(mnemo_engine::finding_status::OPEN.into());
722
720
  if let Ok(fs) = db.findings(&open) {
723
721
  if !fs.is_empty() {
724
722
  sections.push((
@@ -1558,39 +1556,30 @@ mod tests {
1558
1556
  /// ONBOARD-UX: the per-turn line asks for only what its counts hold.
1559
1557
  #[test]
1560
1558
  fn the_turn_line_names_only_what_is_new() {
1561
- let msg = |s: &str| mnemo_engine::Message {
1562
- id: ulid::Ulid::nil(),
1563
- to: "worker-a".into(),
1564
- from: "user".into(),
1565
- subject: s.into(),
1566
- body: String::new(),
1567
- refs: Vec::new(),
1568
- conversation: String::new(),
1569
- hops: 0,
1570
- status: "open".into(),
1571
- delivery: String::new(),
1572
- created_at: 0,
1573
- acked_at: None,
1574
- };
1575
- let claim = mnemo_engine::Claim {
1576
- topic: "task:ship".into(),
1577
- holder: "worker-a".into(),
1578
- expires_at: 600,
1579
- lease: 900,
1559
+ // v0.19.0: these types are `#[non_exhaustive]`, so a caller outside
1560
+ // the engine builds them from `Default` and sets fields.
1561
+ let msg = |s: &str| {
1562
+ let mut m = mnemo_engine::Message::default();
1563
+ m.to = "worker-a".into();
1564
+ m.from = "user".into();
1565
+ m.subject = s.into();
1566
+ m.status = "open".into();
1567
+ m
1580
1568
  };
1569
+ let mut claim = mnemo_engine::Claim::default();
1570
+ claim.topic = "task:ship".into();
1571
+ claim.holder = "worker-a".into();
1572
+ claim.expires_at = 600;
1573
+ claim.lease = 900;
1581
1574
  let head = |w: &mnemo_engine::NewWork| turn_text(w, 0).lines().next().unwrap().to_string();
1582
- let w = mnemo_engine::NewWork {
1583
- messages: vec![msg("hello")],
1584
- ..Default::default()
1585
- };
1575
+ let mut w = mnemo_engine::NewWork::default();
1576
+ w.messages = vec![msg("hello")];
1586
1577
  assert_eq!(
1587
1578
  head(&w),
1588
1579
  "mnemo: new for you: 1 message. Call `inbox` to read it."
1589
1580
  );
1590
- let w = mnemo_engine::NewWork {
1591
- lapsing: vec![claim.clone(), claim],
1592
- ..Default::default()
1593
- };
1581
+ let mut w = mnemo_engine::NewWork::default();
1582
+ w.lapsing = vec![claim.clone(), claim];
1594
1583
  assert_eq!(
1595
1584
  head(&w),
1596
1585
  "mnemo: new for you: 2 claims lapsing soon. Update the task with `task` to renew \