mnemo-engine 0.17.0__tar.gz → 0.17.2__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 (92) hide show
  1. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/PKG-INFO +1 -1
  2. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/Cargo.lock +3 -3
  3. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/Cargo.toml +1 -1
  4. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/README.md +8 -4
  5. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/guide/guide.md +7 -6
  6. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo/hook.rs +121 -4
  7. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo/onboard.rs +989 -125
  8. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo.rs +23 -5
  9. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/builtin.rs +222 -17
  10. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/keys/mod.rs +62 -0
  11. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/mcp/context.rs +12 -4
  12. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/mcp.rs +43 -16
  13. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/memory.rs +4 -0
  14. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/coordination.rs +109 -4
  15. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/records.rs +7 -0
  16. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo-python/Cargo.lock +2 -2
  17. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo-python/Cargo.toml +1 -1
  18. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/pyproject.toml +1 -1
  19. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/README.md +0 -0
  20. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/.gitignore +0 -0
  21. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/benches/corpus.rs +0 -0
  22. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/build.rs +0 -0
  23. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/deny.toml +0 -0
  24. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/ann_defaults_v0_6_0.rs +0 -0
  25. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/ann_diagnose.rs +0 -0
  26. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/ann_recall_grid.rs +0 -0
  27. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/ann_recall_grid_v2.rs +0 -0
  28. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/candle_hard.rs +0 -0
  29. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/embedder_server.py +0 -0
  30. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/file_size_breakdown.rs +0 -0
  31. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/open_rss.rs +0 -0
  32. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/quickstart.rs +0 -0
  33. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/ranking_v2.rs +0 -0
  34. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/session.rs +0 -0
  35. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/shared_bench.rs +0 -0
  36. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/examples/thread_profile.rs +0 -0
  37. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo/export.rs +0 -0
  38. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo/inspect.html +0 -0
  39. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo/inspect.rs +0 -0
  40. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo/mcp_install.rs +0 -0
  41. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/bin/mnemo/project.rs +0 -0
  42. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/cache.rs +0 -0
  43. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/crypto.rs +0 -0
  44. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/embed.rs +0 -0
  45. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/embed_cmd.rs +0 -0
  46. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/error.rs +0 -0
  47. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/format.rs +0 -0
  48. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/freelist.rs +0 -0
  49. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/guide.rs +0 -0
  50. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/ident.rs +0 -0
  51. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/index.rs +0 -0
  52. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/keys/display.rs +0 -0
  53. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/keys/os_store.rs +0 -0
  54. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/keys/recovery.rs +0 -0
  55. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/keyslot.rs +0 -0
  56. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/lib.rs +0 -0
  57. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/pager.rs +0 -0
  58. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/redact.rs +0 -0
  59. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/result_cache.rs +0 -0
  60. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/session.rs +0 -0
  61. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/shared/call.rs +0 -0
  62. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/shared/fscheck.rs +0 -0
  63. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/shared/lock.rs +0 -0
  64. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/shared/mod.rs +0 -0
  65. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/shared/presence.rs +0 -0
  66. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/shared/sidecar.rs +0 -0
  67. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/ann.rs +0 -0
  68. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/cache_api.rs +0 -0
  69. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/continuation.rs +0 -0
  70. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/crud.rs +0 -0
  71. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/essence.rs +0 -0
  72. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/flush.rs +0 -0
  73. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/header_graft_tests.rs +0 -0
  74. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/hooks.rs +0 -0
  75. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/keyed.rs +0 -0
  76. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/load.rs +0 -0
  77. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/maintenance.rs +0 -0
  78. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/mod.rs +0 -0
  79. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/open.rs +0 -0
  80. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/recall.rs +0 -0
  81. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/shared.rs +0 -0
  82. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/snapshots.rs +0 -0
  83. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/store/threads.rs +0 -0
  84. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/text.rs +0 -0
  85. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/transcript.rs +0 -0
  86. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/veccol.rs +0 -0
  87. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo/src/wal.rs +0 -0
  88. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo-python/.gitignore +0 -0
  89. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo-python/README.md +0 -0
  90. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo-python/src/lib.rs +0 -0
  91. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/mnemo-python/test_mnemo.py +0 -0
  92. {mnemo_engine-0.17.0 → mnemo_engine-0.17.2}/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.17.0
3
+ Version: 0.17.2
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.17.0"
1523
+ version = "0.17.2"
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.17.0"
1564
+ version = "0.17.2"
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.17.0"
1574
+ version = "0.17.2"
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.17.0"
13
+ version = "0.17.2"
14
14
  edition = "2021"
15
15
  rust-version = "1.94"
16
16
  # `benches/corpus.rs` is a shared helper module pulled into real benches
@@ -107,8 +107,9 @@ which would leak into shell history and process listings). Tools exposed:
107
107
  `MNEMO_ROLE`; `visibility` for private ones), `task` (the shared work queue: `next`, `update`, `add`,
108
108
  `list`, `get`) and `claim` (`take`, `renew`, `release`, `check`, `who`). A
109
109
  `serve --mcp --shared` with `MNEMO_AGENT` holds that agent's presence lock
110
- in the sidecar directory for its life, so `who` sees it alive; it never
111
- holds the brain's lock between calls. Since v0.17, `recall` and `about` take `visibility` (private records only when asked), and `about` with `stale: true` lists the stale records. Every mutation flushes before
110
+ in the sidecar directory for its life, and since v0.17.2 writes its
111
+ presence record at start, so `who` sees it alive before its first call; it
112
+ never holds the brain's lock between calls. Since v0.17, `recall` and `about` take `visibility` (private records only when asked), and `about` with `stale: true` lists the stale records. Every mutation flushes before
112
113
  returning.
113
114
 
114
115
  With no `--embed-cmd`, the server embeds `text` with the built-in embedder
@@ -139,7 +140,7 @@ On `initialize`, the server sends the guide's card as its `instructions`
139
140
 
140
141
  | Resource | What it holds | Limit |
141
142
  |---|---|---|
142
- | `mnemo://about` | The card, then the brain's briefing (the manifest and onboarding memories) and the project essence | 8,000 bytes |
143
+ | `mnemo://about` | The card, then the counts (as `mnemo about`'s header, since v0.17.2), the brain's briefing (the manifest and onboarding memories) and the project essence | 8,000 bytes |
143
144
  | `mnemo://recent` | The 20 most recently written memories, newest first, a line each | 6,000 bytes |
144
145
  | `mnemo://guide` | The whole guide | Its size |
145
146
  | `mnemo://key/{key}` (a template) | A key's live value, then its earlier versions | 4,000 bytes |
@@ -391,6 +392,9 @@ mnemo cache purge agent.mnemo --ns llm --expired
391
392
  mnemo cache delete agent.mnemo --ns llm --key prompt-42
392
393
  ```
393
394
 
395
+ Since v0.17.2 the path may be left out in a git repository, as with `get`:
396
+ `mnemo cache get --ns llm --key prompt-42` uses this project's brain.
397
+
394
398
  **MCP:** `mnemo serve --mcp` exposes `cache_put`, `cache_get`,
395
399
  `cache_stats`, `cache_put_semantic`, and `cache_get_semantic` as
396
400
  tools (Phase 10.4) — any MCP-compatible agent can drive the cache
@@ -1002,7 +1006,7 @@ cargo run --bin mnemo -- <command>
1002
1006
  | `snapshots` | List the restorable snapshots (one per flush); no path needed in a git repository (v0.16.1) |
1003
1007
  | `restore` | Roll the database back to a past snapshot |
1004
1008
  | `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) |
1005
- | `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). Since v0.17 it writes the per-turn hook too, and `--wake stop` adds the Stop continuation (`--wake off` removes it; a re-run keeps what an earlier one chose) |
1009
+ | `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). At a terminal (v0.17.1), each item is one line tagged like a boot log (`[ OK ]`, `[ ADDED ]`, `[UPDATED]`, ...), after a plan in the future tense when it asks first, and the guide is a pointer; run by an agent, the output is unchanged. Since v0.17 it writes the per-turn hook too, and `--wake stop` adds the Stop continuation (`--wake off` removes it; a re-run keeps what an earlier one chose) |
1006
1010
  | `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. Since v0.17, `user-prompt` (Claude Code's `UserPromptSubmit`, Cursor's `postToolUse` at most once a minute) shows what's new for `MNEMO_AGENT`/`MNEMO_ROLE`: unread messages, tasks ready for the role, its task claims about to lapse, after the framing line and escaped, at most 600 bytes, then marks them seen; an unchanged turn reads only the file's first page (no key, no open). `stop` (written by `onboard --wake stop`) keeps an agent going for a pre-approved task or a message to it by id, within the wake-up guardrails, never twice in a row. Always exits 0, never prompts or downloads |
1007
1011
  | `wake pause\|resume\|status` | The wake-up kill switch for every session of the brain (on the manifest). Paused, nothing wakes an agent (`MNEMO_WAKE=off` does it for one session); the per-turn hook and the brief still show its work. `status` also shows the `crossSessionInbound` settings it finds (keep `accept`). The guardrails: 12 wake-ups per agent an hour, 60 s apart, none for a burst of 8 messages between two agents in 10 minutes or an explicit reply past 8 hops (v0.17) |
1008
1012
  | `demo` | Self-contained end-to-end demonstration |
@@ -60,9 +60,9 @@ wrote, but never the brain or its key.
60
60
 
61
61
  **One step is for a person.** The brain's recovery code is the only way
62
62
  back in if the keychain entry is lost. `onboard` shows it only to a person
63
- at a terminal. Its output ends with the `human step:` lines; an agent that
64
- ran it passes them to its user word for word. The person runs this in a
65
- terminal of their own and writes the code down:
63
+ at a terminal. Run by an agent, its output ends with the `human step:`
64
+ lines, which the agent passes to its user word for word. The person runs
65
+ this in a terminal of their own and writes the code down:
66
66
 
67
67
  ```sh
68
68
  mnemo recovery-code
@@ -378,11 +378,12 @@ of one.
378
378
 
379
379
  - **Every turn:** the `user-prompt` hook adds a short line when something
380
380
  is new for you (a message, a task ready for your role, a claim of yours
381
- about to lapse), and nothing otherwise. Cursor runs it after a tool
382
- call, at most once a minute.
381
+ about to lapse, a task you added that's `ready` for your `done`), and
382
+ nothing otherwise. Cursor runs it after a tool call, at most once a
383
+ minute.
383
384
  - **When a turn ends,** with `onboard --wake stop`: the Stop hook keeps
384
385
  you going for a pre-approved task for your role or a message to you by
385
- name. It's off by default.
386
+ name, never for a task that waits for your `done`. It's off by default.
386
387
  - **In Claude Code, wake a peer yourself:** after you post or add a task,
387
388
  send the session a short pointer with Claude Code's `SendMessage` ("new
388
389
  work in your inbox"). The inbox is the record, and the message is only
@@ -399,12 +399,26 @@ const NO_KEY: &str = "mnemo: this brain's key isn't available here (`mnemo unloc
399
399
  const BUSY: &str = "mnemo: the brain was busy; call the `about` tool";
400
400
  const BAD_ID: &str = "mnemo: the session id isn't one this hook accepts";
401
401
 
402
- /// The brain's secret from the key sources, never a prompt.
402
+ /// The brain's secret from the key sources, never a prompt. A keychain
403
+ /// that refuses, or keeps it waiting, is named (KEYCHAIN-REPROMPT), apart
404
+ /// from a key that isn't there.
403
405
  fn secret(path: &Path) -> Result<Secret, String> {
404
406
  use mnemo_engine::keys::{self, Resolution};
405
407
  let store = keys::default_store();
406
- match keys::resolve(path, store.as_deref(), keys::SERVER_COMMAND_TIMEOUT) {
408
+ let waiting = keys::SlowStoreNote::after(keys::SLOW_STORE_NOTE_AFTER, "mnemo: ");
409
+ let r = keys::resolve(path, store.as_deref(), keys::SERVER_COMMAND_TIMEOUT);
410
+ drop(waiting);
411
+ match r {
407
412
  Ok(Resolution::Found(r)) => Ok(r.secret),
413
+ Err(e) if keys::is_store_error(&e) => {
414
+ let note = format!(
415
+ "mnemo: the keychain didn't give this brain's key ({}); {}",
416
+ one_line(&e.to_string()),
417
+ keys::KEYCHAIN_ALLOW_HINT
418
+ );
419
+ eprintln!("{note}");
420
+ Err(note)
421
+ }
408
422
  _ => Err(NO_KEY.into()),
409
423
  }
410
424
  }
@@ -678,6 +692,27 @@ fn your_work(db: &mut Mnemo) -> String {
678
692
  }
679
693
  }
680
694
  }
695
+ // READY-NOTICE: tasks it created that wait for its `done`.
696
+ if let Some(a) = &agent {
697
+ if let Ok(ts) = db.tasks(Some(mnemo_engine::task_status::READY), None) {
698
+ let mine: Vec<String> = ts
699
+ .iter()
700
+ .filter(|t| &t.creator == a)
701
+ .map(|t| format!("- {}: {}", esc(&t.slug), esc(&t.title)))
702
+ .collect();
703
+ if !mine.is_empty() {
704
+ sections.push((
705
+ format!(
706
+ "{} of your tasks {} for your done (call `task` with `list`, then \
707
+ `update --status done`):",
708
+ mine.len(),
709
+ plural(mine.len(), "waits", "wait")
710
+ ),
711
+ mine,
712
+ ));
713
+ }
714
+ }
715
+ }
681
716
  // Its own tasks' claims about to lapse.
682
717
  if let Some(a) = &agent {
683
718
  if let Ok(claims) = db.claims() {
@@ -988,16 +1023,55 @@ pub fn turn_text(work: &mnemo_engine::NewWork, now: i64) -> String {
988
1023
  "claims lapsing soon",
989
1024
  ));
990
1025
  }
1026
+ if !work.ready_for_done.is_empty() {
1027
+ counts.push(n(
1028
+ work.ready_for_done.len(),
1029
+ "task ready for your `done`",
1030
+ "tasks ready for your `done`",
1031
+ ));
1032
+ }
1033
+ // What to call, for only what the counts hold (ONBOARD-UX).
1034
+ let mut calls = Vec::new();
1035
+ let it = |k: usize, one: &'static str, many: &'static str| if k == 1 { one } else { many };
1036
+ if !work.messages.is_empty() {
1037
+ calls.push(format!(
1038
+ "Call `inbox` to read {}.",
1039
+ it(work.messages.len(), "it", "them")
1040
+ ));
1041
+ }
1042
+ if !work.tasks.is_empty() {
1043
+ calls.push(format!(
1044
+ "Call `task` with `next` to take {}.",
1045
+ it(work.tasks.len(), "it", "one")
1046
+ ));
1047
+ }
1048
+ if !work.lapsing.is_empty() {
1049
+ calls.push(format!(
1050
+ "Update the task with `task` to renew {}.",
1051
+ it(work.lapsing.len(), "its claim", "their claims")
1052
+ ));
1053
+ }
1054
+ // READY-NOTICE: fixed text; the slugs are items, after the framing.
1055
+ if !work.ready_for_done.is_empty() {
1056
+ calls.push("Call `task` with `list`, then `update --status done`.".to_string());
1057
+ }
991
1058
  let head = format!(
992
- "mnemo: new for you: {}. Call `inbox` or `task` (with `next`, or an update to renew a \
993
- claim).\n{}",
1059
+ "mnemo: new for you: {}. {}\n{}",
994
1060
  counts.join(", "),
1061
+ calls.join(" "),
995
1062
  guide::FRAMING
996
1063
  );
997
1064
  let mut items: Vec<String> = Vec::new();
998
1065
  for t in &work.tasks {
999
1066
  items.push(format!("- task {}: {}", esc(&t.slug), esc(&t.title)));
1000
1067
  }
1068
+ for t in &work.ready_for_done {
1069
+ items.push(format!(
1070
+ "- ready for your done: {}: {}",
1071
+ esc(&t.slug),
1072
+ esc(&t.title)
1073
+ ));
1074
+ }
1001
1075
  for c in &work.lapsing {
1002
1076
  items.push(format!(
1003
1077
  "- your claim {} lapses in {} min",
@@ -1446,6 +1520,49 @@ pub fn redaction_note(counts: &[(&'static str, usize)]) -> Option<String> {
1446
1520
  mod tests {
1447
1521
  use super::*;
1448
1522
 
1523
+ /// ONBOARD-UX: the per-turn line asks for only what its counts hold.
1524
+ #[test]
1525
+ fn the_turn_line_names_only_what_is_new() {
1526
+ let msg = |s: &str| mnemo_engine::Message {
1527
+ id: ulid::Ulid::nil(),
1528
+ to: "worker-a".into(),
1529
+ from: "user".into(),
1530
+ subject: s.into(),
1531
+ body: String::new(),
1532
+ refs: Vec::new(),
1533
+ conversation: String::new(),
1534
+ hops: 0,
1535
+ status: "open".into(),
1536
+ delivery: String::new(),
1537
+ created_at: 0,
1538
+ acked_at: None,
1539
+ };
1540
+ let claim = mnemo_engine::Claim {
1541
+ topic: "task:ship".into(),
1542
+ holder: "worker-a".into(),
1543
+ expires_at: 600,
1544
+ lease: 900,
1545
+ };
1546
+ let head = |w: &mnemo_engine::NewWork| turn_text(w, 0).lines().next().unwrap().to_string();
1547
+ let w = mnemo_engine::NewWork {
1548
+ messages: vec![msg("hello")],
1549
+ ..Default::default()
1550
+ };
1551
+ assert_eq!(
1552
+ head(&w),
1553
+ "mnemo: new for you: 1 message. Call `inbox` to read it."
1554
+ );
1555
+ let w = mnemo_engine::NewWork {
1556
+ lapsing: vec![claim.clone(), claim],
1557
+ ..Default::default()
1558
+ };
1559
+ assert_eq!(
1560
+ head(&w),
1561
+ "mnemo: new for you: 2 claims lapsing soon. Update the task with `task` to renew \
1562
+ their claims."
1563
+ );
1564
+ }
1565
+
1449
1566
  #[test]
1450
1567
  fn session_ids() {
1451
1568
  for ok in ["abc", "0f8e-11.x_Y", &"a".repeat(128)] {