andresanemic/lore-plugin / skills/stale-lore
stale-lore
VerifiedUse when the kit's published surface must be reconciled against actual usage in the user's tree. Trigger on "stale-lore", "retira capacidades", "capacidades sin ejercicio", "purge unused skills", or after a major refactoring that renames or replaces published capabilities. Not yours: operating a project's criteria body belongs to transmute-lore; saving one lesson belongs to save-to-lore.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.5 KB |
| scripts/stale-lore.mjs | script | 10.9 KB |
| scripts/stale-lore.regresion.test.mjs | script | 4.3 KB |
| scripts/stale-lore.test.mjs | script | 7.5 KB |
scripts/stale-lore.regresion.test.mjs
View on GitHubimport test from 'node:test';
import assert from 'node:assert/strict';
import { mkdtempSync, writeFileSync, mkdirSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import {
leeCapacidadesCentrales,
buscaRastroCapacidad,
ejecutaStaleLore,
} from './stale-lore.mjs';
/**
* RED de stale-lore 2.5 — los casos que la primera corrida real produjo (2026-10-07).
*
* La corrida en vivo sobre el kit marcó las 9 capacidades stale, con `diasSinUso: 999`
* inventado, y propuso retirarse a sí misma. Los 17 tests anteriores pasaban porque
* probaban las funciones con fixtures que el autor imaginó, no el flujo sobre un árbol real.
*
* Cada test de acá DEBE fallar contra la implementación de 2.5. Ese es el RED.
*/
function arbolTemporal() {
const root = mkdtempSync(join(tmpdir(), 'stale-lore-red-'));
const cleanup = () => rmSync(root, { recursive: true, force: true });
return { root, cleanup };
}
function escribe(raiz, ruta, contenido) {
const full = join(raiz, ruta);
mkdirSync(join(full, '..'), { recursive: true });
writeFileSync(full, contenido);
}
// --- Caso 1: deriva del árbol, no de una lista hardcodeada ---
test('RED: leeCapacidadesCentrales deriva una skill nueva del arbol, no solo las canonicas', () => {
const { root, cleanup } = arbolTemporal();
test.after(cleanup);
escribe(root, 'skills/nueva-capacidad/SKILL.md', `---\nname: nueva-capacidad\ndescription: Use when probando.\n---\n# Nueva\n`);
const caps = leeCapacidadesCentrales(root);
assert.ok(
caps.includes('nueva-capacidad'),
'debe derivar la skill del arbol; hoy solo devuelve las 9 hardcodeadas'
);
});
test('RED: leeCapacidadesCentrales no inventa capacidades de un arbol vacio', () => {
const { root, cleanup } = arbolTemporal();
test.after(cleanup);
const caps = leeCapacidadesCentrales(root);
assert.deepEqual(caps, [], 'un arbol sin skills no declara ninguna capacidad central');
});
// --- Caso 2: no fabricar la cifra ---
test('RED: ejecutaStaleLore no inventa 999 dias; sin rastro es null, no una cifra', () => {
const { root, cleanup } = arbolTemporal();
test.after(cleanup);
escribe(root, 'skills/use-lore/SKILL.md', `---\nname: use-lore\n---\n# Use\n`);
const r = ejecutaStaleLore(root, { dryRun: true });
for (const retiro of r.retiros) {
assert.notEqual(retiro.diasSinUso, 999, `"${retiro.capacidad}" no puede fabricar 999 dias`);
assert.ok(
retiro.diasSinUso === null || retiro.diasSinUso === undefined,
`sin rastro la cifra es null, no ${retiro.diasSinUso}`
);
}
});
// --- Caso 3: no se retira a si misma ---
test('RED: stale-lore no se propone retirar a si misma', () => {
const { root, cleanup } = arbolTemporal();
test.after(cleanup);
escribe(root, 'skills/stale-lore/SKILL.md', `---\nname: stale-lore\n---\n# Stale\n`);
const r = ejecutaStaleLore(root, { dryRun: true });
const seRetira = r.retiros.some((x) => x.capacidad === 'stale-lore');
assert.equal(seRetira, false, 'la capacidad que mide no puede retirarse a si misma');
});
// --- Caso 4: la mencion no es uso (falso verde) ---
test('RED: una mencion en FASES.md no cuenta como uso de hoy', () => {
const { root, cleanup } = arbolTemporal();
test.after(cleanup);
escribe(root, 'FASES.md', `# Estado\n\nPendiente: revisar use-lore en algun momento.\n`);
const rastro = buscaRastroCapacidad('use-lore', root, { ahora: new Date() });
assert.notEqual(
rastro.encontrado,
true,
'una mencion sin artefacto no es rastro de uso; hoy da encontrado:true con fecha de hoy'
);
});
// --- Caso 5: el flujo real sobre un arbol con uso real no retira todo ---
test('RED: un arbol con lore ejercido no marca save-to-lore como nunca ejercida', () => {
const { root, cleanup } = arbolTemporal();
test.after(cleanup);
escribe(root, 'skills/save-to-lore/SKILL.md', `---\nname: save-to-lore\n---\n# Save\n`);
// rastro real: una Pista guardada en el lore del usuario
escribe(root, 'lore/principios.md', `# Principios\n\n## Una leccion — \`confirmed\`\n\n**Pista.** ...\n`);
const r = ejecutaStaleLore(root, { dryRun: true });
const evaluada = r.evaluadas.find((x) => x.capacidad === 'save-to-lore');
assert.equal(
evaluada.nuncaEjercida,
false,
'save-to-lore dejo una Pista en lore/: eso es rastro de uso, no "nunca ejercida"'
);
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |