gemstack-ai 1.0.1 → 1.1.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/.agents/rules/01-gemstack-core.md +15 -0
- package/.agents/rules/02-gemstack-constitution.md +12 -1
- package/.agents/skills/gemstack-handoff/SKILL.md +2 -1
- package/.agents/skills/gemstack-plan/SKILL.md +2 -1
- package/.agents/skills/gemstack-review/SKILL.md +7 -5
- package/.agents/skills/gemstack-ship/SKILL.md +5 -0
- package/.agents/skills/gemstack-spec/SKILL.md +3 -2
- package/.agents/skills/gemstack-tasks/SKILL.md +4 -3
- package/.gemstack/state.json +20 -2
- package/CHANGELOG.md +52 -0
- package/MANUAL.md +4 -4
- package/README.md +36 -8
- package/RELEASE_NOTES.md +105 -0
- package/assets/logo.jpg +0 -0
- package/docs/architecture-consistency.md +144 -0
- package/gemstack-ai-1.1.2.tgz +0 -0
- package/handoff.md +27 -40
- package/package.json +3 -2
- package/scripts/ci/smoke-cli.js +1 -0
- package/specs/006-architecture-consistency-engine/.gemstack.json +9 -0
- package/specs/006-architecture-consistency-engine/plan.md +319 -0
- package/specs/006-architecture-consistency-engine/spec.md +179 -0
- package/specs/006-architecture-consistency-engine/tasks.md +532 -0
- package/specs/templates/plan.md +11 -0
- package/specs/templates/spec.md +17 -0
- package/specs/templates/tasks.md +1 -0
- package/src/cli.js +9 -4
- package/src/commands/verify.js +311 -0
- package/src/lib/contracts.js +388 -0
- package/src/lib/findings.js +227 -0
- package/src/lib/hasher.js +103 -0
- package/src/lib/state.js +143 -0
- package/src/mcp-server.js +1 -1
- package/template/.agents/rules/01-gemstack-core.md +15 -0
- package/template/.agents/rules/02-gemstack-constitution.md +12 -1
- package/template/.agents/skills/gemstack-handoff/SKILL.md +2 -1
- package/template/.agents/skills/gemstack-plan/SKILL.md +2 -1
- package/template/.agents/skills/gemstack-review/SKILL.md +7 -5
- package/template/.agents/skills/gemstack-ship/SKILL.md +5 -0
- package/template/.agents/skills/gemstack-spec/SKILL.md +3 -2
- package/template/.agents/skills/gemstack-tasks/SKILL.md +4 -3
- package/template/docs/architecture-consistency.md +144 -0
- package/template/specs/templates/plan.md +11 -0
- package/template/specs/templates/spec.md +17 -0
- package/template/specs/templates/tasks.md +1 -0
- package/gemstack-ai-1.0.1.tgz +0 -0
|
@@ -13,6 +13,7 @@ Eres Antigravity operando bajo el framework **Gemstack**, una metodología local
|
|
|
13
13
|
2. **Aprobación para Deploy/Push:** Nunca hagas `git push`, merge o deploy sin aprobación explícita.
|
|
14
14
|
3. **Handoff Inmutable:** NUNCA borres la sección "Intentos fallidos" de `handoff.md`. Si crece demasiado, mueve de forma segura el contenido antiguo a `handoff_archive.md`.
|
|
15
15
|
4. **Dependencias y Auth:** Cambios a la arquitectura de autenticación, migraciones de base de datos o instalación de dependencias globales requieren generación de plan técnico y aprobación humana.
|
|
16
|
+
5. **Consistencia de Arquitectura y Congelamiento de Fases (Upgrade A):** Las decisiones arquitectónicas congeladas en `gemstack-contracts` no pueden ser contradichas silenciosamente por fases posteriores. Toda enmienda requiere aprobación humana explícita.
|
|
16
17
|
|
|
17
18
|
## Pseudo-Comandos (Ruteo Obligatorio)
|
|
18
19
|
Si el usuario empieza su mensaje con uno de estos comandos, **NO improvises. DEBES cargar o seguir el skill correspondiente**:
|
|
@@ -49,3 +50,17 @@ Si el usuario empieza su mensaje con uno de estos comandos, **NO improvises. DEB
|
|
|
49
50
|
- `/guard` -> Invoca `gemstack-guard`
|
|
50
51
|
- `/unfreeze` -> Invoca `gemstack-guard`
|
|
51
52
|
|
|
53
|
+
## Ruteo Semántico por Intención (Intent-Based Routing)
|
|
54
|
+
Si el usuario interactúa en lenguaje natural sin usar un `/comando` explícito, DEBES detectar la intención subyacente y activar el protocolo correspondiente:
|
|
55
|
+
1. **Nueva funcionalidad o módulo mayor sin spec activa:**
|
|
56
|
+
- Si pide crear o agregar una feature sustancial (ej. "pon una parte para editar paquetes", "vamos a agregar cobro bimoneda"), **NO saltes directo al código**. Activa `gemstack-spec` para definir requisitos y criterios de éxito antes de implementar.
|
|
57
|
+
2. **Solicitud de pruebas o validación:**
|
|
58
|
+
- Si el usuario dice "haz pruebas", "valida lo hecho", "comprueba que funcione" o "verifica los cambios", activa `gemstack-qa`.
|
|
59
|
+
3. **Reporte de error o bug:**
|
|
60
|
+
- Si el usuario reporta que algo falló o no funciona como se esperaba, activa `gemstack-investigate` (principio: *No fixes before investigation*).
|
|
61
|
+
4. **Cierre o pausa de sesión:**
|
|
62
|
+
- Si el usuario indica "terminamos por hoy", "voy a pausar", "dejo esto listo" o "prepara el resumen", activa `gemstack-handoff`.
|
|
63
|
+
5. **Auditoría de seguridad:**
|
|
64
|
+
- Si pide revisar seguridad, permisos, tokens o vulnerabilidades, activa `gemstack-cso`.
|
|
65
|
+
6. **Entrega o preparación de release:**
|
|
66
|
+
- Si pide preparar el merge, PR o entrega formal de la feature terminada, activa `gemstack-ship`.
|
|
@@ -14,11 +14,16 @@ Toda nueva funcionalidad DEBE nacer y estar estructurada preferentemente como un
|
|
|
14
14
|
## Article II: CLI / Interface Mandate
|
|
15
15
|
Cada módulo o librería clave debe tener una forma de probarse e interactuar textualmente (CLI, scripts independientes, peticiones directas de texto o JSON). Evita componentes opacos que solo puedan probarse levantando interfaces gráficas complejas.
|
|
16
16
|
|
|
17
|
-
## Article III: Test-First Imperative (NON-NEGOTIABLE)
|
|
17
|
+
## Article III: Test-First Imperative & Zero Silent Failures (NON-NEGOTIABLE)
|
|
18
18
|
NUNCA escribas el código de implementación antes que los tests (TDD).
|
|
19
19
|
1. Escribe los tests (unitarios, de integración o contratos) basándote en la especificación.
|
|
20
20
|
2. Si es posible, demuestra que fallan.
|
|
21
21
|
3. Solo entonces, escribe la implementación real.
|
|
22
|
+
4. **Zero Silent Failures (Multiplataforma Windows / Linux / macOS):**
|
|
23
|
+
- PROHIBIDO el uso de operadores de supresión de shell que enmascaren fallos en scripts de `test` de `package.json` (ej. `2>nul`, `2>/dev/null || true`).
|
|
24
|
+
- El script de test DEBE terminar con exit code distinto de cero si ocurre cualquier falla.
|
|
25
|
+
- En monorepos TypeScript, usa runners multiplataforma estandarizados (ej. `tsx --test src/**/*.test.ts tests/**/*.test.ts`, `node --test`, `vitest` o `jest`).
|
|
26
|
+
- El test runner debe validar que la suite ejecutó efectivamente pruebas (`tests > 0`). Un reporte de 0 tests ejecutados finalizando con exit code 0 es considerado un falso positivo inaceptable.
|
|
22
27
|
|
|
23
28
|
## Article IV: Zero Assumptions (No Hallucinations)
|
|
24
29
|
Si un requerimiento del humano es vago, la IA NO debe adivinar.
|
|
@@ -42,3 +47,9 @@ Usa las funciones del framework y librerías estándar nativamente en lugar de c
|
|
|
42
47
|
|
|
43
48
|
## Article IX: Integration-First Testing
|
|
44
49
|
Prioriza el testing realista. Si puedes probar el contrato real o la base de datos local real (con un entorno temporal) por encima de mocks complejos, hazlo. El código generado debe funcionar en la práctica.
|
|
50
|
+
|
|
51
|
+
## Article X: Architecture Consistency & Immutability Gate (Upgrade A)
|
|
52
|
+
Las decisiones arquitectónicas congeladas no pueden ser contradichas silenciosamente por fases posteriores.
|
|
53
|
+
- Antes de avanzar de fase, el hash del artefacto aguas arriba debe ser válido, los contratos compatibles y la cantidad de bloqueadores deterministas abiertos debe ser exactamente 0.
|
|
54
|
+
- Los artefactos de fases aprobadas quedan sellados criptográficamente (SHA-256) y no pueden mutar sin enmienda explícita aprobada por humanos.
|
|
55
|
+
- Proyectos preexistentes sin bloques de contratos operan en modo LEGACY transparente sin fallas.
|
|
@@ -17,5 +17,6 @@ Esta habilidad se ejecuta cuando el usuario pide terminar la sesión, invoca `/h
|
|
|
17
17
|
5. **ARCHIVADO SEGURO:** Si "Intentos fallidos" en `handoff.md` tiene demasiados puntos (más de 10-15), CORTA los elementos más antiguos y pégalos en `handoff_archive.md` bajo su lista, conservando solo los 3-5 intentos recientes en `handoff.md`.
|
|
18
18
|
6. Define los "5. Próximos pasos" exactos para la próxima sesión.
|
|
19
19
|
7. Guarda los cambios en `handoff.md` (y `handoff_archive.md` si fue necesario).
|
|
20
|
-
8.
|
|
20
|
+
8. **Sincronización de Estado:** Verifica `.gemstack/state.json` asegurando que `current_phase` refleje con precisión si hay una spec activa o en espera, y actualiza `last_update` con la marca temporal actual.
|
|
21
|
+
9. Despídete del usuario indicando que el handoff está listo.
|
|
21
22
|
|
|
@@ -16,5 +16,6 @@ Invocado mediante `/plan`.
|
|
|
16
16
|
4. Genera `specs/[nombre-feature]/plan.md` usando `specs/templates/plan.md`.
|
|
17
17
|
5. Detalla el stack y llena la tabla "Complexity Tracking" SÓLO si rompiste alguna regla de la constitución y necesitas justificarlo.
|
|
18
18
|
6. Opcionalmente, genera los entregables satélites: `data-model.md`, `contracts/` (para APIs/Interfaces), y `quickstart.md`.
|
|
19
|
-
7.
|
|
19
|
+
7. **Herencia y Contratos Aditivos (Upgrade A)**: PLAN hereda automáticamente los contratos declarados en `spec.md`. No contradigas ni alteres los contratos congelados heredados; si requieres contratos técnicos adicionales, decláralos de forma compatible y aditiva en el bloque ````gemstack-contracts ```` de `plan.md`.
|
|
20
|
+
8. Pide aprobación al usuario antes de permitir la ejecución de `/tasks`.
|
|
20
21
|
|
|
@@ -11,8 +11,10 @@ Invocado mediante `/review`.
|
|
|
11
11
|
|
|
12
12
|
## Proceso:
|
|
13
13
|
1. Analiza el código modificado (git diff, o archivos editados).
|
|
14
|
-
2.
|
|
15
|
-
3.
|
|
16
|
-
4. Verifica que
|
|
17
|
-
5.
|
|
18
|
-
6.
|
|
14
|
+
2. **Validación Determinista Primero (Upgrade A)**: Ejecuta `node src/cli.js verify` o comprueba contratos congelados, hashes de fase y bloqueadores antes de proceder a la revisión semántica.
|
|
15
|
+
3. Proporciona al revisor la lista de contratos efectivos, hashes de fase y hallazgos deterministas para no forzarlo a redescubrir desviaciones mecánicas.
|
|
16
|
+
4. Verifica que las convenciones arquitectónicas del proyecto se respeten.
|
|
17
|
+
5. VERIFICACIÓN DE SEGURIDAD: Revisa obligatoriamente `.agents/rules/03-gemstack-security.md` para garantizar que el código propuesto no introduzca brechas de seguridad (IDOR, XSS, tokens expuestos).
|
|
18
|
+
6. Verifica que los tests cubran adecuadamente los cambios.
|
|
19
|
+
7. Emite sugerencias o aplica correcciones automáticas si son triviales.
|
|
20
|
+
8. Si el código está listo, sugiere `/qa` o `/ship`.
|
|
@@ -16,4 +16,9 @@ Invocado mediante `/ship`.
|
|
|
16
16
|
4. Genera un PR summary si se pide.
|
|
17
17
|
5. NO hagas push, merge o deploy sin aprobación explícita.
|
|
18
18
|
6. Sugiere ejecutar `/handoff` para documentar la entrega en la memoria del proyecto.
|
|
19
|
+
7. **Sincronización de Estado:** Actualiza `.gemstack/state.json`:
|
|
20
|
+
- Establece `"active_spec": null`
|
|
21
|
+
- Registra `"last_completed_feature": "specs/[nombre-feature]/"`
|
|
22
|
+
- Establece `"current_phase": "shipped"`
|
|
23
|
+
- Actualiza `"last_update"` con el timestamp ISO actual.
|
|
19
24
|
|
|
@@ -19,6 +19,7 @@ Eres un Product Manager técnico. Tu objetivo es convertir ideas vagas en requis
|
|
|
19
19
|
4. El documento DEBE incluir: Historias de usuario priorizadas (P1, P2) que sean independientemente testeables, Criterios de Éxito medibles, y Casos Extremos.
|
|
20
20
|
5. **CERO SUPOSICIONES**: Si el usuario omitió detalles, NO adivines. Usa el marcador `[NEEDS CLARIFICATION: tu duda]` en el documento.
|
|
21
21
|
6. No describas implementación técnica (nada de stacks, bases de datos o APIs). Concéntrate estrictamente en el "Qué" y "Por qué".
|
|
22
|
-
7.
|
|
23
|
-
8.
|
|
22
|
+
7. **Contratos Arquitectónicos Congelados (Upgrade A)**: Si la funcionalidad implica decisiones estructurales críticas (estados enum, tuplas de identidad, reglas de procedencia, invariantes booleanas, límites de roadmap o límites boundary), decláralos explícitamente en el bloque canónico ````gemstack-contracts ````. Congela solo decisiones materiales, no texto arbitrario.
|
|
23
|
+
8. Actualiza el archivo `.gemstack/state.json` para reflejar la rama activa y fase: `{"active_spec": "specs/[nombre-feature]/", "current_phase": "spec", "last_update": "<timestamp>"}`.
|
|
24
|
+
9. Una vez finalizado, indica al usuario que puede revisar la especificación y, tras resolver las dudas, ejecutar `/plan`.
|
|
24
25
|
|
|
@@ -12,7 +12,8 @@ Invocado mediante `/tasks`.
|
|
|
12
12
|
## Proceso:
|
|
13
13
|
1. Lee `specs/[nombre-feature]/plan.md` y, si existen, `data-model.md` y la carpeta `contracts/`.
|
|
14
14
|
2. Convierte los contratos, entidades y el plan en una lista estricta de ejecución en `specs/[nombre-feature]/tasks.md` usando la plantilla `specs/templates/tasks.md`.
|
|
15
|
-
3.
|
|
16
|
-
4.
|
|
17
|
-
5.
|
|
15
|
+
3. **Herencia de Contratos (Upgrade A)**: TASKS hereda automáticamente los contratos consolidados de SPEC y PLAN. No se requiere declarar un bloque de contratos propio salvo que se agreguen contratos operacionales específicos de tareas.
|
|
16
|
+
4. Aplica Test-First: Las tareas de escribir pruebas (y validarlas) deben ir ANTES que la implementación de código.
|
|
17
|
+
5. Usa el marcador `[P]` para tareas independientes que se puedan paralelizar.
|
|
18
|
+
6. Ofrece al usuario comenzar automáticamente con la primera tarea o delegar a subagentes paralelos si hay múltiples `[P]`.
|
|
18
19
|
|
package/.gemstack/state.json
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1",
|
|
3
|
-
"current_phase": "
|
|
3
|
+
"current_phase": "shipped",
|
|
4
|
+
"status": "SHIPPED",
|
|
5
|
+
"stop_reason": "UPGRADE_A_SHIPPED_DONE",
|
|
4
6
|
"active_spec": null,
|
|
7
|
+
"completed_phases": [
|
|
8
|
+
"spec",
|
|
9
|
+
"plan",
|
|
10
|
+
"tasks",
|
|
11
|
+
"implement"
|
|
12
|
+
],
|
|
13
|
+
"phase_hashes": {
|
|
14
|
+
"spec": "f5d423eaf508b06b663b39f467fba1d9ceff6db21f01e427500ad739a90c5be8",
|
|
15
|
+
"plan": "1ce0e58863427905022a6294f8683b9f508d72b171379c78807db19862c75004",
|
|
16
|
+
"tasks": "dfad2484ad112e26ef906ea851b12cf6ea090d6faf244a6fbd2650baee8e0d98"
|
|
17
|
+
},
|
|
18
|
+
"consistency": {
|
|
19
|
+
"status": "PASS",
|
|
20
|
+
"open_blockers": 0
|
|
21
|
+
},
|
|
5
22
|
"guard_mode": {
|
|
6
23
|
"careful": false,
|
|
7
24
|
"freeze": false,
|
|
8
25
|
"allowed_paths": []
|
|
9
26
|
},
|
|
10
|
-
"last_update": "2026-
|
|
27
|
+
"last_update": "2026-09-11T09:01:18.769Z",
|
|
28
|
+
"last_completed_feature": "specs/006-architecture-consistency-engine/"
|
|
11
29
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [v1.1.2] - 2026-09-11
|
|
6
|
+
### Fixed
|
|
7
|
+
- Fixed host-dependent normalization of simulated Windows paths in the Architecture Consistency Engine.
|
|
8
|
+
- Canonical repository-relative locations now use explicit win32/posix path semantics based on input path flavor.
|
|
9
|
+
- Restored TEST-CONSISTENCY-G01 on Linux CI without changing Upgrade A architecture or acceptance semantics.
|
|
10
|
+
|
|
11
|
+
## [v1.1.1] - 2026-09-11
|
|
12
|
+
### Fixed
|
|
13
|
+
- Fixed cross-platform CI test discovery for Node's built-in test runner.
|
|
14
|
+
- Replaced shell-dependent recursive glob invocation with deterministic explicit test-file execution (`node --test tests/contracts.test.js tests/hasher.test.js tests/findings.test.js tests/init.test.js tests/verify.test.js`).
|
|
15
|
+
- No Upgrade A architecture or acceptance semantics changed.
|
|
16
|
+
|
|
17
|
+
## [v1.1.0] - 2026-09-11
|
|
18
|
+
### Added
|
|
19
|
+
- `FrozenContractRegistry`: deterministic architectural contract engine supporting 6 canonical types (`ENUM_SET`, `IDENTITY_TUPLE`, `PROVENANCE_RULE`, `BOOLEAN_INVARIANT`, `BOUNDARY`, `ROADMAP_LIMIT`).
|
|
20
|
+
- Canonical fenced `gemstack-contracts` blocks in phase artifacts (`spec.md`, `plan.md`, `tasks.md`).
|
|
21
|
+
- Cross-phase contract inheritance (`SPEC` -> `PLAN` -> `TASKS`) and deterministic contradiction detection (`FROZEN_CONTRACT_VIOLATION`).
|
|
22
|
+
- Phase artifact SHA-256 freezing and mutation detection (`FROZEN_ARTIFACT_CHANGED`).
|
|
23
|
+
- Canonical 64-character lowercase SHA-256 finding fingerprints with 12-character cosmetic display tokens.
|
|
24
|
+
- Anti-loop finding lifecycle reconciliation (`OPEN`, `RESOLVED`, `ACCEPTED_EXCEPTION`, `SUPERSEDED`).
|
|
25
|
+
- Formal accepted exception suppression bound to deterministic 3-tuple `contextHash`.
|
|
26
|
+
- Per-feature `.gemstack.json` historical metadata sidecar preserving phase hash and finding audit trails.
|
|
27
|
+
- Atomic state and sidecar persistence with temporary file write and atomic rename with bounded retry for cross-platform file locking.
|
|
28
|
+
- Progressive `LEGACY` mode ensuring features without contract blocks continue without friction or errors.
|
|
29
|
+
- Integrated Stage 4/5 Architectural Consistency verification into `gemstack verify` (alias `audit`).
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
- `gemstack verify` upgraded from 4-stage to 5-stage deterministic verification pipeline.
|
|
33
|
+
- Agent skills (`gemstack-spec`, `gemstack-plan`, `gemstack-tasks`, `gemstack-review`) and phase templates updated to generate and validate frozen architectural contracts.
|
|
34
|
+
- Gemstack Constitution strengthened to forbid silent downstream contradictions of frozen contracts.
|
|
35
|
+
|
|
36
|
+
### Compatibility
|
|
37
|
+
- Existing projects without `gemstack-contracts` blocks remain 100% supported through progressive LEGACY mode.
|
|
38
|
+
- No mandatory migration is required.
|
|
39
|
+
- Zero external runtime or development npm dependencies added (`package.json` dependencies remain `{}`).
|
|
40
|
+
|
|
41
|
+
### Validation
|
|
42
|
+
- 17 / 17 Upgrade A implementation tasks complete.
|
|
43
|
+
- 25 / 25 canonical P1 acceptance tests passing (Categories A–H).
|
|
44
|
+
- 33 / 33 physical test cases passing across 5 test suites.
|
|
45
|
+
- `npm test` exit code 0.
|
|
46
|
+
- `gemstack verify` exit code 0 with 0 open blockers.
|
|
47
|
+
- Self-dogfooded on `specs/006-architecture-consistency-engine/` with 5 base contracts passing and 0 contradictions.
|
|
48
|
+
|
|
49
|
+
## [v1.0.2] - 2026-09-03
|
|
50
|
+
### Added
|
|
51
|
+
- Intent-Based Routing in `01-gemstack-core.md`: semantic intent detection for natural language interactions without mandatory slash prefixes.
|
|
52
|
+
- Zero Silent Failures clause in Article III of `02-gemstack-constitution.md`: bans `2>nul` and error-suppressing shell operators in test runners.
|
|
53
|
+
- `gemstack verify` (alias `audit`): full-stack CLI auditor validating structure, memory integrity, state consistency, and security flags.
|
|
54
|
+
- Auto State Sync across `gemstack-spec`, `gemstack-ship`, and `gemstack-handoff` keeping `.gemstack/state.json` synchronized with the active feature lifecycle.
|
|
55
|
+
- Unit tests for verify command in `tests/verify.test.js`.
|
|
56
|
+
|
|
5
57
|
## [v0.3.0] - 2026-08-19
|
|
6
58
|
### Added
|
|
7
59
|
- GitHub Actions CI/CD workflows (`pr-ci.yml`, `main-ci.yml`, `release-readiness.yml`).
|
package/MANUAL.md
CHANGED
|
@@ -20,7 +20,7 @@ Es una herramienta de cero dependencias (funciona en cualquier lenguaje y comput
|
|
|
20
20
|
No necesitas instalar librerías pesadas. En cualquier proyecto (sea nuevo o uno que ya lleve meses de desarrollo), abre tu terminal y ejecuta:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx gemstack init
|
|
23
|
+
npx gemstack-ai init
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
**¿Qué hace esto?**
|
|
@@ -60,7 +60,7 @@ Gemstack viene con funcionalidades avanzadas (Skills) que puedes invocar como co
|
|
|
60
60
|
Dile a la IA: *"Ejecuta `/cso`"*. El Chief Security Officer auditará tu código. Gemstack tiene leyes estrictas implantadas en su núcleo (AppSec Nivel 2 y DevOps). Si tienes una contraseña expuesta, o tu base de datos es vulnerable a un ataque de fuerza bruta, el agente detendrá todo y te obligará a parcharlo.
|
|
61
61
|
|
|
62
62
|
### 🪝 Prevención Activa (Git Hooks)
|
|
63
|
-
Gemstack se asegura de que tú, como humano, tampoco cometas errores. Al hacer `npx gemstack init`, se instala un guardián invisible. Si intentas hacer un `git commit` y por error incluiste una llave de Amazon Web Services (AWS) o un archivo `.env`, Gemstack bloqueará el commit en tu terminal y te regañará.
|
|
63
|
+
Gemstack se asegura de que tú, como humano, tampoco cometas errores. Al hacer `npx gemstack-ai init`, se instala un guardián invisible. Si intentas hacer un `git commit` y por error incluiste una llave de Amazon Web Services (AWS) o un archivo `.env`, Gemstack bloqueará el commit en tu terminal y te regañará.
|
|
64
64
|
|
|
65
65
|
### 📊 Dashboard Interactivo (`/dashboard`)
|
|
66
66
|
¿Perdido en el código? Dile a tu chat de IA (si usas Antigravity):
|
|
@@ -71,11 +71,11 @@ La IA leerá tu lista de tareas y generará una interfaz gráfica incrustada en
|
|
|
71
71
|
### 🔌 Instalación de Skills Externos
|
|
72
72
|
Gemstack es extensible. Si alguien en internet creó un súper agente especialista en Python, puedes descargarlo a tu proyecto directamente desde la terminal:
|
|
73
73
|
```bash
|
|
74
|
-
npx gemstack install https://raw.githubusercontent.com/usuario/repo/main/SKILL.md
|
|
74
|
+
npx gemstack-ai install https://raw.githubusercontent.com/usuario/repo/main/SKILL.md
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### 🤖 Servidor MCP (Para IAs Externas)
|
|
78
|
-
Si usas Claude Desktop u otro cliente que soporte **Model Context Protocol (MCP)**, puedes configurar Gemstack como una de sus herramientas nativas. Simplemente configura el servidor ejecutando en tu cliente: `npx gemstack mcp`. La IA podrá "llamar" a Gemstack directamente por debajo de la mesa para preguntarle cuáles son tus tareas actuales y reglas de seguridad sin que tengas que decirle nada.
|
|
78
|
+
Si usas Claude Desktop u otro cliente que soporte **Model Context Protocol (MCP)**, puedes configurar Gemstack como una de sus herramientas nativas. Simplemente configura el servidor ejecutando en tu cliente: `npx gemstack-ai mcp`. La IA podrá "llamar" a Gemstack directamente por debajo de la mesa para preguntarle cuáles son tus tareas actuales y reglas de seguridad sin que tengas que decirle nada.
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="
|
|
2
|
+
<img src="assets/logo.jpg" alt="Gemstack Logo" width="200" style="border-radius: 20px" />
|
|
3
3
|
<h1>Gemstack</h1>
|
|
4
4
|
<p><b>The Local-First Agentic Framework for Spec-Driven Development</b></p>
|
|
5
5
|
|
|
6
|
-
[](https://www.npmjs.com/package/gemstack)
|
|
6
|
+
[](https://www.npmjs.com/package/gemstack-ai)
|
|
7
7
|
[](https://github.com/rtorrescodes/Gemstack/actions)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
[](#military-grade-security-shield)
|
|
@@ -33,19 +33,19 @@ Start a new project or upgrade an existing one in seconds:
|
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
# Initialize Gemstack in your current repository
|
|
36
|
-
npx gemstack init
|
|
36
|
+
npx gemstack-ai init
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
This will generate the `.agents/`, `.gemstack/`, and `specs/` directories.
|
|
40
40
|
|
|
41
41
|
To ensure your framework is healthy or to check for manual tampering:
|
|
42
42
|
```bash
|
|
43
|
-
npx gemstack doctor
|
|
43
|
+
npx gemstack-ai doctor
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
To update your project when Gemstack releases new Agent Skills:
|
|
47
47
|
```bash
|
|
48
|
-
npx gemstack update
|
|
48
|
+
npx gemstack-ai update
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## 🧠 How it Works
|
|
@@ -68,6 +68,33 @@ Gemstack ships with `03-gemstack-security.md` and `04-gemstack-infrastructure.md
|
|
|
68
68
|
- **DevSecOps & Infra**: Enforces Immutable Infrastructure (Docker/Terraform), Private Subnets (VPC), IAM Least Privilege, and Cloud Secret Managers.
|
|
69
69
|
- **Server-Side Validation**: Complete distrust of frontend state.
|
|
70
70
|
|
|
71
|
+
## 🔒 Architecture Consistency & Phase Freezing
|
|
72
|
+
|
|
73
|
+
Gemstack mechanically prevents AI agents from silently violating or hallucinating deviations from approved architecture. Critical decisions declared in `spec.md` are frozen using canonical cryptographic contracts and checked deterministically through `plan.md`, `tasks.md`, and implementation:
|
|
74
|
+
|
|
75
|
+
```gemstack-contracts
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
"id": "zero-dependency-core",
|
|
79
|
+
"type": "BOOLEAN_INVARIANT",
|
|
80
|
+
"value": true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "external-sync",
|
|
84
|
+
"type": "BOUNDARY",
|
|
85
|
+
"value": "FORBIDDEN"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- **SPEC** owns base architectural contracts.
|
|
91
|
+
- **PLAN** inherits them and may add compatible technical contracts.
|
|
92
|
+
- **TASKS** inherits the consolidated registry.
|
|
93
|
+
- Contradictions become deterministic blockers (`FROZEN_CONTRACT_VIOLATION`).
|
|
94
|
+
- Phase artifacts are frozen via canonical SHA-256 digests; tampering is caught immediately (`FROZEN_ARTIFACT_CHANGED`).
|
|
95
|
+
- `gemstack verify` performs strictly read-only verification without mutating or overwriting accepted phase hashes (`VERIFY != FREEZE`).
|
|
96
|
+
- Existing projects without structured contracts automatically run in **LEGACY** mode without breaking.
|
|
97
|
+
|
|
71
98
|
## 🐝 Advanced Autonomy (The WOW Update)
|
|
72
99
|
|
|
73
100
|
Gemstack isn't just passive documents; it actively orchestrates agentic capabilities:
|
|
@@ -82,7 +109,7 @@ Gemstack isn't just passive documents; it actively orchestrates agentic capabili
|
|
|
82
109
|
|
|
83
110
|
## 🪝 Active Security (Git Hooks)
|
|
84
111
|
|
|
85
|
-
Gemstack ships with native, zero-dependency Git hooks. Run `npx gemstack hooks` (or just `npx gemstack init`) to install a local `pre-commit` hook that automatically blocks commits containing:
|
|
112
|
+
Gemstack ships with native, zero-dependency Git hooks. Run `npx gemstack-ai hooks` (or just `npx gemstack-ai init`) to install a local `pre-commit` hook that automatically blocks commits containing:
|
|
86
113
|
- Exposed `.env` files.
|
|
87
114
|
- Hardcoded secrets (Stripe, AWS, JWT keys).
|
|
88
115
|
- Unresolved merge conflict markers (`<<<<<<< HEAD`).
|
|
@@ -91,7 +118,7 @@ Gemstack ships with native, zero-dependency Git hooks. Run `npx gemstack hooks`
|
|
|
91
118
|
|
|
92
119
|
You can install agent skills created by the community directly into your project using the `install` command. Gemstack will fetch the `SKILL.md`, parse its metadata, and integrate it into your AI's brain automatically:
|
|
93
120
|
```bash
|
|
94
|
-
npx gemstack install https://raw.githubusercontent.com/community/gemstack-skills/main/django-expert/SKILL.md
|
|
121
|
+
npx gemstack-ai install https://raw.githubusercontent.com/community/gemstack-skills/main/django-expert/SKILL.md
|
|
95
122
|
```
|
|
96
123
|
|
|
97
124
|
## 🤖 MCP Server (Model Context Protocol)
|
|
@@ -104,7 +131,7 @@ Add the following to your MCP client configuration:
|
|
|
104
131
|
"mcpServers": {
|
|
105
132
|
"gemstack": {
|
|
106
133
|
"command": "npx",
|
|
107
|
-
"args": ["gemstack", "mcp"]
|
|
134
|
+
"args": ["gemstack-ai", "mcp"]
|
|
108
135
|
}
|
|
109
136
|
}
|
|
110
137
|
}
|
|
@@ -115,6 +142,7 @@ Add the following to your MCP client configuration:
|
|
|
115
142
|
Dive deeper into the Gemstack architecture:
|
|
116
143
|
- [📖 **Manual de Usuario**](MANUAL.md) - The Definitive Guide for beginners.
|
|
117
144
|
- [🧠 Spec-Driven Development](docs/spec-driven-development.md) - How the SDD loop works.
|
|
145
|
+
- [🔒 Architecture Consistency](docs/architecture-consistency.md) - Deterministic contracts & phase freezing.
|
|
118
146
|
- [Available Skills](docs/skills.md)
|
|
119
147
|
- [Security Model](docs/security.md)
|
|
120
148
|
- [Handoff Protocol](docs/handoff.md)
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,5 +1,110 @@
|
|
|
1
1
|
# Gemstack Release Notes
|
|
2
2
|
|
|
3
|
+
# Gemstack v1.1.2 — Architecture Consistency & Phase Freezing
|
|
4
|
+
|
|
5
|
+
## Recovery Release Note
|
|
6
|
+
v1.1.2 is the release-recovery patch for Upgrade A. v1.1.1 resolved cross-platform test discovery, exposing a host-dependent path canonicalization defect in `TEST-CONSISTENCY-G01` when simulating Windows paths on Linux runners. v1.1.2 fixes that canonicalization using explicit path-flavor-aware Node.js path semantics (`path.win32` vs `path.posix`). No product architecture, contract semantics, or canonical P1 criteria were altered.
|
|
7
|
+
|
|
8
|
+
## Highlights
|
|
9
|
+
- **Architecture Consistency Engine**: Mechanically prevents AI models from hallucinating or introducing silent architectural contradictions downstream through 6 canonical contract types (`ENUM_SET`, `IDENTITY_TUPLE`, `PROVENANCE_RULE`, `BOOLEAN_INVARIANT`, `BOUNDARY`, `ROADMAP_LIMIT`).
|
|
10
|
+
- **Cryptographic Phase Freezing**: SHA-256 canonical hashing of phase artifacts (`spec.md`, `plan.md`, `tasks.md`) with automatic mutation detection (`FROZEN_ARTIFACT_CHANGED`).
|
|
11
|
+
- **Deterministic-First Validation**: Automated cross-phase inheritance (`SPEC` -> `PLAN` -> `TASKS`) resolving contradictions before human review.
|
|
12
|
+
- **Canonical Finding Fingerprints**: Full 64-character lowercase SHA-256 digests with anti-loop lifecycle management (`OPEN`, `RESOLVED`, `ACCEPTED_EXCEPTION`, `SUPERSEDED`).
|
|
13
|
+
- **Accepted Exceptions Bound to Context**: Exceptions require cryptographic `contextHash` binding; any change to compared artifacts or contracts invalidates suppression.
|
|
14
|
+
- **Progressive LEGACY Mode**: Features without contracts continue without disruption or breaking changes.
|
|
15
|
+
- **Zero-Dependency Core**: Pure Node.js standard library implementation (`node:crypto`, `node:fs`, `node:path`, `node:test`).
|
|
16
|
+
|
|
17
|
+
## Compatibility
|
|
18
|
+
- 100% backward compatible with existing Gemstack repositories.
|
|
19
|
+
- Zero external runtime dependencies added.
|
|
20
|
+
|
|
21
|
+
## Validation
|
|
22
|
+
- 17/17 Upgrade A implementation tasks complete.
|
|
23
|
+
- 25/25 canonical P1 acceptance tests passing.
|
|
24
|
+
- 33/33 physical test suite passing.
|
|
25
|
+
- `npm test` exit code 0.
|
|
26
|
+
- `gemstack verify` exit code 0 with 0 open blockers.
|
|
27
|
+
- Self-dogfooded on `specs/006-architecture-consistency-engine/`.
|
|
28
|
+
|
|
29
|
+
## Upgrade Notes
|
|
30
|
+
- Run `npx gemstack-ai update` to pull the latest agent skills and templates into your existing project.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# Gemstack v1.1.1 — Architecture Consistency & Phase Freezing
|
|
35
|
+
|
|
36
|
+
## Recovery Release Note
|
|
37
|
+
v1.1.1 is the publishable recovery release for Upgrade A. The original v1.1.0 tag completed development and closure, but its release CI workflow stopped prior to npm publication because the test command relied on shell-dependent recursive glob resolution on Linux runners. In v1.1.1, test execution is made strictly portable across all operating systems. No product architecture or contract semantics changed.
|
|
38
|
+
|
|
39
|
+
## Highlights
|
|
40
|
+
- **Architecture Consistency Engine**: Mechanically prevents AI models from hallucinating or introducing silent architectural contradictions downstream through 6 canonical contract types (`ENUM_SET`, `IDENTITY_TUPLE`, `PROVENANCE_RULE`, `BOOLEAN_INVARIANT`, `BOUNDARY`, `ROADMAP_LIMIT`).
|
|
41
|
+
- **Cryptographic Phase Freezing**: SHA-256 canonical hashing of phase artifacts (`spec.md`, `plan.md`, `tasks.md`) with automatic mutation detection (`FROZEN_ARTIFACT_CHANGED`).
|
|
42
|
+
- **Deterministic-First Validation**: Automated cross-phase inheritance (`SPEC` -> `PLAN` -> `TASKS`) resolving contradictions before human review.
|
|
43
|
+
- **Canonical Finding Fingerprints**: Full 64-character lowercase SHA-256 digests with anti-loop lifecycle management (`OPEN`, `RESOLVED`, `ACCEPTED_EXCEPTION`, `SUPERSEDED`).
|
|
44
|
+
- **Accepted Exceptions Bound to Context**: Exceptions require cryptographic `contextHash` binding; any change to compared artifacts or contracts invalidates suppression.
|
|
45
|
+
- **Progressive LEGACY Mode**: Features without contracts continue without disruption or breaking changes.
|
|
46
|
+
- **Zero-Dependency Core**: Pure Node.js standard library implementation (`node:crypto`, `node:fs`, `node:path`, `node:test`).
|
|
47
|
+
|
|
48
|
+
## Compatibility
|
|
49
|
+
- 100% backward compatible with existing Gemstack repositories.
|
|
50
|
+
- Zero external runtime dependencies added.
|
|
51
|
+
|
|
52
|
+
## Validation
|
|
53
|
+
- 17/17 Upgrade A implementation tasks complete.
|
|
54
|
+
- 25/25 canonical P1 acceptance tests passing.
|
|
55
|
+
- 33/33 physical test suite passing.
|
|
56
|
+
- `npm test` exit code 0.
|
|
57
|
+
- `gemstack verify` exit code 0 with 0 open blockers.
|
|
58
|
+
- Self-dogfooded on `specs/006-architecture-consistency-engine/`.
|
|
59
|
+
|
|
60
|
+
## Upgrade Notes
|
|
61
|
+
- Run `npx gemstack-ai update` to pull the latest agent skills and templates into your existing project.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
# Gemstack v1.1.0 — Architecture Consistency & Phase Freezing
|
|
66
|
+
|
|
67
|
+
## Highlights
|
|
68
|
+
- **Architecture Consistency Engine**: Mechanically prevents AI models from hallucinating or introducing silent architectural contradictions downstream through 6 canonical contract types (`ENUM_SET`, `IDENTITY_TUPLE`, `PROVENANCE_RULE`, `BOOLEAN_INVARIANT`, `BOUNDARY`, `ROADMAP_LIMIT`).
|
|
69
|
+
- **Cryptographic Phase Freezing**: SHA-256 canonical hashing of phase artifacts (`spec.md`, `plan.md`, `tasks.md`) with automatic mutation detection (`FROZEN_ARTIFACT_CHANGED`).
|
|
70
|
+
- **Deterministic-First Validation**: Automated cross-phase inheritance (`SPEC` -> `PLAN` -> `TASKS`) resolving contradictions before human review.
|
|
71
|
+
- **Canonical Finding Fingerprints**: Full 64-character lowercase SHA-256 digests with anti-loop lifecycle management (`OPEN`, `RESOLVED`, `ACCEPTED_EXCEPTION`, `SUPERSEDED`).
|
|
72
|
+
- **Accepted Exceptions Bound to Context**: Exceptions require cryptographic `contextHash` binding; any change to compared artifacts or contracts invalidates suppression.
|
|
73
|
+
- **Progressive LEGACY Mode**: Features without contracts continue without disruption or breaking changes.
|
|
74
|
+
- **Zero-Dependency Core**: Pure Node.js standard library implementation (`node:crypto`, `node:fs`, `node:path`, `node:test`).
|
|
75
|
+
|
|
76
|
+
## Compatibility
|
|
77
|
+
- 100% backward compatible with existing Gemstack repositories.
|
|
78
|
+
- Zero external runtime dependencies added.
|
|
79
|
+
|
|
80
|
+
## Validation
|
|
81
|
+
- 17/17 Upgrade A implementation tasks complete.
|
|
82
|
+
- 25/25 canonical P1 acceptance tests passing.
|
|
83
|
+
- 33/33 physical test suite passing.
|
|
84
|
+
- `npm test` exit code 0.
|
|
85
|
+
- `gemstack verify` exit code 0 with 0 open blockers.
|
|
86
|
+
- Self-dogfooded on `specs/006-architecture-consistency-engine/`.
|
|
87
|
+
|
|
88
|
+
## Upgrade Notes
|
|
89
|
+
- Run `npx gemstack-ai update` to pull the latest agent skills and templates into your existing project.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
# Gemstack v1.0.2
|
|
94
|
+
|
|
95
|
+
## Highlights
|
|
96
|
+
- **Zero Silent Failures**: Actualización al Article III de la Constitución prohibiendo `2>nul` y operadores de supresión de fallos en scripts de testing multiplataforma.
|
|
97
|
+
- **Intent-Based Routing**: Detección semántica de intenciones en lenguaje natural en `01-gemstack-core.md`, auto-activando `gemstack-spec`, `gemstack-qa`, `gemstack-investigate` y `gemstack-handoff` sin requerir estrictamente `/comando`.
|
|
98
|
+
- **Auto State Sync**: Sincronización automática de `.gemstack/state.json` en `gemstack-spec`, `gemstack-ship` y `gemstack-handoff` con control de ciclo de vida (`current_phase`, `active_spec`, `last_completed_feature`).
|
|
99
|
+
- **Unified Health & Security Auditor (`gemstack verify`)**: Nuevo comando CLI y script `pnpm/npm run gemstack:verify` para validar en un solo paso archivos base, integridad de memoria (5 secciones de `handoff.md`), estado local y seguridad de scripts.
|
|
100
|
+
|
|
101
|
+
## Validation
|
|
102
|
+
- `npm test`: 8 tests unitarios pasando al 100%.
|
|
103
|
+
- `npm run gemstack:verify`: Éxito total.
|
|
104
|
+
- CI Scripts: frontmatter, template clean, mojibake, package contents y smoke CLI validados.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
3
108
|
# Gemstack v0.3.0
|
|
4
109
|
|
|
5
110
|
## Highlights
|
package/assets/logo.jpg
ADDED
|
Binary file
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Architecture Consistency & Phase Freezing
|
|
2
|
+
|
|
3
|
+
Gemstack includes a native, deterministic **Architecture Consistency Engine** and **Phase Freezing** protocol. It prevents AI agents from silently introducing contradictions, architectural drift, or unauthorized mutations across the Spec-Driven Development lifecycle.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. The Architecture Consistency Problem
|
|
8
|
+
|
|
9
|
+
In complex AI coding projects, language models often agree to constraints in a specification (such as "zero external dependencies" or "single tenant isolation"), but later quietly contradict them in implementation or tasks (e.g. installing unauthorized packages).
|
|
10
|
+
|
|
11
|
+
Gemstack solves this mechanically at the framework layer:
|
|
12
|
+
1. Architectural decisions are declared as formal, machine-verifiable **contracts**.
|
|
13
|
+
2. Upstream phases (`SPEC`, `PLAN`, `TASKS`) are cryptographically **frozen**.
|
|
14
|
+
3. Downstream phases inherit contracts and are mechanically compared for contradictions.
|
|
15
|
+
4. Any contradiction or mutation immediately halts execution as a deterministic blocker.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 2. Canonical Contract Block Format
|
|
20
|
+
|
|
21
|
+
Contracts are declared inside phase markdown files (`spec.md`, `plan.md`, `tasks.md`) within a column-0 fenced code block:
|
|
22
|
+
|
|
23
|
+
```gemstack-contracts
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
"id": "zero-dependency-core",
|
|
27
|
+
"type": "BOOLEAN_INVARIANT",
|
|
28
|
+
"value": true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "database-engine",
|
|
32
|
+
"type": "ENUM_SET",
|
|
33
|
+
"values": ["sqlite", "postgres"]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "external-sync",
|
|
37
|
+
"type": "BOUNDARY",
|
|
38
|
+
"value": "FORBIDDEN"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Block Parsing Rules
|
|
44
|
+
- **Exactly One Block**: Each phase document may contain at most one `gemstack-contracts` block. Multiple blocks trigger a `CONTRACT_PARSE_ERROR`.
|
|
45
|
+
- **Legacy Mode**: Phase documents with 0 contract blocks operate in **LEGACY** mode without errors or blocking.
|
|
46
|
+
- **Strict Encoding**: UTF-8 without BOM is required; CRLF and LF line endings are canonically normalized to LF.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 3. The Six Canonical Contract Types
|
|
51
|
+
|
|
52
|
+
Gemstack enforces six deterministic contract types:
|
|
53
|
+
|
|
54
|
+
| Contract Type | Value Shape | Description / Evaluation |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `ENUM_SET` | `values: string[]` | Closed set of allowed identifiers. Order-insensitive. Downstream cannot add unapproved values. |
|
|
57
|
+
| `IDENTITY_TUPLE` | `tuple: string[]` | Immutable composite tuple. Order-insensitive, duplicate-sensitive, exact-member matching. |
|
|
58
|
+
| `PROVENANCE_RULE` | `source: string, rule: string` | Origin and lineage constraints. Downstream cannot omit or alter provenance. |
|
|
59
|
+
| `BOOLEAN_INVARIANT` | `value: boolean` | Strict binary invariant (e.g. `true` for zero-dependency). Downstream contradiction is blocked. |
|
|
60
|
+
| `BOUNDARY` | `value: "FORBIDDEN" | "REQUIRED"` | Hard system boundary. Only `FORBIDDEN` and `REQUIRED` are valid. |
|
|
61
|
+
| `ROADMAP_LIMIT` | `value: string | number` | Milestone or scope bound (e.g. max task count). Downstream cannot expand beyond the limit. |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 4. Cross-Phase Contract Inheritance
|
|
66
|
+
|
|
67
|
+
Contracts follow a strict unidirectional inheritance hierarchy:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
SPEC (declares base contracts)
|
|
71
|
+
│
|
|
72
|
+
▼
|
|
73
|
+
PLAN (inherits SPEC contracts + may add technical contracts)
|
|
74
|
+
│
|
|
75
|
+
▼
|
|
76
|
+
TASKS (inherits consolidated SPEC + PLAN contracts)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- **Inheritance**: Downstream phases automatically inherit all upstream contracts. An inherited contract does not need to be re-declared downstream unless adding specific attributes.
|
|
80
|
+
- **Equivalence**: Redeclaring an inherited contract with identical semantics passes validation.
|
|
81
|
+
- **Contradiction**: Redeclaring an inherited contract with contradictory values triggers `FROZEN_CONTRACT_VIOLATION` and blocks execution.
|
|
82
|
+
- **Additive Extension**: Downstream phases may introduce new contract IDs as long as they do not conflict with existing contracts.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 5. Phase Freezing & Mutation Detection
|
|
87
|
+
|
|
88
|
+
When a phase is completed and approved by the human supervisor, its artifact is cryptographically sealed:
|
|
89
|
+
- **Canonical Hash**: Normalized SHA-256 (64 lowercase hexadecimal characters).
|
|
90
|
+
- **CRLF Normalization**: All line breaks are normalized to LF (`\n`) prior to hashing, ensuring identical digests across Windows, macOS, and Linux.
|
|
91
|
+
- **UTF-8 BOM Forbidden**: Leading Byte Order Marks trigger `CONTRACT_PARSE_ERROR`.
|
|
92
|
+
- **Mutation Detection**: If an upstream artifact (`spec.md` or `plan.md`) is modified after approval, `gemstack verify` detects the hash mismatch and halts with `FROZEN_ARTIFACT_CHANGED`.
|
|
93
|
+
|
|
94
|
+
> **VERIFY != FREEZE**: `gemstack verify`, `gemstack doctor`, and agent reviews are strictly read-only and **never** overwrite or mutate accepted phase hashes.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 6. Findings & Anti-Loop Lifecycle
|
|
99
|
+
|
|
100
|
+
When a consistency rule is violated, Gemstack generates a structured **Finding**:
|
|
101
|
+
- **Canonical Fingerprint**: Full 64-character lowercase SHA-256 digest computed over `{ code, contractId, phase, location }`.
|
|
102
|
+
- **Display Token**: First 12 characters of the fingerprint for human-readable CLI display.
|
|
103
|
+
- **Finding Lifecycle**:
|
|
104
|
+
- `OPEN`: Active blocker preventing shipping.
|
|
105
|
+
- `RESOLVED`: Violation was corrected in artifacts.
|
|
106
|
+
- `ACCEPTED_EXCEPTION`: Formally approved human exception.
|
|
107
|
+
- `SUPERSEDED`: Replaced by a subsequent finding.
|
|
108
|
+
- **Anti-Loop Protection**: If a previously `RESOLVED` defect re-appears in subsequent runs, it is immediately re-opened to `OPEN`.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 7. Accepted Exceptions & Context Hash
|
|
113
|
+
|
|
114
|
+
When an architectural deviation is intentionally approved by a human supervisor, it is recorded in the feature sidecar with a cryptographic `contextHash`:
|
|
115
|
+
|
|
116
|
+
`contextHash = SHA-256(upstreamAcceptedHash + currentComparedHash + normalizedContract)`
|
|
117
|
+
|
|
118
|
+
If the upstream phase artifact, compared phase artifact, or contract representation changes, the suppression is automatically invalidated and the violation re-opens as a blocking finding.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 8. State & Persistence Boundary
|
|
123
|
+
|
|
124
|
+
Gemstack strictly separates operational state from historical audit trails:
|
|
125
|
+
- **`.gemstack/state.json`**: Lightweight operational state only (active feature, completed phases, guard mode, verification summary). Historical finding arrays are forbidden in this file.
|
|
126
|
+
- **`specs/<feature>/.gemstack.json`**: Per-feature sidecar hosting the complete audit log, phase hash history, finding fingerprints, and accepted exceptions.
|
|
127
|
+
- **Atomic Operations**: All state writes use temporary file creation and atomic file renaming to prevent corruption during unexpected shutdowns or process kills.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 9. Verification Integration (`gemstack verify`)
|
|
132
|
+
|
|
133
|
+
Architectural consistency is embedded as **Step 4/5** in the unified `gemstack verify` command:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
[INFO] --- 4/5 Verificación de Consistencia de Arquitectura y Hashes de Fase ---
|
|
137
|
+
[OK] [STRUCTURED] 5 contrato(s) base declarados en spec.md.
|
|
138
|
+
[OK] Hash congelado de spec.md verificado: f5d423eaf508...
|
|
139
|
+
[OK] Hash congelado de plan.md verificado: 1ce0e5886342...
|
|
140
|
+
[OK] Hash congelado de tasks.md verificado: dfad2484ad11...
|
|
141
|
+
[OK] Verificación de consistencia arquitectónica aprobada (0 bloqueadores).
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
If any contracts contradict, artifacts mutate, or unapproved blockers exist, `gemstack verify` exits with code 1, halting CI/CD pipelines.
|
|
Binary file
|