mnemo-engine 0.16.0__tar.gz → 0.16.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 (90) hide show
  1. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/PKG-INFO +1 -1
  2. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/Cargo.lock +3 -3
  3. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/Cargo.toml +1 -1
  4. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/README.md +4 -4
  5. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/guide/guide.md +2 -1
  6. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo/hook.rs +4 -2
  7. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo/onboard.rs +12 -3
  8. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo.rs +59 -12
  9. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/lib.rs +6 -5
  10. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/memory.rs +10 -0
  11. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/mod.rs +39 -4
  12. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/recall.rs +7 -0
  13. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/threads.rs +44 -8
  14. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/transcript.rs +74 -0
  15. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo-python/Cargo.lock +2 -2
  16. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo-python/Cargo.toml +1 -1
  17. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/pyproject.toml +1 -1
  18. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/README.md +0 -0
  19. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/.gitignore +0 -0
  20. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/benches/corpus.rs +0 -0
  21. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/build.rs +0 -0
  22. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/deny.toml +0 -0
  23. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/ann_defaults_v0_6_0.rs +0 -0
  24. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/ann_diagnose.rs +0 -0
  25. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/ann_recall_grid.rs +0 -0
  26. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/ann_recall_grid_v2.rs +0 -0
  27. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/candle_hard.rs +0 -0
  28. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/embedder_server.py +0 -0
  29. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/file_size_breakdown.rs +0 -0
  30. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/open_rss.rs +0 -0
  31. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/quickstart.rs +0 -0
  32. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/ranking_v2.rs +0 -0
  33. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/session.rs +0 -0
  34. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/shared_bench.rs +0 -0
  35. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/examples/thread_profile.rs +0 -0
  36. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo/export.rs +0 -0
  37. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo/inspect.html +0 -0
  38. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo/inspect.rs +0 -0
  39. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo/mcp_install.rs +0 -0
  40. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/bin/mnemo/project.rs +0 -0
  41. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/builtin.rs +0 -0
  42. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/cache.rs +0 -0
  43. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/crypto.rs +0 -0
  44. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/embed.rs +0 -0
  45. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/embed_cmd.rs +0 -0
  46. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/error.rs +0 -0
  47. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/format.rs +0 -0
  48. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/freelist.rs +0 -0
  49. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/guide.rs +0 -0
  50. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/ident.rs +0 -0
  51. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/index.rs +0 -0
  52. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/keys/display.rs +0 -0
  53. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/keys/mod.rs +0 -0
  54. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/keys/os_store.rs +0 -0
  55. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/keys/recovery.rs +0 -0
  56. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/keyslot.rs +0 -0
  57. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/mcp/context.rs +0 -0
  58. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/mcp.rs +0 -0
  59. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/pager.rs +0 -0
  60. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/redact.rs +0 -0
  61. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/result_cache.rs +0 -0
  62. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/session.rs +0 -0
  63. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/shared/call.rs +0 -0
  64. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/shared/fscheck.rs +0 -0
  65. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/shared/lock.rs +0 -0
  66. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/shared/mod.rs +0 -0
  67. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/shared/sidecar.rs +0 -0
  68. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/ann.rs +0 -0
  69. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/cache_api.rs +0 -0
  70. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/continuation.rs +0 -0
  71. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/crud.rs +0 -0
  72. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/essence.rs +0 -0
  73. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/flush.rs +0 -0
  74. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/header_graft_tests.rs +0 -0
  75. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/hooks.rs +0 -0
  76. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/keyed.rs +0 -0
  77. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/load.rs +0 -0
  78. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/maintenance.rs +0 -0
  79. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/open.rs +0 -0
  80. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/records.rs +0 -0
  81. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/shared.rs +0 -0
  82. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/store/snapshots.rs +0 -0
  83. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/text.rs +0 -0
  84. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/veccol.rs +0 -0
  85. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo/src/wal.rs +0 -0
  86. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo-python/.gitignore +0 -0
  87. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo-python/README.md +0 -0
  88. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo-python/src/lib.rs +0 -0
  89. {mnemo_engine-0.16.0 → mnemo_engine-0.16.1}/mnemo-python/test_mnemo.py +0 -0
  90. {mnemo_engine-0.16.0 → mnemo_engine-0.16.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.16.0
3
+ Version: 0.16.1
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.16.0"
1523
+ version = "0.16.1"
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.16.0"
1564
+ version = "0.16.1"
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.16.0"
1574
+ version = "0.16.1"
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.16.0"
13
+ version = "0.16.1"
14
14
  edition = "2021"
15
15
  rust-version = "1.94"
16
16
  # `benches/corpus.rs` is a shared helper module pulled into real benches
@@ -950,8 +950,8 @@ cargo run --bin mnemo -- <command>
950
950
  | `list` | Browse live memories (table / json / jsonl, filters) |
951
951
  | `export` | Readable plaintext export (Markdown or JSON Lines, filters); `--git` for diff-clean output |
952
952
  | `inspect` | Browse the file in a local, read-only web view (memories, keyed history, threads and essence, snapshots, about) |
953
- | `get` | Fetch one memory by its ULID |
954
- | `search` | Exact nearest-neighbour search (similarity only) |
953
+ | `get` | Fetch one memory by its ULID, with its whole content. `get <ID>` uses the project brain, and `get <PATH> <ID>` a file (v0.16.1) |
954
+ | `search` | Exact nearest-neighbour search (similarity only); no path needed in a git repository (v0.16.1) |
955
955
  | `recall` | Multi-signal ranked retrieval (sim + recency + …) |
956
956
  | `verify` | Decrypt and re-validate every live record |
957
957
  | `rekey` | Re-encrypt the data key under a new passphrase, or a new generated key (`--new-key`, v0.15, kept in the key store); `--rotate` also rewrites the file under a fresh data key (revokes the old secret) |
@@ -959,9 +959,9 @@ cargo run --bin mnemo -- <command>
959
959
  | `reembed` | Embed every live memory again with a new embedder (`--embed-cmd`, `--embed-name`, `--embed-query`, `--embed-dims`; without `--embed-cmd`, the built-in) and record its identity: a compaction with new vectors, so an interrupted run leaves the file as it was (v0.15) |
960
960
  | `embedder install` | Fetch the built-in embedder's model (91.0 MB) into the cache directory, checking each file's SHA-256; prints the size first (v0.15) |
961
961
  | `embedder status` | The built-in embedder's model, identity and cache, and whether it's installed (v0.15) |
962
- | `snapshots` | List the restorable snapshots (one per flush) |
962
+ | `snapshots` | List the restorable snapshots (one per flush); no path needed in a git repository (v0.16.1) |
963
963
  | `restore` | Roll the database back to a past snapshot |
964
- | `thread ingest` | Save a transcript into a thread's archive (idempotent per turn). `--tool-results omit` keeps only `[tool_result ok|error, N bytes]` markers, and `--redact` replaces known secret shapes (private keys, cloud and API tokens, JWTs, recovery codes, secret-looking `NAME=value`s) with `[redacted: <kind>]` (v0.16) |
964
+ | `thread ingest` | Save a transcript into a thread's archive (idempotent per turn). `--tool-results omit` keeps only `[tool_result ok|error, N bytes]` markers, and `--redact` replaces known secret shapes (private keys, cloud and API tokens, JWTs, recovery codes, secret-looking `NAME=value`s) with `[redacted: <kind>]` (v0.16). A turn of nothing but markers (`[thinking]`, a tool call) is kept, but not embedded or recalled (v0.16.1) |
965
965
  | `onboard` | Set up the project's memory for Claude Code and Cursor: the brain (a generated key in the keychain), the model, the MCP server, the hooks and a skill or rule. Shows the plan and asks once (`--yes`, `--print`); safe to re-run; `--undo` removes what it wrote. `--guide` prints the guide (v0.16) |
966
966
  | `hook` | The hooks `onboard` installs for Claude Code and Cursor (v0.16): `session-start` adds the guide's card, the project's notes and essence, and a short recall to the context (8,000 bytes by default, `--budget` up to 9,000); `pre-compact` and `session-end` save the transcript without tool output and with secrets redacted. Always exits 0, never prompts or downloads |
967
967
  | `demo` | Self-contained end-to-end demonstration |
@@ -58,7 +58,8 @@ wrote, but never the brain or its key.
58
58
 
59
59
  **One step is for a person.** The brain's recovery code is the only way
60
60
  back in if the keychain entry is lost. `onboard` shows it only to a person
61
- at a terminal. If an agent ran `onboard`, the person runs this in a
61
+ at a terminal. Its output ends with the `human step:` lines; an agent that
62
+ ran it passes them to its user word for word. The person runs this in a
62
63
  terminal of their own and writes the code down:
63
64
 
64
65
  ```sh
@@ -849,8 +849,10 @@ pub const SAVE_BATCH: usize = 50;
849
849
  fn first_new_batch(db: &mut Mnemo, thread: &str, turns: &[ThreadTurn]) -> Option<usize> {
850
850
  let mut end = SAVE_BATCH.min(turns.len());
851
851
  loop {
852
- match db.ingest_thread_texts(thread, &turns[..end]) {
853
- Ok(t) if t.is_empty() => {}
852
+ // New turns, counted whether or not they have text to embed (a
853
+ // marker-only turn has none, and is still kept).
854
+ match db.ingest_thread_new_turns(thread, &turns[..end]) {
855
+ Ok(0) => {}
854
856
  _ => return Some(end),
855
857
  }
856
858
  if end == turns.len() {
@@ -1274,15 +1274,23 @@ pub fn run(o: Opts) -> Result<(), String> {
1274
1274
  }
1275
1275
  apply(&ctx, &items, &mut human)?
1276
1276
  };
1277
- summary(&ctx, &o, &done, &human);
1277
+ // The guide first, then the summary, so the output ends with the human
1278
+ // steps: an agent that reads only the tail still sees them (v0.16.1).
1278
1279
  if !o.undo {
1279
- println!();
1280
1280
  print!("{}", mnemo_engine::guide::markdown());
1281
1281
  }
1282
+ let steps = summary(&ctx, &o, &done, &human);
1283
+ if steps > 0 && !interactive() {
1284
+ println!(
1285
+ "mnemo: the human steps above are for the person you work for: pass them on word for \
1286
+ word"
1287
+ );
1288
+ }
1282
1289
  Ok(())
1283
1290
  }
1284
1291
 
1285
- fn summary(ctx: &Ctx, o: &Opts, done: &[String], human: &[String]) {
1292
+ /// The summary, with the human steps last. Returns how many there were.
1293
+ fn summary(ctx: &Ctx, o: &Opts, done: &[String], human: &[String]) -> usize {
1286
1294
  println!();
1287
1295
  for d in done {
1288
1296
  println!("{d}");
@@ -1327,6 +1335,7 @@ fn summary(ctx: &Ctx, o: &Opts, done: &[String], human: &[String]) {
1327
1335
  for s in &steps {
1328
1336
  println!("human step: {s}");
1329
1337
  }
1338
+ steps.len()
1330
1339
  }
1331
1340
 
1332
1341
  #[cfg(test)]
@@ -55,8 +55,11 @@ struct Cli {
55
55
 
56
56
  /// 12.2 step 1: the brain argument of the commands that may leave it out
57
57
  /// (an empty string when it was left out), or `None` for the others.
58
- /// Commands with a positional argument after the brain (`get`,
59
- /// `thread start`, `essence update|resolve|remove`) keep it required.
58
+ /// `get` takes `[PATH] <ID>` ([`shift_get_args`] moves a lone ID); the
59
+ /// other commands with a positional argument after the brain (`update`,
60
+ /// `thread start`, `essence update|resolve|remove`) keep it required, and
61
+ /// so do the ones that rewrite or replace the file (`compact`, `reembed`,
62
+ /// `restore`, `import`, `index`).
60
63
  fn brain_arg(cmd: &mut Command) -> Option<&mut String> {
61
64
  match cmd {
62
65
  Command::Init { path, .. }
@@ -71,6 +74,9 @@ fn brain_arg(cmd: &mut Command) -> Option<&mut String> {
71
74
  | Command::Export { path, .. }
72
75
  | Command::Inspect { path, .. }
73
76
  | Command::Recall { path, .. }
77
+ | Command::Get { path, .. }
78
+ | Command::Search { path, .. }
79
+ | Command::Snapshots { path, .. }
74
80
  | Command::History { path, .. }
75
81
  | Command::Serve { path, .. }
76
82
  | Command::Mcp {
@@ -92,6 +98,24 @@ fn brain_arg(cmd: &mut Command) -> Option<&mut String> {
92
98
  }
93
99
  }
94
100
 
101
+ /// v0.16.1: `get <ID>` is `get <project brain> <ID>`: a lone argument
102
+ /// moves to the ID, and must be a ULID (so a path given without its ID
103
+ /// says so, rather than being read as an id).
104
+ fn shift_get_args(cmd: &mut Command) -> std::result::Result<(), String> {
105
+ if let Command::Get { path, id, .. } = cmd {
106
+ if id.is_none() {
107
+ if parse_ulid(path).is_err() {
108
+ return Err(format!(
109
+ "`get` takes `[PATH] <ID>`: with one argument it's the memory's id, and \
110
+ {path:?} isn't one"
111
+ ));
112
+ }
113
+ *id = Some(std::mem::take(path));
114
+ }
115
+ }
116
+ Ok(())
117
+ }
118
+
95
119
  /// Fill in a brain argument that was left out with the project brain.
96
120
  /// `init` creates the brain's directory (0700); every other command needs
97
121
  /// the brain to exist. Returns whether it was left out.
@@ -463,7 +487,9 @@ enum Command {
463
487
  /// JSON array of floats, comma-separated floats, or whitespace /
464
488
  /// newline-separated floats — the parser auto-detects.
465
489
  Search {
466
- /// Path to the `.mnemo` file.
490
+ /// Path to the `.mnemo` file. Leave it out for this project's brain
491
+ /// (v0.16.1).
492
+ #[arg(default_value = "", hide_default_value = true)]
467
493
  path: String,
468
494
  /// Query vector as comma-separated floats, e.g. `0.1,0.2,0.9`.
469
495
  /// Mutually exclusive with `--query-file`.
@@ -509,10 +535,15 @@ enum Command {
509
535
  },
510
536
  /// Fetch a single memory by its ULID.
511
537
  Get {
512
- /// Path to the `.mnemo` file.
538
+ /// Path to the `.mnemo` file, then the memory's ULID. With one
539
+ /// argument it's the ULID, and the brain is this project's
540
+ /// (`<git-common-dir>/mnemo/project.mnemo`, v0.16.1), as for
541
+ /// `recall`.
542
+ #[arg(value_name = "PATH")]
513
543
  path: String,
514
- /// ULID of the memory to fetch.
515
- id: String,
544
+ /// ULID of the memory to fetch (when PATH is given).
545
+ #[arg(value_name = "ID")]
546
+ id: Option<String>,
516
547
  /// Output format.
517
548
  #[arg(long, value_enum, default_value_t = OutputFormat::Table)]
518
549
  format: OutputFormat,
@@ -859,7 +890,9 @@ enum Command {
859
890
  },
860
891
  /// List the restorable snapshots (one per committed flush).
861
892
  Snapshots {
862
- /// Path to the `.mnemo` file.
893
+ /// Path to the `.mnemo` file. Leave it out for this project's brain
894
+ /// (v0.16.1).
895
+ #[arg(default_value = "", hide_default_value = true)]
863
896
  path: String,
864
897
  #[arg(long)]
865
898
  passphrase: Option<String>,
@@ -2103,7 +2136,15 @@ fn memory_to_json(m: &Memory, include_vector: bool) -> serde_json::Value {
2103
2136
  }
2104
2137
 
2105
2138
  /// Print a single memory in the requested format.
2106
- fn print_memory(m: &Memory, format: OutputFormat, verbose: bool, include_vector: bool) {
2139
+ /// `whole` prints a table row's content in full (one `get`); lists cut it
2140
+ /// at 80 characters.
2141
+ fn print_memory(
2142
+ m: &Memory,
2143
+ format: OutputFormat,
2144
+ verbose: bool,
2145
+ include_vector: bool,
2146
+ whole: bool,
2147
+ ) {
2107
2148
  match format {
2108
2149
  OutputFormat::Table => {
2109
2150
  let id = m.id.to_string();
@@ -2145,7 +2186,11 @@ fn print_memory(m: &Memory, format: OutputFormat, verbose: bool, include_vector:
2145
2186
  m.memory_type.as_str(),
2146
2187
  m.agent_id,
2147
2188
  imp,
2148
- truncate(&m.content, 80),
2189
+ if whole {
2190
+ m.content.clone()
2191
+ } else {
2192
+ truncate(&m.content, 80)
2193
+ },
2149
2194
  );
2150
2195
  }
2151
2196
  }
@@ -2176,7 +2221,7 @@ fn print_memories(items: &[Memory], total: usize, format: OutputFormat, include_
2176
2221
  }
2177
2222
  println!("showing {} of {} memories", items.len(), total);
2178
2223
  for m in items {
2179
- print_memory(m, OutputFormat::Table, false, false);
2224
+ print_memory(m, OutputFormat::Table, false, false, false);
2180
2225
  }
2181
2226
  }
2182
2227
  OutputFormat::Json => {
@@ -2276,6 +2321,7 @@ fn run() -> std::result::Result<(), String> {
2276
2321
  if let Some(dir) = &cli.dir {
2277
2322
  std::env::set_current_dir(dir).map_err(|e| format!("-C {}: {e}", dir.display()))?;
2278
2323
  }
2324
+ shift_get_args(&mut cli.command)?;
2279
2325
  let project_brain = resolve_brain_arg(&mut cli.command, cli.dir.is_some())?;
2280
2326
  let moved = cli.dir.is_some();
2281
2327
  match cli.command {
@@ -3161,10 +3207,11 @@ fn run() -> std::result::Result<(), String> {
3161
3207
  } => {
3162
3208
  // `get` is a plain catalog lookup + record read — no writes.
3163
3209
  let pp = secret_for(&path, &pp, &None)?;
3164
- let ulid = parse_ulid(&id)?;
3210
+ let ulid = parse_ulid(id.as_deref().unwrap_or_default())?;
3165
3211
  let mut db = open_r(&path, &pp).map_err(fmt)?;
3166
3212
  let m = db.get(&ulid).map_err(fmt)?;
3167
- print_memory(&m, format, verbose, vector);
3213
+ // One memory: its whole content, even in the table.
3214
+ print_memory(&m, format, verbose, vector, true);
3168
3215
  }
3169
3216
  Command::List {
3170
3217
  path,
@@ -100,11 +100,12 @@ pub use memory::{
100
100
  CONTINUATION_TIMELINE_ENTRIES, ESSENCE_DEFAULT_RENDER_BYTES, ESSENCE_SECTION_MAX_BYTES,
101
101
  ESSENCE_TIMELINE_MAX_BYTES, ESSENCE_TRANSITIONS, FINDING_TRANSITIONS, MNEMO_META_CONTINUES,
102
102
  MNEMO_META_INVALID_AT, MNEMO_META_KEY, MNEMO_META_KIND, MNEMO_META_KIND_ESSENCE,
103
- MNEMO_META_KIND_THREAD_LINK, MNEMO_META_KIND_TURN, MNEMO_META_LENGTH, MNEMO_META_NS,
104
- MNEMO_META_PART, MNEMO_META_REFS, MNEMO_META_ROLE, MNEMO_META_SECTION, MNEMO_META_SEQ,
105
- MNEMO_META_SHA256, MNEMO_META_STATUS, MNEMO_META_STATUS_HISTORY, MNEMO_META_SUPERSEDED_BY,
106
- MNEMO_META_SUPERSEDES, MNEMO_META_THREAD, MNEMO_META_TURN_ID, MNEMO_META_UPDATED_AT,
107
- TASK_TRANSITIONS, THREAD_TOOL_RESULT_TRUNCATE_BYTES, THREAD_TURN_CHUNK_BYTES,
103
+ MNEMO_META_KIND_THREAD_LINK, MNEMO_META_KIND_TURN, MNEMO_META_LENGTH, MNEMO_META_MARKERS_ONLY,
104
+ MNEMO_META_NS, MNEMO_META_PART, MNEMO_META_REFS, MNEMO_META_ROLE, MNEMO_META_SECTION,
105
+ MNEMO_META_SEQ, MNEMO_META_SHA256, MNEMO_META_STATUS, MNEMO_META_STATUS_HISTORY,
106
+ MNEMO_META_SUPERSEDED_BY, MNEMO_META_SUPERSEDES, MNEMO_META_THREAD, MNEMO_META_TURN_ID,
107
+ MNEMO_META_UPDATED_AT, TASK_TRANSITIONS, THREAD_TOOL_RESULT_TRUNCATE_BYTES,
108
+ THREAD_TURN_CHUNK_BYTES,
108
109
  };
109
110
  pub use result_cache::{
110
111
  CacheBudget, CacheFlushPolicy, CachePutOpts, CacheStats, CachedValue, SemanticCachePutOpts,
@@ -319,6 +319,16 @@ pub const MNEMO_META_LENGTH: &str = "_mnemo.length";
319
319
  /// Marker value for `_mnemo.kind` on thread-turn records.
320
320
  pub const MNEMO_META_KIND_TURN: &str = "turn";
321
321
 
322
+ /// v0.16.1: `true` on a turn whose content is only the markers a
323
+ /// transcript reader makes for blocks it doesn't keep (`[thinking]`,
324
+ /// `[tool_use name=…]`, `[tool_result ok, N bytes]`, `[image]`). Such a
325
+ /// turn is kept in the thread, so `thread export` shows the whole flow,
326
+ /// but it isn't embedded (it carries the sentinel vector) and `recall`
327
+ /// never returns it, since it would match any query weakly. `recall`
328
+ /// leaves out a marker-only turn written before v0.16.1 too, by its
329
+ /// content.
330
+ pub const MNEMO_META_MARKERS_ONLY: &str = "_mnemo.markers_only";
331
+
322
332
  /// Maximum content size for a single turn record before chunking kicks
323
333
  /// in (Phase 12.7a). 8 KB per chunk keeps each record small enough
324
334
  /// that the per-record page cost dominates — and so that a thread of
@@ -48,10 +48,10 @@ use crate::memory::{
48
48
  CONTINUATION_TIMELINE_ENTRIES, ESSENCE_DEFAULT_RENDER_BYTES, ESSENCE_TRANSITIONS,
49
49
  MNEMO_META_CONTINUES, MNEMO_META_INVALID_AT, MNEMO_META_KEY, MNEMO_META_KIND,
50
50
  MNEMO_META_KIND_ESSENCE, MNEMO_META_KIND_THREAD_LINK, MNEMO_META_KIND_TURN, MNEMO_META_LENGTH,
51
- MNEMO_META_PART, MNEMO_META_REFS, MNEMO_META_ROLE, MNEMO_META_SECTION, MNEMO_META_SEQ,
52
- MNEMO_META_SHA256, MNEMO_META_STATUS, MNEMO_META_STATUS_HISTORY, MNEMO_META_SUPERSEDED_BY,
53
- MNEMO_META_SUPERSEDES, MNEMO_META_THREAD, MNEMO_META_TURN_ID, MNEMO_META_UPDATED_AT,
54
- THREAD_TOOL_RESULT_TRUNCATE_BYTES, THREAD_TURN_CHUNK_BYTES,
51
+ MNEMO_META_MARKERS_ONLY, MNEMO_META_PART, MNEMO_META_REFS, MNEMO_META_ROLE, MNEMO_META_SECTION,
52
+ MNEMO_META_SEQ, MNEMO_META_SHA256, MNEMO_META_STATUS, MNEMO_META_STATUS_HISTORY,
53
+ MNEMO_META_SUPERSEDED_BY, MNEMO_META_SUPERSEDES, MNEMO_META_THREAD, MNEMO_META_TURN_ID,
54
+ MNEMO_META_UPDATED_AT, THREAD_TOOL_RESULT_TRUNCATE_BYTES, THREAD_TURN_CHUNK_BYTES,
55
55
  };
56
56
  use crate::pager::{LockedFile, Pager};
57
57
  use crate::result_cache::{
@@ -1319,6 +1319,41 @@ fn written_after_index(e: &CatalogEntry, v9: bool, index_start: u64, index_gen:
1319
1319
  /// Whether a record belongs in the ANN index: facts only. Thread-archive
1320
1320
  /// turns, essence items and thread links are read by kind and scope, never
1321
1321
  /// by similarity, so they stay out (R-004.2).
1322
+ /// v0.16.1: a thread turn whose content is only transcript markers
1323
+ /// ([`MNEMO_META_MARKERS_ONLY`]), by its flag or, for one saved before the
1324
+ /// flag, by its content.
1325
+ pub(super) fn is_markers_only_turn(m: &Memory) -> bool {
1326
+ meta_str(m, MNEMO_META_KIND) == Some(MNEMO_META_KIND_TURN)
1327
+ && (m.metadata.get(MNEMO_META_MARKERS_ONLY) == Some(&Value::Bool(true))
1328
+ || crate::transcript::is_marker_only(&m.content))
1329
+ }
1330
+
1331
+ #[cfg(test)]
1332
+ #[test]
1333
+ fn a_marker_only_turn_saved_before_the_flag_is_recognised_by_its_content() {
1334
+ let turn = |content: &str| {
1335
+ let mut m = Memory::new(content, MemoryType::Episodic, vec![1.0]);
1336
+ m.metadata.insert(
1337
+ MNEMO_META_KIND.into(),
1338
+ Value::String(MNEMO_META_KIND_TURN.into()),
1339
+ );
1340
+ m
1341
+ };
1342
+ assert!(is_markers_only_turn(&turn("[thinking]")));
1343
+ assert!(is_markers_only_turn(&turn(
1344
+ "[tool_use name=mcp__mnemo__remember]"
1345
+ )));
1346
+ assert!(!is_markers_only_turn(&turn(
1347
+ "staging-7\n[tool_use name=Bash]"
1348
+ )));
1349
+ // Only turns: a fact that reads like a marker is a fact.
1350
+ assert!(!is_markers_only_turn(&Memory::new(
1351
+ "[thinking]",
1352
+ MemoryType::Semantic,
1353
+ vec![1.0]
1354
+ )));
1355
+ }
1356
+
1322
1357
  fn is_ann_kind(m: &Memory) -> bool {
1323
1358
  !matches!(
1324
1359
  m.metadata.get(MNEMO_META_KIND).and_then(|v| v.as_str()),
@@ -389,6 +389,13 @@ impl Mnemo {
389
389
  if !req.filter.is_empty() && !req.filter.matches(&m) {
390
390
  continue;
391
391
  }
392
+ // v0.16.1: a turn of nothing but markers (`[thinking]`, a
393
+ // tool call) is never a recall hit, whatever the filter: it
394
+ // would match any query weakly. Its content decides, so a turn
395
+ // saved before v0.16.1 is left out too.
396
+ if is_markers_only_turn(&m) {
397
+ continue;
398
+ }
392
399
  // Phase 12.7: default-exclude the thread layers from fact
393
400
  // recall: archive turns (12.7a), essence items (12.7b; read
394
401
  // by scope through the render, not by similarity) and
@@ -13,6 +13,9 @@ pub(super) struct PendingTurn {
13
13
  /// tool-result turn. Applied to the single chunk the truncation
14
14
  /// yielded.
15
15
  pub(super) truncation: Option<(String, u64)>,
16
+ /// v0.16.1: only markers ([`crate::transcript::is_marker_only`]): kept,
17
+ /// with the sentinel vector, not embedded.
18
+ pub(super) markers_only: bool,
16
19
  }
17
20
 
18
21
  /// Output of `Mnemo::plan_ingest`: the turns to write, the first free
@@ -25,16 +28,22 @@ pub(super) struct IngestPlan {
25
28
  }
26
29
 
27
30
  impl IngestPlan {
28
- /// Every text to embed, in write order (turns, then parts).
31
+ /// Every text to embed, in write order (turns, then parts). A
32
+ /// marker-only turn has none.
29
33
  pub(super) fn texts(&self) -> Vec<&str> {
30
34
  self.pending
31
35
  .iter()
36
+ .filter(|p| !p.markers_only)
32
37
  .flat_map(|p| p.parts.iter().map(String::as_str))
33
38
  .collect()
34
39
  }
35
40
 
36
41
  pub(super) fn text_count(&self) -> usize {
37
- self.pending.iter().map(|p| p.parts.len()).sum()
42
+ self.pending
43
+ .iter()
44
+ .filter(|p| !p.markers_only)
45
+ .map(|p| p.parts.len())
46
+ .sum()
38
47
  }
39
48
  }
40
49
 
@@ -114,7 +123,9 @@ impl Mnemo {
114
123
  /// **Embedding.** An embedder must be registered
115
124
  /// ([`Mnemo::set_embedder`]); the content strings (one per
116
125
  /// resulting chunk / truncated record) are batched into a single
117
- /// `embed()` call.
126
+ /// `embed()` call. A turn of nothing but transcript markers
127
+ /// ([`MNEMO_META_MARKERS_ONLY`], v0.16.1) isn't embedded: it's kept
128
+ /// with the sentinel vector, and `recall` never returns it.
118
129
  ///
119
130
  /// Call `self.flush()` after a successful ingest to persist.
120
131
  pub fn ingest_thread(&mut self, thread_id: &str, turns: &[ThreadTurn]) -> Result<IngestReport> {
@@ -127,19 +138,34 @@ impl Mnemo {
127
138
  }
128
139
  // Batched embed: one round trip to the embedder for the whole
129
140
  // ingest, whatever the turn count.
130
- let vectors = {
141
+ let texts = plan.texts();
142
+ let vectors = if texts.is_empty() {
143
+ Vec::new()
144
+ } else {
131
145
  let embedder = self.embedder.as_ref().ok_or_else(|| {
132
146
  MnemoError::Invalid(
133
147
  "ingest_thread: no embedder registered on this handle; call set_embedder first"
134
148
  .into(),
135
149
  )
136
150
  })?;
137
- embedder.embed(&plan.texts())?
151
+ embedder.embed(&texts)?
138
152
  };
139
153
  self.check_vectors("ingest_thread", &vectors, plan.text_count())?;
140
154
  self.apply_ingest(thread_id, plan, vectors, None)
141
155
  }
142
156
 
157
+ /// v0.16.1: how many of `turns` aren't in `thread_id` yet, and would be
158
+ /// written by an ingest. Unlike [`Mnemo::ingest_thread_texts`], it
159
+ /// counts a marker-only turn, which has no text to embed. Writes
160
+ /// nothing.
161
+ pub fn ingest_thread_new_turns(
162
+ &mut self,
163
+ thread_id: &str,
164
+ turns: &[ThreadTurn],
165
+ ) -> Result<usize> {
166
+ Ok(self.plan_ingest(thread_id, turns)?.pending.len())
167
+ }
168
+
143
169
  /// MOBILE-1a: the texts [`Mnemo::ingest_thread`] would embed for
144
170
  /// `turns`, in order (one per new chunk or truncated record; turns
145
171
  /// already in the thread are skipped). With
@@ -304,6 +330,7 @@ impl Mnemo {
304
330
  turn_id: t.turn_id.clone(),
305
331
  role: t.role.clone(),
306
332
  created_at: t.timestamp.unwrap_or(now),
333
+ markers_only: crate::transcript::is_marker_only(&t.content),
307
334
  parts,
308
335
  truncation,
309
336
  });
@@ -334,13 +361,18 @@ impl Mnemo {
334
361
  // gets a single `_mnemo.seq` slot, so `_mnemo.part`
335
362
  // disambiguates chunks of the same turn.
336
363
  let mut vectors = vectors.into_iter();
364
+ let sentinel = self.sentinel_vector();
337
365
  for p in &pending {
338
366
  let this_seq = next_seq;
339
367
  next_seq += 1;
340
368
  for (part_idx, part_text) in p.parts.iter().enumerate() {
341
- let vec = vectors.next().ok_or_else(|| {
342
- MnemoError::Invalid("ingest_thread: ran out of vectors".into())
343
- })?;
369
+ let vec = if p.markers_only {
370
+ sentinel.clone()
371
+ } else {
372
+ vectors.next().ok_or_else(|| {
373
+ MnemoError::Invalid("ingest_thread: ran out of vectors".into())
374
+ })?
375
+ };
344
376
  let mut m =
345
377
  Memory::new(part_text.clone(), MemoryType::Episodic, vec).with_importance(0.5);
346
378
  if let Some(t) = ttl {
@@ -368,6 +400,10 @@ impl Mnemo {
368
400
  Value::Number((part_idx as u64).into()),
369
401
  );
370
402
  }
403
+ if p.markers_only {
404
+ m.metadata
405
+ .insert(MNEMO_META_MARKERS_ONLY.into(), Value::Bool(true));
406
+ }
371
407
  if let Some((sha, len)) = &p.truncation {
372
408
  m.metadata
373
409
  .insert(MNEMO_META_SHA256.into(), Value::String(sha.clone()));
@@ -298,6 +298,49 @@ fn flatten_blocks(blocks: &[Value], tool_results: ToolResults) -> String {
298
298
  out
299
299
  }
300
300
 
301
+ /// v0.16.1: whether `content` is only the markers [`flatten_blocks`] makes
302
+ /// for blocks it doesn't keep, one per line: `[tool_use name=…]`,
303
+ /// `[tool_result ok|error]`, `[tool_result ok|error, N bytes]`, `[image]`,
304
+ /// or `[<type>]` for any other block type (`[thinking]`,
305
+ /// `[redacted_thinking]`). Empty lines don't count; anything else (any
306
+ /// text, or a tool result kept in full) does. Empty content isn't
307
+ /// marker-only.
308
+ pub(crate) fn is_marker_only(content: &str) -> bool {
309
+ let mut any = false;
310
+ for line in content.lines() {
311
+ let l = line.trim();
312
+ if l.is_empty() {
313
+ continue;
314
+ }
315
+ if !is_marker(l) {
316
+ return false;
317
+ }
318
+ any = true;
319
+ }
320
+ any
321
+ }
322
+
323
+ fn is_marker(l: &str) -> bool {
324
+ let Some(inner) = l.strip_prefix('[').and_then(|r| r.strip_suffix(']')) else {
325
+ return false;
326
+ };
327
+ if let Some(name) = inner.strip_prefix("tool_use name=") {
328
+ return !name.is_empty() && !name.contains([']', '[', ' ']);
329
+ }
330
+ if let Some(rest) = inner.strip_prefix("tool_result ") {
331
+ let (status, size) = match rest.split_once(", ") {
332
+ Some((s, n)) => (s, Some(n)),
333
+ None => (rest, None),
334
+ };
335
+ return matches!(status, "ok" | "error")
336
+ && size.is_none_or(|n| {
337
+ n.strip_suffix(" bytes")
338
+ .is_some_and(|d| !d.is_empty() && d.bytes().all(|b| b.is_ascii_digit()))
339
+ });
340
+ }
341
+ !inner.is_empty() && inner.bytes().all(|b| b.is_ascii_lowercase() || b == b'_')
342
+ }
343
+
301
344
  /// Minimal ISO 8601 parser — enough for Claude Code's
302
345
  /// `"2026-11-07T01:23:45.678Z"` shape. Returns unix seconds when the
303
346
  /// string parses cleanly; `None` otherwise (the caller falls back to
@@ -338,6 +381,37 @@ fn days_from_civil(y: i64, m: u32, d: u32) -> i64 {
338
381
  mod tests {
339
382
  use super::*;
340
383
 
384
+ /// v0.16.1.
385
+ #[test]
386
+ fn marker_only_content() {
387
+ for yes in [
388
+ "[thinking]",
389
+ "[redacted_thinking]\n[tool_use name=Read]",
390
+ "[tool_use name=mcp__mnemo__remember]",
391
+ "[tool_result ok, 30 bytes]",
392
+ "[tool_result error]",
393
+ "\n[image]\n\n [tool_result ok, 0 bytes] \n",
394
+ ] {
395
+ assert!(is_marker_only(yes), "{yes:?}");
396
+ }
397
+ for no in [
398
+ "",
399
+ " \n",
400
+ "It deploys to staging-7.\n[tool_use name=Bash]",
401
+ "[tool_result ok] the whole body, kept in full",
402
+ "[tool_result maybe, 3 bytes]",
403
+ "[tool_result ok, many bytes]",
404
+ "[Thinking]",
405
+ "[see the docs]",
406
+ "[]",
407
+ "[tool_use name=]",
408
+ "a [thinking] b",
409
+ "[thinking] ok",
410
+ ] {
411
+ assert!(!is_marker_only(no), "{no:?}");
412
+ }
413
+ }
414
+
341
415
  #[test]
342
416
  fn jsonl_generic_round_trip() {
343
417
  let src = r#"
@@ -1251,7 +1251,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
1251
1251
 
1252
1252
  [[package]]
1253
1253
  name = "mnemo-engine"
1254
- version = "0.16.0"
1254
+ version = "0.16.1"
1255
1255
  dependencies = [
1256
1256
  "aes-gcm",
1257
1257
  "apple-native-keyring-store",
@@ -1285,7 +1285,7 @@ dependencies = [
1285
1285
 
1286
1286
  [[package]]
1287
1287
  name = "mnemo-python"
1288
- version = "0.16.0"
1288
+ version = "0.16.1"
1289
1289
  dependencies = [
1290
1290
  "mnemo-engine",
1291
1291
  "pyo3",
@@ -4,7 +4,7 @@
4
4
  # fields below are still useful for `cargo publish --dry-run` to lint
5
5
  # cleanly and for `cargo doc` to render coherently.
6
6
  name = "mnemo-python"
7
- version = "0.16.0"
7
+ version = "0.16.1"
8
8
  edition = "2021"
9
9
  rust-version = "1.94"
10
10
  description = "Python (PyO3) bindings for the Mnemo encrypted agent-memory engine; built by maturin into the mnemo-engine wheel on PyPI"
@@ -15,7 +15,7 @@ build-backend = "maturin"
15
15
  # sites unchanged). See the "Breaking: import name" section in
16
16
  # CHANGELOG.md for the full migration.
17
17
  name = "mnemo-engine"
18
- version = "0.16.0"
18
+ version = "0.16.1"
19
19
  description = "Encrypted, portable agent-memory engine — Python bindings"
20
20
  readme = "README.md"
21
21
  requires-python = ">=3.8"
File without changes