@jossuealcala/madre 1.1.1 → 1.1.3

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 (108) hide show
  1. package/CHANGELOG.en.md +42 -1
  2. package/CHANGELOG.md +42 -1
  3. package/README.en.md +4 -4
  4. package/README.md +4 -4
  5. package/SECURITY.md +11 -6
  6. package/bin/madre.mjs +74 -11
  7. package/docs/REFERENCE.md +15 -8
  8. package/docs/SDK.md +8 -8
  9. package/docs/en/REFERENCE.md +12 -7
  10. package/docs/en/SDK.md +8 -8
  11. package/docs/en/training/README.md +1 -1
  12. package/docs/sdk/connector-module.mjs +1 -1
  13. package/docs/sdk/hello-module.mjs +1 -1
  14. package/docs/training/README.md +1 -1
  15. package/docs/training/train.sh +3 -0
  16. package/package.json +4 -2
  17. package/public/activity.js +9 -0
  18. package/public/app.js +990 -173
  19. package/public/attribution.js +9 -0
  20. package/public/brands.js +27 -13
  21. package/public/en.js +2 -3
  22. package/public/es.js +968 -258
  23. package/public/index.html +3 -0
  24. package/public/macroverso.js +24 -5
  25. package/public/manual-content.js +38 -8
  26. package/public/market-view.js +116 -9
  27. package/public/market.js +28 -2
  28. package/public/news-scenes.js +185 -0
  29. package/public/notices.js +66 -0
  30. package/public/power.js +1 -1
  31. package/public/resay.js +3 -0
  32. package/public/salas-mac.css +294 -22
  33. package/public/salas-mac.html +3 -0
  34. package/public/salas-mac.js +760 -38
  35. package/public/styles.css +393 -17
  36. package/public/tips.js +124 -0
  37. package/public/tour-chapters.js +75 -75
  38. package/public/tour.js +36 -8
  39. package/public/troubleshooting.js +215 -22
  40. package/public/welcome-scene.js +358 -0
  41. package/public/welcome.js +523 -254
  42. package/src/adapters/gemini-rest.mjs +236 -0
  43. package/src/adapters/gemini.mjs +9 -7
  44. package/src/adapters/grok.mjs +288 -0
  45. package/src/adapters/process.mjs +14 -3
  46. package/src/auth-probe.mjs +32 -0
  47. package/src/bridge/policy.mjs +1 -1
  48. package/src/capabilities.mjs +30 -0
  49. package/src/checkpoint.mjs +115 -1
  50. package/src/codex-route.mjs +113 -0
  51. package/src/credentials.mjs +46 -8
  52. package/src/dataset.mjs +21 -8
  53. package/src/embeddings.mjs +2 -2
  54. package/src/event-store.mjs +10 -2
  55. package/src/ficha.mjs +142 -0
  56. package/src/file-ops.mjs +9 -3
  57. package/src/files.mjs +36 -2
  58. package/src/github.mjs +5 -3
  59. package/src/lease.mjs +5 -0
  60. package/src/market-check.mjs +1 -1
  61. package/src/market-remote.mjs +170 -3
  62. package/src/mcp/image-server.mjs +1 -1
  63. package/src/mcp/memory-server.mjs +22 -3
  64. package/src/mcp/proxy.mjs +31 -8
  65. package/src/memory-tools.mjs +12 -2
  66. package/src/memory.mjs +44 -3
  67. package/src/models.mjs +21 -3
  68. package/src/modules/ahp.mjs +8 -3
  69. package/src/modules/bishop-exam.mjs +41 -12
  70. package/src/modules/bishop.mjs +2 -2
  71. package/src/modules/check-alone.mjs +25 -0
  72. package/src/modules/choices.mjs +12 -10
  73. package/src/modules/fetch-alone.mjs +7 -0
  74. package/src/modules/helpers.mjs +23 -5
  75. package/src/modules/image-studio.mjs +13 -27
  76. package/src/modules/index.mjs +88 -11
  77. package/src/modules/isolated.mjs +160 -0
  78. package/src/modules/ollama.mjs +35 -6
  79. package/src/modules/playwright.mjs +46 -17
  80. package/src/modules/run-alone.mjs +122 -0
  81. package/src/modules/runs.mjs +11 -8
  82. package/src/modules/sdk.mjs +4 -2
  83. package/src/mother.mjs +6 -1
  84. package/src/notices-key.mjs +8 -0
  85. package/src/notices.mjs +185 -0
  86. package/src/ollama.mjs +57 -15
  87. package/src/outbound.mjs +56 -11
  88. package/src/room/archivist.mjs +36 -5
  89. package/src/room/busy.mjs +16 -0
  90. package/src/room/context.mjs +6 -3
  91. package/src/room/control.mjs +36 -6
  92. package/src/room/copilot.mjs +22 -28
  93. package/src/room/guard.mjs +32 -2
  94. package/src/room/prompt.mjs +32 -5
  95. package/src/room/vectors.mjs +7 -1
  96. package/src/room.mjs +98 -32
  97. package/src/router.mjs +1 -1
  98. package/src/runs.mjs +39 -0
  99. package/src/runtime-detection.mjs +46 -6
  100. package/src/salas.mjs +253 -15
  101. package/src/server.mjs +686 -87
  102. package/src/service.mjs +116 -0
  103. package/src/setup-trouble.mjs +20 -1
  104. package/src/skill-check.mjs +269 -0
  105. package/src/skills-import.mjs +128 -0
  106. package/src/skills.mjs +492 -0
  107. package/src/tour.mjs +15 -4
  108. package/src/whats-new.mjs +71 -0
package/docs/SDK.md CHANGED
@@ -36,9 +36,9 @@ export default {
36
36
  };
37
37
  ```
38
38
 
39
- **Tu módulo no importa paquetes.** Ni a MADRE, ni al SDK, ni nada de npm. Antes de instalarlo, MADRE copia tu archivo a una carpeta temporal aparte y lo carga ahí —así revisa qué es sin que corra donde vive— y en esa carpeta no hay `node_modules`: un `import` por nombre de paquete no resuelve y la instalación falla.
39
+ **Tu módulo no importa paquetes.** Ni a MADRE, ni al SDK, ni nada de npm. Antes de instalarlo, MADRE copia tu archivo a una carpeta temporal aparte y lo carga en un proceso con permisos limitados; en esa carpeta no hay `node_modules`: un `import` por nombre de paquete no resuelve y la instalación falla. Ya instalado, cada llamada al módulo también corre en un proceso separado.
40
40
 
41
- Los **builtins de Node sí**, siempre: `node:fs`, `node:url`, `node:tls`, `node:child_process`. Con eso alcanza para hablar cualquier protocolo. Lo que no hay es nada que instalar.
41
+ Los **builtins de Node se pueden importar**: `node:fs`, `node:url`, `node:tls`, `node:child_process`. El cerco limita lo que hacen: un módulo tuyo no puede leer archivos ajenos, escribir directamente ni abrir procesos. Para hablar con un servicio externo puede usar `fetch` o los protocolos de Node según las reglas de red de la versión de Node. No hay paquetes que instalar.
42
42
 
43
43
  Si necesitas `defineModule` —para calcular algo antes de definir el módulo, por ejemplo— **MADRE te lo entrega**: exporta una función y lo recibes como argumento.
44
44
 
@@ -77,12 +77,12 @@ la suite compara esta tabla contra el código, así que si alguna vez se separan
77
77
  | `credit` | De quién fue la idea, si no fue tuya: un nombre. MADRE lo dice en la ficha del módulo y en el Mercado («Idea de …») |
78
78
  | `icon` | El ícono de tu módulo: `{ svg, color }`. `svg` es el dibujo —sus formas (`<path d="…"/>`) o un `<svg>` entero, en la cuadrícula que quieras— y `color` el de su mosaico, `#rrggbb`. MADRE lo ajusta solo para que se vea como los suyos: lo centra y lo escala al mismo cuadro, lo pinta en blanco y de un solo color, usa el color de MADRE más parecido al tuyo y quita lo que no sea dibujo (scripts, imágenes, enlaces, estilos, degradados). Sin `icon`, tu módulo lleva la pieza de rompecabezas en gris. Hasta 8000 caracteres |
79
79
  | `slash` | Comandos `/nombre` que corren en el servidor con tu `ctx` y devuelven `{ ok, title, text, link }`. La sala los muestra como tarjeta y los agentes los leen. `link` es opcional: `{ href, label }` con una ruta tuya (`/api/x/<id>/…`), y la tarjeta la ofrece como botón que abre otra pestaña; una dirección fuera de tus rutas se ignora |
80
- | `toolsForTurn(ctx, turn)` | Servidores MCP para el turno de un agente: `[{ name, command, args, env, tools, sends, brief }]`. MADRE los adjunta a la CLI en su corrida aislada y describe `brief` al agente. `turn` trae el agente, el modo, el arriendo, la carpeta, el puerto y `turn.turn`: el id de la respuesta que ese turno escribirá. Si tu servidor llama de vuelta a la sala en nombre del turno, manda ese id; `ctx.room.runningTurn(id)` dice si sigue corriendo y para qué agente |
80
+ | `toolsForTurn(ctx, turn)` | Servidores MCP para el turno de un agente: `[{ name, command, args, env, tools, sends, brief }]`. Para un módulo tuyo, `command` debe ser Node y el primer argumento debe ser **el mismo archivo del módulo**; MADRE lo arranca con el mismo cerco de permisos. Un ejecutable diferente no se ofrece al agente. `turn` trae el agente, el modo, el arriendo, la carpeta, el puerto y `turn.turn`: el id de la respuesta que ese turno escribirá |
81
81
  | `toolsForTurn` → `sends` | Cuáles de tus herramientas **mandan algo fuera**. El núcleo las retira por debajo de `#4` AIRLOCK: ni se le cuenta al modelo que existen. Ver abajo |
82
82
  | `reaches` | A dónde llega tu módulo, en las mismas cuatro respuestas que da MADRE de las suyas. Ver abajo |
83
83
  | `secrets` | Las llaves que necesitas, declaradas en vez de dibujadas: `[{ name, label, note, where }]`. MADRE pinta el campo, la guarda en su bodega bajo tu id y te la devuelve por `ctx.vault`. Ver abajo |
84
84
  | `routes` | Rutas HTTP propias: `{ method, path, handler(ctx, { payload, params, url, request, viaPhone }) }` → `{ status, body }`. `viaPhone` es `true` cuando la petición llega desde un teléfono emparejado: niégalo tú si tu ruta es de la Mac |
85
- | `onEvent(ctx, event)` | Cada evento del ledger de cada conversación viva de la sala, mientras tu módulo está encendido. `ctx.room` y `ctx.chat` son los de esa conversación y `ctx.record` escribe en ella. Corre aparte: lo que tarde o falle no detiene a la sala. Como siempre, un módulo no fabrica mensajes ni turnos |
85
+ | `onEvent(ctx, event)` | Cada evento del ledger de cada conversación viva de la sala, mientras tu módulo está encendido. `ctx.room` y `ctx.chat` son los de esa conversación y `ctx.record` escribe en ella. Corre aparte: lo que tarde o falle no detiene a la sala. En un módulo que instala una persona, cada evento abre un proceso nuevo: lo que guardes en una variable no llega al siguiente (guárdalo con `ctx.updateConfig`), y también llegan los avisos de cuánto queda del plan de cada IA, aunque nadie escriba; mira `event.type` primero y termina pronto. Como siempre, un módulo no fabrica mensajes ni turnos |
86
86
  | `controls` | Los ajustes de tu módulo, declarados en vez de dibujados: `[{ key, label, type: 'select' \| 'switch' \| 'text', options, choices, note, invert }]`. MADRE los pinta en la ficha y los guarda en tu bloque de `config.json`. En un `select`, `choices: [{ value, label }]` dice qué frase lee la persona por cada valor que se guarda (si lo das, `options` sale de ahí); sin él, la persona lee el valor tal cual |
87
87
  | `onSettings(ctx, settings)` | Te avisa cuando la humana cambió uno de tus `controls`, por si algo vivo tiene que enterarse |
88
88
  | `conditions` | Entradas para el catálogo de MU/TH/UR, con remedio por plataforma |
@@ -236,7 +236,7 @@ terminando, y mientras tanto solo se activa a propósito con `PULSE_LABS=correo`
236
236
 
237
237
  La ficha de un módulo tuyo trae **GET A NEWER FILE**: MADRE va por el archivo —a la `url` que declaraste o al archivo desde el que lo instalaste—, lo verifica en una copia aparte y solo reemplaza al instalado si carga, respeta las reglas de la casa y dice una versión distinta. Verificar no instala nada.
238
238
 
239
- Y en la cabecera de MODULES hay **+ ADD A MODULE** para instalar el `.mjs` de alguien más. Pasa por la misma puerta que todo lo demás. Dicho claro, porque es lo que es: un módulo corre **dentro de MADRE, con los permisos de quien la abre**. MADRE comprueba que cargue y que no se salga de su corral —id propio, rutas solo bajo `/api/x/<id>/`, jamás encima de un módulo de MADRE—; lo que el código *pretende* no lo puede comprobar nadie más que tú.
239
+ Y en la cabecera de MODULES hay **+ ADD A MODULE** para instalar el `.mjs` de alguien más. Pasa por la misma puerta que todo lo demás. MADRE lo carga y ejecuta aparte: las API ordinarias pueden leer su archivo y el código del SDK, pero no escribir tus archivos ni abrir procesos. Si ofrece una herramienta MCP, también debe ser ese mismo archivo y corre con esos límites. Cuando Node ofrece `--allow-net`, solo un módulo que declara un destino recibe acceso a la red; en versiones anteriores, el modelo de permisos no restringe la red. La declaración no limita los dominios a los que puede llamar. **El modelo de permisos de Node no es una barrera de seguridad contra código malicioso.** Revisa el código y los destinos antes de instalarlo.
240
240
 
241
241
  ### En el Mercado, para todos
242
242
 
@@ -276,12 +276,12 @@ Un módulo que se instala en el proyecto en vez de encenderse conserva su tarjet
276
276
  ctx = {
277
277
  projectRoot, stateRoot, // el proyecto y ~/.pulse
278
278
  config, settings, // config.json completo y tus ajustes con defaults
279
- env, agents, room, // agentes detectados; la sala (room.capabilities(), room.record(...))
279
+ env, agents, room, // env vacío para módulos tuyos; agentes detectados; sala mediada
280
280
  readConfig(), updateConfig(patch),
281
281
  record(type, payload), // escribe un evento en el ledger; tipo "algo.algo", nunca message.* ni agent.*
282
282
  language, t(text, vars), // el idioma de la sala, 'es' o 'en', y tus palabras en él (sdk: 2):
283
283
  // una frase en inglés que MADRE ya conoce, o la tuya en { es, en }
284
- services: { history, imageKey, ollama: { state, generate }, … }, // lo que el servidor ofrece;
284
+ services: { history, ollama: { state, generate } }, // lo que el servidor ofrece a módulos tuyos;
285
285
  // ollama.generate({ system, prompt, json }) contesta con el modelo local (sdk: 2)
286
286
  vault: { get, held, keep, forget } // tus secretos, y solo los tuyos
287
287
  }
@@ -329,7 +329,7 @@ Un módulo tuyo lleva la etiqueta «Tuyo» y se quita desde su ficha con «Quita
329
329
 
330
330
  ## Lo que un módulo no puede tocar
331
331
 
332
- Un módulo corre dentro del proceso de MADRE con tus permisos: instala solo lo que leíste. MADRE, por su parte, protege su núcleo así:
332
+ Un módulo tuyo corre en un proceso separado. El modelo de permisos de Node limita las API ordinarias a su archivo y el código del SDK, sin escritura directa ni apertura de otros procesos. Las funciones de `ctx` pasan por MADRE: la bodega solo entrega los secretos de ese módulo y `updateConfig` solo acepta su bloque de ajustes. Una herramienta MCP del módulo usa el mismo archivo y cerco; si el turno tiene carpeta de borrador, puede escribir allí. El modelo de Node no garantiza contener código malicioso: revisa el código y los destinos de red antes de instalarlo. MADRE protege su núcleo así:
333
333
 
334
334
  - Sus rutas HTTP viven bajo `/api/x/<id>/`; un módulo con rutas fuera de ahí no carga, así ninguno puede suplantar `/api/state`, `/api/messages` o cualquier ruta propia de MADRE.
335
335
  - No puede usar el `id` de un módulo integrado ni de otro ya cargado.
@@ -14,7 +14,7 @@ Everything MADRE does, with the exact numbers. To get started in five minutes, s
14
14
  You need Node 22.5 or later and at least one of these CLIs with a signed-in session: **Codex**, **Claude Code**, **Gemini CLI**, **OpenCode**. If **Ollama** is also running with a chat model, the project gets a fifth, local agent.
15
15
 
16
16
  1. Run `npx @jossuealcala/madre` from any folder: it opens Home, with all your projects and the Coordinator at the top. The first time, a three-step assistant walks you through it: connect the agents (each with its own button to install it and sign in, right there; once for all projects), add the projects (you choose folders inside your user folder; adding does not open them) and open the ones you are going to use. `npx @jossuealcala/madre start` inside a folder still opens that project directly; if there are no agents, the project opens anyway on Connect your agents so you can install them and sign in.
17
- 2. The project opens at `http://127.0.0.1:4317`. Pick an agent in the selector or type `@claude …`. The chip next to `to @agente` says which mode the message goes out in; `#1 CHAT ONLY`, read-only, is the default.
17
+ 2. The project opens at `http://127.0.0.1:4317`. MADRE opens the browser with its ficha in the address (`?ficha=…`): the browser keeps it and the address is left clean. Pick an agent in the selector or type `@claude …`. The chip next to `to @agente` says which mode the message goes out in; `#1 CHAT ONLY`, read-only, is the default.
18
18
  3. To add or reconnect an AI later: Settings → Agents (the settings button in the bar, or ⌘, / Ctrl+,), where the agents live alongside the rest of the settings. Codex, Claude Code, Gemini (with your Google account) and OpenCode (with GitHub Copilot) sign in with one click; Gemini and OpenCode also accept their key right there. Under each agent, "Prefer your terminal?" unfolds the same step written as a command, for whoever prefers to do it by hand. MADRE does not store provider credentials: each session and each key goes to its own CLI's file.
19
19
  4. With Ollama, the Local AI module (Modules, in the bar) is already on: memory is embedded locally and `@madre` appears in the row.
20
20
  5. Settings → Memory decides who distills the memory and how often. The Memory map, from the Diagnostics header, shows what the project remembers.
@@ -25,7 +25,7 @@ npx @jossuealcala/madre setup # the same setup, from the terminal, if you
25
25
  npx @jossuealcala/madre start --no-open --project RUTA
26
26
  ```
27
27
 
28
- **On a server, with no screen.** MADRE listens only on `127.0.0.1` of the machine it runs on, and on purpose: it has no password, and whoever reached it could set the agents to work there. Do not open its ports to the network. To use it on a server, open it through an SSH tunnel from your computer. Home uses 4317 and every project you open takes the next free port (4318, 4319…), so the tunnel carries several; if you open more projects, add more `-L`.
28
+ **On a server, with no screen.** MADRE listens only on `127.0.0.1` of the machine it runs on, and on purpose: whoever reached it could set the agents to work there. Do not open its ports to the network. To use it on a server, open it through an SSH tunnel from your computer. Home uses 4317 and every project you open takes the next free port (4318, 4319…), so the tunnel carries several; if you open more projects, add more `-L`.
29
29
 
30
30
  ```bash
31
31
  # on your computer: reach the server with the tunnel
@@ -34,7 +34,9 @@ ssh -L 4317:127.0.0.1:4317 -L 4318:127.0.0.1:4318 -L 4319:127.0.0.1:4319 -L 4320
34
34
  npx @jossuealcala/madre --no-open
35
35
  ```
36
36
 
37
- Then open `http://127.0.0.1:4317/salas` in your computer's browser. The agents are installed on the server and connected from Settings › Agents: Claude gives you a link and a code you paste right there, and Gemini and OpenCode take their key. Use your own user, not root: the agents work with the permissions of whoever runs MADRE.
37
+ Then open, in your computer's browser, the address MADRE wrote in the server's terminal, the one that ends in `?ficha=…`. The agents are installed on the server and connected from Settings › Agents: Claude gives you a link and a code you paste right there, and Gemini and OpenCode take their key. Use your own user, not root: the agents work with the permissions of whoever runs MADRE.
38
+
39
+ **The ficha.** Every request to MADRE carries its ficha (Spanish for «token»): a random secret in `~/.pulse/credentials/ficha.json` that only your user can read. The browser gets it once, in the address MADRE opens, and keeps it in a cookie; MADRE's own processes send it in the `x-madre-ficha` header. Without it, MADRE only says that it is MADRE and its version: it lets nobody read your projects, install modules or open #4. Home makes a new one each time it starts and opens the browser; a restart with no browser (an update, a project Home opens) keeps the one before. A tab without the ficha tells you where to open MADRE from. What it does not stop: a program running as your user can read the file, as it reads everything of yours, and the cookie also travels to other ports of `127.0.0.1` you open in the same browser.
38
40
 
39
41
  **Three names.** **MADRE** is the product. **Diagnostics** is its operational voice: failures, connections, settings. **Log** is the channel the project runs on: the event record, the plan block, the `.pulse/` folder where artifacts land; those identifiers keep their old name, PULSE.
40
42
 
@@ -96,7 +98,7 @@ Every message goes out with a mode. Your mode is the ceiling of any plan that me
96
98
 
97
99
  **A permission with a time limit.** An agent that needs more asks for it in one line with the mode and for how long ("I need #3 for 15 min: …"). Its reply carries a card with the mode, the time it asked for and the options available (#3: 5, 15 or 30 min; #4: 5 min) or just that message; the key opens that window for that agent.
98
100
 
99
- **Copilot.** The robot next to mode · model · effort. It is turned on with the `#3` key, once, for 30 min, 1, 4, 8 or 24 h; `STOP ALL`, turning it off or a restart end it. While it lasts, a message in `#3` does not ask for the key and goes to the agent you are writing to, even if its Max mode is `#2`, as long as its CLI can write. That agent edits the project, builds plans and gives each step up to `#3`, and the commands it asks for that are safe —reading (`ls`, `cat`, `rg`…), tests and builds (`npm test`, `npm run build`, `node --test`, `pytest`, `go test`…), local git (`status`, `diff`, `log`, `add`, `commit`)— run on their own and their result goes back to it; any other line waits for your button. What it deletes comes back when the turn ends, it never touches `.git/`, `.pulse/`, `.madre/` or the `.env` files, and `#4` still asks for its own key. After eight rounds of commands without you writing, it stops and lets you know.
101
+ **Copilot.** The robot next to mode · model · effort. It is turned on with the `#3` key, once, for 30 min, 1, 4, 8 or 24 h; `STOP ALL`, turning it off or a restart end it. While it lasts, a message in `#3` does not ask for the key and goes to the agent you are writing to, even if its Max mode is `#2`, as long as its CLI can write. That agent edits the project, builds plans and gives each step up to `#3`, and the commands it asks for that only read —`ls`, `cat`, `rg`, `git status`, `git diff`, `git log`, `node --check`— run on their own and their result goes back to it. Tests, builds, linters and git versions (`npm test`, `npm run build`, `node --test`, `pytest`, `cargo`, `git commit`…) wait for your button, like any other line: they run the project's code, and the copilot may have changed it in its turn (since 1.1.2). What it deletes comes back when the turn ends, it never touches `.git/`, `.pulse/`, `.madre/` or the `.env` files, and `#4` still asks for its own key. After eight rounds of commands without you writing, it stops and lets you know.
100
102
 
101
103
  **Mode per step.** An orchestrator can ask for each step's mode: `@codex #2: crea la página`, `@claude #3: arregla el router`. Without a number, the step only reads, or creates if the plan can already create: `#3` is asked for by name. MADRE respects each agent's `MAX MODE`. With your message in `#3`, the orchestrator's word is enough for a `#3` step; with your message in `#1`, a `#2` step goes through the permission request and `#3` or `#4` asks for your key. A `#4` step always asks for that agent's key, even if your message is in `#4`.
102
104
 
@@ -129,7 +131,7 @@ Since 1.1.0, from **#1 to #3**, Claude, OpenCode and Codex may split their work
129
131
  | **Claude** | The `Agent` tool: the subagent inherits the same tools and rules (`--tools`, `--allowedTools`, `dontAsk`) | No `Agent` |
130
132
  | **OpenCode** | Only `explore` and `general`, each with the turn's permissions and unable to call another (OpenCode's own write and run commands) | `task` denied |
131
133
  | **Codex** | Its subagents stay inside the same sandbox | A one-thread limit: `features.multi_agent_v2.max_concurrent_threads_per_session=1` |
132
- | **Gemini** · **Cursor** | No | No |
134
+ | **Gemini** · **Cursor** · **Grok** | No | No |
133
135
 
134
136
  Tried with the real AIs (Claude 2.1.267, OpenCode 1.18.4, Codex 0.161): in #1 the subagent reads and does not write; in #3 it writes in the project, `.pulse/` refuses it and there are no commands; in #4 Codex answers «agent thread limit reached».
135
137
 
@@ -153,7 +155,7 @@ MADRE runs the steps as normal turns: each one stays in the ledger and goes thro
153
155
 
154
156
  **TURNS.** In Diagnostics, next to the sentinel. On by default: a conversation that is still working when you open another one does not stop, it keeps writing its record and the conversations panel marks it until it finishes. Two limits: conversations working at the same time (2) and turns at the same time in each one (3); a message that would exceed them is rejected with the reason before it starts. All conversations share a single holder of EDIT or FULL ACCESS. When it is off, a single conversation drives the agents and you cannot switch away from one that is working. `STOP ALL` stops them all.
155
157
 
156
- **STOP ALL.** The button in the bar, `STOPALL` in the Write box or `curl -X POST http://127.0.0.1:4317/api/stop-all` stop all plans and kill all agent processes. Diagnostics warns in red when the project gets out of hand: three agents at once, one agent with two overlapping turns, a plan longer than five minutes.
158
+ **STOP ALL.** The button in the bar, `STOPALL` in the Write box or `curl -X POST -H "x-madre-ficha: $(node -p "require(require('os').homedir() + '/.pulse/credentials/ficha.json').ficha")" http://127.0.0.1:4317/api/stop-all` stop all plans and kill all agent processes. Diagnostics warns in red when the project gets out of hand: three agents at once, one agent with two overlapping turns, a plan longer than five minutes.
157
159
 
158
160
  ---
159
161
 
@@ -199,7 +201,7 @@ Change who it goes to and the words change; raise the mode and the permission it
199
201
 
200
202
  **THE LAUNCH.** Below the document, the exact command MADRE would run to deliver it: the executable, the directory, every flag and the place where the briefing goes in. It is not a description — it is built by the same adapters that would build it for real. Below that, what keeps the run inside the turn (the session that does not persist, the temporary home that is deleted when it ends) and the MCP servers it could call, with their tools counted. **No environment value from that command is ever printed, only the names**: a command line is something people take photos of.
201
203
 
202
- **Outbound.** The record of what went out: every destination MADRE or an agent called, with its count. Never bodies, headers or query values — only where and how many times.
204
+ **Outbound.** The record of MADRE's and its modules' `fetch` calls, including isolated modules and their one-file MCP servers. It does not observe other Node protocols or agent CLI connections. It never stores bodies, headers or query values: only destinations and call counts.
203
205
 
204
206
  **The console.** Inside the core, Diagnostics answers from what the project already has. Three answers it does not understand and the interface closes.
205
207
 
@@ -355,6 +357,7 @@ MADRE's folder is only taken away whole when it is MADRE's beyond doubt: an abso
355
357
  - how many projects and how many are open;
356
358
  - which of MADRE's own modules are on (one the person wrote only counts as «another»);
357
359
  - how many days the copy has.
360
+ - **The road to the first message (since 1.1.2):** how many times each step of the welcome was reached, which one was finished and which one was left for later (only the step's name: `welcome.at.project`, `welcome.skip.ai`…); how many projects were created, added, made to try and opened; whether someone who updated with no project was shown the invitation to add one and what they chose (`invite.project.shown`, `picked`, `sample`, `later`); and one count when a project gets its first message. Never the project's name or path, nor what you write.
358
361
  - **Life:** installed (a copy that never had an identifier), updated (a newer version opened for the first time, per `~/.pulse/lifecycle.json`), uninstalled (from Settings, sent before anything is removed) and each time Home opens.
359
362
  - **Presence:** while MADRE is open, every five minutes it sends `madre.run/api/presence` only the random identifier, the version and the system, so the author knows how many copies are on now; only one of its processes says it. No path, project name, file or anything you write.
360
363
  - **It turns off like the diagnostics.** The author's copies send no presence, and madre.run does not count them either. (`src/install-metrics.mjs`)
@@ -404,6 +407,8 @@ MADRE's folder is only taken away whole when it is MADRE's beyond doubt: an abso
404
407
  | `PULSE_DELEGATION` · `PULSE_MAX_PLAN_STEPS` | `1` · `4` | Plans |
405
408
  | `PULSE_ESCALATION_MS` | `180000` | Permission request timer |
406
409
  | `PULSE_OPENCODE_MODEL` | from the config | `proveedor/modelo` for OpenCode |
410
+ | `PULSE_GROK_MODEL` | Grok's own | Grok's model when none is chosen (`grok models` lists them) |
411
+ | `PULSE_GROK_SANDBOX` | `read-only` | `off` drops `--sandbox` where Grok's isolation cannot start; `--tools` still keeps it to reading |
407
412
  | `PULSE_CLAUDE_USAGE` · `PULSE_OFFICIAL_QUOTA` | `0` · `1` | Claude's official quota (reads the keychain); `0` turns off all provider reads |
408
413
  | `PULSE_GEMINI_IDLE_MS` · `PULSE_GEMINI_RETRIES` · `PULSE_GEMINI_FALLBACK_MODEL` | `90000` · `1` · `gemini-3-flash-preview` (empty: no spare) | Gemini under load |
409
414
 
package/docs/en/SDK.md CHANGED
@@ -36,9 +36,9 @@ export default {
36
36
  };
37
37
  ```
38
38
 
39
- **Your module does not import packages.** Not MADRE, not the SDK, nothing from npm. Before installing it, MADRE copies your file to a separate temporary folder and loads it there —that way it checks what it is without running it where it lives— and that folder has no `node_modules`: an `import` by package name doesn't resolve and the installation fails.
39
+ **Your module does not import packages.** Not MADRE, not the SDK, nothing from npm. Before installing it, MADRE copies your file to a separate temporary folder and loads it in a restricted process. That folder has no `node_modules`: an `import` by package name doesn't resolve and the installation fails. Once installed, each call also runs in a separate process.
40
40
 
41
- **Node builtins do work**, always: `node:fs`, `node:url`, `node:tls`, `node:child_process`. That's enough to speak any protocol. What there isn't is anything to install.
41
+ **Node builtins can be imported**: `node:fs`, `node:url`, `node:tls`, `node:child_process`. The fence limits what they can do: your module cannot read other files, write directly or start processes. It can use `fetch` or Node protocols for an outside service under the network rules of the installed Node version. There are no packages to install.
42
42
 
43
43
  If you need `defineModule` —to compute something before defining the module, for example— **MADRE hands it to you**: export a function and you receive it as an argument.
44
44
 
@@ -77,12 +77,12 @@ the suite compares this table against the code, so if they ever drift apart, it'
77
77
  | `credit` | Whose idea it was, if it was not yours: a name. MADRE says it on the module's card and in the Market («Idea by …») |
78
78
  | `icon` | Your module's icon: `{ svg, color }`. `svg` is the drawing — its shapes (`<path d="…"/>`) or a whole `<svg>`, on whatever grid you like — and `color` its tile's, `#rrggbb`. MADRE fits it on its own so it looks like MADRE's: centred and scaled to the same square, drawn in white in one color, on the MADRE color nearest to yours, with anything that is not drawing taken out (scripts, images, links, styles, gradients). Without `icon`, your module wears the grey puzzle piece. Up to 8000 characters |
79
79
  | `slash` | `/name` commands that run on the server with your `ctx` and return `{ ok, title, text, link }`. The room shows them as a card and the agents read them. `link` is optional: `{ href, label }` with a route of yours (`/api/x/<id>/…`), and the card offers it as a key that opens another tab; an address outside your routes is ignored |
80
- | `toolsForTurn(ctx, turn)` | MCP servers for an agent's turn: `[{ name, command, args, env, tools, sends, brief }]`. MADRE attaches them to the CLI in its isolated run and describes `brief` to the agent. `turn` carries the agent, the mode, the lease, the folder, the port, and `turn.turn`: the id of the reply that turn will write. If your server calls back to the room on behalf of the turn, send that id; `ctx.room.runningTurn(id)` tells you whether it is still running and for which agent |
80
+ | `toolsForTurn(ctx, turn)` | MCP servers for an agent's turn: `[{ name, command, args, env, tools, sends, brief }]`. For a module of yours, `command` must be Node and the first argument must be **the module's own file**; MADRE starts it with the same permission fence. Another executable is withheld. `turn` carries the agent, mode, lease, folder, port and `turn.turn`: the id of the reply the turn will write |
81
81
  | `toolsForTurn` → `sends` | Which of your tools **send something outside**. The core withdraws them below `#4` AIRLOCK: the model isn't even told they exist. See below |
82
82
  | `reaches` | Where your module reaches, in the same four answers MADRE gives about its own. See below |
83
83
  | `secrets` | The keys you need, declared instead of drawn: `[{ name, label, note, where }]`. MADRE draws the field, keeps it in its vault under your id, and gives it back to you through `ctx.vault`. See below |
84
84
  | `routes` | Your own HTTP routes: `{ method, path, handler(ctx, { payload, params, url, request, viaPhone }) }` → `{ status, body }`. `viaPhone` is `true` when the request comes from a paired phone: deny it yourself if your route belongs to the Mac |
85
- | `onEvent(ctx, event)` | Every ledger event of every live conversation in the room, while your module is on. `ctx.room` and `ctx.chat` are that conversation's, and `ctx.record` writes into it. It runs separately: whatever it takes long on or fails at doesn't stop the room. As always, a module doesn't fabricate messages or turns |
85
+ | `onEvent(ctx, event)` | Every ledger event of every live conversation in the room, while your module is on. `ctx.room` and `ctx.chat` are that conversation's, and `ctx.record` writes into it. It runs separately: whatever it takes long on or fails at doesn't stop the room. In a module a person installs, each event starts a new process: what you keep in a variable doesn't reach the next one (keep it with `ctx.updateConfig`), and the notices of how much is left of each AI's plan arrive too, even when nobody writes; check `event.type` first and finish quickly. As always, a module doesn't fabricate messages or turns |
86
86
  | `controls` | Your module's settings, declared instead of drawn: `[{ key, label, type: 'select' \| 'switch' \| 'text', options, choices, note, invert }]`. MADRE draws them on the page and saves them in your block of `config.json`. In a `select`, `choices: [{ value, label }]` says which phrase the person reads for each value that gets saved (if you give it, `options` comes from there); without it, the person reads the value as is |
87
87
  | `onSettings(ctx, settings)` | Tells you when the human changed one of your `controls`, in case something live needs to know |
88
88
  | `conditions` | Entries for the MU/TH/UR catalog, with a remedy per platform |
@@ -236,7 +236,7 @@ finishing it, and in the meantime it can only be turned on deliberately with `PU
236
236
 
237
237
  The page of a module of yours has **GET A NEWER FILE**: MADRE fetches the file —from the `url` you declared or from the file you installed it from—, verifies it in a separate copy, and only replaces the installed one if it loads, follows the house rules, and states a different version. Verifying installs nothing.
238
238
 
239
- And in the MODULES header there is **+ ADD A MODULE** to install someone else's `.mjs`. It goes through the same door as everything else. Said plainly, because it is what it is: a module runs **inside MADRE, with the permissions of whoever opens it**. MADRE checks that it loads and that it doesn't leave its pen —its own id, routes only under `/api/x/<id>/`, never on top of a MADRE module—; what the code *intends* is something nobody but you can check.
239
+ And in the MODULES header there is **+ ADD A MODULE** to install someone else's `.mjs`. It goes through the same door as everything else. MADRE loads and runs it separately: ordinary APIs can read the module file and SDK code, but cannot directly write your files or start processes. An MCP tool it offers must use that same file and limits. Where Node offers `--allow-net`, only modules declaring an outside destination receive network access; older versions do not restrict network access. A declaration does not limit the hosts it can contact. **Node's permission model is not a security boundary against malicious code.** Review the code and destinations before installing it.
240
240
 
241
241
  ### In the Market, for everyone
242
242
 
@@ -276,12 +276,12 @@ A module that installs into the project instead of being turned on keeps its ins
276
276
  ctx = {
277
277
  projectRoot, stateRoot, // el proyecto y ~/.pulse
278
278
  config, settings, // config.json completo y tus ajustes con defaults
279
- env, agents, room, // agentes detectados; la sala (room.capabilities(), room.record(...))
279
+ env, agents, room, // empty env for your modules; detected agents; mediated room
280
280
  readConfig(), updateConfig(patch),
281
281
  record(type, payload), // escribe un evento en el ledger; tipo "algo.algo", nunca message.* ni agent.*
282
282
  language, t(text, vars), // the room's language, 'es' or 'en', and your words in it (sdk: 2):
283
283
  // an English sentence MADRE already knows, or your own { es, en }
284
- services: { history, imageKey, ollama: { state, generate }, … }, // what the server offers;
284
+ services: { history, ollama: { state, generate } }, // what the server offers your modules;
285
285
  // ollama.generate({ system, prompt, json }) answers with the local model (sdk: 2)
286
286
  vault: { get, held, keep, forget } // tus secretos, y solo los tuyos
287
287
  }
@@ -329,7 +329,7 @@ A module of yours carries the «Yours» tag and is removed from its page with «
329
329
 
330
330
  ## What a module cannot touch
331
331
 
332
- A module runs inside MADRE's process with your permissions: install only what you've read. MADRE, for its part, protects its core like this:
332
+ A module of yours runs in a separate process. Node limits ordinary APIs to its file and the SDK code and denies direct writes and child processes. The `ctx` functions pass through MADRE: the vault returns only that module's secrets, and `updateConfig` accepts only its settings block. Its one-file MCP server uses the same limits and may write to the turn's scratch folder when one exists. Node does not guarantee containment of malicious code: review its code and network destinations before installing it. MADRE also protects its core like this:
333
333
 
334
334
  - Its HTTP routes live under `/api/x/<id>/`; a module with routes outside that doesn't load, so none can impersonate `/api/state`, `/api/messages`, or any route of MADRE's own.
335
335
  - It cannot use the `id` of a built-in module or of another one already loaded.
@@ -10,7 +10,7 @@ From **Settings › What it remembers › Train your own AI › Export** (when i
10
10
  npx @jossuealcala/madre dataset # in the project folder
11
11
  ```
12
12
 
13
- It writes `~/.pulse/rooms/<project>/dataset/{train.jsonl, valid.jsonl, manifest.json}`. Each line is `{"messages":[{role:"system"},{role:"user"},{role:"assistant"}]}`: the project's real answers, redacted (no paths, names, emails or keys), plus the summarized notes as recall pairs. Messages sent in #0 INCOGNITO are never there.
13
+ It writes `~/.pulse/rooms/<project>/dataset/{train.jsonl, valid.jsonl, test.jsonl, manifest.json}`: one pair in ten goes to `valid.jsonl`, to measure while it trains, and another one in ten to `test.jsonl`, never trained on, for the test at the end. Each line is `{"messages":[{role:"system"},{role:"user"},{role:"assistant"}]}`: the project's real answers, redacted (no paths, names, emails or keys), plus the summarized notes as recall pairs. Messages sent in #0 INCOGNITO are never there.
14
14
 
15
15
  How much you need: with fewer than ~200 pairs the model learns the tone and little more; from ~1000 on it starts to be worth it. Export every so often; the split is deterministic, so lines don't switch sides.
16
16
 
@@ -10,7 +10,7 @@
10
10
  //
11
11
  // ─── The one shape worth copying ──────────────────────────────────────────────────────────────
12
12
  //
13
- // A connector needs two things that look like they need two files: a module MADRE imports, and
13
+ // A connector needs two things that look like they need two files: a module MADRE loads separately, and
14
14
  // an MCP server MADRE runs as its own process. They are the same file. It is the spec when
15
15
  // imported and the server when executed, and it tells the two apart at the bottom.
16
16
  //
@@ -33,7 +33,7 @@ export default {
33
33
  return { status: { installed: Boolean(ctx.settings.enabled), detail: ctx.settings.enabled ? `on · says "${ctx.settings.greeting}"` : 'off' } };
34
34
  },
35
35
 
36
- // Slash commands: they run on the server, inside MADRE, and their answer lands in the room as a
36
+ // Slash commands: they run in a separate process, and their answer lands in the room as a
37
37
  // fact card that the human and every agent read. Only while the module is on.
38
38
  slash: [
39
39
  {
@@ -10,7 +10,7 @@ Desde **Ajustes › Lo que recuerda › Entrena tu propia IA › Exportar** (al
10
10
  npx @jossuealcala/madre dataset # en la carpeta del proyecto
11
11
  ```
12
12
 
13
- Escribe `~/.pulse/rooms/<proyecto>/dataset/{train.jsonl, valid.jsonl, manifest.json}`. Cada línea es `{"messages":[{role:"system"},{role:"user"},{role:"assistant"}]}`: las respuestas reales del proyecto, redactados (sin rutas, nombres, correos ni claves), más las notas resumidas como pares de recuerdo. Lo que se envió en #0 INCÓGNITO nunca está.
13
+ Escribe `~/.pulse/rooms/<proyecto>/dataset/{train.jsonl, valid.jsonl, test.jsonl, manifest.json}`: uno de cada diez pares va a `valid.jsonl`, para medir mientras entrena, y otro de cada diez a `test.jsonl`, que nunca se entrena, para la prueba del final. Cada línea es `{"messages":[{role:"system"},{role:"user"},{role:"assistant"}]}`: las respuestas reales del proyecto, redactados (sin rutas, nombres, correos ni claves), más las notas resumidas como pares de recuerdo. Lo que se envió en #0 INCÓGNITO nunca está.
14
14
 
15
15
  Cuánto hace falta: con menos de ~200 pares el modelo aprende el tono y poco más; a partir de ~1000 empieza a valer. Exporta cada tanto; el split es determinista, así que las líneas no cambian de lado.
16
16
 
@@ -7,6 +7,9 @@ ROOM="${1:?room dir, e.g. ~/.pulse/rooms/<sala>}"
7
7
  BASE="${2:-Qwen/Qwen2.5-1.5B-Instruct}"
8
8
  ITERS="${3:-600}"
9
9
  [ -f "$ROOM/dataset/train.jsonl" ] || { echo "no dataset: run 'madre dataset' first"; exit 2; }
10
+ # The test at the end reads test.jsonl, never trained on; a dataset exported before MADRE wrote it
11
+ # has none, and mlx-lm stops there (RX-30).
12
+ [ -s "$ROOM/dataset/test.jsonl" ] || { echo "no test.jsonl: export the dataset again with 'madre dataset'"; exit 2; }
10
13
  PAIRS=$(wc -l < "$ROOM/dataset/train.jsonl")
11
14
  [ "$PAIRS" -ge 50 ] || { echo "only $PAIRS training pairs; let the room grow (aim for a few hundred)"; exit 3; }
12
15
  python3 -c "import mlx_lm" 2>/dev/null || { echo "pip install mlx-lm (inside a venv) first"; exit 4; }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jossuealcala/madre",
3
- "version": "1.1.1",
4
- "description": "MADRE · one local room where the AI coding agents already on your machine (Codex, Claude Code, Gemini CLI, OpenCode) work on your project together, share one memory you can see and explore, and answer to you. Read-only by default, with per-message permission modes and checkpoints you can undo. Nothing leaves your machine on its own.",
3
+ "version": "1.1.3",
4
+ "description": "MADRE · one local room where the AI coding agents already on your machine (Codex, Claude Code, Gemini CLI, Cursor, OpenCode, Grok) work on your project together, share one memory you can see and explore, and answer to you. Read-only by default, with per-message permission modes and checkpoints you can undo. Nothing leaves your machine on its own.",
5
5
  "keywords": [
6
6
  "ai-agents",
7
7
  "codex",
@@ -40,6 +40,8 @@
40
40
  "files": [
41
41
  "bin",
42
42
  "src",
43
+ "!src/madre-logs.mjs",
44
+ "!src/rumbo.mjs",
43
45
  "public",
44
46
  "!public/assets/manual/*.pdf",
45
47
  "README.md",
@@ -276,10 +276,19 @@ export function mountActivity({ key, badge, openChat, toast = () => {} }) {
276
276
  const title = what.startsWith('agent:') ? t('Installing {name}', { name: brandOf(what.slice(6)).label })
277
277
  : what === 'ollama' ? (item.model ? t('Downloading {name}', { name: item.model }) : t('Installing {name}', { name: 'Ollama' }))
278
278
  : t('Installing the module {name}', { name: what });
279
+ // Opened, it says what the installer said last and how far it got; a model downloading can be
280
+ // stopped from here, as in the welcome. It opened onto nothing before (2026-11-06, the author).
281
+ const percent = (() => { const all = [...String(item.line ?? '').matchAll(/(\d{1,3}(?:\.\d+)?)\s?%/g)]; return all.length ? Math.min(100, Number(all.at(-1)[1])) : null; })();
279
282
  return row({
280
283
  id: uid, face: sysAvatar('download', { busy: true }), title,
281
284
  sub: `${project.home ? t('Home') : whereOf(project)} · ${t('It ends on its own; you can keep working.')}`,
282
285
  time: item.startedAt ? () => clock(since(item.startedAt)()) : '',
286
+ progress: percent === null ? null : () => percent / 100,
287
+ more: (inside) => {
288
+ inside.append(el('p', 'ap-meta', t('It ends on its own; you can keep working.')));
289
+ if (item.line) inside.append(el('pre', 'ap-out', item.line));
290
+ if (item.stoppable) inside.append(actions([t('Stop the download'), 'stop', () => stop(project, item)]));
291
+ },
283
292
  });
284
293
  }
285
294