refacil-sdd-ai 4.2.4 → 4.4.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 (47) hide show
  1. package/README.md +239 -214
  2. package/agents/auditor.md +189 -184
  3. package/agents/debugger.md +201 -204
  4. package/agents/implementer.md +150 -149
  5. package/agents/investigator.md +80 -89
  6. package/agents/proposer.md +219 -124
  7. package/agents/tester.md +140 -144
  8. package/agents/validator.md +153 -145
  9. package/bin/cli.js +158 -116
  10. package/lib/bus/askFulfillment.js +17 -17
  11. package/lib/bus/broker.js +599 -599
  12. package/lib/bus/ui/app.js +318 -318
  13. package/lib/commands/sdd.js +447 -0
  14. package/lib/hooks.js +236 -236
  15. package/lib/installer.js +58 -2
  16. package/lib/methodology-migration-pending.js +101 -136
  17. package/package.json +4 -6
  18. package/skills/apply/SKILL.md +139 -120
  19. package/skills/archive/SKILL.md +105 -107
  20. package/skills/ask/SKILL.md +78 -78
  21. package/skills/attend/SKILL.md +70 -70
  22. package/skills/bug/SKILL.md +121 -128
  23. package/skills/explore/SKILL.md +73 -63
  24. package/skills/guide/SKILL.md +79 -79
  25. package/skills/inbox/SKILL.md +43 -43
  26. package/skills/join/SKILL.md +82 -82
  27. package/skills/prereqs/BUS-CROSS-REPO.md +55 -55
  28. package/skills/prereqs/METHODOLOGY-CONTRACT.md +122 -115
  29. package/skills/prereqs/SKILL.md +30 -37
  30. package/skills/propose/SKILL.md +103 -102
  31. package/skills/reply/SKILL.md +44 -44
  32. package/skills/review/SKILL.md +163 -126
  33. package/skills/review/checklist-back.md +92 -92
  34. package/skills/review/checklist-front.md +72 -72
  35. package/skills/review/checklist.md +114 -114
  36. package/skills/say/SKILL.md +38 -38
  37. package/skills/setup/SKILL.md +85 -141
  38. package/skills/setup/troubleshooting.md +38 -35
  39. package/skills/test/SKILL.md +104 -94
  40. package/skills/test/testing-patterns.md +63 -63
  41. package/skills/up-code/SKILL.md +108 -108
  42. package/skills/update/SKILL.md +109 -132
  43. package/skills/verify/SKILL.md +159 -132
  44. package/templates/compact-guidance.md +45 -45
  45. package/templates/methodology-guide.md +46 -42
  46. package/config/openspec-config.yaml +0 -8
  47. package/skills/prereqs/OPENSPEC-DELTAS.md +0 -51
@@ -1,70 +1,70 @@
1
- ---
2
- name: refacil:attend
3
- description: Modo escucha activa del bus. Espera preguntas dirigidas a esta sesión, las procesa y responde; luego sigue escuchando. Habilita conversación automática LLM a LLM entre repos.
4
- user-invocable: true
5
- ---
6
-
7
- # refacil:attend — Escuchar y responder preguntas del bus
8
-
9
- Pone esta sesión en modo escucha. Cuando llega una pregunta dirigida, la respondes usando tu conocimiento del repo y vuelves a escuchar. Así otros agentes pueden preguntarte cosas y recibir respuesta automática mientras estés en este modo.
10
-
11
- ## Instrucciones
12
-
13
- ### Paso 1: Ejecutar attend
14
-
15
- Ejecuta vía `Bash` con timeout alto (10 minutos / 600000 ms):
16
-
17
- ```bash
18
- refacil-sdd-ai bus attend
19
- ```
20
-
21
- **IMPORTANTE**: al invocar el `Bash` tool, pasa `timeout: 600000` (10 min) para aprovechar el máximo.
22
-
23
- El comando:
24
- - Revisa primero si hay preguntas pendientes dirigidas a esta sesión en el historial reciente
25
- - Si no hay, espera en vivo hasta 9 minutos por una nueva pregunta dirigida
26
- - Retorna apenas llegue una, o con un mensaje "sin preguntas" si pasa el tiempo
27
-
28
- ### Paso 2: Procesar el resultado
29
-
30
- **Si el output contiene "Pregunta recibida del bus"**:
31
- 1. Lee `de:`, `correlationId:` y `texto:` del output.
32
- 2. Si el `texto` es una **solicitud de cambio** en **este** repo (no solo una pregunta informativa), canaliza con **`/refacil:propose`** y el flujo SDD-AI; en el `reply` resume estado o siguiente paso sin re-explicar la metodologia (quien pregunta ya esta en la sala por `join`). Ver `refacil-prereqs/BUS-CROSS-REPO.md` y `/refacil:ask` Paso 1.5.
33
- 3. Investiga el repo para encontrar la respuesta. Usa `Read`, `Grep`, `Glob` según necesites.
34
- 4. Responde al bus con:
35
- ```bash
36
- refacil-sdd-ai bus reply --text "<tu respuesta>"
37
- ```
38
- El broker autocompleta el `correlationId` con la última pregunta dirigida a ti (la que acabas de procesar).
39
- 5. Si la pregunta está fuera de tu scope, igualmente responde:
40
- ```bash
41
- refacil-sdd-ai bus reply --text "fuera de mi alcance, consulta al repo X"
42
- ```
43
- 6. **Vuelve a ejecutar `refacil-sdd-ai bus attend`** (paso 1) para seguir escuchando.
44
-
45
- **Si el output contiene "Sin preguntas en"**:
46
- - No hubo preguntas en el intervalo.
47
- - **Vuelve a ejecutar `refacil-sdd-ai bus attend`** (paso 1) para seguir escuchando.
48
-
49
- ### Paso 3: Salir del modo
50
-
51
- El loop continúa mientras el usuario (dev) no te otra instrucción o aborte con ESC. Si el usuario te da una tarea nueva en medio del loop, abandona el attend y atiende la nueva tarea.
52
-
53
- ## Cuándo usar attend
54
-
55
- - Cuando el dev te dice *"atiende el bus un rato"* o *"quedás escuchando al bus mientras yo hago otra cosa"*.
56
- - Cuando sabes que otro agente te va a consultar cosas y quieres responder automáticamente.
57
-
58
- ## Cuándo NO usar attend
59
-
60
- - Si tienes una tarea activa que el usuario te pidióprimero termínala.
61
- - Si el dev necesita usar esta sesión para algo inmediato — attend bloquea la sesión.
62
-
63
- ## Reglas
64
-
65
- - Si el `ask` implica **que implementes un cambio en este repo** acordado por la sala, despues de ejecutarlo usa **`/refacil:propose`** (y el flujo SDD-AI) y **cierra al solicitante** por bus (`reply` u otro canal segun `refacil-prereqs/BUS-CROSS-REPO.md`); no cierres en silencio.
66
- - **Siempre re-invocar attend después de responder** — un solo `attend` atiende una sola pregunta; el loop lo mantienes tú.
67
- - **No respondas desde conocimiento general**: usa archivos del repo como fuente. Si no sabes, dilo.
68
- - **No envíes secretos ni tokens** en las respuestas los mensajes quedan 7 días en disco local.
69
- - **Sesión ocupada**: mientras attend corre, el dev no puede usar esta sesión sin abortar. Si el dev te interrumpe, deja attend y atiende al dev.
70
- - El timeout interno (9 min) es para mantenerse dentro del límite del Bash tool; no es tope de escucha total. Al re-invocar, el loop es efectivamente infinito.
1
+ ---
2
+ name: refacil:attend
3
+ description: Active bus listening mode. Waits for questions directed to this session, processes them and responds; then continues listening. Enables automatic LLM-to-LLM conversation between repos.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # refacil:attend — Listen and respond to bus questions
8
+
9
+ Puts this session in listening mode. When a directed question arrives, you respond using your knowledge of the repo and go back to listening. This way other agents can ask you things and receive an automatic response while you are in this mode.
10
+
11
+ ## Instructions
12
+
13
+ ### Step 1: Execute attend
14
+
15
+ Run via `Bash` with a high timeout (10 minutes / 600000 ms):
16
+
17
+ ```bash
18
+ refacil-sdd-ai bus attend
19
+ ```
20
+
21
+ **IMPORTANT**: when invoking the `Bash` tool, pass `timeout: 600000` (10 min) to take advantage of the maximum.
22
+
23
+ The command:
24
+ - First checks if there are pending questions directed to this session in the recent history
25
+ - If not, waits live for up to 9 minutes for a new directed question
26
+ - Returns as soon as one arrives, or with a "no questions" message if the time passes
27
+
28
+ ### Step 2: Process the result
29
+
30
+ **If the output contains "Question received from bus"**:
31
+ 1. Read `from:`, `correlationId:`, and `text:` from the output.
32
+ 2. If the `text` is a **change request** in **this** repo (not just an informational question), channel it with **`/refacil:propose`** and the SDD-AI flow; in the `reply` summarize status or next step without re-explaining the methodology (whoever asks is already in the room via `join`). See `refacil-prereqs/BUS-CROSS-REPO.md` and `/refacil:ask` Step 1.5.
33
+ 3. Investigate the repo to find the answer. Use `Read`, `Grep`, `Glob` as needed.
34
+ 4. Respond to the bus with:
35
+ ```bash
36
+ refacil-sdd-ai bus reply --text "<your response>"
37
+ ```
38
+ The broker autocompletes the `correlationId` with the last question directed to you (the one you just processed).
39
+ 5. If the question is outside your scope, still respond:
40
+ ```bash
41
+ refacil-sdd-ai bus reply --text "out of my scope, consult repo X"
42
+ ```
43
+ 6. **Run `refacil-sdd-ai bus attend` again** (step 1) to continue listening.
44
+
45
+ **If the output contains "No questions in"**:
46
+ - There were no questions in the interval.
47
+ - **Run `refacil-sdd-ai bus attend` again** (step 1) to continue listening.
48
+
49
+ ### Step 3: Exit the mode
50
+
51
+ The loop continues while the user (dev) does not give you another instruction or aborts with ESC. If the user gives you a new task in the middle of the loop, leave attend and attend to the new task.
52
+
53
+ ## When to use attend
54
+
55
+ - When the dev says *"attend the bus for a while"* or *"stay listening to the bus while I do something else"*.
56
+ - When you know another agent will consult you and you want to respond automatically.
57
+
58
+ ## When NOT to use attend
59
+
60
+ - If you have an active task the user asked forfinish it first.
61
+ - If the dev needs to use this session for something immediate — attend blocks the session.
62
+
63
+ ## Rules
64
+
65
+ - If the `ask` implies **implementing a change in this repo** agreed by the room, after executing it use **`/refacil:propose`** (and the SDD-AI flow) and **close to the requester** via bus (`reply` or other channel according to `refacil-prereqs/BUS-CROSS-REPO.md`); do not close silently.
66
+ - **Always re-invoke attend after responding** — a single `attend` handles a single question; you maintain the loop yourself.
67
+ - **Do not respond from general knowledge**: use repo files as the source. If you do not know, say so.
68
+ - **Do not send secrets or tokens** in responsesmessages stay 7 days on local disk.
69
+ - **Busy session**: while attend runs, the dev cannot use this session without aborting. If the dev interrupts you, leave attend and attend to the dev.
70
+ - The internal timeout (9 min) is to stay within the Bash tool limit; it is not a total listening cap. By re-invoking, the loop is effectively infinite.
@@ -1,128 +1,121 @@
1
- ---
2
- name: refacil:bug
3
- description: Flujo guiado completo para investigar y corregir bugs — delega la investigacion y el fix al sub-agente refacil-debugger en dos pasadas separadas por la confirmacion del usuario
4
- user-invocable: true
5
- ---
6
-
7
- # refacil:bug — Entrypoint de Bug Fix
8
-
9
- Este skill es un **wrapper** que guia al usuario por el flujo de bug fix y delega el trabajo pesado al sub-agente `refacil-debugger`. El sub-agente opera en dos modos: `investigation` (analiza y propone hipotesis sin modificar nada) y `fix` (implementa la correccion aprobada, genera tests y crea trazabilidad). La confirmacion de hipotesis y la validacion de rama ocurren en este wrapper, entre las dos invocaciones.
10
-
11
- **Prerequisitos**: perfil `agents` de `refacil-prereqs/SKILL.md` + reglas de `METHODOLOGY-CONTRACT.md`.
12
-
13
- ## Flujo
14
-
15
- ### Paso 0: Verificar prerequisito de trazabilidad
16
-
17
- 1. Verifica si existe la carpeta `openspec/` en la raiz del repo.
18
- 2. Si NO existe, deten el flujo y muestra:
19
- ```
20
- Este flujo de bugfix requiere OpenSpec inicializado para guardar trazabilidad.
21
- Ejecuta /refacil:setup y vuelve a correr /refacil:bug.
22
- ```
23
- 3. Si existe, continua al Paso 1.
24
-
25
- ### Paso 1: Describir el bug
26
-
27
- Si `$ARGUMENTS` no trae suficiente informacion, pregunta al usuario:
28
- - Comportamiento actual vs. esperado.
29
- - Pasos de reproduccion.
30
- - Evidencia disponible (logs, stack traces).
31
- - Cuando empezo a ocurrir.
32
- - Severidad (Critico/Alto/Medio/Bajo).
33
-
34
- Si `$ARGUMENTS` ya es claro, no preguntes de nuevo.
35
-
36
- ### Paso 2: Delegar investigacion al sub-agente refacil-debugger (mode: investigation)
37
-
38
- Invoca al sub-agente `refacil-debugger` pasandole:
39
- - `mode: investigation`
40
- - `description`: descripcion completa del bug (recogida en el Paso 1 o de `$ARGUMENTS`).
41
-
42
- El sub-agente:
43
- - Busca en el codebase simbolos/archivos de logs o stack traces.
44
- - Traza el flujo desde entrada hasta el punto de falla.
45
- - Revisa commits recientes si el bug es nuevo.
46
- - Retorna hipotesis ordenadas por confianza + correccion propuesta, fenced como ` ```refacil-debug-investigation `.
47
-
48
- ### Paso 3: Confirmar hipotesis con el usuario
49
-
50
- Muestra al usuario las hipotesis y la correccion propuesta. Pregunta explicitamente:
51
-
52
- ```
53
- Hipotesis de mayor confianza: [descripcionarchivo:linea]
54
- Correccion propuesta: [descripcion minima]
55
- Archivos a modificar: [lista]
56
-
57
- ¿Confirmas esta hipotesis? (si/no/otra hipotesis N)
58
- ¿Apruebas aplicar la correccion? (si/no)
59
- ```
60
-
61
- **NO implementes nada hasta tener aprobacion explicita del usuario.**
62
-
63
- Segun la respuesta del usuario:
64
-
65
- - **"si" / aprobacion**: pasa al Paso 4 con la hipotesis #1 como `hypothesis` confirmada.
66
- - **"otra hipotesis N"** (ej. "hipotesis 2"): usa esa hipotesis como `hypothesis` confirmada para el Paso 5. La correccion propuesta puede ser diferente resume al usuario la correccion de esa hipotesis alternativa y pide confirmacion de que aprueba aplicarla antes de continuar.
67
- - **"no" / rechazo sin alternativa**: ofrece al usuario dos opciones:
68
- 1. **Reinvestigar** — vuelve al Paso 2 con descripcion enriquecida (pide al usuario que aporte mas contexto: logs adicionales, steps de reproduccion, cuando empezo). El sub-agente `refacil-debugger` se invoca de nuevo en `mode: investigation` con la descripcion actualizada.
69
- 2. **Cancelar** — cierra el flujo sin modificar nada.
70
- No continues hasta que el usuario elija una opcion.
71
-
72
- Si el sub-agente reporto `crossRepo: true` en alguna hipotesis: antes de implementar, aplica el protocolo de `refacil-prereqs/BUS-CROSS-REPO.md` para verificar con el agente del otro repo via el bus. Usa la respuesta para confirmar si el fix va en este repo, en el otro, o en ambos.
73
-
74
- ### Paso 4: Validar rama de trabajo (antes de implementar)
75
-
76
- Ejecuta `git branch --show-current` para obtener la rama actual.
77
-
78
- Aplica la **Politica de ramas protegidas y creacion de rama** definida en `refacil-prereqs/METHODOLOGY-CONTRACT.md`.
79
-
80
- - Si la rama actual es protegida, ejecutar ese protocolo completo antes de continuar.
81
- - Para `refacil:bug`, el prefijo sugerido de rama es `fix/`.
82
- - Si la rama actual ya es de trabajo (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.), continuar sin interrumpir.
83
-
84
- ### Paso 5: Delegar implementacion al sub-agente refacil-debugger (mode: fix)
85
-
86
- Invoca al sub-agente `refacil-debugger` pasandole:
87
- - `mode: fix`
88
- - `description`: descripcion completa del bug.
89
- - `hypothesis`: causa raiz confirmada por el usuario en el Paso 3.
90
-
91
- El sub-agente:
92
- - Implementa el fix minimo y enfocado.
93
- - Genera tests de regresion (reproduce el bug + verifica el fix + no regresion).
94
- - Crea `openspec/changes/fix-<nombre>/summary.md` con trazabilidad.
95
- - Ejecuta todos los tests del proyecto.
96
- - Retorna el reporte fenced como ` ```refacil-debug-fix `.
97
-
98
- ### Paso 6: Presentar resultado y siguiente paso
99
-
100
- Muestra al usuario el **reporte** (todo lo anterior al bloque `refacil-debug-fix`). No muestres el bloque JSON — es metadata interna.
101
-
102
- Agrega al final:
103
-
104
- ```
105
- El siguiente paso es el review del fix (obligatorio antes de archivar).
106
- Quieres que continue con /refacil:review?
107
- (Luego el flujo sigue con /refacil:archive y /refacil:up-code)
108
- ```
109
-
110
- Si el sub-agente retorno `result: "FALLO"` (tests no pasan), presenta el detalle de los tests fallidos y ofrece al usuario:
111
- 1. **Reintentar** — el sub-agente `refacil-debugger` se invoca de nuevo en `mode: fix` con la misma hipotesis mas el contexto del fallo de tests.
112
- 2. **Cancelar** — cierra el flujo sin archivar. Los archivos modificados quedan en la rama para revision manual.
113
-
114
- ## Reglas
115
-
116
- - **Siempre investiga antes de proponer** — no delegar el fix sin hipotesis confirmada.
117
- - **NUNCA implementar sin aprobacion explicita del usuario** (Paso 3).
118
- - **Siempre valida la rama** (Paso 4) antes de delegar el fix.
119
- - **No repliques aqui la logica de investigacion ni de implementacion** — eso vive en `refacil-debugger`.
120
- - **No muestres los bloques JSON al usuario**. Son metadata interna del wrapper.
121
- - El Paso 3 (bus cross-repo) es **opcional** solo aplica si el sub-agente reporto `crossRepo: true`.
122
- - Responder en espanol con terminos tecnicos en ingles.
123
- - **Continuidad del flujo**: si el usuario confirma afirmativamente ("si", "ok", "dale", "continua", etc.) la pregunta de continuidad del Paso 6, invocar inmediatamente el **Skill tool** con `skill: "refacil:review"`. No describirlo en texto ni esperar que el usuario escriba `/refacil:review`. (Ver `METHODOLOGY-CONTRACT.md §5`.)
124
-
125
- ## Ver tambien
126
-
127
- - Sub-agente: `.claude/agents/refacil-debugger.md` (fuente: `refacil-sdd-ai/agents/debugger.md`)
128
- - Bus cross-repo: `refacil-prereqs/BUS-CROSS-REPO.md`
1
+ ---
2
+ name: refacil:bug
3
+ description: Guided complete flow to investigate and fix bugs — delegates investigation and fix to the refacil-debugger sub-agent in two passes separated by user confirmation
4
+ user-invocable: true
5
+ ---
6
+
7
+ # refacil:bug — Bug Fix Entrypoint
8
+
9
+ This skill is a **wrapper** that guides the user through the bug fix flow and delegates the heavy work to the `refacil-debugger` sub-agent. The sub-agent operates in two modes: `investigation` (analyzes and proposes hypotheses without modifying anything) and `fix` (implements the approved correction, generates tests, and creates traceability). Hypothesis confirmation and branch validation occur in this wrapper, between the two invocations.
10
+
11
+ **Prerequisites**: `agents` profile from `refacil-prereqs/SKILL.md` + rules from `METHODOLOGY-CONTRACT.md`.
12
+
13
+ ## Flow
14
+
15
+ ### Step 0: Verify traceability prerequisite
16
+
17
+ 1. Verify that the `refacil-sdd/` folder exists in the repo root.
18
+ 2. If it does NOT exist, stop the flow and show:
19
+ ```
20
+ This bugfix flow requires the SDD-AI methodology initialized to save traceability.
21
+ Run /refacil:setup and re-run /refacil:bug.
22
+ ```
23
+ 3. If it exists, continue to Step 1.
24
+
25
+ ### Step 1: Describe the bug
26
+
27
+ If `$ARGUMENTS` does not bring enough information, ask the user:
28
+ - Current vs. expected behavior.
29
+ - Reproduction steps.
30
+ - Available evidence (logs, stack traces).
31
+ - When it started occurring.
32
+ - Severity (Critical/High/Medium/Low).
33
+
34
+ If `$ARGUMENTS` is already clear, do not ask again.
35
+
36
+ ### Step 2: Delegate investigation to the refacil-debugger sub-agent (mode: investigation)
37
+
38
+ Invoke the `refacil-debugger` sub-agent passing it:
39
+ - `mode: investigation`
40
+ - `description`: complete bug description (collected in Step 1 or from `$ARGUMENTS`).
41
+
42
+ The sub-agent:
43
+ - Searches the codebase for symbols/files from logs or stack traces.
44
+ - Traces the flow from entry to the failure point.
45
+ - Reviews recent commits if the bug is new.
46
+ - Returns hypotheses ordered by confidence + proposed correction, fenced as ` ```refacil-debug-investigation `.
47
+
48
+ ### Step 3: Confirm hypothesis with the user
49
+
50
+ Show the user the hypotheses and the proposed correction. Ask explicitly:
51
+
52
+ ```
53
+ Most confident hypothesis: [descriptionfile:line]
54
+ Proposed fix: [minimal description]
55
+ Files to modify: [list]
56
+
57
+ Do you confirm this hypothesis? (yes/no/other hypothesis N)
58
+ Do you approve applying the fix? (yes/no)
59
+ ```
60
+
61
+ **Do NOT implement anything until you have explicit user approval.**
62
+
63
+ According to the user's response:
64
+
65
+ - **"yes" / approval**: proceed to Step 4 with hypothesis #1 as the confirmed `hypothesis`.
66
+ - **"other hypothesis N"** (e.g. "hypothesis 2"): use that hypothesis as the confirmed `hypothesis` for Step 5. The proposed correction may differsummarize the fix for that alternative hypothesis to the user and ask for confirmation that they approve applying it before continuing.
67
+ - **"no" / rejection without alternative**: offer the user two options:
68
+ 1. **Re-investigate** — return to Step 2 with an enriched description (ask the user to provide more context: additional logs, reproduction steps, when it started). The `refacil-debugger` sub-agent is invoked again in `mode: investigation` with the updated description.
69
+ 2. **Cancel** — close the flow without modifying anything.
70
+ Do not continue until the user chooses an option.
71
+
72
+ If the sub-agent reported `crossRepo: true` in any hypothesis: before implementing, apply the protocol from `refacil-prereqs/BUS-CROSS-REPO.md` to verify with the other repo's agent via the bus. Use the response to confirm whether the fix goes in this repo, the other, or both.
73
+
74
+ ### Step 4: Validate working branch (before implementing)
75
+
76
+ Run `git branch --show-current` to get the current branch.
77
+
78
+ Apply the **Protected branch policy and branch creation** defined in `refacil-prereqs/METHODOLOGY-CONTRACT.md`.
79
+
80
+ - If the current branch is protected, execute the full protocol before continuing.
81
+ - For `refacil:bug`, the suggested branch prefix is `fix/`.
82
+ - If the current branch is already a working branch (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.), continue without interruption.
83
+
84
+ ### Step 5: Delegate implementation to the refacil-debugger sub-agent (mode: fix)
85
+
86
+ Invoke the `refacil-debugger` sub-agent passing it:
87
+ - `mode: fix`
88
+ - `description`: complete bug description.
89
+ - `hypothesis`: root cause confirmed by the user in Step 3.
90
+
91
+ The sub-agent:
92
+ - Implements the minimal and focused fix.
93
+ - Generates regression tests (reproduces the bug + verifies the fix + no regression).
94
+ - Creates `refacil-sdd/changes/fix-<name>/summary.md` with traceability.
95
+ - Runs all project tests.
96
+ - Returns the report fenced as ` ```refacil-debug-fix `.
97
+
98
+ ### Step 6: Present result and next step
99
+
100
+ Show the user the **report** (everything before the `refacil-debug-fix` block). Do not show the JSON block it is internal metadata.
101
+
102
+ Add at the end:
103
+
104
+ ```
105
+ The next step is the fix review (mandatory before archiving).
106
+ Do you want me to continue with /refacil:review?
107
+ (The flow then continues with /refacil:archive and /refacil:up-code)
108
+ ```
109
+
110
+ If the sub-agent returned `result: "FAILED"` (tests not passing), present the failing test details and offer the user:
111
+ 1. **Retry** — the `refacil-debugger` sub-agent is invoked again in `mode: fix` with the same hypothesis plus the test failure context.
112
+ 2. **Cancel** — close the flow without archiving. The modified files remain in the branch for manual review.
113
+
114
+ ## Rules
115
+
116
+ - **Always investigate before proposing** — do not delegate the fix without a confirmed hypothesis.
117
+ - **NEVER implement without explicit user approval** (Step 3).
118
+ - **Always validate the branch** (Step 4) before delegating the fix.
119
+ - **Do not replicate investigation or implementation logic here** — that lives in `refacil-debugger`.
120
+ - Step 3 (bus cross-repo) is **optional** only applies if the sub-agent reported `crossRepo: true`.
121
+ - **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 6, immediately invoke the **Skill tool** with `skill: "refacil:review"`. Do not describe it in text or wait for the user to type `/refacil:review`. (See `METHODOLOGY-CONTRACT.md §5`.)
@@ -1,63 +1,73 @@
1
- ---
2
- name: refacil:explore
3
- description: Explorar e investigar el codebase antes de hacer cambios delega al sub-agente refacil-investigator para analizar arquitectura, flujos y dependencias sin modificar nada
4
- user-invocable: true
5
- ---
6
-
7
- # refacil:explore — Entrypoint de Exploracion
8
-
9
- Este skill es un **wrapper delgado** que delega la investigacion al sub-agente `refacil-investigator`. El sub-agente corre en contexto aislado (no satura tu sesion principal con lecturas masivas de archivos) y retorna un reporte conciso con arquitectura, flujos y recomendaciones.
10
-
11
- **Prerequisitos**: perfil `openspec` de `refacil-prereqs/SKILL.md` — usa `AGENTS.md` como contexto activo durante toda la exploracion.
12
-
13
- ## Flujo
14
-
15
- ### Paso 0: Validar pregunta
16
-
17
- - Si `$ARGUMENTS` viene vacio, pide al usuario la pregunta o topico a explorar ANTES de invocar al sub-agente.
18
- - Si hay pregunta, continua.
19
-
20
- ### Paso 1: Delegar al sub-agente refacil-investigator
21
-
22
- Invoca al sub-agente `refacil-investigator` pasandole:
23
- - La pregunta del usuario (`$ARGUMENTS`).
24
- - Si el usuario pidio modo detallado explicitamente, indicaselo (`mode: detailed`). Default: conciso.
25
-
26
- El sub-agente:
27
- - Delega a OpenSpec explore para la exploracion base.
28
- - Enriquece con patrones y convenciones de `AGENTS.md`.
29
- - Detecta dependencias cross-repo y, si corresponde, consulta el bus segun `refacil-prereqs/BUS-CROSS-REPO.md`.
30
- - Retorna un reporte con arquitectura, flujos, dependencias y recomendaciones de siguiente paso.
31
-
32
- ### Paso 2: Presentar el reporte
33
-
34
- Muestra al usuario el reporte completo que retorno el sub-agente. No hay artefactos que escribir — exploracion es puramente analitica.
35
-
36
- Si el sub-agente pidio clarificacion (porque el prompt no traia pregunta explicita), propaga la pregunta al usuario.
37
-
38
- ### Paso 3: Siguiente paso
39
-
40
- El sub-agente ya incluye recomendaciones al final de su reporte. Aplica la regla de continuidad natural de `METHODOLOGY-CONTRACT.md §5`:
41
-
42
- - Si el reporte converge en **un solo** siguiente paso (ej. el hallazgo claramente indica un feature nuevo o un bug), cierra con la formula unica:
43
- - *"El siguiente paso es [descripcion]. Quieres que continue con `/refacil:propose`?"* (o `/refacil:bug`, segun corresponda).
44
- - Si hay **varios caminos validos**, listalos numerados y pide al usuario seleccionar.
45
-
46
- ## Reglas
47
-
48
- - **Siempre delega al sub-agente**. No repliques la logica de exploracion aqui.
49
- - **No invoques sin pregunta**. Si `$ARGUMENTS` esta vacio, pide la pregunta primero.
50
- - **No escribes archivos**. Exploracion es read-only end-to-end.
51
- - **Continuidad del flujo**: si el usuario confirma afirmativamente ("si", "ok", "dale", "continua", etc.) la pregunta de continuidad del Paso 3, invocar inmediatamente el **Skill tool** con el nombre exacto resuelto a partir del hallazgo del sub-agente. Resolucion determinista:
52
- - Hallazgo = feature nuevo o mejora `skill: "refacil:propose"`
53
- - Hallazgo = bug funcional o error en produccion → `skill: "refacil:bug"`
54
- - Hallazgo = falta configuracion inicial del repo `skill: "refacil:setup"`
55
- - Hallazgo = duda de flujo o no queda claro el siguiente comando → `skill: "refacil:guide"`
56
- - Si no hay match claro, NO invocar listar opciones numeradas al usuario y pedir seleccion explicita antes de continuar.
57
-
58
- No describirlo en texto ni esperar que el usuario escriba el comando. (Ver `METHODOLOGY-CONTRACT.md §5`.)
59
-
60
- ## Ver tambien
61
-
62
- - Sub-agente: `.claude/agents/refacil-investigator.md` (fuente: `refacil-sdd-ai/agents/investigator.md`)
63
- - Bus cross-repo: `refacil-prereqs/BUS-CROSS-REPO.md`
1
+ ---
2
+ name: refacil:explore
3
+ description: Explore and investigate the codebase before making changesdelegates to the refacil-investigator sub-agent to analyze architecture, flows, and dependencies without modifying anything
4
+ user-invocable: true
5
+ ---
6
+
7
+ # refacil:explore — Exploration Entrypoint
8
+
9
+ This skill is a **thin wrapper** that delegates the investigation to the `refacil-investigator` sub-agent. The sub-agent runs in an isolated context (does not saturate your main session with massive file reads) and returns a concise report with architecture, flows, and recommendations.
10
+
11
+ **Prerequisites**: `sdd` profile from `refacil-prereqs/SKILL.md` — use `AGENTS.md` as active context throughout the entire exploration.
12
+
13
+ ## Flow
14
+
15
+ ### Step 0: Validate question
16
+
17
+ - If `$ARGUMENTS` is empty, ask the user for the question or topic to explore BEFORE invoking the sub-agent.
18
+ - If there is a question, continue.
19
+
20
+ ### Step 0.1: Duplicate exploration guard (CA-11)
21
+
22
+ Before delegating, check the current session conversation context for a prior complete exploration report with overlapping scope (same modules, files, or question topic):
23
+
24
+ - **If a prior complete exploration exists for the same or highly overlapping topic**: summarize the already-known context in 2-3 sentences and ask:
25
+ ```
26
+ I already explored [topic] earlier in this session. The key findings were: [summary].
27
+ Do you want me to run a targeted follow-up on a specific aspect, or proceed with a new full exploration?
28
+ ```
29
+ Wait for the user's answer before proceeding.
30
+ - **If there is no prior exploration** (or it is on a clearly different topic): continue to Step 1 without interruption.
31
+
32
+ ### Step 1: Delegate to the refacil-investigator sub-agent
33
+
34
+ Invoke the `refacil-investigator` sub-agent passing it:
35
+ - The user's question (`$ARGUMENTS`).
36
+ - If the user explicitly requested detailed mode, indicate it (`mode: detailed`). Default: concise.
37
+
38
+ The sub-agent:
39
+ - Explores the codebase natively (Read/Grep with discipline — see sub-agent rules).
40
+ - Enriches with patterns and conventions from `AGENTS.md`.
41
+ - Detects cross-repo dependencies and, if appropriate, consults the bus according to `refacil-prereqs/BUS-CROSS-REPO.md`.
42
+ - Returns a report with architecture, flows, dependencies, and next-step recommendations.
43
+
44
+ ### Step 2: Present the report
45
+
46
+ Show the user the full report returned by the sub-agent. There are no artifacts to write — exploration is purely analytical.
47
+
48
+ If the sub-agent asked for clarification (because the prompt did not carry an explicit question), propagate the question to the user.
49
+
50
+ ### Step 3: Next step
51
+
52
+ The sub-agent already includes recommendations at the end of its report. Apply the natural continuity rule from `METHODOLOGY-CONTRACT.md §5`:
53
+
54
+ - If the report converges on **one single** next step (e.g. the finding clearly indicates a new feature or a bug), close with the single formula:
55
+ - *"The next step is [description]. Do you want me to continue with `/refacil:propose`?"* (or `/refacil:bug`, as appropriate).
56
+ - If there are **multiple valid paths**, list them numbered and ask the user to select.
57
+
58
+ ## Rules
59
+
60
+ - **Always delegate to the sub-agent**. Do not replicate the exploration logic here.
61
+ - **Do not invoke without a question**. If `$ARGUMENTS` is empty, ask for the question first.
62
+ - **Do not write files**. Exploration is read-only end-to-end.
63
+ - **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 3, immediately invoke the **Skill tool** with the exact name resolved from the sub-agent's finding. Deterministic resolution:
64
+
65
+ | Finding | Skill |
66
+ |---------|-------|
67
+ | New feature or improvement | `refacil:propose` |
68
+ | Functional bug or production error | `refacil:bug` |
69
+ | Missing initial repo configuration | `refacil:setup` |
70
+ | Flow doubt or next command unclear | `refacil:guide` |
71
+ | No clear match | Do NOT invoke — list numbered options and ask for explicit selection |
72
+
73
+ Do not describe it in text or wait for the user to type the command. (See `METHODOLOGY-CONTRACT.md §5`.)