elsabro 2.3.0 → 3.7.0

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 (67) hide show
  1. package/README.md +668 -20
  2. package/bin/install.js +0 -0
  3. package/flows/development-flow.json +452 -0
  4. package/flows/quick-flow.json +118 -0
  5. package/package.json +3 -2
  6. package/references/SYSTEM_INDEX.md +379 -5
  7. package/references/agent-marketplace.md +2274 -0
  8. package/references/agent-protocol.md +1126 -0
  9. package/references/ai-code-suggestions.md +2413 -0
  10. package/references/checkpointing.md +595 -0
  11. package/references/collaboration-patterns.md +851 -0
  12. package/references/collaborative-sessions.md +1081 -0
  13. package/references/configuration-management.md +1810 -0
  14. package/references/cost-tracking.md +1095 -0
  15. package/references/enterprise-sso.md +2001 -0
  16. package/references/error-contracts-v2.md +968 -0
  17. package/references/event-driven.md +1031 -0
  18. package/references/flow-orchestration.md +940 -0
  19. package/references/flow-visualization.md +1557 -0
  20. package/references/ide-integrations.md +3513 -0
  21. package/references/interrupt-system.md +681 -0
  22. package/references/kubernetes-deployment.md +3099 -0
  23. package/references/memory-system.md +683 -0
  24. package/references/mobile-companion.md +3236 -0
  25. package/references/multi-llm-providers.md +2494 -0
  26. package/references/multi-project-memory.md +1182 -0
  27. package/references/observability.md +793 -0
  28. package/references/output-schemas.md +858 -0
  29. package/references/performance-profiler.md +955 -0
  30. package/references/plugin-system.md +1526 -0
  31. package/references/prompt-management.md +292 -0
  32. package/references/sandbox-execution.md +303 -0
  33. package/references/security-system.md +1253 -0
  34. package/references/streaming.md +696 -0
  35. package/references/testing-framework.md +1151 -0
  36. package/references/time-travel.md +802 -0
  37. package/references/tool-registry.md +886 -0
  38. package/references/voice-commands.md +3296 -0
  39. package/templates/agent-marketplace-config.json +220 -0
  40. package/templates/agent-protocol-config.json +136 -0
  41. package/templates/ai-suggestions-config.json +100 -0
  42. package/templates/checkpoint-state.json +61 -0
  43. package/templates/collaboration-config.json +157 -0
  44. package/templates/collaborative-sessions-config.json +153 -0
  45. package/templates/configuration-config.json +245 -0
  46. package/templates/cost-tracking-config.json +148 -0
  47. package/templates/enterprise-sso-config.json +438 -0
  48. package/templates/events-config.json +148 -0
  49. package/templates/flow-visualization-config.json +196 -0
  50. package/templates/ide-integrations-config.json +442 -0
  51. package/templates/kubernetes-config.json +764 -0
  52. package/templates/memory-state.json +84 -0
  53. package/templates/mobile-companion-config.json +600 -0
  54. package/templates/multi-llm-config.json +544 -0
  55. package/templates/multi-project-memory-config.json +145 -0
  56. package/templates/observability-config.json +109 -0
  57. package/templates/performance-profiler-config.json +125 -0
  58. package/templates/plugin-config.json +170 -0
  59. package/templates/prompt-management-config.json +86 -0
  60. package/templates/sandbox-config.json +185 -0
  61. package/templates/schemas-config.json +65 -0
  62. package/templates/security-config.json +120 -0
  63. package/templates/streaming-config.json +72 -0
  64. package/templates/testing-config.json +81 -0
  65. package/templates/timetravel-config.json +62 -0
  66. package/templates/tool-registry-config.json +109 -0
  67. package/templates/voice-commands-config.json +658 -0
@@ -0,0 +1,683 @@
1
+ ---
2
+ name: memory-system
3
+ description: Sistema de memoria multi-nivel inspirado en CrewAI
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # ELSABRO Multi-Level Memory System
8
+
9
+ ## Vision General
10
+
11
+ El sistema de memoria multi-nivel permite a ELSABRO mantener contexto a través de sesiones, aprender de errores, y mejorar continuamente. Inspirado en CrewAI's memory architecture.
12
+
13
+ ```
14
+ ┌────────────────────────────────────────────────────────────────────────┐
15
+ │ MEMORY ARCHITECTURE │
16
+ ├────────────────────────────────────────────────────────────────────────┤
17
+ │ │
18
+ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
19
+ │ │ SHORT-TERM │ │ LONG-TERM │ │ ENTITY │ │
20
+ │ │ MEMORY │ │ MEMORY │ │ MEMORY │ │
21
+ │ ├──────────────────┤ ├──────────────────┤ ├──────────────────┤ │
22
+ │ │ • Sesión actual │ │ • patterns.md │ │ • Archivos │ │
23
+ │ │ • Conversación │ │ • mistakes.md │ │ • Funciones │ │
24
+ │ │ • Decisiones │ │ • preferences │ │ • Componentes │ │
25
+ │ │ • Contexto temp │ │ • learnings │ │ • Dependencies │ │
26
+ │ └──────────────────┘ └──────────────────┘ └──────────────────┘ │
27
+ │ │ │ │ │
28
+ │ └────────────────────┼──────────────────────┘ │
29
+ │ ▼ │
30
+ │ ┌──────────────────────┐ │
31
+ │ │ CONTEXTUAL MEMORY │ │
32
+ │ │ (RAG + Embeddings) │ │
33
+ │ ├──────────────────────┤ │
34
+ │ │ • Semantic search │ │
35
+ │ │ • Related context │ │
36
+ │ │ • Auto-retrieval │ │
37
+ │ └──────────────────────┘ │
38
+ │ │
39
+ └────────────────────────────────────────────────────────────────────────┘
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Tipos de Memoria
45
+
46
+ ### 1. Short-Term Memory (Sesión)
47
+
48
+ **Propósito**: Mantener contexto dentro de una sesión de trabajo.
49
+
50
+ **Duración**: Mientras dure la sesión (se guarda en checkpoint al pausar).
51
+
52
+ **Contenido**:
53
+ - Conversación actual con el usuario
54
+ - Decisiones tomadas en esta sesión
55
+ - Archivos leídos/modificados
56
+ - Errores encontrados y resueltos
57
+ - Estado de tareas en progreso
58
+
59
+ ```json
60
+ {
61
+ "shortTerm": {
62
+ "sessionId": "ses_abc123",
63
+ "startedAt": "2024-01-20T15:00:00Z",
64
+ "conversation": [
65
+ {"role": "user", "content": "Quiero agregar auth", "at": "..."},
66
+ {"role": "assistant", "action": "planned", "at": "..."}
67
+ ],
68
+ "decisions": [
69
+ {
70
+ "question": "¿Qué librería de auth usar?",
71
+ "decision": "NextAuth.js",
72
+ "reasoning": "Mejor integración con Next.js, soporte OAuth",
73
+ "alternatives": ["Auth0", "Clerk", "Custom JWT"],
74
+ "decidedAt": "2024-01-20T15:05:00Z"
75
+ }
76
+ ],
77
+ "filesAccessed": [
78
+ {"path": "src/app/layout.tsx", "action": "read", "at": "..."},
79
+ {"path": "src/app/api/auth/[...nextauth]/route.ts", "action": "created", "at": "..."}
80
+ ],
81
+ "currentContext": {
82
+ "activeTask": "Implementar login",
83
+ "activePhase": "implementation",
84
+ "focusArea": "authentication"
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ ### 2. Long-Term Memory (Persistente)
91
+
92
+ **Propósito**: Aprendizajes que persisten entre sesiones.
93
+
94
+ **Duración**: Permanente (hasta que el usuario los borre).
95
+
96
+ **Contenido**:
97
+ - Patrones preferidos del proyecto/usuario
98
+ - Errores cometidos y cómo evitarlos
99
+ - Preferencias de estilo de código
100
+ - Decisiones arquitectónicas importantes
101
+
102
+ **Archivos**:
103
+ - `.planning/patterns.md` - Patrones a seguir
104
+ - `.planning/mistakes.md` - Errores a evitar
105
+ - `.planning/preferences.json` - Preferencias del usuario
106
+ - `.planning/learnings.json` - Aprendizajes acumulados
107
+
108
+ ```json
109
+ {
110
+ "longTerm": {
111
+ "patterns": [
112
+ {
113
+ "id": "pat_001",
114
+ "name": "Error Handling Pattern",
115
+ "description": "Siempre usar try-catch con tipos específicos",
116
+ "example": "try { ... } catch (error) { if (error instanceof AuthError) ... }",
117
+ "context": ["typescript", "error-handling"],
118
+ "createdAt": "2024-01-15T10:00:00Z",
119
+ "usageCount": 12
120
+ }
121
+ ],
122
+ "mistakes": [
123
+ {
124
+ "id": "mis_001",
125
+ "description": "No usar 'any' en TypeScript",
126
+ "correction": "Definir tipos específicos o usar 'unknown'",
127
+ "severity": "high",
128
+ "occurrences": 3,
129
+ "lastOccurrence": "2024-01-18T14:30:00Z"
130
+ }
131
+ ],
132
+ "preferences": {
133
+ "codeStyle": {
134
+ "semicolons": false,
135
+ "quotes": "single",
136
+ "indentation": 2,
137
+ "maxLineLength": 100
138
+ },
139
+ "architecture": {
140
+ "preferredPatterns": ["repository", "service-layer"],
141
+ "avoidPatterns": ["singleton-abuse", "god-objects"]
142
+ },
143
+ "testing": {
144
+ "framework": "vitest",
145
+ "coverage": 80,
146
+ "style": "describe-it"
147
+ }
148
+ },
149
+ "learnings": [
150
+ {
151
+ "id": "learn_001",
152
+ "trigger": "User correction",
153
+ "original": "Usé fetch sin error handling",
154
+ "learned": "Siempre envolver fetch en try-catch con timeout",
155
+ "confidence": 0.95,
156
+ "applications": 8
157
+ }
158
+ ]
159
+ }
160
+ }
161
+ ```
162
+
163
+ ### 3. Entity Memory (Codebase)
164
+
165
+ **Propósito**: Conocimiento sobre entidades específicas del código.
166
+
167
+ **Duración**: Se actualiza cuando cambia el código.
168
+
169
+ **Contenido**:
170
+ - Información sobre archivos importantes
171
+ - Funciones/componentes y sus responsabilidades
172
+ - Dependencias y relaciones
173
+ - Historial de cambios
174
+
175
+ ```json
176
+ {
177
+ "entityMemory": {
178
+ "files": {
179
+ "src/components/Auth/LoginForm.tsx": {
180
+ "type": "component",
181
+ "purpose": "Formulario de login con email/password",
182
+ "dependencies": ["@/lib/auth", "@/components/ui/Button"],
183
+ "exports": ["LoginForm", "LoginFormProps"],
184
+ "lastModified": "2024-01-20T15:30:00Z",
185
+ "modifiedBy": ["elsabro-executor"],
186
+ "complexity": "medium",
187
+ "testCoverage": 85,
188
+ "notes": ["Usa react-hook-form", "Validación con zod"]
189
+ }
190
+ },
191
+ "functions": {
192
+ "validateCredentials": {
193
+ "file": "src/lib/auth/validators.ts",
194
+ "signature": "(email: string, password: string) => Promise<User | null>",
195
+ "purpose": "Valida credenciales contra la base de datos",
196
+ "sideEffects": ["database-read"],
197
+ "calledBy": ["LoginForm", "API route"],
198
+ "calls": ["prisma.user.findUnique", "bcrypt.compare"]
199
+ }
200
+ },
201
+ "components": {
202
+ "LoginForm": {
203
+ "file": "src/components/Auth/LoginForm.tsx",
204
+ "props": ["onSuccess", "onError", "redirectUrl"],
205
+ "state": ["isLoading", "error"],
206
+ "hooks": ["useForm", "useAuth"],
207
+ "children": ["Button", "Input", "ErrorMessage"]
208
+ }
209
+ },
210
+ "relationships": {
211
+ "authentication": {
212
+ "entry": "src/app/api/auth/[...nextauth]/route.ts",
213
+ "components": ["LoginForm", "RegisterForm", "ForgotPassword"],
214
+ "services": ["AuthService", "EmailService"],
215
+ "database": ["User", "Session", "Account"]
216
+ }
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ ### 4. Contextual Memory (RAG)
223
+
224
+ **Propósito**: Recuperación semántica de contexto relevante.
225
+
226
+ **Duración**: Índice persistente, actualizado incrementalmente.
227
+
228
+ **Contenido**:
229
+ - Embeddings del codebase
230
+ - Documentación indexada
231
+ - Historial de conversaciones relevantes
232
+ - Decisiones arquitectónicas
233
+
234
+ ```json
235
+ {
236
+ "contextualMemory": {
237
+ "index": {
238
+ "provider": "pinecone",
239
+ "namespace": "project-my-app",
240
+ "dimensions": 1536,
241
+ "lastUpdated": "2024-01-20T16:00:00Z",
242
+ "documentCount": 245
243
+ },
244
+ "sources": [
245
+ {
246
+ "type": "codebase",
247
+ "path": "src/",
248
+ "indexed": 180,
249
+ "lastIndexed": "2024-01-20T15:55:00Z"
250
+ },
251
+ {
252
+ "type": "documentation",
253
+ "path": "docs/",
254
+ "indexed": 35,
255
+ "lastIndexed": "2024-01-19T10:00:00Z"
256
+ },
257
+ {
258
+ "type": "conversations",
259
+ "count": 30,
260
+ "lastIndexed": "2024-01-20T16:00:00Z"
261
+ }
262
+ ],
263
+ "recentQueries": [
264
+ {
265
+ "query": "authentication flow",
266
+ "results": ["src/lib/auth/index.ts", "docs/auth.md"],
267
+ "at": "2024-01-20T15:45:00Z"
268
+ }
269
+ ]
270
+ }
271
+ }
272
+ ```
273
+
274
+ ---
275
+
276
+ ## API del Sistema de Memoria
277
+
278
+ ### MemoryManager
279
+
280
+ ```javascript
281
+ /**
282
+ * MemoryManager
283
+ * Gestiona los 4 niveles de memoria de ELSABRO
284
+ */
285
+ class MemoryManager {
286
+ constructor(projectPath = '.planning') {
287
+ this.projectPath = projectPath;
288
+ this.shortTerm = new ShortTermMemory();
289
+ this.longTerm = new LongTermMemory(projectPath);
290
+ this.entity = new EntityMemory(projectPath);
291
+ this.contextual = new ContextualMemory(projectPath);
292
+ }
293
+
294
+ // ==================== Short-Term ====================
295
+
296
+ /**
297
+ * Registra una decisión en la sesión actual
298
+ */
299
+ async recordDecision(decision) {
300
+ return this.shortTerm.addDecision({
301
+ question: decision.question,
302
+ decision: decision.answer,
303
+ reasoning: decision.reasoning,
304
+ alternatives: decision.alternatives || [],
305
+ decidedAt: new Date().toISOString()
306
+ });
307
+ }
308
+
309
+ /**
310
+ * Registra acceso a archivo
311
+ */
312
+ async recordFileAccess(filePath, action) {
313
+ return this.shortTerm.addFileAccess({
314
+ path: filePath,
315
+ action, // 'read' | 'created' | 'modified' | 'deleted'
316
+ at: new Date().toISOString()
317
+ });
318
+ }
319
+
320
+ /**
321
+ * Obtiene contexto de la sesión actual
322
+ */
323
+ async getSessionContext() {
324
+ return this.shortTerm.getContext();
325
+ }
326
+
327
+ // ==================== Long-Term ====================
328
+
329
+ /**
330
+ * Aprende un nuevo patrón
331
+ */
332
+ async learnPattern(pattern) {
333
+ // Verificar si ya existe similar
334
+ const existing = await this.longTerm.findSimilarPattern(pattern);
335
+
336
+ if (existing) {
337
+ return this.longTerm.reinforcePattern(existing.id);
338
+ }
339
+
340
+ return this.longTerm.addPattern({
341
+ name: pattern.name,
342
+ description: pattern.description,
343
+ example: pattern.example,
344
+ context: pattern.context || [],
345
+ usageCount: 1
346
+ });
347
+ }
348
+
349
+ /**
350
+ * Registra un error para no repetirlo
351
+ */
352
+ async learnFromMistake(mistake) {
353
+ const existing = await this.longTerm.findSimilarMistake(mistake);
354
+
355
+ if (existing) {
356
+ return this.longTerm.incrementMistakeOccurrence(existing.id);
357
+ }
358
+
359
+ return this.longTerm.addMistake({
360
+ description: mistake.description,
361
+ correction: mistake.correction,
362
+ severity: mistake.severity || 'medium',
363
+ context: mistake.context || []
364
+ });
365
+ }
366
+
367
+ /**
368
+ * Obtiene patrones relevantes para contexto actual
369
+ */
370
+ async getRelevantPatterns(context) {
371
+ return this.longTerm.queryPatterns(context);
372
+ }
373
+
374
+ /**
375
+ * Obtiene errores a evitar para contexto actual
376
+ */
377
+ async getMistakesToAvoid(context) {
378
+ return this.longTerm.queryMistakes(context);
379
+ }
380
+
381
+ // ==================== Entity ====================
382
+
383
+ /**
384
+ * Actualiza información de un archivo
385
+ */
386
+ async updateFileEntity(filePath, info) {
387
+ return this.entity.updateFile(filePath, {
388
+ ...info,
389
+ lastModified: new Date().toISOString()
390
+ });
391
+ }
392
+
393
+ /**
394
+ * Obtiene información de un archivo
395
+ */
396
+ async getFileInfo(filePath) {
397
+ return this.entity.getFile(filePath);
398
+ }
399
+
400
+ /**
401
+ * Obtiene relaciones de una entidad
402
+ */
403
+ async getRelationships(entityName) {
404
+ return this.entity.getRelationships(entityName);
405
+ }
406
+
407
+ /**
408
+ * Mapea el codebase completo
409
+ */
410
+ async mapCodebase(rootPath) {
411
+ return this.entity.scanAndIndex(rootPath);
412
+ }
413
+
414
+ // ==================== Contextual ====================
415
+
416
+ /**
417
+ * Busca contexto relevante semánticamente
418
+ */
419
+ async searchContext(query, options = {}) {
420
+ const { limit = 5, threshold = 0.7 } = options;
421
+
422
+ return this.contextual.search(query, {
423
+ limit,
424
+ threshold,
425
+ sources: ['codebase', 'documentation', 'conversations']
426
+ });
427
+ }
428
+
429
+ /**
430
+ * Indexa nuevo contenido
431
+ */
432
+ async indexContent(content, metadata) {
433
+ return this.contextual.index(content, metadata);
434
+ }
435
+
436
+ /**
437
+ * Re-indexa el codebase
438
+ */
439
+ async reindexCodebase() {
440
+ return this.contextual.reindex('codebase');
441
+ }
442
+
443
+ // ==================== Cross-Memory ====================
444
+
445
+ /**
446
+ * Obtiene todo el contexto relevante para una tarea
447
+ */
448
+ async getFullContext(task) {
449
+ const [patterns, mistakes, entities, contextual] = await Promise.all([
450
+ this.getRelevantPatterns(task.context),
451
+ this.getMistakesToAvoid(task.context),
452
+ this.entity.getRelevantEntities(task.files || []),
453
+ this.searchContext(task.description)
454
+ ]);
455
+
456
+ return {
457
+ patterns,
458
+ mistakes,
459
+ entities,
460
+ relatedContent: contextual,
461
+ sessionContext: await this.getSessionContext()
462
+ };
463
+ }
464
+
465
+ /**
466
+ * Guarda estado de memoria para checkpoint
467
+ */
468
+ async saveToCheckpoint() {
469
+ return {
470
+ shortTerm: await this.shortTerm.serialize(),
471
+ longTermSummary: await this.longTerm.getSummary(),
472
+ entitySummary: await this.entity.getSummary()
473
+ };
474
+ }
475
+
476
+ /**
477
+ * Restaura estado de memoria desde checkpoint
478
+ */
479
+ async restoreFromCheckpoint(data) {
480
+ await this.shortTerm.deserialize(data.shortTerm);
481
+ // Long-term y entity se cargan desde archivos
482
+ }
483
+ }
484
+ ```
485
+
486
+ ---
487
+
488
+ ## Integración con Agentes
489
+
490
+ ### Antes de Ejecutar Agente
491
+
492
+ ```javascript
493
+ async function prepareAgentContext(agent, task) {
494
+ const memory = new MemoryManager();
495
+
496
+ // Obtener contexto completo
497
+ const context = await memory.getFullContext(task);
498
+
499
+ // Inyectar en prompt del agente
500
+ return `
501
+ ## Contexto de Memoria
502
+
503
+ ### Patrones a Seguir
504
+ ${context.patterns.map(p => `- ${p.name}: ${p.description}`).join('\n')}
505
+
506
+ ### Errores a Evitar
507
+ ${context.mistakes.map(m => `- ⚠️ ${m.description} → ${m.correction}`).join('\n')}
508
+
509
+ ### Archivos Relevantes
510
+ ${context.entities.map(e => `- ${e.path}: ${e.purpose}`).join('\n')}
511
+
512
+ ### Contexto Adicional
513
+ ${context.relatedContent.map(c => `- ${c.source}: ${c.summary}`).join('\n')}
514
+
515
+ ## Tarea
516
+ ${task.description}
517
+ `;
518
+ }
519
+ ```
520
+
521
+ ### Después de Ejecutar Agente
522
+
523
+ ```javascript
524
+ async function processAgentResult(agent, result) {
525
+ const memory = new MemoryManager();
526
+
527
+ // Registrar archivos modificados
528
+ for (const file of result.filesModified) {
529
+ await memory.recordFileAccess(file.path, 'modified');
530
+ await memory.updateFileEntity(file.path, {
531
+ modifiedBy: [agent],
532
+ purpose: file.purpose
533
+ });
534
+ }
535
+
536
+ // Aprender de decisiones
537
+ for (const decision of result.decisions) {
538
+ await memory.recordDecision(decision);
539
+
540
+ // Si es un patrón reutilizable, guardarlo
541
+ if (decision.isPattern) {
542
+ await memory.learnPattern({
543
+ name: decision.patternName,
544
+ description: decision.reasoning,
545
+ example: decision.implementation
546
+ });
547
+ }
548
+ }
549
+
550
+ // Aprender de errores corregidos
551
+ for (const error of result.errorsFixed) {
552
+ await memory.learnFromMistake({
553
+ description: error.original,
554
+ correction: error.fix,
555
+ severity: error.severity
556
+ });
557
+ }
558
+ }
559
+ ```
560
+
561
+ ---
562
+
563
+ ## Comandos de Usuario
564
+
565
+ ### /elsabro:memory
566
+
567
+ ```bash
568
+ /elsabro:memory show # Ver estado de memoria
569
+ /elsabro:memory patterns # Ver patrones aprendidos
570
+ /elsabro:memory mistakes # Ver errores a evitar
571
+ /elsabro:memory search <query> # Buscar en memoria contextual
572
+ /elsabro:memory forget <id> # Olvidar un item específico
573
+ /elsabro:memory export # Exportar memoria a JSON
574
+ /elsabro:memory import <file> # Importar memoria desde JSON
575
+ /elsabro:memory reindex # Re-indexar memoria contextual
576
+ ```
577
+
578
+ ---
579
+
580
+ ## Archivos de Memoria
581
+
582
+ ### Estructura de Directorios
583
+
584
+ ```
585
+ .planning/
586
+ ├── memory/
587
+ │ ├── short-term/
588
+ │ │ └── session-{id}.json # Estado de sesión actual
589
+ │ ├── long-term/
590
+ │ │ ├── patterns.json # Patrones aprendidos
591
+ │ │ ├── mistakes.json # Errores a evitar
592
+ │ │ ├── preferences.json # Preferencias del usuario
593
+ │ │ └── learnings.json # Aprendizajes acumulados
594
+ │ ├── entity/
595
+ │ │ ├── files.json # Info de archivos
596
+ │ │ ├── functions.json # Info de funciones
597
+ │ │ ├── components.json # Info de componentes
598
+ │ │ └── relationships.json # Relaciones entre entidades
599
+ │ └── contextual/
600
+ │ ├── index.json # Metadata del índice
601
+ │ └── embeddings/ # Embeddings locales (opcional)
602
+ ├── patterns.md # Versión legible de patterns
603
+ ├── mistakes.md # Versión legible de mistakes
604
+ └── CLAUDE.md # Resumen para Claude
605
+ ```
606
+
607
+ ---
608
+
609
+ ## Triggers de Aprendizaje
610
+
611
+ ### Detección Automática
612
+
613
+ El sistema detecta oportunidades de aprendizaje:
614
+
615
+ | Trigger | Acción |
616
+ |---------|--------|
617
+ | Usuario corrige código | Aprender patrón/error |
618
+ | Usuario dice "siempre usa X" | Guardar preferencia |
619
+ | Mismo error 3+ veces | Elevar severidad |
620
+ | Patrón usado 5+ veces | Marcar como establecido |
621
+ | Usuario elogia resultado | Reforzar patrón |
622
+
623
+ ### Frases de Trigger
624
+
625
+ ```javascript
626
+ const LEARNING_TRIGGERS = {
627
+ pattern: [
628
+ /siempre (usa|haz|prefiero)/i,
629
+ /en este proyecto (usamos|preferimos)/i,
630
+ /la convención es/i,
631
+ /mejor así/i
632
+ ],
633
+ mistake: [
634
+ /no,? (hazlo|así no)/i,
635
+ /eso está mal/i,
636
+ /nunca (uses|hagas)/i,
637
+ /evita/i
638
+ ],
639
+ preference: [
640
+ /prefiero/i,
641
+ /me gusta más/i,
642
+ /usa .* en vez de/i
643
+ ]
644
+ };
645
+ ```
646
+
647
+ ---
648
+
649
+ ## Configuración
650
+
651
+ ### .planning/memory-config.json
652
+
653
+ ```json
654
+ {
655
+ "memory": {
656
+ "shortTerm": {
657
+ "maxConversationLength": 50,
658
+ "maxDecisions": 100,
659
+ "persistOnPause": true
660
+ },
661
+ "longTerm": {
662
+ "maxPatterns": 200,
663
+ "maxMistakes": 100,
664
+ "autoLearn": true,
665
+ "confirmBeforeLearn": false,
666
+ "decayEnabled": false
667
+ },
668
+ "entity": {
669
+ "autoScan": true,
670
+ "scanInterval": "on-change",
671
+ "includePatterns": ["src/**/*", "lib/**/*"],
672
+ "excludePatterns": ["node_modules/**", "dist/**"]
673
+ },
674
+ "contextual": {
675
+ "provider": "local",
676
+ "embeddingModel": "text-embedding-3-small",
677
+ "chunkSize": 500,
678
+ "chunkOverlap": 50,
679
+ "autoReindex": true
680
+ }
681
+ }
682
+ }
683
+ ```