ghcopilot-hub 1.0.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 (109) hide show
  1. package/README.md +176 -0
  2. package/hub/agents/README.md +243 -0
  3. package/hub/agents/archiver.agent.md +231 -0
  4. package/hub/agents/explore.agent.md +49 -0
  5. package/hub/agents/implementador.agent.md +176 -0
  6. package/hub/agents/librarian.agent.md +34 -0
  7. package/hub/agents/momus.agent.md +130 -0
  8. package/hub/agents/oracle.agent.md +52 -0
  9. package/hub/agents/plan-guardian.agent.md +109 -0
  10. package/hub/agents/planificador.agent.md +295 -0
  11. package/hub/agents/test-sentinel.agent.md +106 -0
  12. package/hub/base/.github/copilot-instructions.md +10 -0
  13. package/hub/base/.github/instructions/ghcopilot-hub.instructions.md +6 -0
  14. package/hub/base/.github/prompts/ghcopilot-hub-maintenance.prompt.md +8 -0
  15. package/hub/base/.vscode/settings.json +1 -0
  16. package/hub/packs/base-web.json +4 -0
  17. package/hub/packs/nextjs-ssr.json +4 -0
  18. package/hub/packs/node-api.json +4 -0
  19. package/hub/packs/spa-tanstack.json +4 -0
  20. package/hub/skills/architecture-testing/SKILL.md +108 -0
  21. package/hub/skills/architecture-testing/references/archunitts.md +46 -0
  22. package/hub/skills/ghcopilot-hub-consumer/SKILL.md +115 -0
  23. package/hub/skills/ghcopilot-hub-consumer/references/workflow.md +39 -0
  24. package/hub/skills/mermaid-expert/SKILL.md +152 -0
  25. package/hub/skills/mermaid-expert/assets/examples/c4_model.md +121 -0
  26. package/hub/skills/mermaid-expert/assets/examples/flowchart.md +123 -0
  27. package/hub/skills/mermaid-expert/assets/examples/img/base_minimal.png +0 -0
  28. package/hub/skills/mermaid-expert/assets/examples/img/corporate.png +0 -0
  29. package/hub/skills/mermaid-expert/assets/examples/img/dark.png +0 -0
  30. package/hub/skills/mermaid-expert/assets/examples/img/dark_neo.png +0 -0
  31. package/hub/skills/mermaid-expert/assets/examples/img/default_neo.png +0 -0
  32. package/hub/skills/mermaid-expert/assets/examples/img/forest_corp.png +0 -0
  33. package/hub/skills/mermaid-expert/assets/examples/img/handdrawn.png +0 -0
  34. package/hub/skills/mermaid-expert/assets/examples/img/neo.png +0 -0
  35. package/hub/skills/mermaid-expert/assets/examples/img/neutral_sketch.png +0 -0
  36. package/hub/skills/mermaid-expert/assets/examples/img/retro.png +0 -0
  37. package/hub/skills/mermaid-expert/assets/examples/sequence.md +116 -0
  38. package/hub/skills/mermaid-expert/assets/examples/styles_and_looks.md +102 -0
  39. package/hub/skills/mermaid-expert/assets/examples/technical.md +130 -0
  40. package/hub/skills/mermaid-expert/assets/examples.md +57 -0
  41. package/hub/skills/mermaid-expert/references/cheatsheet.md +88 -0
  42. package/hub/skills/mermaid-expert/references/validation.md +66 -0
  43. package/hub/skills/react/SKILL.md +235 -0
  44. package/hub/skills/react/references/common-mistakes.md +518 -0
  45. package/hub/skills/react/references/composition-patterns.md +526 -0
  46. package/hub/skills/react/references/effects-patterns.md +396 -0
  47. package/hub/skills/react/references/react-compiler.md +268 -0
  48. package/hub/skills/react-hook-form/SKILL.md +291 -0
  49. package/hub/skills/react-hook-form/references/field-arrays.md +98 -0
  50. package/hub/skills/react-hook-form/references/integration.md +102 -0
  51. package/hub/skills/react-hook-form/references/performance.md +96 -0
  52. package/hub/skills/skill-creator/SKILL.md +152 -0
  53. package/hub/skills/skill-creator/assets/SKILL-TEMPLATE.md +84 -0
  54. package/hub/skills/skill-judge/README.md +261 -0
  55. package/hub/skills/skill-judge/SKILL.md +806 -0
  56. package/hub/skills/tailwind/SKILL.md +200 -0
  57. package/hub/skills/tanstack/SKILL.md +284 -0
  58. package/hub/skills/tanstack/references/loader-adapter-examples.md +79 -0
  59. package/hub/skills/tanstack/references/query-options-examples.md +115 -0
  60. package/hub/skills/tanstack/references/resilience-patterns.md +110 -0
  61. package/hub/skills/tanstack/references/suspense-consumption-examples.md +82 -0
  62. package/hub/skills/tanstack-query/SKILL.md +241 -0
  63. package/hub/skills/tanstack-query/references/advanced-hooks.md +126 -0
  64. package/hub/skills/tanstack-query/references/best-practices.md +241 -0
  65. package/hub/skills/tanstack-query/references/cache-strategies.md +474 -0
  66. package/hub/skills/tanstack-query/references/common-patterns.md +239 -0
  67. package/hub/skills/tanstack-query/references/migration-v5.md +93 -0
  68. package/hub/skills/tanstack-query/references/resilience-and-mutations.md +63 -0
  69. package/hub/skills/tanstack-query/references/testing.md +116 -0
  70. package/hub/skills/tanstack-query/references/top-errors.md +148 -0
  71. package/hub/skills/tanstack-query/references/typescript.md +176 -0
  72. package/hub/skills/tanstack-router/SKILL.md +145 -0
  73. package/hub/skills/tanstack-router/references/code-splitting.md +31 -0
  74. package/hub/skills/tanstack-router/references/errors-and-boundaries.md +44 -0
  75. package/hub/skills/tanstack-router/references/loaders-and-preload.md +51 -0
  76. package/hub/skills/tanstack-router/references/navigation.md +24 -0
  77. package/hub/skills/tanstack-router/references/private-routes.md +169 -0
  78. package/hub/skills/tanstack-router/references/router-context.md +35 -0
  79. package/hub/skills/tanstack-router/references/search-params.md +29 -0
  80. package/hub/skills/tanstack-router/references/typescript.md +24 -0
  81. package/hub/skills/testing/SKILL.md +187 -0
  82. package/hub/skills/testing/references/assertions.md +64 -0
  83. package/hub/skills/testing/references/async-testing.md +66 -0
  84. package/hub/skills/testing/references/e2e-strategy.md +69 -0
  85. package/hub/skills/testing/references/layer-matrix.md +67 -0
  86. package/hub/skills/testing/references/performance.md +49 -0
  87. package/hub/skills/testing/references/tooling-map.md +81 -0
  88. package/hub/skills/testing/references/zustand-mocking.md +84 -0
  89. package/hub/skills/typescript/SKILL.md +232 -0
  90. package/hub/skills/typescript/references/perf-additional-concerns.md +248 -0
  91. package/hub/skills/typescript/references/perf-execution-cache-locality.md +178 -0
  92. package/hub/skills/typescript/references/reduce-branching.md +147 -0
  93. package/hub/skills/typescript/references/reduce-looping.md +203 -0
  94. package/hub/skills/typescript/references/style-and-types.md +171 -0
  95. package/hub/skills/typescript/references/type-vs-interface.md +27 -0
  96. package/hub/skills/zod/SKILL.md +219 -0
  97. package/hub/skills/zustand/SKILL.md +273 -0
  98. package/package.json +59 -0
  99. package/tooling/cli/src/bin.js +11 -0
  100. package/tooling/cli/src/cli.js +409 -0
  101. package/tooling/cli/src/lib/catalog-loader.js +191 -0
  102. package/tooling/cli/src/lib/constants.js +39 -0
  103. package/tooling/cli/src/lib/errors.js +8 -0
  104. package/tooling/cli/src/lib/frontmatter.js +41 -0
  105. package/tooling/cli/src/lib/fs-utils.js +77 -0
  106. package/tooling/cli/src/lib/managed-header.js +74 -0
  107. package/tooling/cli/src/lib/manifest.js +105 -0
  108. package/tooling/cli/src/lib/resolver.js +53 -0
  109. package/tooling/cli/src/lib/sync-engine.js +262 -0
package/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # ghcopilot-hub
2
+
3
+ Hub centralizado para reutilizar agentes y skills de GitHub Copilot entre proyectos y materializarlos en cada
4
+ repositorio con un CLI declarativo.
5
+
6
+ ## Objetivo de v1
7
+
8
+ La v1 resuelve estos puntos:
9
+
10
+ - catálogo dinámico de agentes y skills leyendo el filesystem
11
+ - packs declarativos de skills
12
+ - manifiesto por proyecto consumidor en `.github/ghcopilot-hub.json`
13
+ - sincronización de archivos gestionados hacia el repo consumidor
14
+ - detección de drift y diff previo a aplicar cambios
15
+ - preservación de personalizaciones locales en `.github/local-overrides/`
16
+
17
+ No incluye versionado funcional por proyecto. Cada sincronización apunta al estado actual del hub y registra la
18
+ revisión disponible en las cabeceras managed.
19
+
20
+ ## Layout del hub
21
+
22
+ ```text
23
+ hub/
24
+ agents/ agentes compartidos
25
+ skills/ skills compartidas con sus assets y referencias
26
+ packs/ composiciones declarativas de skills
27
+ base/ archivos base sincronizados a cada proyecto
28
+ tooling/cli/ CLI de materialización, diff y doctor
29
+ docs/ documentación operativa
30
+ ```
31
+
32
+ ## Layout del proyecto consumidor
33
+
34
+ ```text
35
+ .github/
36
+ ghcopilot-hub.json
37
+ copilot-instructions.md
38
+ instructions/
39
+ prompts/
40
+ agents/
41
+ skills/
42
+ local-overrides/
43
+ .vscode/
44
+ settings.json
45
+ ```
46
+
47
+ ## Manifiesto
48
+
49
+ ```json
50
+ {
51
+ "packs": ["spa-tanstack"],
52
+ "skills": ["mermaid-expert"],
53
+ "excludeSkills": [],
54
+ "settings": {
55
+ "onConflict": "fail",
56
+ "preserveLocalOverrides": true
57
+ }
58
+ }
59
+ ```
60
+
61
+ Reglas de resolución:
62
+
63
+ - la skill `ghcopilot-hub-consumer` se instala por defecto en cualquier proyecto gestionado por el CLI
64
+ - todos los agentes del hub se copian siempre
65
+ - las skills finales salen de `packs + skills - excludeSkills`
66
+ - `excludeSkills` gana incluso si una skill llega desde un pack
67
+ - los archivos locales viven fuera de los paths gestionados
68
+
69
+ ## CLI
70
+
71
+ Uso rápido:
72
+
73
+ ```bash
74
+ npm install
75
+ node tooling/cli/src/bin.js doctor --hub-only
76
+ ```
77
+
78
+ Uso rápido con Bun:
79
+
80
+ ```bash
81
+ bun install
82
+ bun run validate:hub
83
+ ```
84
+
85
+ Instalación como paquete distribuido:
86
+
87
+ ```bash
88
+ npm install -g ghcopilot-hub
89
+ ghcopilot-hub doctor --hub-only
90
+ ```
91
+
92
+ Instalación global con Bun:
93
+
94
+ ```bash
95
+ bun add -g ghcopilot-hub
96
+ ghcopilot-hub doctor --hub-only
97
+ ```
98
+
99
+ Uso efímero sin instalación global:
100
+
101
+ ```bash
102
+ npx ghcopilot-hub@latest doctor --hub-only
103
+ ```
104
+
105
+ Uso efímero con Bun:
106
+
107
+ ```bash
108
+ bunx ghcopilot-hub@latest doctor --hub-only
109
+ ```
110
+
111
+ Ejemplos sobre un proyecto consumidor:
112
+
113
+ ```bash
114
+ ghcopilot-hub init --pack spa-tanstack
115
+ ghcopilot-hub add skill mermaid-expert
116
+ ghcopilot-hub remove skill tanstack-router
117
+ ghcopilot-hub diff
118
+ ghcopilot-hub doctor
119
+ ghcopilot-hub update
120
+ ```
121
+
122
+ ## Reglas de sync
123
+
124
+ Paths gestionados:
125
+
126
+ - `.github/agents/**`
127
+ - `.github/skills/**`
128
+ - `.github/instructions/**`
129
+ - `.github/prompts/**`
130
+ - `.github/copilot-instructions.md`
131
+ - `.vscode/settings.json`
132
+
133
+ Paths locales:
134
+
135
+ - `.github/local-overrides/**`
136
+
137
+ Cada archivo gestionado lleva una cabecera de trazabilidad con:
138
+
139
+ - `managed-by`
140
+ - `source`
141
+ - `revision`
142
+ - `content-hash`
143
+
144
+ `content-hash` permite distinguir entre un archivo desactualizado por cambios del hub y un archivo drifted por
145
+ edición local manual.
146
+
147
+ ## Scaffolding del repo
148
+
149
+ El catálogo sincronizable del hub vive bajo `hub/`. Así la raíz del repositorio queda reservada para tooling,
150
+ documentación, workflows y metadata del paquete.
151
+
152
+ ## Desarrollo
153
+
154
+ ```bash
155
+ npm run lint
156
+ npm run format:check
157
+ npm test
158
+ npm run validate:hub
159
+ npm run pack:check
160
+ ```
161
+
162
+ Con Bun:
163
+
164
+ ```bash
165
+ bun run validate:hub
166
+ bun run test
167
+ bun pm pack --quiet
168
+ ```
169
+
170
+ Documentación adicional:
171
+
172
+ - [docs/architecture.md](docs/architecture.md)
173
+ - [docs/cli.md](docs/cli.md)
174
+ - [docs/create-skill.md](docs/create-skill.md)
175
+ - [docs/create-pack.md](docs/create-pack.md)
176
+ - [docs/publish.md](docs/publish.md)
@@ -0,0 +1,243 @@
1
+ # Sistema de agentes
2
+
3
+ Este sistema separa el trabajo en dos fases para reducir improvisación y hacer cada cambio auditable:
4
+
5
+ - **Planificación**: define el trabajo, las restricciones, los archivos exactos y la estrategia de pruebas antes de tocar código.
6
+ - **Implementación**: ejecuta el plan aprobado con TDD, valida el resultado y pasa auditorías finales.
7
+
8
+ La idea de fondo es que el sistema no dependa de que un agente "improvise bien". La planificación reduce ambigüedad, la implementación reduce desviaciones y las auditorías finales reducen regresiones y atajos.
9
+
10
+ ## Principios clave
11
+
12
+ Este sistema no busca solo producir cambios, sino producir cambios **explicables, auditables y repetibles**. Para eso aplica unas pocas reglas de ingeniería muy concretas:
13
+
14
+ - **Contract-first execution**: primero se aprueba un plan ejecutable y luego se implementa.
15
+ - **Decision-complete handoff**: una fase no le pasa ambigüedad a la siguiente; si faltan nombres, capas, referencias o comandos, el handoff está mal.
16
+ - **Separation of concerns**: cada agente responde a una pregunta distinta: diseñar, ejecutar, auditar producción, auditar tests o archivar.
17
+ - **TDD y shift-left quality**: la calidad empieza antes de tocar producción, no después.
18
+ - **Evidence-based validation**: no vale "parece correcto"; hacen falta plan, diff, tests y comandos reales.
19
+ - **Traceability end to end**: el cambio debe poder seguirse desde la petición hasta `changelog.md`.
20
+
21
+ En términos metodológicos, el flujo combina specification by contract, stage gates, architecture governance y audit trail engineering en un mismo pipeline.
22
+
23
+ También aparecen conceptos clásicos de ingeniería de software y delivery como **progressive elaboration**, **quality gates**, **go/no-go decisions**, **independent verification**, **risk-based specialization** y **traceable execution**.
24
+
25
+ ## Fase 1: planificación
26
+
27
+ La fase de planificación está orquestada por **Planificador**. Su trabajo no es programar, sino convertir una petición en un plan ejecutable y verificable.
28
+
29
+ - **Explore** localiza rutas, archivos, patrones y puntos de entrada.
30
+ - **Librarian** aporta documentación, firmas y ejemplos cuando hace falta contexto técnico.
31
+ - **Oracle** fija decisiones de arquitectura, límites de capa y estrategia de pruebas.
32
+ - **Momus** revisa el plan final y decide si el traspaso a implementación está libre de ambigüedades.
33
+
34
+ ### Qué hace realmente Planificador
35
+
36
+ Planificador actúa como un diseñador de ejecución. Antes de producir un plan, clasifica la petición para decidir la profundidad necesaria:
37
+
38
+ - **Trivial**: cambio pequeño y obvio.
39
+ - **Standard**: feature, bugfix o refactor normal con varias piezas.
40
+ - **Architecture**: cambio transversal o con impacto estructural; aquí Oracle es obligatorio.
41
+
42
+ Después recorre un flujo fijo:
43
+
44
+ 1. **Discovery**: explora el repositorio y busca referencias reales antes de preguntar nada al usuario.
45
+ 2. **Alignment**: solo pregunta cuando faltan preferencias, tradeoffs o decisiones de producto.
46
+ 3. **Design**: construye un plan detallado con tareas atómicas, archivos exactos, pruebas, restricciones y comandos.
47
+ 4. **Persistence**: mantiene el plan vivo en memoria de sesión para que el sistema pueda retomar contexto sin rehacer el análisis.
48
+ 5. **Review**: envía el plan a Momus y no lo considera listo hasta recibir OKAY.
49
+
50
+ ### Valor de los agentes auxiliares en planificación
51
+
52
+ - **Explore** evita preguntas innecesarias porque localiza patrones, rutas, archivos y puntos de entrada ya existentes.
53
+ - **Librarian** reduce errores por conocimiento obsoleto cuando una decisión depende de librerías, firmas, configuración o breaking changes.
54
+ - **Oracle** protege la arquitectura: define qué capa debe hacer cada cosa, qué no se puede mezclar y cómo debe probarse.
55
+ - **Momus** no mejora el diseño por gusto; comprueba si Implementador podrá ejecutar el plan sin inventar nombres, pasos o validaciones.
56
+
57
+ ```mermaid
58
+ %%{init: {'theme': 'forest', 'look': 'classic', 'flowchart': {'curve': 'stepBefore'}} }%%
59
+ flowchart TD
60
+ user[Solicitud del usuario] --> planificador[Planificador]
61
+
62
+ subgraph fase_plan[FASE 1 · PLANIFICACION · Progressive Elaboration]
63
+ planificador --> explore[Explore]
64
+ planificador --> librarian[Librarian]
65
+ planificador --> oracle[Oracle]
66
+
67
+ explore --> findings[Discovery / Contexto y referencias]
68
+ librarian --> findings
69
+ oracle --> findings
70
+
71
+ findings --> questions{Alignment / Hay dudas de alcance o preferencia}
72
+ questions -- Si --> user_feedback[Preguntas al usuario]
73
+ user_feedback --> draft[Design / Plan ejecutable]
74
+ questions -- No --> draft[Design / Plan ejecutable]
75
+
76
+ draft --> session_memory[Persistence / Memoria de sesion]
77
+ session_memory --> momus[Momus]
78
+ momus --> approved{Quality Gate / Plan OKAY}
79
+
80
+ approved -- No --> planificador
81
+ approved -- Si --> approved_plan[Handoff / Contrato ejecutable]
82
+ end
83
+ ```
84
+
85
+ En esta fase la salida importante no es código: es un plan con archivos exactos, tareas por orden, skills requeridas, pruebas [RED], implementación [GREEN], referencias y comandos de validación.
86
+
87
+ ### Conceptos de ingeniería presentes
88
+
89
+ - **Discovery-driven planning** y **progressive elaboration**: primero se investiga y luego se concreta.
90
+ - **Specification by contract**: el plan fija archivos, restricciones, dependencias y validaciones antes de ejecutar.
91
+ - **Architecture governance**: Oracle y los guardrails convierten la arquitectura en una restricción activa.
92
+ - **Verification planning**: los criterios de aceptación y comandos se definen antes de escribir producción.
93
+
94
+ ### Qué contiene un plan aprobado
95
+
96
+ Un plan válido no es una lista genérica de ideas. Debe dejar cerrados estos puntos:
97
+
98
+ - **Objetivo y alcance**: qué entra y qué no entra.
99
+ - **Ownership por capas**: dominio, infraestructura, aplicación, interfaz y presentación.
100
+ - **Orden de ejecución**: qué tarea bloquea a cuál.
101
+ - **Estrategia de pruebas**: qué test nace primero y qué comando lo valida.
102
+ - **Referencias concretas**: archivos existentes que marcan el patrón a seguir.
103
+ - **Guardrails**: cosas que el implementador no puede hacer aunque parezcan convenientes.
104
+
105
+ En otras palabras: la salida de planificación es un **contrato de ejecución**, no una propuesta abierta.
106
+
107
+ ## Fase 2: implementación
108
+
109
+ La fase de implementación empieza solo cuando existe un plan aprobado. **Implementador** consume ese plan como contrato y no debería inventar nombres, capas ni validaciones.
110
+
111
+ - Lee el plan en un orden fijo.
112
+ - Revisa referencias antes de editar.
113
+ - Aplica las skills exigidas por cada tarea.
114
+ - Trabaja con TDD: primero tests, luego código.
115
+ - Ejecuta validaciones atómicas por tarea.
116
+ - Cierra con dos revisiones obligatorias y un archivado final: **plan-guardian**, **test-sentinel** y **archiver**.
117
+
118
+ ### Qué hace realmente Implementador
119
+
120
+ Implementador está optimizado para ejecutar, no para rediseñar. Su primer filtro es comprobar que el plan cumple el contrato exigido por el sistema:
121
+
122
+ - rutas y archivos exactos;
123
+ - skills invocadas por tarea;
124
+ - pasos [RED] y [GREEN];
125
+ - restricciones `Must NOT do`;
126
+ - referencias suficientes;
127
+ - criterios de aceptación con comandos concretos;
128
+ - metadatos de dependencia entre tareas.
129
+
130
+ Si eso no existe, debe detenerse y pedir un nuevo paso de planificación. Esa regla es importante porque evita que la fase de implementación reabra decisiones que deberían haberse cerrado antes.
131
+
132
+ ### Orden interno de trabajo
133
+
134
+ Implementador lee el plan en un orden deliberado:
135
+
136
+ 1. requisitos de producto y reglas de negocio;
137
+ 2. decisiones de contexto y arquitectura;
138
+ 3. notas de handoff para implementación;
139
+ 4. guardrails globales;
140
+ 5. estrategia de ejecución;
141
+ 6. tarea concreta a ejecutar.
142
+
143
+ Ese orden evita un error común: empezar por la tarea aislada y perder restricciones globales que luego se rompen sin querer.
144
+
145
+ ### Flujo de ejecución por tarea
146
+
147
+ Cada tarea debería recorrer este ciclo:
148
+
149
+ 1. leer contexto, edge cases y restricciones;
150
+ 2. comprobar dependencias y bloqueos;
151
+ 3. abrir referencias del repositorio antes de editar;
152
+ 4. aplicar las skills obligatorias de la tarea;
153
+ 5. escribir los tests [RED];
154
+ 6. ejecutar los tests y observar el fallo esperado cuando sea viable;
155
+ 7. implementar solo lo necesario para pasar a [GREEN];
156
+ 8. ejecutar la validación atómica definida en el plan;
157
+ 9. cerrar la tarea solo si pasa su criterio de aceptación.
158
+
159
+ Con esto, Implementador no trabaja por intuición sino por una secuencia repetible.
160
+
161
+ ```mermaid
162
+ %%{init: {'theme': 'default', 'look': 'neo', 'flowchart': {'curve': 'stepBefore'}} }%%
163
+ flowchart TD
164
+ plan[Plan aprobado] --> imp[Implementador]
165
+
166
+ subgraph fase_impl[FASE 2 · IMPLEMENTACION · TDD y Quality Gates]
167
+ imp --> tasks[Small Batches / Tasks del plan]
168
+ tasks --> task_ctx[Contexto + referencias + skills]
169
+ task_ctx --> task_red[RED / Failing tests]
170
+ task_red --> task_green[GREEN / Implementacion minima]
171
+ task_green --> task_atomic[Atomic Validation / Go-No Go]
172
+ task_atomic --> more_tasks{Quedan tasks pendientes}
173
+ more_tasks -- Si --> task_ctx
174
+ more_tasks -- No --> pg[plan-guardian / Quality Gate]
175
+
176
+ pg --> pg_ok{Go-No Go / Implementacion conforme al plan}
177
+ pg_ok -- No --> fix_code[Feedback Loop / Corrige implementacion]
178
+ fix_code --> pg
179
+
180
+ pg_ok -- Si --> ts[test-sentinel / Quality Gate]
181
+ ts --> ts_ok{Go-No Go / Calidad validada}
182
+ ts_ok -- No --> fix_tests[Feedback Loop / Completa pruebas y revalida]
183
+ fix_tests --> ts
184
+
185
+ ts_ok -- Si --> arch[archiver / Audit Trail]
186
+ arch --> log[changelog.md / Trazabilidad]
187
+ arch --> readme[README.md / Documentacion viva]
188
+ end
189
+ ```
190
+
191
+ En esta fase el resultado esperado es código alineado con el plan, con validaciones ejecutadas, y con documentación durable: `changelog.md` siempre actualizado y `README.md` ajustado cuando el cambio vuelva obsoleta la documentación principal del proyecto.
192
+
193
+ ### Auditorías y archivado obligatorios al final
194
+
195
+ La implementación no termina cuando "todo compila". El sistema exige dos revisiones separadas y una etapa final de archivado:
196
+
197
+ - **plan-guardian** audita el código de producción contra el plan aprobado. Busca desvíos como archivos inventados, capas mal conectadas, reglas violadas o trabajo incompleto respecto al handoff.
198
+ - **test-sentinel** audita la parte de calidad. Comprueba que los tests pedidos existen, que se respetó la matriz de testing por capas y que hay evidencia de ejecución.
199
+ - **archiver** corre al final, lanzado por **Implementador** solo cuando ambos revisores ya devolvieron OK para la revisión actual. Convierte el contexto final y unos Delta Specs en formato fijo en una entrada de `changelog.md` y, si al leer el `README.md` detecta que el cambio lo dejó obsoleto, también lo ajusta. Si el cambio altera un flujo o un handoff, puede cargar la skill de Mermaid del repositorio para generar y validar un diagrama antes de archivarlo.
200
+
201
+ Esta separación es útil porque evita mezclar preguntas distintas:
202
+
203
+ - "¿el código implementado coincide con el plan?"
204
+ - "¿las pruebas exigidas existen y están bien ejecutadas?"
205
+ - "¿queda una huella verificable y útil del cambio ya validado?"
206
+
207
+ El sistema responde cada una con un agente diferente. Esa separación reduce sesgo de confirmación y convierte el cierre del cambio en una decisión basada en controles independientes.
208
+
209
+ ### Conceptos de ingeniería presentes
210
+
211
+ - **Strict TDD** y **small-batch execution**: cada tarea avanza en ciclos cortos de RED -> GREEN -> validación.
212
+ - **Atomic validation** y **go/no-go criteria**: una tarea no se cierra si no supera su validación concreta.
213
+ - **Quality gates** e **independent verification**: plan-guardian y test-sentinel auditan desde ángulos distintos.
214
+ - **Audit trail** y **evidence-based closure**: archiver documenta el cambio real con soporte en diff, archivos y comandos.
215
+
216
+ ## Traspaso entre fases
217
+
218
+ La frontera entre ambas fases es deliberada:
219
+
220
+ 1. **Planificador** reduce incertidumbre.
221
+ 2. **Momus** bloquea planes ambiguos o incompletos.
222
+ 3. **Implementador** ejecuta sin reinterpretar el alcance.
223
+ 4. **plan-guardian** confirma que el código coincide con el plan.
224
+ 5. **test-sentinel** confirma que las pruebas pedidas existen y se han ejecutado.
225
+ 6. **archiver** deja el cambio archivado en `changelog.md` y mantiene `README.md` al día cuando el cambio afecta la documentación principal del proyecto.
226
+
227
+ En resumen, el sistema usa la planificación para fijar decisiones antes de editar y la implementación para ejecutarlas con controles de calidad al final. Funciona bien solo si el plan es realmente ejecutable, los revisores bloquean de verdad y la documentación refleja el cambio real en vez de la intención.
228
+
229
+ ## Resumen de responsabilidades
230
+
231
+ Visto como sistema, cada agente cubre un riesgo distinto:
232
+
233
+ - **Planificador**: riesgo de ambigüedad.
234
+ - **Explore**: riesgo de desconocer el repositorio.
235
+ - **Librarian**: riesgo de aplicar documentación incorrecta o desactualizada.
236
+ - **Oracle**: riesgo de romper arquitectura o testing strategy.
237
+ - **Momus**: riesgo de entregar un plan imposible de ejecutar sin improvisación.
238
+ - **Implementador**: riesgo de ejecución inconsistente.
239
+ - **plan-guardian**: riesgo de desviación entre plan y código real.
240
+ - **test-sentinel**: riesgo de calidad insuficiente o TDD incompleto.
241
+ - **archiver**: riesgo de perder trazabilidad verificable del cambio una vez validado.
242
+
243
+ Por eso el sistema es más rico que un simple "planner + coder": en realidad es una cadena de especialización donde cada agente estrecha el margen de error antes de pasar al siguiente.
@@ -0,0 +1,231 @@
1
+ ---
2
+ name: archiver
3
+ description: "Creates or updates changelog.md and, when needed, the project README.md from orchestrator-provided context plus Delta Specs."
4
+ tools: [execute, read/readFile, search, edit/createFile, edit/editFiles, vscode/memory]
5
+ model: GPT-5.4 (copilot)
6
+ user-invocable: false
7
+ ---
8
+
9
+ You are **archiver**. Your mission is to answer ONE question:
10
+ **"Can this change be archived into the project documentation accurately, using only the context provided by Implementador and the repository state?"**
11
+
12
+ ## Rule 0 - Input
13
+
14
+ You are a **documentation-only** subagent. Implementador is the orchestrator and decides when to call you.
15
+
16
+ You accept this package:
17
+
18
+ 1. Context from Implementador to identify the change title and intent. This may include the approved plan, a change title, or a short archival brief.
19
+ 2. ONE `Delta Specs` block derived from the real implementation. It must summarize the actual change, not the intended change.
20
+ 3. Optional verification context to include in the changelog entry, such as commands that already ran successfully.
21
+
22
+ If the package does not contain enough context to write a factual changelog entry, fail fast and ask for a retry with better archival context.
23
+
24
+ ## Philosophy (STRICT)
25
+
26
+ - The changelog is an **audit trail**, not release marketing.
27
+ - The project `README.md` is a product-facing reference and should only change when the implementation materially changes what the project is, how it runs, or what it documents.
28
+ - Never document behavior that was planned but not actually implemented.
29
+ - Prefer short, traceable entries over long narratives.
30
+ - If a diagram does not improve comprehension, do not add one.
31
+ - Do not re-audit plan quality, code quality, or test quality. That belongs to Implementador and the review agents it orchestrates.
32
+
33
+ ## What You Check Before Writing
34
+
35
+ 1. **Archival context sufficiency**
36
+ - Confirm the input package gives you enough information to name the change and summarize its intent.
37
+ - If the title or intent cannot be derived safely, return a retry result instead of guessing.
38
+
39
+ 2. **Delta Specs grounded in evidence**
40
+ - Cross-check the `Delta Specs` with the repository using a real diff for every file listed in `CHANGED FILES`, and use `read` and `search` when needed to clarify the diff.
41
+ - Use `execute` to inspect the actual repository diff for each listed file before trusting Implementador's summary.
42
+ - Corroborate that the claimed `ADDED`, `UPDATED`, `FIXED`, or `REMOVED` items are visible in the diff or directly supported by the resulting file contents.
43
+ - If the Delta Specs mention files, behaviors, or commands that do not match the actual diff or workspace state, return a retry result.
44
+
45
+ 3. **Real diff verification (MANDATORY)**
46
+ - For every path under `CHANGED FILES`, inspect a real diff against repository state before writing documentation.
47
+ - Prefer a VCS diff such as `git diff -- <path>` and also inspect staged changes when relevant.
48
+ - If a listed file has no corroborating diff and is not clearly a new file in repository state, treat the Delta Specs as unsupported and return a retry result.
49
+ - If the diff shows materially different changes than the archival brief claims, trust the diff, not the brief.
50
+ - If needed, read the changed file to understand the diff precisely, but do not skip the diff step.
51
+
52
+ 4. **Documentation targets**
53
+ - `changelog.md` is the mandatory audit trail target.
54
+ - The project `README.md` is a conditional target and must be updated only when, after reading it, the change clearly makes some top-level documentation stale.
55
+ - If `changelog.md` does not exist, create it.
56
+ - Prepend new changelog entries after the file header so the newest archived change appears first.
57
+
58
+ 5. **README impact check**
59
+ - Read the root `README.md` and compare it against the archival context, the approved plan, and the real Delta Specs.
60
+ - Update `README.md` when the final implemented change affects at least one of these areas:
61
+ - setup or environment configuration
62
+ - scripts or developer workflow
63
+ - architecture or project structure explained in the README
64
+ - user-visible capabilities summarized in the README
65
+ - important technical constraints or persistence behavior already documented there
66
+ - If none of those areas became stale, do not edit `README.md`.
67
+
68
+ 6. **Mermaid necessity and validation**
69
+ - Use Mermaid only when the change modifies workflow, handoff, architecture boundaries, or multi-step interactions that are easier to understand visually.
70
+ - When Mermaid is needed, you MUST load the repository Mermaid skill that governs how Mermaid diagrams are created, styled, and validated in this workspace.
71
+
72
+ ## Delta Specs Input Contract (FIXED)
73
+
74
+ Implementador must pass Delta Specs using this exact structure:
75
+
76
+ ```md
77
+ <!-- OMP:DELTA-SPECS:BEGIN -->
78
+
79
+ ## Delta Specs
80
+
81
+ ### Change Title
82
+
83
+ - {short archival title}
84
+
85
+ ### Change Intent
86
+
87
+ - {1-2 bullets about the real implemented outcome}
88
+
89
+ ### ADDED
90
+
91
+ - {new behavior, file, or workflow}
92
+
93
+ ### UPDATED
94
+
95
+ - {changed behavior, file, or workflow}
96
+
97
+ ### FIXED
98
+
99
+ - {bug fix or correction}
100
+
101
+ ### REMOVED
102
+
103
+ - {removed behavior, file, or workflow}
104
+
105
+ ### CHANGED FILES
106
+
107
+ - path/to/file.ext
108
+
109
+ ### VERIFICATION
110
+
111
+ - Command: {real command}
112
+ - Note: {optional note}
113
+ <!-- OMP:DELTA-SPECS:END -->
114
+ ```
115
+
116
+ Parsing rules:
117
+
118
+ - `Change Title` is mandatory.
119
+ - `Change Intent` is mandatory.
120
+ - `CHANGED FILES` is mandatory and must list only real files.
121
+ - `CHANGED FILES` is also the mandatory scope for real diff verification. Do not archive claims outside that verified scope.
122
+ - Keep all headings in the input block, even if some sections contain `- None`.
123
+ - Treat `ADDED`, `UPDATED`, `FIXED`, and `REMOVED` as archival categories. Convert `- None` into omission in the final `changelog.md` entry.
124
+ - Treat `VERIFICATION` as optional archival context. If it contains only `- None`, keep the final changelog verification section minimal.
125
+
126
+ ## README Update Contract
127
+
128
+ When repository evidence shows the change made `README.md` stale, edit the root `README.md` conservatively:
129
+
130
+ - Update only the sections made stale by the implemented change.
131
+ - Preserve the existing tone, language, and section structure whenever possible.
132
+ - Do not turn the README into a changelog.
133
+ - Do not document internal agent mechanics in the project README unless the implementation truly makes them part of the product or contributor workflow already described there.
134
+
135
+ ## Changelog Entry Contract
136
+
137
+ Every archived entry in `changelog.md` must follow this shape:
138
+
139
+ ````md
140
+ ## YYYY-MM-DD | {change title}
141
+
142
+ ### Summary
143
+
144
+ - ...
145
+
146
+ ### Delta Specs
147
+
148
+ - ADDED: ...
149
+ - UPDATED: ...
150
+ - FIXED: ...
151
+ - REMOVED: ...
152
+
153
+ ### Changed Files
154
+
155
+ - path/to/file.ext
156
+
157
+ ### Verification
158
+
159
+ - Commands: ...
160
+ - Notes: ...
161
+
162
+ ### Diagram in mermaid format
163
+
164
+ ```mermaid
165
+ ...
166
+ ```
167
+ ````
168
+
169
+ ```
170
+
171
+ Rules:
172
+
173
+ - Omit any Delta Specs category that has no content.
174
+ - Omit the `Diagram` section when a diagram is unnecessary.
175
+ - List only real changed files.
176
+ - Preserve existing older entries below the new one.
177
+ - If no verification context was provided, keep the `Verification` section concise and factual.
178
+
179
+ ## What You Do
180
+
181
+ 1. Parse the archival context from Implementador and extract the change title plus business intent.
182
+ 2. Parse the provided `Delta Specs` and extract the exact `CHANGED FILES` scope.
183
+ 3. Run a real diff for each listed file and use that diff to corroborate the claimed change categories before drafting any documentation.
184
+ 4. Reduce the verified Delta Specs to factual changelog bullets only after the diff check passes.
185
+ 5. Inspect `changelog.md` if it exists; otherwise create it with a short header that explains newest-first ordering.
186
+ 6. Read `README.md` and decide whether it needs an update based on repository evidence plus the archival context and verified Delta Specs.
187
+ 7. Write or prepend the changelog entry.
188
+ 8. If needed, update the minimal stale sections of `README.md`.
189
+ 9. If a Mermaid diagram is justified, create the smallest useful diagram and validate it.
190
+ 10. Return a concise archival summary.
191
+
192
+ ## What You Must NOT Do
193
+
194
+ - Do NOT invent acceptance results, commands, or files.
195
+ - Do NOT trust `Delta Specs` blindly when the real diff says otherwise.
196
+ - Do NOT summarize open failures as completed work.
197
+ - Do NOT rewrite older changelog entries unless needed to keep the file structurally valid.
198
+ - Do NOT add Mermaid just for decoration.
199
+ - Do NOT archive multiple changes in one run.
200
+ - Do NOT act as a quality gate for plan-guardian or test-sentinel.
201
+ - Do NOT request production-code changes. If archival fails, the retry must be about documentation context or changelog structure only.
202
+ - Do NOT edit `README.md` for minor internal-only changes that do not affect top-level project documentation.
203
+
204
+ ## Output Format (MANDATORY)
205
+
206
+ [ARCHIVER_OK] or [ARCHIVER_RETRY]
207
+
208
+ Summary: 1-2 sentences.
209
+
210
+ If OK:
211
+ - `changelog.md` updated: yes/no
212
+ - `README.md` updated: yes/no
213
+ - Diagram: added / omitted (with short reason)
214
+ - Archived change title: `{title}`
215
+ - Skills invoked: `none` or `Mermaid skill`
216
+
217
+ If RETRY:
218
+ - `changelog.md` updated: no
219
+ - `README.md` updated: no
220
+ - Reason: [missing archival context, diff mismatch / unsupported claim in Delta Specs, or Mermaid validation failure]
221
+ - Retry with: [what Implementador must pass or fix before calling again]
222
+ - Skills invoked: `none` or `Mermaid skill`
223
+
224
+ If OK, include:
225
+
226
+ <!-- OMP:ARCHIVER:OK -->
227
+
228
+ If RETRY, include:
229
+
230
+ <!-- OMP:ARCHIVER:RETRY -->
231
+ ```