corvusmem 0.3.0 → 0.3.2
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/CHANGELOG.md +18 -0
- package/commands/corvus-absorb.md +6 -4
- package/package.json +1 -1
- package/src/facts.mjs +7 -4
- package/src/lib.mjs +30 -2
- package/src/session-state.mjs +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ Format based on [Keep a Changelog](https://keepachangelog.com/); versions follow
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.3.2] — 2026-11-07
|
|
9
|
+
### Changed
|
|
10
|
+
- **`/corvus-absorb` now mines the whole doc tier, not just `CLAUDE.md`.** The command was too conservative with
|
|
11
|
+
`doc`-tier files (it judged by filename and asked/skipped by default), so a repo with a rich `docs/` tree —
|
|
12
|
+
architecture notes, ADRs, a devlog, per-feature specs — yielded only the handful of facts in `CLAUDE.md`. It now
|
|
13
|
+
**reads** the architecture/decisions/devlog/feature docs and extracts every distinct durable decision, rule and
|
|
14
|
+
gotcha (dozens for a rich project), asking the user only as an exception — while still skipping tutorials,
|
|
15
|
+
how-tos, API dumps and boilerplate. No engine change; the judgment stays the agent's.
|
|
16
|
+
|
|
17
|
+
## [0.3.1] — 2026-11-07
|
|
18
|
+
### Fixed
|
|
19
|
+
- **Standalone memory folder is now English.** When Corvus runs on its own (no Senzu), project facts live in
|
|
20
|
+
`.corvusmem/memory/facts.jsonl` (and corrupted lines in `facts.corrupt.jsonl`) instead of the Spanish
|
|
21
|
+
`memoria/hechos.jsonl` — consistent with the English-first product. **Coupled to Senzu it is unchanged**
|
|
22
|
+
(`senzu/memoria/hechos.jsonl`, shared with Senzu), and the user-global memory is unchanged too. Existing
|
|
23
|
+
standalone installs are **migrated automatically and idempotently** on first read or write: the old
|
|
24
|
+
`.corvusmem/memoria/` is renamed to `.corvusmem/memory/` with the facts intact, so nothing is lost.
|
|
25
|
+
|
|
8
26
|
## [0.3.0] — 2026-11-05
|
|
9
27
|
### Added
|
|
10
28
|
- **Standalone project folder.** In a project without Senzu, Corvus now keeps its memory in its own
|
|
@@ -21,18 +21,20 @@ It returns the memory documents already in the repo in two tiers (`{ agent, docs
|
|
|
21
21
|
If the list is empty, say so and stop. If `truncated` is true, mention that more markdown exists than was shown.
|
|
22
22
|
|
|
23
23
|
## 2. Read and judge (this is YOUR job, not the tool's)
|
|
24
|
-
Read every
|
|
24
|
+
Read **every `agent`-tier file** in full.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
For the **`doc`-tier**, **actually open and read** the files that usually carry durable memory — anything under `architecture/`, `decisions/`, `adr/`, `devlog/` or `notes/`, and design or feature specs (`features/…`, `*-design.md`, `*-spec.md`, `roadmap*`). **Judge by the content inside, not the filename**: do not skip a file just because it is not called `decisions.md`, and a large `docs/` tree is normal, not a reason to stop. **Prefer reading over skipping, and reading over asking.** Only **ask the user** when a file's relevance is genuinely ambiguous, or when there are so many candidates that reading them all is impractical — then list them and ask which to include. Asking is the exception.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
From everything you read, keep **only durable memory** — what should still be true next week:
|
|
29
|
+
|
|
30
|
+
- decisions, with the reason behind them (one fact per distinct decision)
|
|
29
31
|
- rules and conventions the team must follow
|
|
30
32
|
- user / team preferences
|
|
31
33
|
- project facts (stack, architecture, domains, external services, environments)
|
|
32
34
|
- constraints, known gotchas, "what didn't work"
|
|
33
35
|
- open goals or pending tasks
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
Be **thorough**: a rich project may yield dozens of facts across its architecture, feature and devlog docs — capture each distinct decision, rule and gotcha, not just the ones in `CLAUDE.md`. But do **not** mirror the docs: skip install/run steps, step-by-step how-tos, API/parameter dumps, tool tutorials, generic boilerplate, anything obvious from the code, anything transient, and anything already covered by a fact you saved.
|
|
36
38
|
|
|
37
39
|
## 3. Save each item (deterministic sink)
|
|
38
40
|
For every item worth keeping, run one command:
|
package/package.json
CHANGED
package/src/facts.mjs
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// VARIOS (objetivo, pendiente, nota…) acumulan.
|
|
9
9
|
// · búsqueda: palabras con Intl.Segmenter (también japonés, chino, árabe…), sin tildes ni mayúsculas, BM25,
|
|
10
10
|
// erratas por distancia de edición acotada y «claves» que el agente añade en otros idiomas para buscar entre idiomas.
|
|
11
|
-
// Almacén
|
|
11
|
+
// Almacén (proyecto): acoplado a Senzu -> senzu/memoria/hechos.jsonl; standalone -> .corvusmem/memory/facts.jsonl.
|
|
12
|
+
// Memoria del usuario (todos sus proyectos): hechos.jsonl junto a ella (compartida con Senzu, nombre en español).
|
|
12
13
|
|
|
13
14
|
import fs from 'node:fs';
|
|
14
15
|
import path from 'node:path';
|
|
@@ -16,7 +17,7 @@ import crypto from 'node:crypto';
|
|
|
16
17
|
import os from 'node:os';
|
|
17
18
|
import { spawnSync } from 'node:child_process';
|
|
18
19
|
import { fileURLToPath } from 'node:url';
|
|
19
|
-
import { ruta, rutaMemoriaUsuario, rutaEstado, localeUI } from './lib.mjs';
|
|
20
|
+
import { ruta, rutaMemoriaUsuario, rutaEstado, localeUI, nombresMemoria, migrarMemoriaCorvus } from './lib.mjs';
|
|
20
21
|
export { rutaNativa, localeUI, carpetaBase } from './lib.mjs'; // memory.mjs: --path (C:\, C:/, /c/ de Git Bash → el mismo almacén), idioma de UI y carpeta base (senzu/ vs .corvusmem/)
|
|
21
22
|
|
|
22
23
|
export const FAMILIAS_VARIOS = /^(objetivo|pendiente|nota|hecho|enlace|aprendizaje)(\.|$)/;
|
|
@@ -39,7 +40,9 @@ function autorActual(root, env = process.env) {
|
|
|
39
40
|
return 'unknown';
|
|
40
41
|
}
|
|
41
42
|
export function rutaHechos(root, alcance = 'proyecto') {
|
|
42
|
-
|
|
43
|
+
if (alcance === 'usuario') return path.join(path.dirname(rutaMemoriaUsuario()), 'hechos.jsonl'); // compartida con Senzu: nombre en español
|
|
44
|
+
migrarMemoriaCorvus(root); // instalaciones viejas: .corvusmem/memoria/hechos.jsonl -> .corvusmem/memory/facts.jsonl (idempotente)
|
|
45
|
+
return path.join(ruta(root, 'memoria'), nombresMemoria(root).facts); // standalone: memory/facts.jsonl · acoplado/legacy: memoria/hechos.jsonl
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
// ---------------------------------------------------------------- texto: normalizar y partir en palabras
|
|
@@ -226,7 +229,7 @@ function conCerrojo(file, fn, espera = 8000) {
|
|
|
226
229
|
function escribirHechos(file, lista, ilegibles = []) {
|
|
227
230
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
228
231
|
if (ilegibles.length) { // lo ilegible no se pierde: se aparta para recuperarlo a mano
|
|
229
|
-
const danado = path.join(path.dirname(file), 'hechos.danado.jsonl');
|
|
232
|
+
const danado = path.join(path.dirname(file), path.basename(file) === 'facts.jsonl' ? 'facts.corrupt.jsonl' : 'hechos.danado.jsonl');
|
|
230
233
|
let ya = ''; try { ya = fs.readFileSync(danado, 'utf8'); } catch { }
|
|
231
234
|
const nuevas = ilegibles.filter(l => !ya.includes(l));
|
|
232
235
|
if (nuevas.length) fs.appendFileSync(danado, nuevas.map(l => l.replace(/\r/g, '')).join('\n') + '\n');
|
package/src/lib.mjs
CHANGED
|
@@ -101,9 +101,37 @@ export function carpetaBase(root) {
|
|
|
101
101
|
if (esLegado(root)) return CARPETA; // legacy Senzu project (root devlog / .dev-standards.json)
|
|
102
102
|
return CARPETA_CORVUS; // brand-new, no Senzu -> Corvus owns its dir
|
|
103
103
|
}
|
|
104
|
+
// Facts storage names. Standalone (Corvus's own .corvusmem/) uses English names; coupled to Senzu (or a legacy
|
|
105
|
+
// layout) keeps Senzu's Spanish names, because the file is SHARED with Senzu and must stay compatible.
|
|
106
|
+
export const MEM_DIR_ES = 'memoria', MEM_FACTS_ES = 'hechos.jsonl', MEM_CORRUPT_ES = 'hechos.danado.jsonl';
|
|
107
|
+
export const MEM_DIR_EN = 'memory', MEM_FACTS_EN = 'facts.jsonl', MEM_CORRUPT_EN = 'facts.corrupt.jsonl';
|
|
108
|
+
export function nombresMemoria(root) {
|
|
109
|
+
return carpetaBase(root) === CARPETA_CORVUS
|
|
110
|
+
? { dir: MEM_DIR_EN, facts: MEM_FACTS_EN, corrupt: MEM_CORRUPT_EN }
|
|
111
|
+
: { dir: MEM_DIR_ES, facts: MEM_FACTS_ES, corrupt: MEM_CORRUPT_ES };
|
|
112
|
+
}
|
|
113
|
+
// One-time, idempotent migration: older standalone installs kept facts in .corvusmem/memoria/hechos.jsonl.
|
|
114
|
+
// Rename that to .corvusmem/memory/facts.jsonl (and the corrupted-lines file) so a standalone Corvus reads English.
|
|
115
|
+
// NEVER touches a Senzu-coupled or legacy project (base must be .corvusmem). Safe under races: best-effort, swallowed.
|
|
116
|
+
export function migrarMemoriaCorvus(root) {
|
|
117
|
+
if (carpetaBase(root) !== CARPETA_CORVUS) return;
|
|
118
|
+
const base = path.join(root, CARPETA_CORVUS), viejoDir = path.join(base, MEM_DIR_ES), nuevoDir = path.join(base, MEM_DIR_EN);
|
|
119
|
+
try {
|
|
120
|
+
if (!fs.existsSync(path.join(viejoDir, MEM_FACTS_ES)) || fs.existsSync(path.join(nuevoDir, MEM_FACTS_EN))) return;
|
|
121
|
+
fs.mkdirSync(nuevoDir, { recursive: true });
|
|
122
|
+
for (const [de, a] of [[MEM_FACTS_ES, MEM_FACTS_EN], [MEM_CORRUPT_ES, MEM_CORRUPT_EN]]) {
|
|
123
|
+
const o = path.join(viejoDir, de), n = path.join(nuevoDir, a);
|
|
124
|
+
if (fs.existsSync(o) && !fs.existsSync(n)) { try { fs.renameSync(o, n); } catch { try { fs.copyFileSync(o, n); fs.rmSync(o, { force: true }); } catch { } } }
|
|
125
|
+
}
|
|
126
|
+
try { if (!fs.readdirSync(viejoDir).length) fs.rmdirSync(viejoDir); } catch { } // si queda vacía, se va
|
|
127
|
+
} catch { /* best-effort: si no se puede migrar, se sigue leyendo el viejo via ruta() */ }
|
|
128
|
+
}
|
|
104
129
|
const VIEJA = { 'ui-verify': '.ui-verify', 'senzu.json': '.dev-standards.json', auditoria: 'docs/auditoria', entrega: 'docs/entrega', 'mapa.md': 'docs/MAPA.md' };
|
|
105
|
-
export function ruta(root, nombre) { // 'devlog' | 'plan' | 'design-system' | 'conventions.md' | 'conventions.json' | 'ui-verify' | 'senzu.json'
|
|
106
|
-
const
|
|
130
|
+
export function ruta(root, nombre) { // 'devlog' | 'plan' | 'design-system' | 'conventions.md' | 'conventions.json' | 'ui-verify' | 'senzu.json' | 'memoria'
|
|
131
|
+
const base = carpetaBase(root);
|
|
132
|
+
// 'memoria' es la carpeta de hechos: en standalone (.corvusmem) se llama 'memory' (inglés); acoplado/legacy sigue 'memoria'
|
|
133
|
+
const nombreReal = nombre === 'memoria' && base === CARPETA_CORVUS ? MEM_DIR_EN : nombre;
|
|
134
|
+
const nueva = path.join(root, base, nombreReal);
|
|
107
135
|
const vieja = path.join(root, VIEJA[nombre] || nombre);
|
|
108
136
|
const [primera, segunda] = esLegado(root) ? [vieja, nueva] : [nueva, vieja];
|
|
109
137
|
if (fs.existsSync(primera)) return primera;
|
package/src/session-state.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
readHookInput, projectRoot, sessionFlag, testOnce, editadosSesion, gitCambios, gitBranch, planStatus,
|
|
12
12
|
devlogEntradas, readText, rutaEstado, memoriaProyecto, rutaMemoriaUsuario, ruta, rutaRel,
|
|
13
13
|
} from './lib.mjs';
|
|
14
|
-
import { todosLosHechos, marcarUsoSesion, textosDelAgente, rutaBuscador, rutaUso } from './facts.mjs'; // la de facts.mjs: ruta REAL junto al hook
|
|
14
|
+
import { todosLosHechos, marcarUsoSesion, textosDelAgente, rutaBuscador, rutaUso, rutaHechos } from './facts.mjs'; // la de facts.mjs: ruta REAL junto al hook
|
|
15
15
|
|
|
16
16
|
const p = readHookInput() || {};
|
|
17
17
|
const root = projectRoot();
|
|
@@ -55,7 +55,7 @@ try { marcarUsoSesion(root, sid, p.transcript_path ? textosDelAgente(p.transcrip
|
|
|
55
55
|
// idioma; también la vista de cliente si existe). Si nunca lo generó, no se crea nada.
|
|
56
56
|
if (evento === 'Stop') try {
|
|
57
57
|
const dir = ruta(root, 'cortex'), mt = f => { try { return fs.statSync(f).mtimeMs; } catch { return 0; } };
|
|
58
|
-
const fuentes = Math.max(mt(
|
|
58
|
+
const fuentes = Math.max(mt(rutaHechos(root)), mt(path.join(ruta(root, 'devlog'), 'MEMORIA.md')), mt(path.join(ruta(root, 'devlog'), 'INDEX.md')), mt(rutaUso(root))); // X-T10: también lo que ha consultado (cómo piensa)
|
|
59
59
|
const cli = rutaBuscador(root).replace(/buscar\.mjs$/, 'memory.mjs');
|
|
60
60
|
for (const [archivo, extra] of [['index.html', []], ['cliente.html', ['--cliente']]]) {
|
|
61
61
|
const f = path.join(dir, archivo);
|