agentic-kdd 3.2.3 → 3.5.1

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/bin/akdd.js CHANGED
@@ -66,6 +66,21 @@ const HELP = `
66
66
  akdd creative apply <id> Apply a suggestion
67
67
  akdd creative wins View applied creative improvements
68
68
 
69
+ Memory (ranked retrieval):
70
+ akdd recall "query" Ranked BM25+vector search — replaces full file reads
71
+ akdd memory stats Memory retrieval stats (indexed, coverage, mode)
72
+ akdd memory index Re-index all .agentic/memoria/*.md files
73
+ akdd validate scan Scan all memory for stale/obsolete/poisoned entries
74
+ akdd validate report Health report of knowledge base
75
+ akdd telemetry Telemetry summary (spans, STOPs, recalls)
76
+ akdd telemetry view View last cycle trace (L4 audit trail)
77
+
78
+ Autonomous decisions (L4):
79
+ akdd decide <file> Analyze a change — STOP/WARN/IMPLEMENT/DEFER decision
80
+ akdd deferred View deferred queue (end-of-cycle suggestions)
81
+ akdd deferred flush Show and clear deferred queue
82
+ akdd sprint-plan "obj" Generate sprint plan from business objective
83
+
69
84
  Effectiveness:
70
85
  akdd report Real data — before vs after comparison across all cycles
71
86
 
@@ -270,6 +285,47 @@ switch (command) {
270
285
  break;
271
286
  }
272
287
 
288
+ // ── v3.4: KDD Memory, Knowledge Validator, Telemetry ─────────────────────
289
+ case 'recall':
290
+ runModule('kdd-memory.cjs', 'recall', args.slice(1).join(' '));
291
+ break;
292
+ case 'memory':
293
+ const sub = arg1 || 'stats';
294
+ if (sub === 'index') runModule('kdd-memory.cjs', 'index');
295
+ else if (sub === 'sync') runModule('kdd-memory.cjs', 'sync');
296
+ else runModule('kdd-memory.cjs', 'stats');
297
+ break;
298
+ case 'validate':
299
+ const vsub = arg1 || 'report';
300
+ if (vsub === 'scan') runModule('knowledge-validator.cjs', 'scan');
301
+ else if (vsub === 'report') runModule('knowledge-validator.cjs', 'report');
302
+ else runModule('knowledge-validator.cjs', 'validate', arg1);
303
+ break;
304
+ case 'telemetry':
305
+ const tsub = arg1 || 'summary';
306
+ if (tsub === 'view') runModule('telemetry.cjs', 'view', arg2 || '');
307
+ else runModule('telemetry.cjs', 'summary');
308
+ break;
309
+
310
+ // ── v3.3: Autonomous Decision Engine ──────────────────────────────────────
311
+ case 'decide': {
312
+ const files = args.slice(1);
313
+ if (!files.length) { console.log('\n Uso: akdd decide <archivo> [archivos...]\n'); break; }
314
+ runModule('autonomous-decision.cjs', 'analyze', files.map(f => `"${f}"`).join(' '));
315
+ break;
316
+ }
317
+ case 'deferred': {
318
+ const sub = arg1 || 'queue';
319
+ runModule('autonomous-decision.cjs', sub === 'flush' ? 'flush' : 'queue');
320
+ break;
321
+ }
322
+ case 'sprint-plan': {
323
+ const objective = args.slice(1).join(' ');
324
+ if (!objective) { console.log('\n Uso: akdd sprint-plan "objetivo del sprint"\n'); break; }
325
+ runModule('autonomous-decision.cjs', 'sprint', `--objective "${objective}"`);
326
+ break;
327
+ }
328
+
273
329
  // ── v3.3: Effectiveness Report ──────────────────────────────────────────────
274
330
  case 'report':
275
331
  runModule('effectiveness-report.cjs');
@@ -26,13 +26,42 @@ const PROVISIONER_URL = 'https://agentic-collab.adrianlpz-game.workers.dev';
26
26
 
27
27
  const COLLAB_CONFIG_PATH = '.agentic/collab.json';
28
28
 
29
+ // ─── SYNC TABLES — TODO lo que hace a Agentic L4 ──────────────────────────────
30
+ // Regla: si está aquí, cualquier miembro del equipo que haga collab pull
31
+ // recibe el cerebro completo del proyecto — no solo fragmentos.
32
+ //
33
+ // NO sincronizar:
34
+ // regression_snapshots → snapshots de sesión individual, no conocimiento del equipo
35
+ // working_memory → buffer de sesión activa, se resetea por diseño
36
+ // creative_suggestions → sugerencias personales del dev, no del equipo
37
+ // git_context_log → log local de diffs, cada dev tiene su propio git
38
+ // deferred_queue → archivo JSON por dev, no tabla compartida
39
+ //
29
40
  const SYNC_TABLES = [
30
- 'nodos',
31
- 'relaciones_semanticas',
32
- 'episodios',
33
- 'knowledge_docs',
34
- 'ast_symbols',
35
- 'ast_edges',
41
+
42
+ // ── CORE MEMORY (CoALA 4 layers) ───────────────────────────────────────────
43
+ 'nodos', // Patrones, errores, decisiones con confianza — EL núcleo
44
+ 'episodios', // Historia cruda de cada ciclo
45
+ 'entidades', // Módulos, archivos, APIs detectados en el proyecto
46
+ 'relaciones_semanticas', // Causal edges: caused_failure, was_fixed_by, verifies, protects
47
+
48
+ // ── CICLOS Y TRAZABILIDAD ──────────────────────────────────────────────────
49
+ 'ciclos', // Qué se hizo, cuándo, con qué resultado — historial ejecutivo
50
+ 'fases', // Fases dentro de cada ciclo — granularidad total
51
+ 'knowledge_docs', // ADRs, gotchas, convenciones — por qué las cosas son como son
52
+
53
+ // ── AST GRAPH ─────────────────────────────────────────────────────────────
54
+ 'ast_symbols', // Símbolos del codebase — estructura completa
55
+ 'ast_edges', // Relaciones AST — dependencias, imports, call graph
56
+
57
+ // ── PRESERVATION INTELLIGENCE ─────────────────────────────────────────────
58
+ 'verified_contracts', // Contratos protegidos — lo que no se puede romper
59
+ 'creative_wins', // Mejoras aplicadas — el equipo aprende de lo que funcionó
60
+ 'contract_violations',// Violaciones pasadas — el equipo sabe qué rompió qué
61
+
62
+ // ── PREDICCIÓN Y CI/CD ────────────────────────────────────────────────────
63
+ 'prediction_log', // Patrones de riesgo predictivo detectados
64
+ 'cicd_reports', // Reportes de CI/CD — qué falló en producción
36
65
  ];
37
66
 
38
67
  // ─── DB LOCAL ──────────────────────────────────────────────────────────────────
@@ -346,9 +375,14 @@ async function syncDown(projectRoot) {
346
375
  const placeholders = keys.map(() => '?').join(', ');
347
376
 
348
377
  // Estrategia por tabla:
349
- // episodios → INSERT OR IGNORE (son aditivos, no sobrescribir locales)
350
- // resto → INSERT OR REPLACE (toma la versión más reciente)
351
- const strategy = table === 'episodios' ? 'OR IGNORE' : 'OR REPLACE';
378
+ // OR IGNORE: tablas aditivas no sobrescribir versión local
379
+ // episodios, ciclos, fases, prediction_log, cicd_reports
380
+ // (cada dev tiene su propia historia de ejecución)
381
+ // OR REPLACE: tablas de conocimiento compartido — toma la más reciente
382
+ // nodos, entidades, relaciones_semanticas, knowledge_docs,
383
+ // ast_symbols, ast_edges, verified_contracts, creative_wins, contract_violations
384
+ const ADDITIVE_TABLES = new Set(['episodios','ciclos','fases','prediction_log','cicd_reports']);
385
+ const strategy = ADDITIVE_TABLES.has(table) ? 'OR IGNORE' : 'OR REPLACE';
352
386
 
353
387
  try {
354
388
  localDB.prepare(
@@ -420,12 +454,25 @@ async function status(projectRoot) {
420
454
 
421
455
  function getDateField(table) {
422
456
  const fields = {
423
- nodos: 'fecha_update',
424
- episodios: 'fecha',
425
- relaciones_semanticas: 'valid_at',
426
- knowledge_docs: 'last_indexed',
427
- ast_symbols: 'last_indexed',
428
- ast_edges: 'last_indexed',
457
+ // Core memory
458
+ nodos: 'fecha_update',
459
+ episodios: 'fecha',
460
+ entidades: 'fecha_update',
461
+ relaciones_semanticas: 'valid_at',
462
+ // Ciclos y trazabilidad
463
+ ciclos: 'fecha_inicio',
464
+ fases: 'fecha',
465
+ knowledge_docs: 'last_indexed',
466
+ // AST
467
+ ast_symbols: 'last_indexed',
468
+ ast_edges: 'last_indexed',
469
+ // Preservation Intelligence
470
+ verified_contracts: 'updated_at',
471
+ creative_wins: 'created_at',
472
+ contract_violations: 'created_at',
473
+ // Predicción y CI/CD
474
+ prediction_log: 'fecha',
475
+ cicd_reports: 'fecha',
429
476
  };
430
477
  return fields[table] || 'rowid';
431
478
  }