@jossuealcala/madre 1.0.4 → 1.0.5

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 (104) hide show
  1. package/CHANGELOG.en.md +106 -1
  2. package/CHANGELOG.md +106 -1
  3. package/NOTICE +30 -0
  4. package/README.en.md +59 -156
  5. package/README.md +60 -161
  6. package/TRADEMARKS.md +18 -0
  7. package/bin/madre.mjs +2 -2
  8. package/docs/REFERENCE.md +1 -1
  9. package/docs/SDK.md +25 -4
  10. package/docs/en/REFERENCE.md +1 -1
  11. package/docs/en/SDK.md +22 -2
  12. package/docs/madre-banner.png +0 -0
  13. package/package.json +1 -1
  14. package/public/app.js +1078 -239
  15. package/public/assets/manual/madre-manual-en.pdf +0 -0
  16. package/public/assets/manual/madre-manual-es.pdf +0 -0
  17. package/public/assets/manual/shots/en-agents.webp +0 -0
  18. package/public/assets/manual/shots/en-code.webp +0 -0
  19. package/public/assets/manual/shots/en-composer.webp +0 -0
  20. package/public/assets/manual/shots/en-connectors.webp +0 -0
  21. package/public/assets/manual/shots/en-continuity.webp +0 -0
  22. package/public/assets/manual/shots/en-coordinator.webp +0 -0
  23. package/public/assets/manual/shots/en-copilot.webp +0 -0
  24. package/public/assets/manual/shots/en-diagnostics.webp +0 -0
  25. package/public/assets/manual/shots/en-home.webp +0 -0
  26. package/public/assets/manual/shots/en-local.webp +0 -0
  27. package/public/assets/manual/shots/en-memory.webp +0 -0
  28. package/public/assets/manual/shots/en-modes.webp +0 -0
  29. package/public/assets/manual/shots/en-modules.webp +0 -0
  30. package/public/assets/manual/shots/en-notes.webp +0 -0
  31. package/public/assets/manual/shots/en-settings.webp +0 -0
  32. package/public/assets/manual/shots/en-windows.webp +0 -0
  33. package/public/assets/manual/shots/es-agents.webp +0 -0
  34. package/public/assets/manual/shots/es-code.webp +0 -0
  35. package/public/assets/manual/shots/es-composer.webp +0 -0
  36. package/public/assets/manual/shots/es-connectors.webp +0 -0
  37. package/public/assets/manual/shots/es-continuity.webp +0 -0
  38. package/public/assets/manual/shots/es-coordinator.webp +0 -0
  39. package/public/assets/manual/shots/es-copilot.webp +0 -0
  40. package/public/assets/manual/shots/es-diagnostics.webp +0 -0
  41. package/public/assets/manual/shots/es-home.webp +0 -0
  42. package/public/assets/manual/shots/es-local.webp +0 -0
  43. package/public/assets/manual/shots/es-memory.webp +0 -0
  44. package/public/assets/manual/shots/es-modes.webp +0 -0
  45. package/public/assets/manual/shots/es-modules.webp +0 -0
  46. package/public/assets/manual/shots/es-notes.webp +0 -0
  47. package/public/assets/manual/shots/es-settings.webp +0 -0
  48. package/public/assets/manual/shots/es-windows.webp +0 -0
  49. package/public/en.js +74 -0
  50. package/public/es.js +493 -136
  51. package/public/i18n.js +45 -7
  52. package/public/index.html +2 -3
  53. package/public/manual-content.js +657 -0
  54. package/public/manual-shots.js +43 -0
  55. package/public/manual.css +228 -0
  56. package/public/manual.html +15 -0
  57. package/public/manual.js +398 -0
  58. package/public/market-art.js +56 -0
  59. package/public/market-view.js +140 -22
  60. package/public/market.js +25 -14
  61. package/public/mcp-catalog.js +62 -0
  62. package/public/resay.js +1 -0
  63. package/public/salas-mac.css +178 -30
  64. package/public/salas-mac.html +5 -5
  65. package/public/salas-mac.js +432 -67
  66. package/public/styles.css +300 -42
  67. package/public/tour-chapters.js +98 -90
  68. package/public/tour.js +63 -21
  69. package/public/troubleshooting.js +145 -10
  70. package/src/adapters/cursor.mjs +56 -7
  71. package/src/adapters/gemini.mjs +12 -1
  72. package/src/adapters/madre.mjs +27 -6
  73. package/src/adapters/process.mjs +5 -2
  74. package/src/auth-probe.mjs +22 -3
  75. package/src/bridge/policy.mjs +1 -1
  76. package/src/bridge/server.mjs +1 -1
  77. package/src/capabilities.mjs +3 -3
  78. package/src/credentials.mjs +24 -2
  79. package/src/history.mjs +76 -0
  80. package/src/i18n.mjs +23 -1
  81. package/src/local-ai.mjs +10 -2
  82. package/src/looks.mjs +17 -5
  83. package/src/market-license.mjs +104 -0
  84. package/src/market-remote.mjs +17 -1
  85. package/src/mcp/notes-server.mjs +120 -0
  86. package/src/mcp/proxy.mjs +14 -3
  87. package/src/models.mjs +82 -9
  88. package/src/modules/index.mjs +3 -1
  89. package/src/modules/local-models.mjs +28 -0
  90. package/src/modules/notes.mjs +142 -0
  91. package/src/modules/ollama.mjs +39 -10
  92. package/src/modules/playwright.mjs +14 -3
  93. package/src/modules/reminders.mjs +345 -0
  94. package/src/modules/sdk.mjs +21 -5
  95. package/src/mother.mjs +11 -1
  96. package/src/ollama.mjs +2 -2
  97. package/src/opencode-health.mjs +63 -0
  98. package/src/outbound.mjs +25 -1
  99. package/src/reminder-time.mjs +127 -0
  100. package/src/room.mjs +19 -7
  101. package/src/runtime-detection.mjs +6 -2
  102. package/src/sentinel-errors.mjs +4 -3
  103. package/src/server.mjs +302 -70
  104. package/src/tour.mjs +24 -5
@@ -0,0 +1,127 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
3
+ // When a reminder is due, read from a person's own words (Reminders, 2026-10-20).
4
+ //
5
+ // «mañana a las 5», «el lunes», «en 2 horas», «cada día», «tomorrow at 9am», «every monday»: what
6
+ // people write when they say when, in Spanish or in English. Read here, without a model, so the
7
+ // same words always give the same hour and a reminder never depends on a model being awake. What
8
+ // is not said is filled the way a person would: a day without an hour is at 9:00, an hour without
9
+ // a day is the next time that hour comes, and «a las 5» with nothing else is in the afternoon.
10
+
11
+ const fold = (text) => String(text ?? '').normalize('NFD').replace(/\p{M}/gu, '').toLowerCase();
12
+ export const REPEATS = ['daily', 'weekdays', 'weekly'];
13
+ const DAYS = [
14
+ ['domingo', 'sunday'], ['lunes', 'monday'], ['martes', 'tuesday'], ['miercoles', 'wednesday'],
15
+ ['jueves', 'thursday'], ['viernes', 'friday'], ['sabado', 'saturday'],
16
+ ];
17
+ const dayIndex = (word) => DAYS.findIndex((names) => names.includes(word));
18
+ const DAY_WORDS = DAYS.flat().join('|');
19
+ const NUMBERS = { un: 1, una: 1, uno: 1, a: 1, an: 1, one: 1, dos: 2, two: 2, tres: 3, three: 3, cuatro: 4, four: 4, cinco: 5, five: 5, diez: 10, ten: 10, quince: 15, fifteen: 15, veinte: 20, twenty: 20, treinta: 30, thirty: 30 };
20
+ const UNIT_MS = { min: 60000, hor: 3600000, hou: 3600000, dia: 86400000, day: 86400000, sem: 7 * 86400000, wee: 7 * 86400000 };
21
+ export const DEFAULT_HOUR = 9;
22
+
23
+ const at = (base, hour, minute = 0) => { const next = new Date(base); next.setHours(hour, minute, 0, 0); return next; };
24
+ const plusDays = (base, days) => { const next = new Date(base); next.setDate(next.getDate() + days); return next; };
25
+
26
+ // The hour said, if any: «a las 5», «a las 17:30», «at 9am», «5 pm», «10:15».
27
+ function hourOf(text) {
28
+ const match = text.match(/\b(?:a las|a la|at)\s+(\d{1,2})(?::(\d{2}))?\s*(am|pm|a\.m\.|p\.m\.|de la manana|de la tarde|de la noche|hrs|h)?\b/)
29
+ ?? text.match(/\b(\d{1,2}):(\d{2})\s*(am|pm|a\.m\.|p\.m\.)?/)
30
+ ?? text.match(/\b(\d{1,2})()\s*(am|pm|a\.m\.|p\.m\.)(?![a-z])/);
31
+ if (!match) return null;
32
+ let hour = Number(match[1]);
33
+ const minute = Number(match[2] || 0);
34
+ const tag = match[3] ?? '';
35
+ if (hour > 23 || minute > 59) return null;
36
+ if (/pm|p\.m\.|tarde|noche/.test(tag) && hour < 12) hour += 12;
37
+ else if (/am|a\.m\.|manana/.test(tag) && hour === 12) hour = 0;
38
+ // «a las 5» with nothing else: a person at work means the afternoon, not dawn.
39
+ else if (!tag && hour >= 1 && hour <= 7) hour += 12;
40
+ return { hour, minute };
41
+ }
42
+
43
+ // The part of the day said in words, when no hour was.
44
+ function partOfDay(text) {
45
+ if (/\b(esta noche|en la noche|por la noche|tonight|in the evening)\b/.test(text)) return { hour: 20, minute: 0 };
46
+ if (/\b(esta tarde|en la tarde|por la tarde|this afternoon|in the afternoon)\b/.test(text)) return { hour: 17, minute: 0 };
47
+ if (/\b(en la manana|por la manana|in the morning)\b/.test(text)) return { hour: 9, minute: 0 };
48
+ if (/\b(al mediodia|a mediodia|at noon|noon)\b/.test(text)) return { hour: 12, minute: 0 };
49
+ return null;
50
+ }
51
+
52
+ // What repeats, and on which day for a weekly one.
53
+ function repeatOf(text) {
54
+ const weekly = text.match(new RegExp(`\\b(?:cada|todos los|every)\\s+(${DAY_WORDS})s?\\b`));
55
+ if (weekly) return { repeat: 'weekly', day: dayIndex(weekly[1]) };
56
+ if (/\b(entre semana|de lunes a viernes|every weekday|weekdays)\b/.test(text)) return { repeat: 'weekdays' };
57
+ if (/\b(cada dia|todos los dias|diario|diariamente|cada manana|todas las mananas|every day|everyday|daily|each day|every morning)\b/.test(text)) return { repeat: 'daily' };
58
+ if (/\b(cada semana|semanal(mente)?|every week|weekly)\b/.test(text)) return { repeat: 'weekly' };
59
+ return null;
60
+ }
61
+
62
+ // The next time a repeating reminder comes after `after`.
63
+ export function nextOccurrence(due, repeat, after = new Date()) {
64
+ let next = new Date(due);
65
+ if (!REPEATS.includes(repeat)) return next;
66
+ const step = () => {
67
+ if (repeat === 'weekly') next = plusDays(next, 7);
68
+ else {
69
+ next = plusDays(next, 1);
70
+ if (repeat === 'weekdays') while (next.getDay() === 0 || next.getDay() === 6) next = plusDays(next, 1);
71
+ }
72
+ };
73
+ for (let guard = 0; next <= after && guard < 4000; guard += 1) step();
74
+ return next;
75
+ }
76
+
77
+ // { due, repeat, said } for the words, or null when they say no time at all.
78
+ export function parseWhen(words, now = new Date(), { hour: dayHour = DEFAULT_HOUR } = {}) {
79
+ const text = fold(words);
80
+ const base = new Date(now);
81
+ const repeated = repeatOf(text);
82
+ const hour = hourOf(text) ?? partOfDay(text);
83
+ const said = [];
84
+
85
+ // «en 2 horas», «en media hora», «in 20 minutes»: a moment from now, the hour does not apply.
86
+ const relative = text.match(/\b(?:en|in|dentro de)\s+(\d+|media|half an?|un|una|uno|a|an|one|dos|two|tres|three|cuatro|four|cinco|five|diez|ten|quince|fifteen|veinte|twenty|treinta|thirty)\s+(min\w*|hor\w*|hou\w*|dia\w*|day\w*|sem\w*|wee\w*)/);
87
+ if (relative && !repeated) {
88
+ const amount = /^(media|half)/.test(relative[1]) ? 0.5 : Number(relative[1]) || NUMBERS[relative[1]] || 1;
89
+ const unit = UNIT_MS[relative[2].slice(0, 3)] ?? 3600000;
90
+ return { due: new Date(base.getTime() + amount * unit), repeat: null, said: relative[0] };
91
+ }
92
+
93
+ let day = null;
94
+ if (/\bpasado manana\b|\bday after tomorrow\b/.test(text)) { day = plusDays(base, 2); said.push('pasado mañana'); }
95
+ // «mañana» is tomorrow unless it is the morning: «la mañana», «de la mañana», «por la mañana».
96
+ else if (/(^|[^a-z])(manana)(?![a-z])/.test(text.replace(/\b(la|las|en la|por la|de la|cada|todas las)\s+manana(s)?\b/g, ' ')) || /\btomorrow\b/.test(text)) { day = plusDays(base, 1); said.push('mañana'); }
97
+ else if (/\b(hoy|today|tonight|esta tarde|esta noche|this afternoon)\b/.test(text)) { day = new Date(base); said.push('hoy'); }
98
+ else if (/\b(la proxima semana|la semana que viene|next week)\b/.test(text)) {
99
+ day = plusDays(base, ((8 - base.getDay()) % 7) || 7);
100
+ said.push('la próxima semana');
101
+ } else {
102
+ const named = text.match(new RegExp(`\\b(?:el|este|el proximo|on|next|this)?\\s*(${DAY_WORDS})\\b`));
103
+ if (named && !repeated) {
104
+ const target = dayIndex(named[1]);
105
+ const ahead = (target - base.getDay() + 7) % 7;
106
+ day = plusDays(base, ahead || 7);
107
+ said.push(named[1]);
108
+ }
109
+ }
110
+
111
+ if (repeated) {
112
+ let first = at(base, hour?.hour ?? dayHour, hour?.minute ?? 0);
113
+ if (repeated.repeat === 'weekly' && Number.isInteger(repeated.day)) first = plusDays(first, (repeated.day - base.getDay() + 7) % 7);
114
+ if (repeated.repeat === 'weekdays') while (first.getDay() === 0 || first.getDay() === 6) first = plusDays(first, 1);
115
+ const due = first > base ? first : nextOccurrence(first, repeated.repeat, base);
116
+ return { due, repeat: repeated.repeat, said: 'repeat' };
117
+ }
118
+ if (day) return { due: at(day, hour?.hour ?? dayHour, hour?.minute ?? 0), repeat: null, said: said.join(' ') };
119
+ if (hour) {
120
+ const today = at(base, hour.hour, hour.minute);
121
+ return { due: today > base ? today : plusDays(today, 1), repeat: null, said: 'hour' };
122
+ }
123
+ return null;
124
+ }
125
+
126
+ // When nothing was said: tomorrow, at the start of the day (the person's own start, from Reminders' settings).
127
+ export const tomorrowMorning = (now = new Date(), hour = DEFAULT_HOUR) => at(plusDays(now, 1), hour);
package/src/room.mjs CHANGED
@@ -1079,8 +1079,8 @@ export class Room {
1079
1079
 
1080
1080
  // A slash command's result, shared with everyone (and with agents through
1081
1081
  // the transcript) as a fact card.
1082
- async recordCommand({ name, title, text, ok, args = [] }) {
1083
- return this.#emit('command.output', { name, title, text: String(text ?? '').slice(0, 20000), ok: ok !== false, args });
1082
+ async recordCommand({ name, title, text, ok, args = [], link = null }) {
1083
+ return this.#emit('command.output', { name, title, text: String(text ?? '').slice(0, 20000), ok: ok !== false, args, ...(link ? { link } : {}) });
1084
1084
  }
1085
1085
 
1086
1086
  // Live settings changes from the room UI. Only the fields present change.
@@ -1154,8 +1154,10 @@ export class Room {
1154
1154
  this.#vectors.stop();
1155
1155
  }
1156
1156
 
1157
+ // Counted as work from the first moment: a message is read, checked and written down before its
1158
+ // turn exists, and a room that looked idle all that while was let go under it (2026-10-21).
1157
1159
  async send(options = {}) {
1158
- await this.#accept(options, null);
1160
+ await this.#track(this.#accept(options, null));
1159
1161
  }
1160
1162
 
1161
1163
  // An order from BISHOP (docs/MACROVERSO.md, S-028, D-S11). The same door as the human's message
@@ -1167,7 +1169,7 @@ export class Room {
1167
1169
  async order({ text, target, mode = 1 } = {}) {
1168
1170
  const wanted = Number(mode);
1169
1171
  if (!Number.isInteger(wanted) || wanted < 0 || wanted > 2) throw new Error('An order comes in at #2 at most; #3 and #4 are armed by the human in this room.');
1170
- const accepted = await this.#accept({ text, target, mode: wanted }, { via: 'bishop', depth: 1 });
1172
+ const accepted = await this.#track(this.#accept({ text, target, mode: wanted }, { via: 'bishop', depth: 1 }));
1171
1173
  const events = await this.#store.readAll();
1172
1174
  const reply = accepted?.responseMessageId ? events.find((event) => event.type === 'message.created' && event.payload?.messageId === accepted.responseMessageId)?.payload : null;
1173
1175
  const failed = accepted?.messageId ? events.findLast((event) => event.type === 'message.failed' && event.payload?.messageId === accepted.messageId)?.payload : null;
@@ -1655,11 +1657,11 @@ export class Room {
1655
1657
  claude: ['--no-session-persistence: the run keeps no session of its own.', 'Only the project\'s own CLAUDE.md and MADRE\'s briefing are read; hooks, plugins and outside MCP servers are not.'],
1656
1658
  gemini: ['GEMINI_CLI_HOME points at a temporary home made for this turn and removed after it, so settings, hooks and extensions come from there and not from yours.', 'GEMINI_CLI_NO_RELAUNCH keeps the launcher from spawning a second process MADRE could not stop.'],
1657
1659
  opencode: ['The run is given the model you chose and nothing else of your session.'],
1658
- cursor: ['--mode ask: Cursor\'s read-only mode, whatever its own settings say; no edits and no commands.', 'CURSOR_CONFIG_DIR points at a configuration made for this turn and removed after it: every command and every write denied. The sign-in stays in the system keychain.'],
1660
+ cursor: ['#0 and #1: --mode ask, Cursor\'s read-only mode, whatever its own settings say; no edits and no commands. #2 and #3: its agent mode with --force, writing allowed and every command denied. #4: commands allowed too. The places nobody writes stay denied at every mode, and MADRE locks and puts them back itself.', 'CURSOR_CONFIG_DIR points at a configuration made for this turn and removed after it, with only what the mode you chose allows. The sign-in stays in the system keychain.'],
1659
1661
  }[agent.id] ?? [];
1660
1662
  const env = {
1661
1663
  gemini: [{ name: 'GEMINI_CLI_HOME', note: 'the temporary home for this turn' }, { name: 'GEMINI_CLI_NO_RELAUNCH', note: 'so the launcher stays killable' }],
1662
- cursor: [{ name: 'CURSOR_CONFIG_DIR', note: 'the configuration for this turn: read only' }, { name: 'NO_OPEN_BROWSER', note: 'a turn never opens a page' }],
1664
+ cursor: [{ name: 'CURSOR_CONFIG_DIR', note: 'the configuration for this turn, from the mode you chose' }, { name: 'NO_OPEN_BROWSER', note: 'a turn never opens a page' }],
1663
1665
  }[agent.id] ?? [];
1664
1666
  return {
1665
1667
  agent: agent.id, label: agent.label, local: false,
@@ -1853,6 +1855,9 @@ export class Room {
1853
1855
  // And for its closing turn of a round: what each agent asked actually said, with its number.
1854
1856
  round: agent.id === MADRE_AGENT_ID && planId && /this is your closing turn/i.test(text) ? await this.#roundAnswers(planId) : undefined,
1855
1857
  });
1858
+ // STOP was pressed while the agent answered: whatever comes back late is not said (2026-10-20).
1859
+ // An adapter that does not hear the signal still cannot post an answer the person stopped.
1860
+ signal?.throwIfAborted();
1856
1861
  // Privacy: a private term in a reply is replaced before the ledger, the plan parser,
1857
1862
  // the archivist or any other agent can see it. The reply says how many, not which.
1858
1863
  const guarded = this.#privacy?.redact(result.text ?? '') ?? { text: result.text, hits: 0 };
@@ -1981,7 +1986,10 @@ export class Room {
1981
1986
  await this.#recordUsage(agent.id, result.usage, { messageId, responseMessageId });
1982
1987
  await this.#recordCost(agent.id, responseMessageId, result.usage, turnMode);
1983
1988
  this.#liveTurns.delete(responseMessageId);
1984
- await this.#emit('agent.completed', { messageId, agent: agent.id, handoffId, planId });
1989
+ // Which model the turn ran on, when the room knows it (the one asked for, or the agent's
1990
+ // default): what answered is what MADRE can offer again when another model fails.
1991
+ const ranOn = await this.#pricedModel(agent.id, model).catch(() => null);
1992
+ await this.#emit('agent.completed', { messageId, agent: agent.id, handoffId, planId, ...(ranOn ? { ranOn } : {}) });
1985
1993
  return { responseMessageId, directives };
1986
1994
  } catch (error) {
1987
1995
  if (responseMessageId) this.#liveTurns.delete(responseMessageId);
@@ -2014,10 +2022,14 @@ export class Room {
2014
2022
  }
2015
2023
  }
2016
2024
  const cutByClock = ['TIMEOUT', 'IDLE'].includes(error?.code);
2025
+ const failedOn = await this.#pricedModel(agent.id, model).catch(() => null);
2017
2026
  await this.#emit('message.failed', {
2018
2027
  messageId, target: agent.id, planId,
2028
+ ...(failedOn ? { ranOn: failedOn } : {}),
2019
2029
  error: this.#privacy ? this.#privacy.redact(plain).text : plain,
2020
2030
  ...(this.#turns.get(messageId)?.stoppedByHuman ? { stopped: true } : {}),
2031
+ // Cut because MADRE is closing: nothing went wrong in the turn, so nobody files it as a fault.
2032
+ ...(this.#shuttingDown ? { closing: true } : {}),
2021
2033
  ...(cutByClock ? { timeout: { ms: this.timeoutFor(agent.id, { writing: Boolean(lease) }), writing: Boolean(lease), idle: error.code === 'IDLE' } } : {}),
2022
2034
  ...(partial ? { partial } : {}),
2023
2035
  });
@@ -2,11 +2,13 @@
2
2
  // MADRE · © 2026 Jossue Alcalá · GNU AGPL v3 with additional terms (Section 7): ADDITIONAL-TERMS.md
3
3
  import { constants } from 'node:fs';
4
4
  import { access } from 'node:fs/promises';
5
- import { homedir } from 'node:os';
5
+ import { homedir, userInfo } from 'node:os';
6
6
  import { delimiter, join } from 'node:path';
7
7
  import { execFile } from 'node:child_process';
8
8
  import { promisify } from 'node:util';
9
9
 
10
+ const accountHome = () => { try { return userInfo().homedir || homedir(); } catch { return homedir(); } };
11
+
10
12
  const execFileAsync = promisify(execFile);
11
13
 
12
14
  const definitions = [
@@ -43,7 +45,9 @@ const definitions = [
43
45
  // on the PATH a room is started with.
44
46
  id: 'cursor',
45
47
  label: 'Cursor',
46
- candidates: ['cursor-agent', join(homedir(), '.local', 'bin', 'cursor-agent')],
48
+ // Also the account's own home, as the system knows it (2026-10-20): a MADRE started with
49
+ // another HOME (a test home, a launcher) still finds the CLI the person installed.
50
+ candidates: [...new Set(['cursor-agent', join(homedir(), '.local', 'bin', 'cursor-agent'), join(accountHome(), '.local', 'bin', 'cursor-agent')])],
47
51
  versionArgs: ['--version'],
48
52
  adapter: 'cursor-readonly',
49
53
  },
@@ -102,12 +102,13 @@ export class ErrorSentinel {
102
102
  // A room event goes by: a failure MU/TH/UR cannot classify is worth a report.
103
103
  async observe(event) {
104
104
  if (event?.type !== 'message.failed') return null;
105
- const { target, error, stopped } = event.payload ?? {};
105
+ const { target, error, stopped, closing } = event.payload ?? {};
106
106
  if (typeof error !== 'string' || !error.trim()) return null;
107
107
  // A turn the human stopped is not a condition. It ends exactly like a failure because the
108
108
  // process really was killed, but nothing went wrong and there is nothing for anyone to
109
- // diagnose — filing it would be reporting the brake as a fault.
110
- if (stopped) return null;
109
+ // diagnose — filing it would be reporting the brake as a fault. A turn cut because MADRE was
110
+ // closing is the same: every room closed mid-turn filed «MADRE is shutting down» (2026-10-21).
111
+ if (stopped || closing) return null;
111
112
  const known = diagnose(error, target ?? null);
112
113
  if (known.length) return null;
113
114
  return this.record({ kind: 'unknown', agent: target ?? null, error, at: event.timestamp });