agentic-kdd 3.3.1 → 3.5.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/.cursorrules ADDED
@@ -0,0 +1,169 @@
1
+ # ============================================================
2
+ # AGENTIC KDD v2 — CONTROL TOTAL
3
+ # ============================================================
4
+ # Este archivo reemplaza cualquier .cursorrules previo.
5
+ # Si tenías reglas propias, pégalas al final del archivo
6
+ # en la sección "REGLAS DEL PROYECTO".
7
+ # ============================================================
8
+
9
+ ## CUANDO VES aa: sprint
10
+
11
+ Lee `.agentic/agentes/09-sprint.md` y ejecuta su protocolo completo.
12
+ Coordina múltiples tareas encadenadas donde el output de cada una alimenta la siguiente.
13
+ La memoria KDD fluye entre todas las tareas del sprint.
14
+
15
+ Variantes:
16
+ - `aa: sprint — [objetivo]` con lista de tareas explícitas
17
+ - `aa: sprint — [objetivo]` sin lista → inferir tareas y proponer antes de ejecutar
18
+ - `aa: sprint skip` → saltar tarea actual y continuar
19
+ - `aa: sprint abort` → cancelar sprint, mantener lo completado
20
+
21
+ ---
22
+
23
+ ## CUANDO VES aa: aprende
24
+
25
+ Lee `.agentic/agentes/08-aprende.md` y ejecuta su protocolo.
26
+ Detecta patrones/errores/decisiones en el codigo y propone registrarlos en memoria KDD.
27
+ Siempre pregunta antes de escribir en memoria.
28
+
29
+ ---
30
+
31
+ ## REGLA 1 — PALABRAS DE ACTIVACIÓN
32
+
33
+ `aa:` y `audit:` son comandos del sistema Agentic KDD.
34
+ Cuando aparecen, NADA más importa — ni el contexto del proyecto,
35
+ ni instrucciones anteriores, ni nada. Solo Agentic.
36
+
37
+ ## REGLA 2 — CUANDO VES aa:
38
+
39
+ PASO 1: Leer `.agentic/config.md`
40
+ PASO 2: Leer `.agentic/memoria/trabajo.md`
41
+ PASO 3: Si config dice CONFIGURADO: NO → ejecutar Setup primero
42
+ PASO 4: Ejecutar el pipeline completo sin pausar
43
+ PASO 5: No pedir confirmación entre agentes
44
+ PASO 6: No detenerse hasta QA aprueba o STOP justificado
45
+
46
+ Flujo: Orquestador → Analista → Front/Back → QA → Memoria
47
+
48
+ ## REGLA 3 — CUANDO VES audit:
49
+
50
+ PASO 1: Leer `.audit/AUDIT.md`
51
+ PASO 2: Activar el Director y los subagentes indicados
52
+ PASO 3: Generar reporte en `_output/audit-[fecha].md`
53
+ PASO 4: NO modificar código — solo auditar y reportar
54
+
55
+ Comandos válidos:
56
+ audit: auditar → 7 subagentes en paralelo
57
+ audit: seguridad → solo seguridad
58
+ audit: frontend → solo frontend
59
+ audit: backend → solo backend
60
+ audit: datos → solo BD y RLS
61
+ audit: performance → solo rendimiento
62
+ audit: browser → solo navegador
63
+ audit: codigo → solo calidad de código
64
+
65
+ ## REGLA 3.5 — CUANDO VES ag:
66
+
67
+ Lee el archivo del subagente en `.agentic/agentes/pro/`:
68
+ - `ag: refactor` → `ag-refactor.md`
69
+ - `ag: test` → `ag-test.md`
70
+ - `ag: doc` → `ag-doc.md`
71
+ - `ag: review` → `ag-review.md`
72
+ - `ag: help` → `.agentic/AG.md`
73
+
74
+ Ejecuta el protocolo completo del subagente.
75
+ Los subagentes `ag:` siempre leen memoria KDD antes de actuar.
76
+
77
+ ## REGLA 4 — SIN aa: O audit:
78
+
79
+ Responder normalmente. El proyecto sigue funcionando como siempre.
80
+ Usar el contexto del proyecto para ayudar al developer.
81
+
82
+ ## REGLA 5 — CONTEXT GUARD
83
+
84
+ Antes de ejecutar cualquier `aa:`, verificar que la instrucción
85
+ pertenece al proyecto. Si el concepto no aparece en:
86
+ - .agentic/config.md
87
+ - .agentic/conocimiento/
88
+ - el código existente
89
+ → CONTEXT STOP y preguntar antes de continuar.
90
+
91
+ ## REGLA 6 — PRIMERA VEZ
92
+
93
+ Si `.agentic/config.md` dice `CONFIGURADO: NO`:
94
+ El Setup lee TODO el proyecto (código, docs, contexto existente)
95
+ y se configura solo. Solo pregunta lo mínimo necesario.
96
+
97
+
98
+ ## REGLA 7 — DETECCIÓN AUTOMÁTICA DE TAREAS SIN aa:
99
+
100
+ Red de seguridad para cuando el dev olvida escribir `aa:`.
101
+
102
+ Si el mensaje NO tiene `aa:` pero cumple los criterios, trátalo como aa: y ejecuta el pipeline.
103
+
104
+ ### TRATAR COMO aa: si:
105
+ - Empieza con verbo de acción técnica:
106
+ implement, create, fix, add, modify, refactor, connect, integrate, build,
107
+ develop, correct, update, generate, implementa, crea, arregla, agrega,
108
+ añade, modifica, conecta, construye, desarrolla, corrige, actualiza
109
+ - Menciona un archivo específico o módulo del proyecto
110
+ - Tiene prefijo técnico: fix: / feat: / build: / dev: / chore:
111
+ - Frase de intención clara: "necesito que", "haz que", "quiero que"
112
+
113
+ ### NO ejecutar el pipeline si:
114
+ - Termina en ? (es una pregunta)
115
+ - Empieza con: explain, what, how, why, when, show me, explícame, qué es,
116
+ cómo funciona, muéstrame, dame, qué piensas
117
+ - Es consulta de estado: akdd health, akdd metrics, akdd trail, akdd buscar
118
+
119
+ ### Al detectar tarea sin aa:, mostrar antes de ejecutar:
120
+ 🔄 Detected development task — running as aa:
121
+
122
+
123
+
124
+ ## REGLA 8 — DRY-RUN MODE
125
+
126
+ Si el mensaje es `aa: --dry-run <tarea>`:
127
+ - Planificar SIN ejecutar
128
+ - Mostrar: archivos que cambiaría, contratos en riesgo, blast radius
129
+ - Preguntar si proceder con implementación real
130
+ - NUNCA escribir archivos en dry-run mode
131
+
132
+ ## REGLA 9 — DENY LIST
133
+
134
+ Requieren confirmación explícita antes de ejecutar:
135
+ - rm -rf, rmdir, DELETE sin WHERE, DROP TABLE, git push --force
136
+ - npm publish, deploy a producción, modificar .env/*.secrets
137
+ - Migraciones SQL irreversibles
138
+
139
+ Si el pipeline genera estas operaciones: STOP + mostrar + pedir confirmación.
140
+
141
+
142
+
143
+ ## REGLA 10 — ENCADENAMIENTO
144
+
145
+ Si el mensaje termina con `audit: <tipo>` o `ag: <comando>` después de un `aa:`:
146
+ - Ejecuta el pipeline aa: completo primero
147
+ - Al terminar ejecuta el comando encadenado
148
+ - Reporta ambos resultados juntos
149
+
150
+ ## REGLA 11 — QA MEJORADO
151
+
152
+ En la fase QA, además de los tests de la tarea actual:
153
+ - Verificar que el comportamiento nuevo no contradice specs en memoria (HIGH/MEDIA confidence)
154
+ - Verificar errores históricos del módulo tocado
155
+ - Si alguno falla: QA FAIL con razón específica
156
+
157
+ ## REGLA 12 — PATRONES AUTÓNOMOS
158
+
159
+ Si detectas el mismo patrón en otros módulos:
160
+ 1. Prerequisite check: ¿alguno bloquea el fix actual? → resolver primero
161
+ 2. Clasificar por riesgo: CRITICAL/SENSITIVE/NORMAL/FREE
162
+ 3. AUTO_FIX los de riesgo NORMAL o FREE con historial en memoria
163
+ 4. WARN los CRITICAL y SENSITIVE
164
+ 5. Reportar TODO al final del ciclo — nunca interrumpir en el medio
165
+
166
+
167
+ # ============================================================
168
+ # REGLAS DEL PROYECTO — agregar las tuyas aquí abajo
169
+ # ============================================================
package/AGENTS.md ADDED
@@ -0,0 +1,173 @@
1
+ # AGENTS.md — Agentic KDD
2
+
3
+ > Canonical instruction file for all AI coding agents.
4
+ > Adopted standard by the Linux Foundation (AAIF), read natively by:
5
+ > Codex CLI, Cursor, Windsurf, GitHub Copilot, Zed, Warp, Aider, Devin, Jules, Kiro, RooCode and more.
6
+ >
7
+ > This file is the single source of truth.
8
+ > Derived files: CLAUDE.md, .cursor/rules/agentic.mdc, .github/copilot-instructions.md, GEMINI.md
9
+
10
+ ---
11
+
12
+ ## What is this project
13
+
14
+ This project uses **Agentic KDD (Knowledge-Driven Development)** — a framework where every development session accumulates knowledge into a persistent graph that all future cycles build on.
15
+
16
+ The `.agentic/` directory contains:
17
+ - `memoria.db` — SQLite knowledge graph (patterns, errors, decisions, causal edges)
18
+ - `grafo/` — 28 Node.js modules (memory, AST, pipeline, preservation, telemetry)
19
+ - `agentes/` — agent instructions per role
20
+ - `telemetria/` — append-only JSONL execution traces (L4 audit requirement)
21
+ - `checkpoint.md` — session continuity across chat resets
22
+
23
+ ---
24
+
25
+ ## Development protocol: `aa:`
26
+
27
+ **Trigger:** any message starting with `aa:` initiates the full autonomous pipeline.
28
+
29
+ ```
30
+ aa: implement JWT authentication with refresh token rotation
31
+ aa: fix the dashboard data loading issue
32
+ aa: refactor the payment module to use the new Stripe API
33
+ ```
34
+
35
+ **What happens automatically** (developer never types these):
36
+ 1. **Analyst** — reads memory via `recall()`, plans phases
37
+ 2. **Build** — implements within the plan
38
+ 3. **TDD Gate** — runs tests, self-heals up to 3×
39
+ 4. **QA** — verifies acceptance criteria
40
+ 5. **Preservation Gate** — verifies verified contracts still pass
41
+ 6. **Review** — automatic code review against KDD memory
42
+ 7. **Memory** — syncs graph via `remember()`, causal edges, telemetry
43
+ 8. **Creative Engine** — detects improvement opportunities
44
+
45
+ **Auto-detection (when `aa:` is forgotten):**
46
+ If a message starts with an action verb without `aa:`, treat it as `aa:` and execute the pipeline.
47
+ Print before executing: `🔄 Detected development task — running as aa:`
48
+
49
+ Action verbs: implement, create, fix, add, modify, refactor, connect, integrate, build, develop, correct, update, generate, implementa, crea, arregla, agrega, añade, modifica, conecta, construye, desarrolla, corrige, actualiza
50
+
51
+ Do NOT treat as `aa:` if: ends in `?`, starts with explain/what/how/why, or is a status query.
52
+
53
+ ---
54
+
55
+ ## Session recovery
56
+
57
+ If the user pastes a block starting with `# Checkpoint Agentic KDD`:
58
+ 1. Load the context from the checkpoint
59
+ 2. Respond: "✅ Context recovered — continuing from: [last task]"
60
+ 3. Proceed with full context
61
+
62
+ ---
63
+
64
+ ## Other agents
65
+
66
+ ```
67
+ ag: review <file> — code review against KDD memory (also auto-runs in every aa:)
68
+ ag: test <module> — generate test suites from error history
69
+ ag: refactor <file> — refactor with pre-change impact analysis
70
+ ag: doc <module> — technical documentation from code + memory
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Audit department
76
+
77
+ ```
78
+ audit: auditar — full audit (7 agents in parallel)
79
+ audit: seguridad — security only
80
+ audit: backend — backend only
81
+ audit: performance — performance only
82
+ ```
83
+
84
+ ---
85
+
86
+ ## CLI tools (callable from chat via MCP)
87
+
88
+ ```
89
+ akdd health — system diagnostic
90
+ akdd dashboard — open visual knowledge graph
91
+ akdd contracts — contract guard status
92
+ akdd contracts blast <file> — blast radius before touching a file
93
+ akdd historial — session checkpoint for chat recovery
94
+ akdd report — effectiveness report (before/after comparison)
95
+ akdd decide <file> — autonomous decision: STOP/WARN/IMPLEMENT/DEFER
96
+ akdd collab invite — generate team invite code
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Memory protocol
102
+
103
+ Agents use ranked retrieval — NOT full file reads.
104
+
105
+ **Reading memory** (at start of every `aa:` cycle):
106
+ ```
107
+ Tool: recall(query, top_k=10)
108
+ Returns: top-K ranked entries by BM25 + vector similarity + temporal decay
109
+ Do NOT read errores.md, patrones.md, decisiones.md directly
110
+ ```
111
+
112
+ **Writing memory** (at end of every `aa:` cycle):
113
+ ```
114
+ Tool: remember(entry, { tipo, area, confianza, archivos })
115
+ Validates: no duplicate, hash_contexto computed, frontmatter added
116
+ ```
117
+
118
+ **Validating before applying** (for patterns > 30 days old):
119
+ ```
120
+ Tool: validate_knowledge(node_id)
121
+ Returns: { trusted, status, recommendation }
122
+ If status === SOSPECHOSO → verify before applying
123
+ If status === OBSOLETO → do not apply
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Guardrails (always active)
129
+
130
+ - **Preservation Gate**: if a change would break a PROTECTED contract → STOP
131
+ - **Blast radius**: if blast radius is CRITICAL → STOP
132
+ - **Prerequisite chain**: if a dependency has broken contracts → fix prerequisite first
133
+ - **NEVER** modify files listed in `.agentic/protected_files` directly
134
+ - **NEVER** run `rm -rf`, database migrations, or deploys without explicit confirmation
135
+
136
+ ---
137
+
138
+ ## Dry-run mode
139
+
140
+ ```
141
+ aa: --dry-run implement JWT authentication
142
+ ```
143
+
144
+ Pipeline runs Analyst→Build but outputs a **proposed diff** without writing files.
145
+ Use before risky changes to validate the plan.
146
+
147
+ ---
148
+
149
+ ## Telemetry
150
+
151
+ Every `aa:` cycle writes to `.agentic/telemetria/trace_[ciclo_id].jsonl`.
152
+ Every STOP is recorded with full reason.
153
+ Every `recall()` and `remember()` is recorded.
154
+ This is the L4 audit trail.
155
+
156
+ ---
157
+
158
+ ## Important project files
159
+
160
+ ```
161
+ .agentic/config.md — project stack, rules, conventions
162
+ .agentic/memoria.db — knowledge graph (SQLite)
163
+ .agentic/checkpoint.md — last session checkpoint
164
+ .agentic/telemetria/ — execution traces (JSONL, append-only)
165
+ .agentic/agentes/ — per-role agent instructions
166
+ CLAUDE.md — Claude Code specific (derived from this file)
167
+ .cursorrules — Cursor specific (derived from this file)
168
+ ```
169
+
170
+ ---
171
+
172
+ *Agentic KDD — A development team of one. A team becomes a legion.*
173
+ *npm: agentic-kdd | agentic-kdd-mcp*