sumo-agents 0.6.1 → 0.7.0

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.
package/src/cli.mjs CHANGED
@@ -3,28 +3,27 @@ import { StringDecoder } from 'node:string_decoder';
3
3
  import { createInterface } from 'node:readline';
4
4
  import { applyOps } from './apply.mjs';
5
5
  import { card } from './card.mjs';
6
- import { discoverModels, knownModel, MODEL_IDS, modelLines, setModel } from './catalog.mjs';
6
+ import { knownModel, MODEL_IDS, modelLines } from './catalog.mjs';
7
7
  import { openDb } from './db.mjs';
8
- import { backup, damaged, exportJson, exportMarkdown, liveDatabase, purgeFromBackups, restoreCandidate, restoreHint, restoreLines, restoreQuestion } from './export.mjs';
8
+ import { backup, damaged, exportJson, exportMarkdown, liveDatabase, purgeFromBackups, purgeRowFromBackups, restoreCandidate, restoreHint, restoreLines, restoreQuestion } from './export.mjs';
9
9
  import { resolveAnthropicCredential } from './auth.mjs';
10
10
  import { costLines } from './cost.mjs';
11
11
  import { runHook } from './hooks.mjs';
12
12
  import * as jobs from './jobs.mjs';
13
13
  import * as memory from './memory.mjs';
14
14
  import { NeedsCredential, Refusal, UsageError } from './memory.mjs';
15
- import { prime } from './prime.mjs';
15
+ import { noteUsedFrom, prime } from './prime.mjs';
16
16
  import * as projects from './projects.mjs';
17
- import { detail, historyLine, line, scopeLabel } from './render.mjs';
18
- import { memoryStatus, passLines as memoryPassLines, runMemoryPass } from './keeper.mjs';
17
+ import { detail, foundLine, historyLine, line, saidDetail, saidLine, scopeLabel } from './render.mjs';
18
+ import { passLines as memoryPassLines, runMemoryPass } from './keeper.mjs';
19
19
  import { buildBundle, outcomeLines } from './scribe.mjs';
20
- import { findSaved, searchTurns, taskEndedNudge } from './sessions.mjs';
21
- import { closest, saysAs } from './text.mjs';
20
+ import { searchAll } from './search.mjs';
21
+ import { findSaved, journalEntry, taskEndedNudge } from './sessions.mjs';
22
+ import { clip, closest, saysAs } from './text.mjs';
22
23
  import { heldBy } from './lock.mjs';
23
- import { redact } from './redact.mjs';
24
24
  import { VERSION } from './paths.mjs';
25
25
  import { CHAT_EFFORTS, config, doctor, makePrivate, positiveInteger, reportOf, setup, uninstall, uninstallPlan, uninstallQuestion } from './setup.mjs';
26
26
  import { colourEnabled, safeForTerminal, styles } from './tty.mjs';
27
- import { ftsQuery } from './text.mjs';
28
27
  import { verdictLines } from './verify.mjs';
29
28
 
30
29
  const DOCS = 'https://github.com/sumododda/sumo-agents/wiki';
@@ -33,20 +32,20 @@ const ISSUES = 'https://github.com/sumododda/sumo-agents/issues';
33
32
  const HELP = `sumo — one chat across your projects, memory that lasts, and jobs checked before they say done
34
33
 
35
34
  sumo chat [--model M] [--effort E] [--resume [id]] talk, with this memory behind it
36
- sumo search <query> [--project S] [--type T] [-n N] what is remembered; --turns: what was said
35
+ sumo search <query> [--project S] [--type T] [-n N] what is remembered, then what was said
37
36
  sumo add <type> "<text>" [--project S] a preference · fact · decision · gotcha
38
37
  sumo learn "<title>" --cue "<action>" a workflow, its steps on stdin · sumo gate
39
38
  sumo show|history|confirm|reject|forget <id> sumo supersede <old> <new>
40
- sumo memory [run [--tidy] | status | show] the page · the pass that files and tidies
39
+ sumo memory [run|status|check|eval|rebuild|show] the page · the pass that files and tidies
41
40
  sumo project add <path> [--slug S] [--alias A]... show · list · rescan · alias · archive
42
41
  sumo job new --project S --title T [--agent A] a job, its task on stdin
43
42
  by id: run · watch · tell · note · ask · answer · show · brief · baseline · verify · changes
44
43
  finish <id> --status DONE|FAILED · abandon · retry · list [--all] · stats
45
44
  sumo prime · sumo --version the block a session starts with · which sumo
46
45
  sumo export [--json] · sumo backup [restore [file]] · sumo cost [--days N] [--project S]
47
- sumo models [discover | enable <name> | disable <name>] the API models: which are here and on
48
- sumo mcp [add | remove | tools | allow | revoke] <name> MCP servers, for the chat and every job
49
- sumo setup · sumo uninstall · sumo config [key [value]] · sumo doctor [--fix] [--report]
46
+ sumo config every setting, on one page; /config in a chat
47
+ sumo models · sumo mcp [tools <name>] the API models · the MCP servers, as set
48
+ sumo setup · sumo uninstall · sumo doctor [--fix] [--report]
50
49
 
51
50
  Scope is global plus --project; other projects stay hidden without --everywhere.
52
51
  Exit: 0 done · 1 not done or failed · 2 the command line was wrong · 4 needs an Anthropic credential
@@ -70,26 +69,33 @@ EOF
70
69
  const USAGE = {
71
70
  chat: 'sumo chat [--model auto|<model>] [--effort <effort>] [--resume [id]] (piped: plain lines, the memory block first; --resume picks a saved session up, the newest without an id)',
72
71
  search: `sumo search <query> [--project S] [--type T] [--since <YYYY-MM-DD|Nd>] [--before <YYYY-MM-DD>]
73
- --project S that project's memories beside the global ones; other projects stay hidden
74
- --everywhere every project's memories
75
- --type T preference, fact, decision, gotcha or workflow
72
+ one search: memories first (m12), then the conversations — what you said (t481) and what sumo answered (r3).
73
+ every word is looked for first; only when nothing holds them all, any word. sumo show <id> opens any line whole.
74
+ --project S that project's memories and conversations beside the global ones; other projects are only counted
75
+ --everywhere every project's memories and conversations
76
+ --type T preference, fact, decision, gotcha or workflow — memories only
76
77
  --all forgotten and replaced memories too
77
78
  --since said or changed since that day, or in the last N days (7d); --before: said before that day
78
- -n N at most N, the best first (8 unless said)
79
- --json one object for a script: {memories, more, elsewhere} (with --turns: {turns})
80
- --turns what the user typed, not what is remembered`,
79
+ -n N at most N memories, the best first (8 unless said); three lines of conversation follow memories
80
+ --json one object for a script: {memories, conversations, more, moreConversations, elsewhere, loose}
81
+ --turns only the conversations, no memories`,
81
82
  add: `sumo add preference|fact|decision|gotcha "<one sentence>" [--project S] [--topic T] [--pin] [--supersedes ID] [--observed]
82
83
  a workflow (steps to repeat) is saved with sumo learn instead:
83
84
  ${LEARN_USAGE}`,
84
85
  learn: LEARN_USAGE,
85
- show: 'sumo show <id> [--json]',
86
+ show: 'sumo show <id> [--json] (m12 a memory; t481 something you said, r3 something sumo answered — whole, with what was said around it)',
86
87
  history: 'sumo history <id>',
87
88
  supersede: 'sumo supersede <old-id> <new-id>',
88
89
  gate: "sumo gate <workflow-id> '<regex over the shell command>' | sumo gate <workflow-id> off",
89
- forget: 'sumo forget <id> [--purge [--yes]] (--purge erases it for good, from every backup; it asks first, or --yes)',
90
+ forget: 'sumo forget <id> [--purge [--yes]] (--purge erases it for good, from every backup, with the turns and replies that say it whole — listed first; it asks, or --yes. One turn or reply: sumo forget --purge t12)',
90
91
  confirm: 'sumo confirm <id>',
91
92
  reject: 'sumo reject <id>',
92
- memory: 'sumo memory [run [--tidy] | status | show] (no argument serves the page on this machine and opens it; Ctrl-C stops it)',
93
+ memory: `sumo memory [run [--tidy] | status | check [--fix] | eval [--limit N] [--json] | rebuild [--dry-run] [--since D] [--limit N] [--yes] | show] (no argument serves the page on this machine and opens it; Ctrl-C stops it)
94
+ run: reads the conversations not yet read — also one still going on, and when filing is paused — and tidies when a week has gone by, or now with --tidy (--auto is how a session runs it: finished conversations only, nothing while paused)
95
+ rebuild: reads your conversations again with the extractor as it is now and shows what it would add and which memories it derived that it would no longer file; --dry-run only shows. It never touches what you said to remember, confirmed or pinned; --since a day or 7d, --limit the newest N conversations (each is a model call), --yes for a change wider than a pass may make; one that replaced another memory is kept
96
+ status: whether you are heard and from where, the model in use, what waits, whether filing is on
97
+ check: the search indexes, the newest turn found by search, the spool, the backup, passes left unfinished — exit 1 when one fails; --fix rebuilds an index that fails and tries the spool's set-aside lines again
98
+ eval: the searches that once found nothing run again, and the extractor replayed on your own history (--limit N memories of each kind, 20 unless said; each is a model call) — exit 1 when this extractor scores below the last other one`,
93
99
  project: `sumo project add <path> [--slug S] [--alias A]...
94
100
  sumo project show <name> | list [--all] [--json] | rescan <name> | alias <name> <alias> | archive <name> (add it again to bring it back)`,
95
101
  job: `sumo job new --project S --title T [--agent scout|worker|reviewer] (task on stdin)
@@ -114,22 +120,15 @@ sumo job list [--all] [--json]`,
114
120
  apply: 'sumo apply <ops.json> [--source scribe|dream]',
115
121
  export: 'sumo export [--json]',
116
122
  backup: 'sumo backup [restore [file] [--yes]] (restore: the newest copy, or the one named, put back, the one there kept aside; over a database that is fine it asks first, or --yes)',
117
- models: `sumo models every model Sumo knows: on or off, its API id, and why
118
- sumo models discover ask the API which of them this credential can use, and set the switches from the answer (one turned off by hand stays off)
119
- sumo models enable|disable <name>`,
120
- mcp: `sumo mcp every configured server: where it is, its tools or why it failed, what may run unasked
121
- sumo mcp add <name> [--env K=V]... -- <command> [args...] a server run as a process (stdio)
122
- sumo mcp add <name> --url <url> [--header K=V]... a server reached over HTTP
123
- \${NAME} in a value is filled from the shell when the server starts: the file never holds a token
124
- sumo mcp add <name> --url <url> --from-claude a server Claude Code is logged in to (claude mcp login <name>): its token is borrowed
125
- sumo mcp remove <name>
123
+ models: 'sumo models every model Sumo knows: on or off, its API id, and why — switched on and off, and discovered, on the settings page (sumo config)',
124
+ mcp: `sumo mcp every server: where it is, its tools or why it failed, what may run unasked
126
125
  sumo mcp tools <name> the server's tools, one a line
127
- sumo mcp allow <name> <tool>|all let it run without asking sumo mcp revoke <name> <tool>|all`,
128
- setup: 'sumo setup [--bin-dir DIR] [--no-link] [--model-source URL] [--no-model]',
126
+ added, removed and allowed on the settings page: /config in the chat, or sumo config`,
127
+ setup: 'sumo setup [--bin-dir DIR] [--no-link] [--no-model] (the local model comes from Memory › Local model, on the settings page: sumo config)',
129
128
  uninstall: 'sumo uninstall [--yes] [--discard-memory] (removes what setup made — the home\'s own files, its sumo links, the local model\'s server — after copying the memory out beside the home; asks first, or --yes)',
130
129
  doctor: 'sumo doctor [--fix] [--report] (--fix: make the files of the home private · --report: version, checks, settings, MCP server names, the last crash and the logs\' tails — redacted, printed here, sent nowhere)',
131
- config: 'sumo config [key [value]]',
132
- hook: 'sumo hook session-start|prompt|pre-tool|stop|session-end (for a harness\'s hook configuration: the event\'s JSON on stdin, what to add to the session on stdout; never fails the session)',
130
+ config: 'sumo config [key] [--json] every setting on one page, at a terminal — the arrows change one, it is saved as it changes, Esc closes it; with a key, --json or no terminal, the settings printed',
131
+ hook: 'sumo hook session-start|prompt|pre-tool|stop|session-end (for a harness\'s hook configuration: the event\'s JSON on stdin, what to add to the session on stdout; never fails the session — sumo help hooks prints the lines for Claude Code)',
133
132
  };
134
133
 
135
134
  /** A usage text as `--help` prints it: a line too wide for the terminal (100 columns at most, or piped) goes on, indented, below. */
@@ -155,6 +154,8 @@ function wrapped(text, width = Math.min(process.stdout.columns || 100, 100)) {
155
154
  }
156
155
 
157
156
  const ADDABLE = ['preference', 'fact', 'decision', 'gotcha'];
157
+ /** The memory commands a model runs in another harness's shell: each says, there, when that harness is not being heard. */
158
+ const HEARD_CHECKED = ['search', 'add', 'prime'];
158
159
 
159
160
  /**
160
161
  * Who runs this command: the model's shell carries SUMO_TOOL, a job's SUMO_JOB too. Under either, what only the user does is
@@ -163,21 +164,25 @@ const ADDABLE = ['preference', 'fact', 'decision', 'gotcha'];
163
164
  */
164
165
  const fromTool = () => Boolean(process.env.SUMO_TOOL || process.env.SUMO_JOB);
165
166
  const fromJob = () => process.env.SUMO_JOB || null;
167
+ /** A count with its noun: `1 turn`, `3 replies`. */
168
+ const counted = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
166
169
  /** Typed by the user at a terminal: no model's shell, and a terminal at both ends — another harness's tool runs without one. */
167
170
  const byUser = () => (!fromTool() && process.stdin.isTTY && process.stdout.isTTY ? 'user' : undefined);
168
- const OWNER_ONLY = "Refused: the model's shell does not change what the user controls — the MCP allow list, the models and the configuration. If the user wants it, they run it themselves: `! sumo …`";
171
+ const OWNER_ONLY = "Refused: the model's shell does not change what the user controls — the MCP allow list, the models and the settings. The user changes them on the settings page: /config in the chat, or sumo config at a terminal";
172
+ /** Where a command that set something by name went: the settings page, the one way a setting changes now. */
173
+ const ON_THE_PAGE = (what) => `${what} is set on the settings page now — sumo config at a terminal, or /config in the chat`;
169
174
  const jobWrites = () => `Refused: j${fromJob()} runs this command, and a job never writes memory. Put what you learned in your report; the user, or the chat, decides what is kept.`;
170
175
  const RECENT_TURNS = 40;
171
176
  /**
172
- * Whether something the user typed lately says what the memory says — nearly all of its words, the same way round — so
173
- * a memory the model files as the user's is really theirs. A few of the user's words inside much they never said, or
177
+ * The turn the user typed lately that says what the memory says — nearly all of its words, the same way round — or
178
+ * null: so a memory the model files as the user's is really theirs, and is kept with the turn it was said in. A few of the user's words inside much they never said, or
174
179
  * their rule turned round, is not.
175
180
  */
176
181
  function saidByUser(db, text) {
177
182
  return db
178
- .prepare('SELECT text FROM user_turns ORDER BY id DESC LIMIT ?')
183
+ .prepare('SELECT id, session_id, text FROM user_turns ORDER BY id DESC LIMIT ?')
179
184
  .all(RECENT_TURNS)
180
- .some((turn) => saysAs(text, turn.text));
185
+ .find((turn) => saysAs(text, turn.text)) ?? null;
181
186
  }
182
187
  const HELD = (id) => `held as unconfirmed: nothing the user typed lately says this, so it is theirs to confirm — sumo confirm m${id}, or sumo reject m${id}`;
183
188
  /** The docs say "workflow", the store says "procedure"; whoever types either means the same thing. */
@@ -189,13 +194,13 @@ const COMMANDS = {
189
194
  add: { value: ['project', 'topic', 'supersedes'], bool: ['pin', 'observed'], run: runAdd },
190
195
  learn: { value: ['project', 'cue', 'gate', 'from-file'], bool: [], run: runLearn },
191
196
  gate: { value: [], bool: [], run: runGate },
192
- show: { value: [], bool: ['json'], max: 1, run: (db, { args, flags }) => (flags.json ? asJson({ memory: memory.get(db, memory.parseId(args[0])) }) : [detail(memory.get(db, memory.parseId(args[0])))]) },
197
+ show: { value: [], bool: ['json'], max: 1, run: runShow },
193
198
  history: { value: [], bool: [], max: 1, run: (db, { args }) => memory.history(db, memory.parseId(args[0])).map(historyLine) },
194
199
  supersede: { value: [], bool: [], max: 2, run: runSupersede },
195
200
  forget: { value: [], bool: ['purge', 'yes'], max: 1, run: runForget },
196
201
  confirm: { value: [], bool: [], max: 1, run: runConfirm },
197
- reject: { value: [], bool: [], max: 1, run: (db, { args }) => [`rejected ${line(memory.reject(db, memory.parseId(args[0])))}`] },
198
- memory: { value: [], bool: ['tidy'], run: runMemoryCommand },
202
+ reject: { value: [], bool: [], max: 1, run: (db, { args }) => [`rejected ${line(memory.reject(db, memory.parseId(args[0]), undefined, { actor: fromTool() ? 'model-shell' : 'user' }))}`] },
203
+ memory: { value: ['limit', 'since'], bool: ['tidy', 'auto', 'fix', 'json', 'dry-run', 'yes'], run: runMemoryCommand },
199
204
  project: { value: ['slug'], multi: ['alias'], bool: ['all', 'json'], run: runProject },
200
205
  job: { value: ['project', 'title', 'agent', 'status', 'from-file', 'guide', 'reviews', 'accept', 'attempts'], bool: ['all', 'tests-may-change', 'json'], run: runJob },
201
206
  prime: { value: ['budget'], bool: [], max: 0, run: (db, { flags }) => [forPerson(prime(db, { budget: flags.budget === undefined ? undefined : positiveInteger(flags.budget, '--budget needs a positive number') }))] },
@@ -206,6 +211,7 @@ const COMMANDS = {
206
211
  export: { value: [], bool: ['json', 'md'], max: 0, run: runExport },
207
212
  backup: { value: [], bool: ['yes'], run: runBackup },
208
213
  models: { value: [], bool: [], run: runModels },
214
+ // The flags the retired `mcp add` took are still read, so that it is told where adding went rather than that a flag is unknown.
209
215
  mcp: { value: ['url'], multi: ['env', 'header'], bool: ['from-claude'], run: runMcp },
210
216
  };
211
217
 
@@ -328,32 +334,35 @@ function runSearch(db, { args, flags }) {
328
334
  const limit = flags.n === undefined ? undefined : positiveInteger(flags.n, '-n needs a positive number');
329
335
  const since = dayFlag(flags.since, '--since', { back: true });
330
336
  const before = dayFlag(flags.before, '--before');
337
+ if (flags.turns && flags.type) throw new UsageError('--type picks a kind of memory, and --turns leaves memories out — use one of the two');
338
+ const asked = args.join(' ');
331
339
 
332
- if (flags.turns) {
333
- if (since || before) throw new UsageError('--since and --before hold memories to a time, not what the user typed — leave out --turns, or the dates');
334
- const match = ftsQuery(args.join(' '));
335
- if (!match) throw new UsageError('nothing to search for');
336
- const turns = searchTurns(db, match, limit);
337
- if (flags.json) return asJson({ turns });
338
- return turns.length > 0 ? turns.map((t) => `t${t.id} ${t.ts.slice(0, 10)} ${t.text.replace(/\s+/g, ' ').slice(0, 200)}`) : [`the user never said anything like: ${args.join(' ')}`];
339
- }
340
-
341
- const { results, elsewhere, more } = memory.search(db, args.join(' '), {
340
+ const { memories, conversations, more, moreSaid, elsewhere, loose } = searchAll(db, asked, {
342
341
  project: flags.project,
343
342
  type: WORKFLOW_NAMES.includes(flags.type) ? 'procedure' : flags.type,
344
343
  everywhere: flags.everywhere,
345
344
  all: flags.all,
345
+ turns: flags.turns,
346
346
  since,
347
347
  before,
348
348
  limit,
349
349
  });
350
350
 
351
- if (flags.json) return asJson({ memories: results.map(plainMemory), more, elsewhere });
351
+ const said = conversations.map(({ rank, ...hit }) => hit);
352
+ if (flags.json) return asJson(flags.turns ? { conversations: said, moreConversations: moreSaid, elsewhere } : { memories: memories.map(plainMemory), conversations: said, more, moreConversations: moreSaid, elsewhere, loose });
353
+ const out = memories.map(foundLine);
354
+ // A list cut short says so, and how to see the rest.
355
+ if (more > 0) out.push(`… ${more} more — -n ${memories.length + more} shows them all, or narrow the words`);
356
+ if (said.length > 0) {
357
+ // What is not a memory says so: nobody settled these words as true, they are what was said that day.
358
+ if (!flags.turns) out.push(`${memories.length > 0 ? 'also said' : 'no memory of this — said'} in the conversations (sumo show <id> opens one whole):`);
359
+ out.push(...said.map(saidLine));
360
+ if (moreSaid > 0) out.push(flags.turns ? `… ${moreSaid} more — -n ${said.length + moreSaid} shows them all, or narrow the words` : `… ${moreSaid} more in the conversations — sumo search "${asked}" --turns`);
361
+ }
352
362
  // An explicit "nothing" is an answer: it is what lets an agent say
353
363
  // "not in memory" instead of guessing.
354
- const out = results.length > 0 ? results.map(line) : [`nothing in memory for: ${args.join(' ')}`];
355
- // A list cut short says so, and how to see the rest.
356
- if (more > 0) out.push(`… ${more} more — -n ${results.length + more} shows them all, or narrow the words`);
364
+ if (out.length === 0) out.push(flags.turns ? `nothing in the conversations for: ${asked}` : `nothing in memory for: ${asked}${flags.type ? '' : ' — nor in the conversations'}`);
365
+ else if (loose) out.push('a loose match: no line holds two of these words — not an answer to rely on');
357
366
  const others = Object.entries(elsewhere);
358
367
  if (others.length > 0) {
359
368
  const where = others.map(([scope, n]) => `${scopeLabel(scope)} (${n})`).join(', ');
@@ -362,6 +371,14 @@ function runSearch(db, { args, flags }) {
362
371
  return out;
363
372
  }
364
373
 
374
+ /** One line of a search, whole: a memory (m12), or a turn (t481) or a reply (r3) with what was said around it. */
375
+ function runShow(db, { args, flags }) {
376
+ const said = journalEntry(db, args[0]);
377
+ if (said) return flags.json ? asJson({ [said.entry.kind]: said.entry, around: said.around }) : [saidDetail(said)];
378
+ const row = memory.get(db, memory.parseId(args[0]));
379
+ return flags.json ? asJson({ memory: row }) : [detail(row)];
380
+ }
381
+
365
382
  function savedLines({ memory: saved, similar, redacted }) {
366
383
  const out = [`saved ${line(saved)}`];
367
384
  if (redacted > 0) out.push(`redacted ${redacted} secret-looking value${redacted === 1 ? '' : 's'} before storing`);
@@ -379,16 +396,22 @@ function runAdd(db, { args, flags }) {
379
396
  if (WORKFLOW_NAMES.includes(type)) throw new UsageError(`a workflow has a title and steps, so it is saved with sumo learn, not sumo add:\n${LEARN_USAGE}`);
380
397
  if (!ADDABLE.includes(type)) throw new UsageError(`unknown type "${type}" — one of: ${ADDABLE.join(', ')} (for a workflow: sumo learn)`);
381
398
  const body = text.join(' ');
382
- // From the model's shell, the user's word is checked against the user's words: an inferred memory waits unconfirmed.
383
- const held = fromTool() && !saidByUser(db, body);
399
+ // From the model's shell, the user's word is checked against the user's words: what they never typed is held for
400
+ // them (`held_for = 'shell'`) and asked about in the block, never active and never dropped unseen.
401
+ // Said in a turn, it is kept with that turn: forgotten later, the pass that reads the conversation does not file it again.
402
+ const said = fromTool() ? saidByUser(db, body) : null;
403
+ const held = fromTool() && !said;
384
404
  const saved = memory.add(db, {
385
405
  type,
386
406
  body,
407
+ sourceSession: said?.session_id,
408
+ sourceTurn: said?.id,
387
409
  project: flags.project,
388
410
  topic: flags.topic,
389
411
  pin: flags.pin,
390
412
  supersedes: flags.supersedes === undefined ? undefined : memory.parseId(flags.supersedes),
391
- provenance: held ? 'inferred' : flags.observed ? 'observed' : 'stated',
413
+ provenance: flags.observed ? 'observed' : 'stated',
414
+ heldFor: held ? 'shell' : undefined,
392
415
  writtenBy: byUser(),
393
416
  });
394
417
  return savedLines(saved).concat(held ? [HELD(saved.memory.id)] : []);
@@ -401,7 +424,7 @@ function runLearn(db, { args, flags }) {
401
424
  if (!body.trim()) throw new UsageError('no steps given — pipe them in, or use --from-file <path>');
402
425
  const title = args.join(' ');
403
426
  const held = fromTool() && !saidByUser(db, [title, flags.cue ?? '', body].join(' '));
404
- const saved = memory.add(db, { type: 'procedure', title, cue: flags.cue, gate: flags.gate, body, project: flags.project, provenance: held ? 'inferred' : 'stated', writtenBy: byUser() });
427
+ const saved = memory.add(db, { type: 'procedure', title, cue: flags.cue, gate: flags.gate, body, project: flags.project, heldFor: held ? 'shell' : undefined, writtenBy: byUser() });
405
428
  return savedLines(saved).concat(flags.gate ? [`gates shell commands matching: ${flags.gate}`] : [], held ? [HELD(saved.memory.id)] : []);
406
429
  }
407
430
 
@@ -413,7 +436,7 @@ function runGate(db, { args }) {
413
436
 
414
437
  function runSupersede(db, { args }) {
415
438
  need(args, 2, 'supersede');
416
- const old = memory.supersede(db, memory.parseId(args[0]), memory.parseId(args[1]));
439
+ const old = memory.supersede(db, memory.parseId(args[0]), memory.parseId(args[1]), undefined, { actor: fromTool() ? 'model-shell' : 'user' });
417
440
  return [`superseded ${line(old)}`];
418
441
  }
419
442
 
@@ -421,9 +444,10 @@ function runSupersede(db, { args }) {
421
444
  const AFFIRMS = /^\s*(?:yes|yep|yeah|yup|y|correct|right|that['’]?s right|confirm(?:ed)?|ok(?:ay)?|sure|true|exactly|agreed?|keep (?:it|that)|do it)\b/i;
422
445
 
423
446
  /**
424
- * A guess made a memory of the user's. From the model's shell only once the user has spoken since the guess was made,
425
- * and said yes, or said the thing itself: a model may not add a guess and vouch for it in one go, nor a page tell it
426
- * to. One held because its conversation read the web or an MCP server only the user confirms (memory.confirm).
447
+ * A memory held for the user made theirs. One the model's shell saved without the user's words (`held_for = 'shell'`,
448
+ * a guess) is confirmed from that shell only once the user has spoken since it was made, and said yes, or said the
449
+ * thing itself: a model may not add a guess and vouch for it in one go, nor a page tell it to. One held because its
450
+ * conversation read the web or an MCP server only the user confirms (memory.confirm).
427
451
  */
428
452
  function runConfirm(db, { args }) {
429
453
  const id = memory.parseId(args[0]);
@@ -437,23 +461,75 @@ function runConfirm(db, { args }) {
437
461
  return [`confirmed ${line(memory.confirm(db, id, { byUser: !fromTool() }))}`];
438
462
  }
439
463
 
464
+ /** One turn or reply as a purge lists it: its id, its day, the start of its words. */
465
+ const SAID_SHOWN = 100;
466
+ const saidRow = (mark, row) => ` ${mark}${row.id} · ${row.ts.slice(0, 10)} · ${clip(row.text, SAID_SHOWN)}`;
467
+ const MENTIONS = 'other mentions may remain — find them: sumo search "<words>" --turns, erase one: sumo forget --purge t12';
468
+ const stillIn = (failed) => (failed.length > 0 ? [`still in ${failed.length} backup${failed.length === 1 ? '' : 's'} that could not be cleaned — delete ${failed.length === 1 ? 'it' : 'them'} by hand: ${failed.join(' ')}`] : []);
469
+ const fromCopies = (cleaned, spooled) => `${cleaned > 0 ? `, and from ${cleaned} backup${cleaned === 1 ? '' : 's'}` : ''}${spooled > 0 ? `, and ${counted(spooled, 'line')} of the spool` : ''}`;
470
+
471
+ /**
472
+ * `sumo forget --purge t12`: one turn or reply erased for good, from the database, the backups and the spool — shown
473
+ * first, its id typed back. How a mention that a memory's purge left behind is taken out.
474
+ */
475
+ async function purgeSaid(db, entry, flags) {
476
+ const mark = `${entry.kind === 'turn' ? 't' : 'r'}${entry.id}`;
477
+ const shown = `${saidRow(entry.kind === 'turn' ? 't' : 'r', entry).trimStart()}\nErase ${mark} for good, from every backup too? Type ${mark} to confirm: `;
478
+ if (!(await confirmed(flags, `erasing ${mark} for good cannot be undone`, shown, [mark]))) throw new Error(`nothing was erased — the answer was not ${mark}`);
479
+ const cites = memory.purgeRow(db, entry);
480
+ const { cleaned, failed } = purgeRowFromBackups(entry);
481
+ // The same words still waiting to be written would bring the row back.
482
+ const same = entry.text.replace(/\s+/g, ' ').trim();
483
+ const spooled = (await import('./spool.mjs')).purgeSpool((text) => String(text).replace(/\s+/g, ' ').trim() === same);
484
+ return [
485
+ `purged ${mark} — erased, not recoverable${fromCopies(cleaned, spooled)}`,
486
+ ...cites.map((id) => `m${id} was drawn from it and still holds its words: sumo forget m${id} --purge erases it too`),
487
+ ...stillIn(failed),
488
+ ];
489
+ }
490
+
440
491
  async function runForget(db, { args, flags }) {
441
492
  need(args, 1, 'forget');
493
+ // A turn or a reply by its id: never merely forgotten — the journal has no history to keep it in — only erased.
494
+ const entry = /^[tr]\d+$/i.test(args[0]) ? args[0].toLowerCase() : null;
495
+ if (entry && !flags.purge) throw new UsageError(`${entry} is a turn or a reply, which is erased or kept: sumo forget --purge ${entry} erases it for good. A memory is forgotten by its id, like m12`);
442
496
  // Erased for good, from the backups too: only the user decides that. A forget without --purge keeps the history.
443
- if (flags.purge && fromTool()) throw new Refusal(`erasing a memory for good is the user's to do: they run sumo forget ${args[0]} --purge themselves. sumo forget ${args[0]} stops it being true and keeps its history`);
497
+ if (flags.purge && fromTool()) {
498
+ throw new Refusal(entry ? `erasing a turn or a reply for good is the user's to do: they run sumo forget --purge ${entry} themselves` : `erasing a memory for good is the user's to do: they run sumo forget ${args[0]} --purge themselves. sumo forget ${args[0]} stops it being true and keeps its history`);
499
+ }
500
+ if (entry) return purgeSaid(db, journalEntry(db, entry).entry, flags);
444
501
  const id = memory.parseId(args[0]);
445
502
  if (flags.purge) {
446
- // Seen before it goes: the memory as it stands, and its id typed back — the strongest yes, for what no backup brings back.
447
- const shown = `${line(memory.get(db, id))}\nErase m${id} for good, from every backup too? Type m${id} to confirm: `;
503
+ // Seen before it goes: the memory as it stands, each turn and reply that goes with it, and its id typed back — the strongest yes, for what no backup brings back.
504
+ const reach = memory.purgeReach(db, memory.get(db, id));
505
+ const with_ = [reach.turns.length > 0 ? counted(reach.turns.length, 'turn') : '', reach.replies.length > 0 ? counted(reach.replies.length, 'reply', 'replies') : ''].filter(Boolean);
506
+ const going = with_.length > 0 ? [`with it go ${with_.join(' and ')} that say${reach.turns.length + reach.replies.length === 1 ? 's' : ''} it:`, ...reach.turns.map((r) => saidRow('t', r)), ...reach.replies.map((r) => saidRow('r', r))] : [];
507
+ const shown = [line(memory.get(db, id)), ...going, `Erase m${id} for good, from every backup too? Type m${id} to confirm: `].join('\n');
448
508
  if (!(await confirmed(flags, `erasing m${id} for good cannot be undone`, shown, [`m${id}`, String(id)]))) throw new Error(`nothing was erased — the answer was not m${id}`);
449
509
  }
450
- const gone = memory.forget(db, id, { purge: flags.purge });
510
+ const gone = memory.forget(db, id, { purge: flags.purge, actor: fromTool() ? 'model-shell' : 'user' });
451
511
  if (!flags.purge) return [`forgot ${line(gone)}`];
452
512
  const { cleaned, failed } = purgeFromBackups(gone);
453
- const copies = cleaned > 0 ? `, and from ${cleaned} backup${cleaned === 1 ? '' : 's'}` : '';
454
- const lines = [gone.source_turn !== null ? `purged m${gone.id} — erased, not recoverable, with the sentence it came from${copies}` : `purged m${gone.id} — erased, not recoverable${copies}; no sentence of the user's was tied to it — sumo search --turns finds one if it is there`];
455
- if (failed.length > 0) lines.push(`still in ${failed.length} backup${failed.length === 1 ? '' : 's'} that could not be cleaned — delete ${failed.length === 1 ? 'it' : 'them'} by hand: ${failed.join(' ')}`);
456
- return lines;
513
+ // What still waits to be written, or was set aside, may say it too.
514
+ const spooled = (await import('./spool.mjs')).purgeSpool(memory.saying([gone.source_quote, gone.body]));
515
+ const turns = gone.erased_turns.length;
516
+ const echoes = gone.erased_replies.length;
517
+ // Said as it was done: the sentence it cites, then whatever else of the journal said it whole.
518
+ const cited = gone.erased_source !== null;
519
+ const more = turns - (cited ? 1 : 0);
520
+ const went = cited
521
+ ? `, with the sentence it came from${more > 0 ? ` and ${more} more turn${more === 1 ? ' that says it' : 's that say it'}` : ''}${echoes > 0 ? ` and ${counted(echoes, 'reply', 'replies')} of sumo's that said it back` : ''}`
522
+ : turns + echoes > 0 ? `, with ${[turns > 0 ? counted(turns, 'turn') : '', echoes > 0 ? counted(echoes, 'reply', 'replies') : ''].filter(Boolean).join(' and ')} that say${turns + echoes === 1 ? 's' : ''} it`
523
+ : '';
524
+ return [
525
+ `purged m${gone.id} — erased, not recoverable${went}${fromCopies(cleaned, spooled)}${cited || turns + echoes > 0 ? '' : "; no sentence of the user's was tied to it — sumo search --turns finds one if it is there"}`,
526
+ // Each row that went, as the question listed them: with --yes this is the only place they are said.
527
+ ...gone.erased_turns.map((r) => saidRow('t', r)),
528
+ ...gone.erased_replies.map((r) => saidRow('r', r)),
529
+ ...stillIn(failed),
530
+ // Only what says the memory whole went with it: a conversation that mentions part of it is the user's to find and judge.
531
+ MENTIONS,
532
+ ];
457
533
  }
458
534
 
459
535
  function runProject(db, { args, flags }) {
@@ -751,8 +827,32 @@ async function runMemoryCommand(db, { args, flags }) {
751
827
  // Nor with no terminal: piped or in a script, nobody is there to look at it, or to press Ctrl-C.
752
828
  if (args[0] === undefined && (!process.stdin.isTTY || !process.stdout.isTTY)) throw new UsageError('the memory page runs until Ctrl-C, so it needs a terminal — run sumo memory in one; sumo memory status and sumo search work anywhere');
753
829
  if (args[0] === undefined) return runMemoryPage(db);
754
- if (args[0] === 'run') return memoryPassLines(await runMemoryPass(db, { tidy: flags.tidy === true }), { asked: flags.tidy === true });
755
- if (args[0] === 'status') return memoryStatus(db);
830
+ if (args[0] === 'run') return memoryPassLines(await runMemoryPass(db, { tidy: flags.tidy === true, auto: flags.auto === true }), { asked: flags.tidy === true });
831
+ if (args[0] === 'rebuild') {
832
+ // It lets memories go, past the bound with --yes: from the model's shell — this command runs outside the sandbox — only the difference is shown.
833
+ if (fromTool() && flags['dry-run'] !== true) throw new Refusal("rebuilding memory is the user's to do: they run sumo memory rebuild themselves. sumo memory rebuild --dry-run shows what it would change");
834
+ const { rebuild } = await import('./rebuild.mjs');
835
+ const limit = flags.limit === undefined ? undefined : positiveInteger(flags.limit, '--limit needs a positive number');
836
+ return rebuild(db, { dryRun: flags['dry-run'] === true, since: dayFlag(flags.since, '--since', { back: true }), limit, yes: flags.yes === true });
837
+ }
838
+ // The checks load with the commands that report them: a hook reaches this file on every prompt.
839
+ if (args[0] === 'status') return (await import('./check.mjs')).memoryStatus(db);
840
+ if (args[0] === 'check') {
841
+ // Mending rewrites the indexes and replays what was set aside: the model's shell reads the checks, and no more.
842
+ if (fromTool() && flags.fix === true) throw new Refusal("mending memory is the user's to do: they run sumo memory check --fix themselves. sumo memory check says what is wrong");
843
+ const { memoryCheck, memoryHealth, memoryHealthLine } = await import('./check.mjs');
844
+ const heard = memoryHealthLine(memoryHealth(db));
845
+ const checks = [{ ...heard, warn: !heard.fail }, ...memoryCheck(db, undefined, { fix: flags.fix === true })];
846
+ const lines = checks.map((c) => checkLine(c, styles(colourEnabled())));
847
+ return checks.some((c) => !c.ok && !c.warn) ? Object.assign(lines, { exitCode: 1 }) : lines;
848
+ }
849
+ if (args[0] === 'eval') {
850
+ // Dozens of model calls, and a score kept that the next eval is judged against: not something a model starts.
851
+ if (fromTool()) throw new Refusal("measuring the extractor asks the model about every case, and is the user's to do: they run sumo memory eval themselves");
852
+ const { evalLines, memoryEval } = await import('./memeval.mjs');
853
+ const result = await memoryEval(db, { limit: flags.limit === undefined ? undefined : positiveInteger(flags.limit, '--limit needs a positive number') });
854
+ return flags.json ? Object.assign(asJson(result), { exitCode: result.worse || result.replay.failed ? 1 : 0 }) : evalLines(result);
855
+ }
756
856
  if (args[0] === 'show') return [buildBundle(db)?.prompt ?? 'nothing waits to be filed: the next memory pass has nothing new to read'];
757
857
  throw new UsageError(`usage: ${USAGE.memory}`);
758
858
  }
@@ -790,42 +890,17 @@ async function runMemoryPage(db) {
790
890
  return ['stopped'];
791
891
  }
792
892
 
793
- /** The models Sumo can run on, their switches, and the two ways the switches are set: by the API's answer, or by hand. */
794
- async function runModels(db, { args }) {
795
- const [sub, name] = args;
796
- if (sub === undefined) return modelLines(db);
797
- if (sub === 'discover') {
798
- const result = await discoverModels(db);
799
- if (!result.ok) throw new (/no Anthropic credential/.test(result.error) ? NeedsCredential : Error)(`could not check the models — ${result.error}; nothing was changed`);
800
- return modelLines(db);
801
- }
802
- if ((sub === 'enable' || sub === 'disable') && name !== undefined) {
803
- setModel(db, name, sub === 'enable');
804
- return modelLines(db, [name]);
805
- }
893
+ /** The models Sumo can run on and their switches, as the settings page set them. */
894
+ function runModels(db, { args }) {
895
+ if (args[0] === undefined) return modelLines(db);
896
+ if (['enable', 'disable', 'discover'].includes(args[0])) throw new UsageError(ON_THE_PAGE(`which models are on (${args[0]})`));
806
897
  throw new UsageError(`usage: ${USAGE.models}`);
807
898
  }
808
899
 
809
- /** `NAME=value` pairs from the command line, as an object. The values are stored as typed: `${NAME}` is filled from the shell when the server starts. */
810
- function pairs(list = [], flag) {
811
- return Object.fromEntries(
812
- list.map((pair) => {
813
- const at = pair.indexOf('=');
814
- if (at < 1) throw new UsageError(`${flag} takes NAME=value, not "${pair}"`);
815
- const [name, value] = [pair.slice(0, at), pair.slice(at + 1)];
816
- // The file never holds a token: one given in the clear is refused, with how to pass it instead — it stays in the shell.
817
- if (redact(value).text !== value) {
818
- throw new UsageError(`${flag} ${name} holds a token in the clear, and the file never does — export it in your shell and write \${NAME} in its place (${flag} "${name}=${value.startsWith('Bearer ') ? 'Bearer ' : ''}\${MY_TOKEN}"): it is filled in when the server starts`);
819
- }
820
- return [name, value];
821
- }),
822
- );
823
- }
824
-
825
- /** MCP servers: configured here, connected by every chat and job; what may run without asking is set here too. */
826
- async function runMcp(db, { args, flags }) {
827
- const { addServer, allowedBy, CLAUDE_CODE_TOKEN, closeMcp, connect, mcpLines, mcpReady, readConfig, removeServer, setAllow } = await import('./mcp.mjs');
828
- const [sub = 'list', name, ...rest] = args;
900
+ /** MCP servers, as the settings page set them: each one connected to say how it is, and a server's tools. */
901
+ async function runMcp(db, { args }) {
902
+ const { allowedBy, closeMcp, connect, mcpLines, mcpReady, readConfig } = await import('./mcp.mjs');
903
+ const [sub = 'list', name] = args;
829
904
  switch (sub) {
830
905
  case 'list': {
831
906
  // Connecting can take a while — each server is given up to a minute — so a terminal is told what it is waiting for.
@@ -842,29 +917,11 @@ async function runMcp(db, { args, flags }) {
842
917
  await closeMcp();
843
918
  }
844
919
  }
845
- case 'add': {
846
- if (!name) throw new UsageError(`usage: ${USAGE.mcp}`);
847
- let spec;
848
- if (flags.url) {
849
- if (rest.length > 0) throw new UsageError('a server is a command or a --url, not both');
850
- if (!/^https?:\/\/[^\s/]/i.test(flags.url)) throw new UsageError(`--url takes a web address, https://… — not "${flags.url}"`);
851
- if (flags['from-claude'] && flags.header) throw new UsageError('a token borrowed from Claude Code or --header, not both');
852
- spec = { url: flags.url, ...(flags.header ? { headers: pairs(flags.header, '--header') } : {}), ...(flags['from-claude'] ? { token: CLAUDE_CODE_TOKEN } : {}) };
853
- } else if (flags['from-claude']) {
854
- throw new UsageError('--from-claude goes with --url: the server Claude Code is logged in to');
855
- } else if (rest.length > 0) {
856
- spec = { command: rest[0], args: rest.slice(1), ...(flags.env ? { env: pairs(flags.env, '--env') } : {}) };
857
- } else {
858
- throw new UsageError('a server is a command (after --) or a --url:\nsumo mcp add <name> -- <command> [args...] | sumo mcp add <name> --url <url>');
859
- }
860
- addServer(name, spec);
861
- const borrowed = spec.token === CLAUDE_CODE_TOKEN ? `, with Claude Code's login — log in there first: claude mcp add --transport http --scope user ${name} ${spec.url}, then claude mcp login ${name}` : '';
862
- return [`added ${name} (${spec.url ? `http: ${spec.url}` : `stdio: ${[spec.command, ...spec.args].join(' ')}`}${borrowed})`, `next: sumo mcp — connects to it and lists its tools; sumo mcp allow ${name} <tool>|all — lets them run without asking`];
863
- }
920
+ case 'add':
864
921
  case 'remove':
865
- if (!name) throw new UsageError(`usage: ${USAGE.mcp}`);
866
- removeServer(name);
867
- return [`removed ${name}`];
922
+ case 'allow':
923
+ case 'revoke':
924
+ throw new UsageError(ON_THE_PAGE(`an MCP server (${sub})`));
868
925
  case 'tools': {
869
926
  if (!name) throw new UsageError(`usage: ${USAGE.mcp}`);
870
927
  const spec = readConfig().mcpServers[name];
@@ -878,14 +935,6 @@ async function runMcp(db, { args, flags }) {
878
935
  await session.close();
879
936
  }
880
937
  }
881
- case 'allow':
882
- case 'revoke': {
883
- const tool = rest[0];
884
- if (!name || !tool) throw new UsageError(`usage: ${USAGE.mcp}`);
885
- setAllow(name, tool, sub === 'allow');
886
- if (tool === 'all') return [sub === 'allow' ? `${name}: every tool may run without asking` : `${name}: every call asks first`];
887
- return [sub === 'allow' ? `${name}: ${tool} may run without asking` : `${name}: ${tool} asks first`];
888
- }
889
938
  default:
890
939
  throw new UsageError(`usage: ${USAGE.mcp}`);
891
940
  }
@@ -928,6 +977,11 @@ export async function main(argv) {
928
977
  process.stdout.write(HELP);
929
978
  return 0;
930
979
  }
980
+ // Not a command: the lines that make another harness heard, with this home's launcher in them.
981
+ if (topic === 'hooks') {
982
+ process.stdout.write(`${(await import('./check.mjs')).hooksHelp().join('\n')}\n`);
983
+ return 0;
984
+ }
931
985
  if (!Object.hasOwn(USAGE, topic)) {
932
986
  const near = closest(topic, Object.keys(USAGE));
933
987
  throw new UsageError(`no help for "${topic}" — ${near ? `did you mean "${near}"? ` : ''}the commands are in: sumo help`);
@@ -946,8 +1000,9 @@ export async function main(argv) {
946
1000
  return 0;
947
1001
  }
948
1002
  if (command === 'setup') {
949
- const { flags } = parse(rest, { value: ['bin-dir', 'model-source'], bool: ['no-link', 'no-model'] });
950
- const lines = await setup({ binDir: flags['bin-dir'], link: !flags['no-link'], modelSource: flags['model-source'], noModel: !!flags['no-model'] });
1003
+ if (rest.some((token) => /^--model-source(=|$)/.test(token))) throw new UsageError(ON_THE_PAGE("the local model's address (Memory › Local model), downloaded as it is set,"));
1004
+ const { flags } = parse(rest, { value: ['bin-dir'], bool: ['no-link', 'no-model'] });
1005
+ const lines = await setup({ binDir: flags['bin-dir'], link: !flags['no-link'], noModel: !!flags['no-model'] });
951
1006
  process.stdout.write(`${lines.join('\n')}\n`);
952
1007
  return 0;
953
1008
  }
@@ -991,9 +1046,21 @@ export async function main(argv) {
991
1046
  return await runDoctor(flags);
992
1047
  }
993
1048
  if (command === 'config') {
994
- const { args } = parse(rest, { value: [], bool: [] });
995
- if (args[1] !== undefined && fromTool()) throw new Refusal(OWNER_ONLY);
996
- process.stdout.write(`${config(args[0], args[1]).join('\n')}\n`);
1049
+ const { args, flags } = parse(rest, { value: [], bool: ['json'] });
1050
+ if (args[1] !== undefined) {
1051
+ if (fromTool()) throw new Refusal(OWNER_ONLY);
1052
+ // A name that is not a setting, or no longer one, is said as that first: what it became, or the one meant.
1053
+ config(args[0]);
1054
+ throw new UsageError(ON_THE_PAGE(args[0]));
1055
+ }
1056
+ // The page takes keys: it opens for a person at a terminal, never for the model's shell, which only reads.
1057
+ if (args.length === 0 && !flags.json && !fromTool() && process.stdin.isTTY && process.stdout.isTTY) {
1058
+ const { runSettings } = await import('./settings.mjs');
1059
+ process.stdout.write(`${(await runSettings({ plain: config('chat.screen')[0].endsWith('= plain') })).join('\n')}\n`);
1060
+ return 0;
1061
+ }
1062
+ const lines = config(args[0]);
1063
+ process.stdout.write(`${flags.json ? asJson({ settings: Object.fromEntries(lines.map((l) => l.split(' = '))) })[0] : lines.join('\n')}\n`);
997
1064
  return 0;
998
1065
  }
999
1066
 
@@ -1024,8 +1091,15 @@ export async function main(argv) {
1024
1091
  if (command === 'backup' && parsed.args.length > 0) throw new UsageError(`usage: ${USAGE.backup}`);
1025
1092
  const db = openDb();
1026
1093
  try {
1094
+ // Evidence that Claude Code is in use, for the heartbeat: a command run from it (this is never the hook's path).
1095
+ noteUsedFrom(db);
1027
1096
  const lines = await spec.run(db, parsed);
1028
1097
  process.stdout.write(`${lines.join('\n')}\n`);
1098
+ // Run inside Claude Code, which sumo does not hear: said to the model that ran this, once a day.
1099
+ if (process.env.CLAUDECODE === '1' && (HEARD_CHECKED.includes(command) || (command === 'memory' && parsed.args[0] === 'status'))) {
1100
+ const unheard = (await import('./check.mjs')).notHeardLine(db);
1101
+ if (unheard) process.stderr.write(`${unheard}\n`);
1102
+ }
1029
1103
  return lines.exitCode ?? 0;
1030
1104
  } finally {
1031
1105
  db.close();