gemstack-ai 1.3.0 → 2.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 (71) hide show
  1. package/.agents/rules/03-gemstack-security.md +2 -2
  2. package/.gemstack/state.json +7 -8
  3. package/CHANGELOG.md +87 -0
  4. package/CONTRIBUTING.md +1 -1
  5. package/README.md +113 -22
  6. package/RELEASE_NOTES.md +80 -1
  7. package/handoff.md +33 -19
  8. package/package.json +4 -3
  9. package/scripts/ci/check-package-contents.js +1 -1
  10. package/scripts/ci/check-secrets.js +84 -0
  11. package/specs/009-context-capsule/context-capsule.json +4 -4
  12. package/specs/010-agent-swarm-visual-qa/.gemstack.json +5 -0
  13. package/specs/010-agent-swarm-visual-qa/closure.json +59 -0
  14. package/specs/010-agent-swarm-visual-qa/plan.md +759 -0
  15. package/specs/010-agent-swarm-visual-qa/spec.md +842 -0
  16. package/specs/010-agent-swarm-visual-qa/swarm.json +49 -0
  17. package/specs/010-agent-swarm-visual-qa/tasks.md +873 -0
  18. package/specs/010-agent-swarm-visual-qa/visual-qa.json +41 -0
  19. package/specs/011-gemstack-2.0-hardening/.gemstack.json +5 -0
  20. package/specs/011-gemstack-2.0-hardening/closure.json +58 -0
  21. package/specs/011-gemstack-2.0-hardening/plan.md +210 -0
  22. package/specs/011-gemstack-2.0-hardening/spec.md +277 -0
  23. package/specs/011-gemstack-2.0-hardening/tasks.md +59 -0
  24. package/specs/012-gemstack-2.0-honest-evidence/.gemstack.json +5 -0
  25. package/specs/012-gemstack-2.0-honest-evidence/closure.json +58 -0
  26. package/specs/012-gemstack-2.0-honest-evidence/plan.md +202 -0
  27. package/specs/012-gemstack-2.0-honest-evidence/spec.md +222 -0
  28. package/specs/012-gemstack-2.0-honest-evidence/tasks.md +99 -0
  29. package/specs/013-gemstack-2.0-adaptable-sdd/.gemstack.json +9 -0
  30. package/specs/013-gemstack-2.0-adaptable-sdd/closure.json +58 -0
  31. package/specs/013-gemstack-2.0-adaptable-sdd/context-capsule.json +227 -0
  32. package/specs/013-gemstack-2.0-adaptable-sdd/plan.md +179 -0
  33. package/specs/013-gemstack-2.0-adaptable-sdd/spec.md +212 -0
  34. package/specs/013-gemstack-2.0-adaptable-sdd/tasks.md +90 -0
  35. package/specs/014-gemstack-2.0-context-memory/.gemstack.json +9 -0
  36. package/specs/014-gemstack-2.0-context-memory/closure.json +58 -0
  37. package/specs/014-gemstack-2.0-context-memory/plan.md +161 -0
  38. package/specs/014-gemstack-2.0-context-memory/spec.md +163 -0
  39. package/specs/014-gemstack-2.0-context-memory/tasks.md +79 -0
  40. package/src/cli.js +11 -0
  41. package/src/commands/context.js +1 -1
  42. package/src/commands/doctor.js +18 -0
  43. package/src/commands/hooks.js +98 -14
  44. package/src/commands/init.js +1 -1
  45. package/src/commands/install.js +174 -49
  46. package/src/commands/spec.js +105 -0
  47. package/src/commands/swarm.js +111 -0
  48. package/src/commands/update.js +1 -1
  49. package/src/commands/verify.js +48 -0
  50. package/src/commands/visual.js +82 -0
  51. package/src/lib/backup.js +3 -3
  52. package/src/lib/closure-context.js +9 -1
  53. package/src/lib/context-fatigue.js +165 -0
  54. package/src/lib/contract-amendments.js +109 -0
  55. package/src/lib/dependency-audit.js +202 -0
  56. package/src/lib/filesystem-safe.js +85 -15
  57. package/src/lib/memory-audit.js +121 -0
  58. package/src/lib/provider-boundary.js +5 -1
  59. package/src/lib/provider-registry.js +6 -4
  60. package/src/lib/safety-gates.js +176 -8
  61. package/src/lib/sdd-rigor.js +181 -0
  62. package/src/lib/spec-delta.js +194 -0
  63. package/src/lib/spec-merge.js +168 -0
  64. package/src/lib/swarm.js +639 -0
  65. package/src/lib/visual-qa.js +652 -0
  66. package/template/.agents/rules/03-gemstack-security.md +2 -2
  67. package/.github/workflows/main-ci.yml +0 -32
  68. package/.github/workflows/pr-ci.yml +0 -31
  69. package/.github/workflows/publish.yml +0 -52
  70. package/.github/workflows/release-readiness.yml +0 -43
  71. package/gemstack-ai-1.3.0.tgz +0 -0
@@ -1,7 +1,7 @@
1
- # Gemstack Security Core (Military-Grade Shielding)
1
+ # Gemstack Security Core (Architecture & Security Gates)
2
2
 
3
3
  ## Propósito
4
- Esta es la Ley de "Seguridad por Diseño". Todo código escrito, planificado o revisado por la IA bajo el marco Gemstack DEBE adherirse a estos principios de blindaje, independientemente del stack tecnológico utilizado. El objetivo es mitigar el 99% de las vulnerabilidades comunes (OWASP) desde el momento de la concepción del código.
4
+ Esta es la Ley de "Seguridad por Diseño". Todo código escrito, planificado o revisado por la IA bajo el marco Gemstack DEBE adherirse a estos principios de blindaje, independientemente del stack tecnológico utilizado. El objetivo es establecer controles sistemáticos y verificables frente a vulnerabilidades comunes (OWASP Top 10) desde el momento de la concepción del código.
5
5
 
6
6
  ## 1. Cero Exposición de Credenciales (Zero Trust Secrets)
7
7
  - **Regla Estricta:** JAMÁS hardcodees contraseñas, llaves de API, secrets de Webhooks o URIs de bases de datos en el código fuente.
@@ -2,17 +2,16 @@
2
2
  "version": "0.1",
3
3
  "current_phase": "shipped",
4
4
  "status": "SHIPPED",
5
- "stop_reason": "UPGRADE_C_SHIPPED_DONE",
5
+ "stop_reason": null,
6
6
  "active_spec": null,
7
7
  "completed_phases": [
8
8
  "spec",
9
- "plan",
10
- "tasks"
9
+ "plan"
11
10
  ],
12
11
  "phase_hashes": {
13
- "spec": "9241b9e992f687e80ecef388c79731ece7af9aa75ba989dc8f0b1e9b855f7914",
14
- "plan": "6a2e29e9aeda266a71ab435fa09bca3b18521835a69f6020cd8d9f135643e3aa",
15
- "tasks": "1697c32a1f6596f317491df68cd1b161e5c77fbbddc74ce3f1e6e00a42619249"
12
+ "spec": "408e0d0aebfc6ac65cb07bbaf694b573571489d2da8aa4314ee7c36d65bbe951",
13
+ "plan": "845bbb28f699b642f17be9462a3fac71c112d51fb9f23b4b9ad48d665a0f17d2",
14
+ "tasks": "53c19462e3ec4a7c95c126c0af0fe379ff45f610c32d1bcaad79550b58783a0e"
16
15
  },
17
16
  "consistency": {
18
17
  "status": "PASS",
@@ -23,6 +22,6 @@
23
22
  "freeze": false,
24
23
  "allowed_paths": []
25
24
  },
26
- "last_update": "2026-09-11T17:38:04.916Z",
27
- "last_completed_feature": "specs/008-cost-provider-safety-gates"
25
+ "last_update": "2026-09-23T02:09:36.940Z",
26
+ "last_completed_feature": "specs/014-gemstack-2.0-context-memory"
28
27
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,93 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [v2.0.0] - 2026-09-23
6
+
7
+ ### Major Architecture Milestone: Gemstack 2.0
8
+ Gemstack 2.0 elevates the framework from declarative agent guidance to reproducible cryptographic and runtime guarantees.
9
+
10
+ ### Added
11
+ - **P0 Trust Boundaries & Hardening (Sprint A)**:
12
+ - `resolveSafeStrict`: Enforces realpath resolution to permanently eliminate arbitrary symlink path traversal outside project roots.
13
+ - Remote Skill Provenance: Verifies remote skills against `allowed_sources` and validates SHA-256 content checksums prior to installation.
14
+ - Native Secret Blocking in Git Hooks: Local pre-commit hook automatically scans for and rejects commits containing API keys (GitHub PATs, OpenAI/Anthropic/Stripe tokens), private keys, or `.env` files.
15
+ - Environment & Log Sanitization: Eliminates credential leakage by redacting sensitive values across all CLI logs.
16
+ - **P1 Honest Evidence & Reliable Metrics (Sprint B)**:
17
+ - Authenticated Billable Action Tokens: Implemented HMAC-SHA256 authenticated spending tokens, cumulative budget accounting, and positive unit enforcement (`src/lib/safety-gates.js`).
18
+ - Disk-Recomputed Visual Evidence: Screenshots must be verified by recomputing SHA-256 hashes from disk; rejects self-declared diffs without a registered visual diff adapter (`UNVERIFIED`).
19
+ - Pre-Persistence Secret Masking: Sensitive inputs and credentials are redacted prior to persisting visual evidence on disk.
20
+ - Public Control Matrix: Public `Control / Scope / Test / Limit` 4-column matrix in `README.md` and rules, eliminating unverified marketing claims.
21
+ - Pinned CI Workflows: GitHub Actions pinned to 40-character commit SHAs with explicit least-privilege `permissions: contents: read`.
22
+ - **P2 Adaptable SDD & Incremental Specs (Sprint C)**:
23
+ - Four Rigor Levels: `quick` (single-artifact lightweight mode), `fix` (enforces linked regression test), `feature` (standard 3-phase SDD), and `high-risk` (threat model, rollback plan, and dual human approvals).
24
+ - Incremental Spec Deltas: Structured `ADDED`, `MODIFIED`, and `REMOVED` declarations preventing destructive overwriting of base specifications by concurrent agents.
25
+ - Offline Spec Merge: `gemstack spec merge` detects colliding contracts and duplicate canonical test IDs before merging branches.
26
+ - Formal Contract Amendments: Replaces silent contract mutations with signed, auditable amendment records (`src/lib/contract-amendments.js`).
27
+ - **P3 Efficient Context & Persistent Memory (Sprint D)**:
28
+ - Context Fatigue Detector & Noise Pruning: Flags warnings when accumulated token load or redundancy ratios exceed thresholds; deterministically prunes ephemeral chatter while preserving contracts and state.
29
+ - Offline Dependency Auditor in `gemstack doctor`: Analyzes orphan dependencies, undeclared imports, and local circular cycles in <10ms without invoking external network requests.
30
+ - Memory Cross-Verification in `gemstack verify`: Reconciles recent git commit log against `handoff.md` to prevent unrecorded work from being lost across sessions.
31
+
32
+ ### Validation
33
+ - 180 physical tests passing across 23 test suites with 0 failures and 0 skipped.
34
+ - Full CI test suite (`npm run ci:all`) passing cleanly.
35
+ - `gemstack verify` passing with 0 errors and 0 open blockers.
36
+ - Zero runtime npm dependencies maintained (`dependencies: {}`).
37
+
38
+ ## [v1.4.0] - 2026-09-11
39
+
40
+ ### Added
41
+ - **Agent Swarm Planning & Validation (Upgrade E)**: Deterministic multi-worker wave planning and coordination verification framework.
42
+ - Deterministic swarm planning contracts and canonical `swarm.json` manifest schema.
43
+ - Task ownership and write-set partitioning: enforces disjoint write boundaries per wave (`write_set(T1) ∩ write_set(T2) = ∅`).
44
+ - Write-collision detection: automatically detects overlapping write sets and serializes conflicting tasks into sequential waves.
45
+ - Dependency wave scheduling: preserves task prerequisite graphs and rejects circular dependencies (`SWARM_DEPENDENCY_CYCLE`).
46
+ - Task-scoped context projections: compiles minimal, role-tailored contexts derived from `context-capsule.json`.
47
+ - Context freshness validation: verifies live capsule hash against `source_capsule_hash` to reject stale projections (`SWARM_CONTEXT_STALE`).
48
+ - Separation of duties gate: mechanically enforces `AUTHOR != REVIEWER` (`SWARM_SELF_REVIEW_DETECTED`).
49
+ - Provider policy and budget gating: integrates with Upgrade C `ProviderCapabilityGate` and `BillableActionGate` to prevent budget runaway.
50
+ - Subagent limits enforcement: strictly blocks unauthorized recursive worker spawning.
51
+ - Pure offline read-only verification (Stage 5.3 in `gemstack verify`): validates swarm manifests without worker or agent execution.
52
+ - Explicit non-execution invariant: Gemstack core does NOT execute autonomous coding agents.
53
+ - **Visual QA Evidence (Upgrade E)**: Mechanical, offline visual verification architecture based on cryptographic digests and neutral masking.
54
+ - Canonical `visual-qa.json` manifest schema declaring route, deterministic viewport dimensions, and approved baseline references.
55
+ - Deterministic viewport specifications: standard profiles with explicit width, height, and device scale factor.
56
+ - Cryptographic baseline pinning: baseline images tracked via canonical SHA-256 byte digests (`image_sha256`).
57
+ - Tampering detection: flags baseline image mutations on disk (`VQA_BASELINE_TAMPERED`).
58
+ - Neutral selector masking: masks dynamic elements (`[MASKED_NEUTRAL]`) to prevent flaky subpixel and timestamp diffs.
59
+ - Mandatory automatic password & credential masking: automatically replaces sensitive input fields (`type=password`, `data-sensitive=true`) with `[MASKED_SECRET]`.
60
+ - Structured visual evidence comparison: fast SHA-256 digest match path with offline tolerance-bounded diffing (`max_diff_percentage`).
61
+ - Explicit baseline promotion: baselines are NEVER auto-updated or healed during test or verify; requires explicit `gemstack vqa promote <scenario-id>`.
62
+ - Pure offline read-only verification (Stage 5.4 in `gemstack verify`): zero browser launches, zero network calls, zero file mutations.
63
+ - Explicit non-execution invariant: Gemstack core does NOT launch browsers and does NOT capture screenshots automatically.
64
+ - **New CLI Surfaces**:
65
+ - `gemstack swarm plan [--json]`: compiles `tasks.md` into deterministic concurrent waves.
66
+ - `gemstack swarm validate [--json]`: validates write partitions, review separation, and context freshness.
67
+ - `gemstack vqa validate [--json]` (or `gemstack visual validate`): validates visual QA manifests, viewports, baselines, and evidence offline.
68
+ - `gemstack vqa promote <scenario-id>` (or `gemstack visual promote`): explicitly promotes live evidence to approved canonical baseline.
69
+
70
+ ### Changed
71
+ - `gemstack verify` extended with Stage 5.3 (Swarm Audit) and Stage 5.4 (Visual QA Audit) running in pure read-only mode.
72
+ - `src/lib/closure-context.js` updated to track `swarm.json` and `visual-qa.json` in closure context hashing, and support alphanumeric task IDs (`UE-T001`..`T029`).
73
+ - `package.json` test script updated to register the 5 new Upgrade E test suites.
74
+
75
+ ### Compatibility
76
+ - 100% backward compatible with existing Gemstack repositories and frozen contracts from Upgrades A, B, C, and D.
77
+ - Zero external runtime npm dependencies added (`package.json` dependencies remain `{}`).
78
+ - Zero external development npm dependencies added (`package.json` devDependencies remain `{}`).
79
+
80
+ ### Validation
81
+ - 29/29 Upgrade E tasks COMPLETE.
82
+ - 20/20 Upgrade E canonical acceptance tests passing (`TEST-SWARM-A01`..`E02`, `TEST-VISUAL-A01`..`E02`).
83
+ - 10/10 Upgrade E bootstrap contracts passing.
84
+ - 26/26 adversarial test cases passing.
85
+ - 126/126 physical tests passing across 14 suites with 0 failures and 0 skipped.
86
+ - Full CI test matrix (`npm run ci:all`) passing cleanly.
87
+ - `gemstack verify` exit code 0 with 0 errors and 0 open blockers.
88
+ - Swarm manifest verified: `VALID` and `FRESH`.
89
+ - Visual QA manifest verified: `VALID` and `FRESH`.
90
+ - Closure evidence: `specs/010-agent-swarm-visual-qa/closure.json` status `VERIFIED`.
91
+
5
92
  ## [v1.3.0] - 2026-09-11
6
93
 
7
94
  ### Added
package/CONTRIBUTING.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Contributing to Gemstack
2
2
 
3
- First off, thank you for considering contributing to Gemstack! Gemstack is an open-source, local-first framework designed to supercharge AI coding agents with Spec-Driven Development (SDD) and military-grade security out of the box.
3
+ First off, thank you for considering contributing to Gemstack! Gemstack is an open-source, local-first framework designed to supercharge AI coding agents with Spec-Driven Development (SDD) and verifiable architectural and security gates out of the box.
4
4
 
5
5
  ## Code of Conduct
6
6
  By participating in this project, you agree to abide by our [Code of Conduct](./CODE_OF_CONDUCT.md).
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  <div align="center">
2
2
  <img src="assets/logo.jpg" alt="Gemstack Logo" width="200" style="border-radius: 20px" />
3
- <h1>Gemstack</h1>
3
+ <h1>Gemstack v2.0.0</h1>
4
4
  <p><b>The Local-First Agentic Framework for Spec-Driven Development</b></p>
5
5
 
6
6
  [![npm version](https://img.shields.io/npm/v/gemstack-ai.svg?style=flat-square)](https://www.npmjs.com/package/gemstack-ai)
7
+ [![Release](https://img.shields.io/badge/release-v2.0.0-blue.svg?style=flat-square)](https://github.com/rtorrescodes/Gemstack/releases/tag/v2.0.0)
7
8
  [![CI Build](https://img.shields.io/github/actions/workflow/status/rtorrescodes/Gemstack/main-ci.yml?style=flat-square&branch=main)](https://github.com/rtorrescodes/Gemstack/actions)
8
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
9
- [![Security Shield](https://img.shields.io/badge/Security-Military--Grade-red.svg?style=flat-square)](#military-grade-security-shield)
10
+ [![Security Shield](https://img.shields.io/badge/Security-Architecture%20Gates-green.svg?style=flat-square)](#security-architecture--safety-gates)
10
11
 
12
+ > **🚀 Current Stable Release: `v2.0.0`** — *Security Hardening, Adaptable SDD & Persistent Memory Checkpoint*
11
13
  > **💡 ¿No sabes por dónde empezar o cómo funciona esto?**
12
14
  > 👉 [**¡Lee el Manual de Usuario Interactivo (La Guía Definitiva)!**](MANUAL.md) 👈
13
15
  </div>
@@ -16,20 +18,23 @@
16
18
 
17
19
  Gemstack is a zero-dependency, local-first framework designed to supercharge your AI Coding Agents (like Google Antigravity, Claude, Cursor, or Aider).
18
20
 
19
- Instead of letting AI write code blindly in a chaotic chat window, Gemstack installs a "Brain" directly into your repository. It enforces **Spec-Driven Development (SDD)**, injecting strict rules, autonomous skills, and military-grade security into the AI's context.
21
+ Instead of letting AI write code blindly in a chaotic chat window, Gemstack installs a "Brain" directly into your repository. It enforces **Spec-Driven Development (SDD)**, injecting strict rules, autonomous skills, and rigorous security gates into the AI's context.
20
22
 
21
- ## ✨ Features
23
+ ## ✨ Features (v2.0.0)
22
24
 
23
- - 🧠 **Spec-Driven Development (SDD)**: The AI is physically prevented from hallucinating code without writing and getting approval for a `spec.md`, `plan.md`, and `tasks.md` first.
24
- - 🛡️ **Military-Grade Security**: Includes a built-in Chief Security Officer (`gemstack-cso`) and immutable Constitution Rules that force the AI to respect OWASP, zero-trust secrets, and multi-tenant isolation.
25
- - 🐝 **Swarm Architecture**: Tag tasks with `[P]` and invoke `/swarm` to watch the AI spawn parallel subagents to code your app simultaneously.
26
- - 🏥 **Self-Healing CI/CD**: Run `/heal` when GitHub Actions fails. The AI will autonomously read the CI logs, write the patch, and push the fix.
27
- - 👁️ **Visual QA Automation**: The `/qa-visual` skill instructs the agent to write and execute ephemeral Playwright scripts in an isolated sandbox to visually verify UI criteria.
28
- - 📦 **Zero Dependencies**: Gemstack's footprint is just standard Markdown and JSON files. No heavy NPM packages polluting your production bundle.
25
+ - 🧠 **Adaptable Spec-Driven Development (SDD)**: Four rigor levels (`quick`, `fix`, `feature`, `high-risk`) tailoring validation rigor to change impact without unnecessary friction.
26
+ - 🛡️ **Hardened Trust Boundaries & Safety Gates**: Authenticated HMAC spending tokens (`BillableActionGate`), realpath symlink enforcement, pre-commit secret blocking, and automated credential masking.
27
+ - 🔄 **Incremental Specs & Conflict Detection**: Structured `ADDED`/`MODIFIED`/`REMOVED` declarations and offline `gemstack spec merge` to mechanically detect contract collisions before merging branches.
28
+ - 📜 **Formal Contract Amendments**: Replaces silent contract tampering with signed, auditable amendment records (`src/lib/contract-amendments.js`).
29
+ - 🩺 **Offline Health & Dependency Auditor**: `gemstack doctor` scans for orphans, undeclared packages, and local circular imports in milliseconds without network calls.
30
+ - 🧠 **Context Fatigue Detection & Persistent Memory**: Monitors token accumulation, prunes ephemeral noise, and cross-verifies `handoff.md` against git commit history.
31
+ - 🐝 **Agent Swarm Planning**: Compiles tasks into deterministic execution waves with disjoint write partition ownership.
32
+ - 👁️ **Visual QA Verification**: Disk-recomputed SHA-256 evidence hashing with offline tolerance-bounded diffing and neutral masking.
33
+ - 📦 **Zero Dependencies**: 100% native Node.js standard library with 0 runtime and 0 dev npm dependencies.
29
34
 
30
35
  ## 🚀 Quickstart
31
36
 
32
- Start a new project or upgrade an existing one in seconds:
37
+ Start a new project or upgrade an existing one in seconds with **Gemstack v2.0.0**:
33
38
 
34
39
  ```bash
35
40
  # Initialize Gemstack in your current repository
@@ -60,14 +65,25 @@ Gemstack works by providing an **Operating System** for your LLM via markdown fi
60
65
  5. `/review` -> The AI reviews the diffs against the `03-gemstack-security.md` rules.
61
66
  6. `/handoff` -> The AI saves its memory to `handoff.md` so you can close your laptop and resume flawlessly tomorrow.
62
67
 
63
- ## 🛡️ Military-Grade Security Shield
68
+ ## 🛡️ Security Architecture & Safety Gates
64
69
 
65
- Gemstack ships with `03-gemstack-security.md` and `04-gemstack-infrastructure.md`, rulebooks extracted from high-compliance SaaS and Cloud Native environments (OWASP, NIST). When you run `/cso` or `/review`, the AI strictly checks for:
70
+ Gemstack ships with `03-gemstack-security.md` and `04-gemstack-infrastructure.md`, rulebooks based on high-compliance SaaS and Cloud Native standards (OWASP, NIST). When you run `/cso` or `/review`, the AI systematically checks for:
66
71
  - **AppSec (Level 2)**: IDOR Protection, Race Condition prevention, CSRF/SSRF blocking, Rate Limiting, and Audit Trails.
67
72
  - **Zero Trust Secrets**: Hardcoded keys are blocked.
68
73
  - **DevSecOps & Infra**: Enforces Immutable Infrastructure (Docker/Terraform), Private Subnets (VPC), IAM Least Privilege, and Cloud Secret Managers.
69
74
  - **Server-Side Validation**: Complete distrust of frontend state.
70
75
 
76
+ ### Control & Verification Matrix
77
+
78
+ | Control | Scope | Test Verification | Boundary Limit |
79
+ |---|---|---|---|
80
+ | **Spec-Driven Development (SDD)** | Architectural alignment and phase gating | Cryptographic phase hashes (`gemstack verify`) | Does not prevent human commit of unapproved manual diffs outside the CLI |
81
+ | **Filesystem Traversal & Symlink Defense** | Scaffolding, backup, install, and visual QA writes | Realpath resolution and confined atomic writes (`tests/security-p0-hardening.test.js`) | Local OS processes with root privileges outside Gemstack CLI process boundaries |
82
+ | **Secret Scanning & Hook Preservation** | Local git commits and CI pipelines | Multi-provider regex scanning and pre-commit wrapper chaining (`scripts/ci/check-secrets.js`) | Only inspects staged text files; does not inspect compiled binary blobs or external networks |
83
+ | **Spending & Cost Safety Gates** | Billable agent API and model execution | HMAC token verification, cumulative budget tracking, positive unit bounds (`src/lib/safety-gates.js`) | Enforced on calls through ProviderBoundary; does not intercept direct outbound curl requests |
84
+ | **Visual QA Evidence Verification** | UI screenshots and regression detection | Disk-computed SHA-256 and pluggable diff adapter; UNVERIFIED fallback (`src/lib/visual-qa.js`) | Diff accuracy depends on adapter engine; static hashes detect file modification only |
85
+ | **Agent Rulebooks & AppSec Guidance** | Agent context prompts during review & planning | CSO audit scripts and rule templates (`.agents/rules/03-gemstack-security.md`) | Agent guidance is advisory; mechanical enforcement requires CLI verify and CI gates |
86
+
71
87
  ## 🔒 Architecture Consistency & Phase Freezing
72
88
 
73
89
  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:
@@ -118,6 +134,7 @@ Gemstack Upgrade C guarantees fail-closed safety for commercial, remote, and AI
118
134
  - **Environment Safety**: Commercial provider execution is forbidden in `test` and `ci` environments.
119
135
  - **Trusted Mock Boundaries**: Test mocks operate strictly in memory with zero network escapes.
120
136
  - **Offline Purity**: `gemstack verify` runs 100% offline with zero external network or provider charges.
137
+ - **Core Invariant**: `NO PROOF OF AUTHORIZATION = NO COMMERCIAL EXECUTION`.
121
138
 
122
139
  ## 📦 Context Capsule & Compression
123
140
 
@@ -130,18 +147,73 @@ Gemstack Upgrade D enables deterministic, constraint-lossless context compressio
130
147
  - **Size Budgeting**: 32 KB target budget with deterministic priority condensation and 64 KB fail-closed hard cap.
131
148
  - **`gemstack context show`**: Displays human-readable continuation context summary or raw JSON.
132
149
  - **`gemstack context verify`**: Read-only validation of context capsule freshness and integrity.
150
+ - **Core Invariant**: `Context Capsule = derived continuation context NOT project authority`.
151
+
152
+ ## 🐝 Agent Swarm Planning & Validation
153
+
154
+ Gemstack Upgrade E introduces deterministic multi-worker planning and write-set partition validation:
155
+ - **`gemstack swarm plan`**: Compiles parallelizable `tasks.md` items into deterministic concurrent waves in `specs/<feature>/swarm.json`.
156
+ - **Exclusive Write Boundaries**: Validates that concurrent tasks possess strictly disjoint write sets (`write_set(T1) ∩ write_set(T2) = ∅`), mathematically preventing write collisions.
157
+ - **Collision Avoidance**: Overlapping write sets are automatically serialized into sequential waves (`SWARM_WRITE_COLLISION_PREVENTED`).
158
+ - **Separation of Duties Gate**: Non-waivable mechanical check enforcing `author != reviewer` on all task reviews (`SWARM_SELF_REVIEW_DETECTED`).
159
+ - **Task-Scoped Context Projections**: Projects minimal, structured context payloads derived from `context-capsule.json` without raw chat transcripts or prompt noise.
160
+ - **Provider & Budget Integration**: Intercepts model invocations via Upgrade C `ProviderCapabilityGate` and `BillableActionGate` to prevent budget breaches.
161
+ - **`gemstack swarm validate`**: Pure read-only validation of wave partitions, task ownership, and review independence.
162
+ - **Explicit Boundary**: *Gemstack core coordinates and validates; Gemstack core does NOT execute autonomous coding agents.*
163
+
164
+ ## 👁️ Visual QA Evidence & Offline Verification
165
+
166
+ Gemstack Upgrade E provides mechanical visual verification grounded in cryptographic digests and offline comparisons:
167
+ - **Canonical Visual Manifest (`visual-qa.json`)**: Declares scenario routes, deterministic viewports, selector masks, baseline digests, and diff tolerances.
168
+ - **Deterministic Viewports**: Standardized profiles (Desktop, Mobile, Tablet) with locked width, height, and device scale factor.
169
+ - **Cryptographic Baseline Hashing**: Baselines are tracked and pinned via canonical SHA-256 hashes (`image_sha256`); flags disk tampering (`VQA_BASELINE_TAMPERED`).
170
+ - **Neutral & Secret Masking**: Eliminates dynamic timestamp/counter diff flakiness (`[MASKED_NEUTRAL]`) and enforces mandatory automatic masking on password and credential fields (`[MASKED_SECRET]`).
171
+ - **Structured Evidence Comparison**: Fast SHA-256 match path with offline tolerance-bounded diffing (`max_diff_percentage`).
172
+ - **Explicit Promotion Semantics**: Baselines are NEVER auto-updated or healed during test or verify; requires explicit `gemstack vqa promote <scenario-id>`.
173
+ - **`gemstack vqa validate`**: Pure read-only offline validation of manifests, baselines, and evidence completeness.
174
+ - **Explicit Boundary**: *Gemstack core inspects and diffs evidence; Gemstack core does NOT launch browsers and does NOT capture screenshots automatically. Capture remains external/adapted.*
175
+
176
+ ## 🏛️ Architectural Principles
177
+
178
+ Gemstack operates on strict, non-negotiable architectural principles:
179
+
180
+ ```text
181
+ authority > derived artifacts
182
+ evidence ≠ authority
183
+ verify = validate
184
+ agent output ≠ architecture
185
+ visual evidence ≠ architecture
186
+ credentials ≠ authorization
187
+ provider availability ≠ permission
188
+ unknown cost ≠ free
189
+ fallback ≠ inherited authorization
190
+ agent says done ≠ task mechanically complete
191
+ author ≠ reviewer where independent review is required
192
+ ```
133
193
 
134
- ## 🐝 Advanced Autonomy (The WOW Update)
194
+ ## 💻 CLI Reference
135
195
 
136
- Gemstack isn't just passive documents; it actively orchestrates agentic capabilities:
196
+ Gemstack provides a focused, deterministic CLI surface:
137
197
 
138
- | Command | Action |
139
- |---------|--------|
140
- | `/swarm` | Orchestrates parallel subagents for tasks marked `[P]` |
141
- | `/qa-visual` | Spawns sandbox browsers to visually assert Acceptance Criteria |
142
- | `/dashboard` | Generates a rich, interactive inline UI of your project's progress |
143
- | `/heal` | Hooks into GitHub CLI (`gh`) to read failing CI logs and auto-push fixes |
144
- | `/sandbox` | Wraps risky AI execution inside an ephemeral Docker container |
198
+ ```bash
199
+ # Core verification & collection
200
+ gemstack verify [--json] [--target <dir>] # 6-stage read-only audit (0 mutations, 0 network)
201
+ gemstack collect [--target <dir>] # Executes test runner & records closure.json
202
+ gemstack ship [--target <dir>] # Transitions lifecycle to SHIPPED if closure is VERIFIED
203
+
204
+ # Context capsule (Upgrade D)
205
+ gemstack context generate [--force] # Compiles deterministic context-capsule.json
206
+ gemstack context show [--raw] # Displays continuation context summary or JSON
207
+ gemstack context verify # Verifies capsule freshness and provenance
208
+
209
+ # Agent swarm (Upgrade E)
210
+ gemstack swarm plan [--json] # Compiles tasks into disjoint concurrent waves
211
+ gemstack swarm validate [--json] # Validates write sets and review attestations
212
+
213
+ # Visual QA (Upgrade E)
214
+ gemstack vqa validate [--json] # Validates visual manifest, viewports, and baselines
215
+ gemstack vqa promote <scenario-id> # Explicitly promotes live evidence to baseline
216
+ ```
145
217
 
146
218
  ## 🪝 Active Security (Git Hooks)
147
219
 
@@ -157,6 +229,7 @@ You can install agent skills created by the community directly into your project
157
229
  npx gemstack-ai install https://raw.githubusercontent.com/community/gemstack-skills/main/django-expert/SKILL.md
158
230
  ```
159
231
 
232
+
160
233
  ## 🤖 MCP Server (Model Context Protocol)
161
234
 
162
235
  Gemstack ships with a built-in MCP server that exposes the SDD state of your project to any MCP-compliant AI client (like Claude Desktop or Cursor).
@@ -173,6 +246,24 @@ Add the following to your MCP client configuration:
173
246
  }
174
247
  ```
175
248
 
249
+ ## 📜 Version History & Release Highlights
250
+
251
+ Gemstack tracks every architectural enhancement through verifiable milestones:
252
+
253
+ | Version | Milestone & Core Highlights | Canonical Tests | Status |
254
+ | :--- | :--- | :--- | :--- |
255
+ | **`v2.0.0`** | **Security Hardening, Adaptable SDD & Persistent Memory**<br/>• Strict symlink realpath confinement & remote skill SHA-256 verification.<br/>• HMAC-authenticated spending tokens & disk-recomputed visual evidence.<br/>• 4 SDD Rigor levels (`quick`, `fix`, `feature`, `high-risk`) & incremental spec deltas.<br/>• Signed contract amendments & offline collision detection (`gemstack spec merge`).<br/>• Context fatigue detection, offline dependency auditor, & git-memory cross-audit. | **180 physical tests / 23 suites** | **Current Stable** |
256
+ | **`v1.4.0`** | **Agent Swarm Planning & Visual QA Evidence Checkpoint**<br/>• Multi-worker wave planning with disjoint write partitions (`swarm.json`).<br/>• Separation of duties gate (`author != reviewer`) and subagent limits.<br/>• Offline Visual QA manifest, deterministic viewports, & auto-secret masking. | **126 physical tests / 14 suites** | Superseded by v2.0.0 |
257
+ | **`v1.3.0`** | **Cost & Provider Safety Gates + Context Capsule**<br/>• `ProviderCapabilityGate` and `BillableActionGate` (NO PROOF = NO EXECUTION).<br/>• Deterministic context capsule compression with 32KB budget. | **100 physical tests / 25 suites** | Superseded by v1.4.0 |
258
+ | **`v1.2.0`** | **Mechanical Test Matrix & Closure Evidence**<br/>• Canonical acceptance matrices, mutating collector (`gemstack collect`), & `closure.json`.<br/>• Zero-shell TAP test runner & exact reconciliation arithmetic. | **53 physical tests / 11 suites** | Superseded by v1.3.0 |
259
+ | **`v1.1.2`** | **Architecture Consistency Engine & Phase Freezing**<br/>• Cryptographic SHA-256 phase freezing (`spec.md` -> `plan.md` -> `tasks.md`).<br/>• 6 canonical contract types & context-bound accepted exceptions. | **33 physical tests** | Superseded by v1.2.0 |
260
+ | **`v1.0.2`** | **Zero Silent Failures & Intent Routing**<br/>• Constitution update prohibiting `2>nul` silent masking in test runners.<br/>• Semantic intent-based routing and unified `gemstack verify` command. | **8 physical tests** | Superseded by v1.1.2 |
261
+ | **`v0.3.0`** | **Cross-Platform CI & Supply-Chain Hardening**<br/>• Multi-OS GitHub Actions workflows and zero-dependency CI verification scripts. | Unit + Smoke suites | Superseded by v1.0.2 |
262
+ | **`v0.2.0`** | **Zero-Dependency CLI & Scaffolding Engine**<br/>• Local-first `gemstack init` and `gemstack update` with automated rollback backups. | Native node:test suite | Superseded by v0.3.0 |
263
+ | **`v0.1.0`** | **Initial Antigravity Spec-Driven Development Framework**<br/>• Foundational 13 skills, Constitution rulebooks, and SecureDocs anti-IDOR demo app. | Demo smoke tests | Superseded by v0.2.0 |
264
+
265
+ For full historical details and upgrade guides, see [CHANGELOG.md](CHANGELOG.md) and [RELEASE_NOTES.md](RELEASE_NOTES.md).
266
+
176
267
  ## 📚 Documentation
177
268
 
178
269
  Dive deeper into the Gemstack architecture:
package/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # Gemstack Release Notes
2
2
 
3
+ # Gemstack v2.0.0 — Security Hardening, Adaptable SDD & Persistent Memory
4
+
5
+ ## Highlights
6
+
7
+ ### Gemstack 2.0 Architectural Milestone
8
+ Gemstack 2.0 converts declarative conventions into reproducible cryptographic and runtime guarantees:
9
+
10
+ ### Sprint A: P0 Trust Boundaries & Hardening
11
+ - **Strict Symlink Traversal Elimination**: Replaced lax normalization with `resolveSafeStrict` (`fs.realpathSync`) to permanently eliminate symlink escapes.
12
+ - **Remote Skill Provenance & Checksums**: Enforces `allowed_sources` and SHA-256 verification before installing community skills.
13
+ - **Git Pre-commit Hook Hardening**: Zero-dependency regex secret blocking directly inside native Git hooks.
14
+ - **Environment & Log Sanitization**: Scrubbed process environments and redacted sensitive credentials in all output logs.
15
+
16
+ ### Sprint B: P1 Honest Evidence & Reliable Metrics
17
+ - **Cryptographic Billable Token Boundary**: Implemented HMAC-SHA256 authenticated spending tokens, cumulative budget verification, positive unit validation, and strict scope binding.
18
+ - **Visual QA Evidence Verification**: Forced disk re-computation of screenshot hashes; rejected self-declared diffs without a registered visual diff adapter (`UNVERIFIED` fallback).
19
+ - **Pre-Persistence Secret Masking**: Added credential masking before visual evidence is written to disk.
20
+ - **Public Control Matrix**: Replaced all ungrounded superlatives with the public `Control / Scope / Test / Limit` matrix across `README.md` and security rules.
21
+ - **GitHub Actions Hardening**: Pinned all workflow actions to 40-character commit SHAs with explicit least-privilege `permissions: contents: read` and clean `npm ci`.
22
+
23
+ ### Sprint C: P2 Adaptable SDD & Incremental Specs
24
+ - **Four Rigor Levels**: `quick` (single-artifact lightweight mode), `fix` (linked regression test), `feature` (standard 3-phase SDD), and `high-risk` (threat model, rollback plan, and dual human approvals).
25
+ - **Incremental Spec Deltas**: Structured `ADDED`, `MODIFIED`, and `REMOVED` declarations preventing destructive clobbering of base specifications.
26
+ - **Spec Merge & Conflict Detection**: `gemstack spec merge` detects colliding contracts and duplicate canonical test IDs before merging branches.
27
+ - **Formal Contract Amendments**: Replaces silent contract mutations with signed, auditable amendment records (`src/lib/contract-amendments.js`).
28
+
29
+ ### Sprint D: P3 Efficient Context & Persistent Memory
30
+ - **Context Fatigue Detector & Noise Pruning**: Monitors token accumulation and redundancy; deterministically prunes ephemeral chatter while preserving contracts and decisions.
31
+ - **Offline Dependency Auditor in `gemstack doctor`**: Scans dependencies offline for orphans, undeclared imports, and circular cycles in <10ms without network calls.
32
+ - **Memory Cross-Verification in `gemstack verify`**: Reconciles recent git commits against `handoff.md` to prevent unrecorded work from being lost across sessions.
33
+
34
+ ## Acceptance & Regression Baseline
35
+ - 180 total physical tests passing across 23 explicitly enumerated suites with 0 failures and 0 skipped.
36
+ - Full CI suite (`npm run ci:all`) passing cleanly.
37
+ - `gemstack verify` exit code 0 with 0 errors and 0 open blockers.
38
+ - Zero runtime dependencies maintained (`dependencies: {}`).
39
+
40
+ ---
41
+
42
+ # Gemstack v1.4.0 — Agent Swarm & Visual QA
43
+
44
+ ## Highlights
45
+
46
+ ### Upgrade E — Agent Swarm Planning & Validation
47
+ - **Deterministic Multi-Worker Planning**: Compiles parallelizable `tasks.md` items into deterministic, phased execution waves recorded in canonical `swarm.json`.
48
+ - **Task Ownership & Exclusive Write Boundaries**: Validates that concurrent tasks possess strictly disjoint file write partitions (`write_set(T1) ∩ write_set(T2) = ∅`), completely preventing parallel write collisions.
49
+ - **Automatic Collision Avoidance**: Automatically serializes conflicting tasks into sequential waves during planning (`SWARM_WRITE_COLLISION_PREVENTED`).
50
+ - **Separation of Duties Gate**: Non-waivable mechanical check enforcing `author != reviewer` on all task reviews (`SWARM_SELF_REVIEW_DETECTED`).
51
+ - **Task-Scoped Context Projections**: Projects minimal, structured context payloads derived from Upgrade D `context-capsule.json` with conversational narrative and raw chat transcripts strictly excluded.
52
+ - **Cryptographic Provenance & Freshness**: Pinned `source_capsule_hash` ensures workers operate against verified project state; flags drift fail-closed (`SWARM_CONTEXT_STALE`).
53
+ - **Provider & Budget Gating**: Intercepts model invocations via Upgrade C `ProviderCapabilityGate` and `BillableActionGate` to prevent runaway spending across concurrent workers.
54
+ - **Worker Limits**: Prevents recursive child agent spawning (`SWARM_RECURSIVE_SPAWN_DENIED`).
55
+ - **Explicit Invariant**: Gemstack core coordinates and validates; it does NOT execute autonomous coding agents.
56
+
57
+ ### Upgrade E — Visual QA Evidence & Offline Verification
58
+ - **Canonical Visual QA Manifest (`visual-qa.json`)**: Declares explicit routes, deterministic viewports, selector masks, baseline references, and diff tolerances.
59
+ - **Deterministic Viewport Specifications**: Locks standardized viewport profiles (Desktop, Mobile, Tablet) with explicit width, height, and device scale factor.
60
+ - **Cryptographic Baseline Hashing**: Baselines are tracked and verified via canonical SHA-256 byte digests (`image_sha256`); flags disk tampering (`VQA_BASELINE_TAMPERED`).
61
+ - **Neutral & Secret Selector Masking**: Neutral masks (`[MASKED_NEUTRAL]`) eliminate font/timestamp flakiness; mandatory automatic masking replaces sensitive input fields (`type=password`) with `[MASKED_SECRET]`.
62
+ - **Structured Evidence Comparison**: Fast SHA-256 digest comparison with offline tolerance-bounded diffing (`max_diff_percentage`).
63
+ - **Explicit Baseline Promotion**: Baselines are NEVER mutated during verification; updates require explicit `gemstack vqa promote <scenario-id>`.
64
+ - **Pure Offline Verification (Stages 5.3 & 5.4)**: `gemstack verify` runs 100% offline with zero browser launches, zero network calls, and zero file mutations.
65
+ - **Explicit Invariant**: Gemstack core inspects evidence; it does NOT launch browsers or capture screenshots.
66
+
67
+ ## Acceptance & Regression Baseline
68
+ - 25 Upgrade A canonical acceptance tests passing.
69
+ - 20 Upgrade B canonical acceptance tests passing.
70
+ - 20 Upgrade C canonical acceptance tests passing.
71
+ - 20 Upgrade D canonical acceptance tests passing.
72
+ - 20 Upgrade E canonical acceptance tests passing (`TEST-SWARM-A01`..`E02`, `TEST-VISUAL-A01`..`E02`).
73
+ - 10 Upgrade E bootstrap contracts passing.
74
+ - 26 Upgrade E adversarial cases passing.
75
+ - 105 total canonical acceptance tests passing.
76
+ - 126 total physical tests passing across 14 explicitly enumerated suites with 0 failures and 0 skipped.
77
+ - Full CI suite (`npm run ci:all`) passing cleanly.
78
+ - Upgrade E closed with closure status `VERIFIED`.
79
+
80
+ ---
81
+
3
82
  # Gemstack v1.3.0 — Cost & Provider Safety Gates + Context Capsule
4
83
 
5
84
  ## Highlights
@@ -19,7 +98,7 @@
19
98
  - **Constraint-Lossless Compression**: 100% of normative behavioral constraints (`MUST`, `MUST NOT`), frozen architectural contracts, and acceptance criteria survive compression without semantic loss.
20
99
  - **Canonical Authority Precedence**: Authoritative repository artifacts unconditionally govern over derived capsule claims (`SPEC` > `PLAN` > `TASKS` > implementation).
21
100
  - **Cryptographic Provenance & Drift Detection**: Live SHA-256 source digests detect artifact modifications or tampering immediately (`STALE` / `TAMPERED`).
22
- - **Strict Secrets Barrier**: Automated regex scanner blocks credential properties (`apiKey`, `token`, `secret`, `clientSecret`), token patterns (`sk-...`, `AIza...`, `ghp_...`), private keys, and `.env` references.
101
+ - **Strict Secrets Barrier**: Automated regex scanner blocks credential properties (`apiKey`, `token`, `secret`, `clientSecret`), token patterns (`sk-...`, `AIza...`, GitHub/Slack tokens), private keys, and `.env` references.
23
102
  - **Deterministic Size Budgeting**: 32 KB target budget with prioritized 3-tier condensation and a 64 KB hard fail-closed limit.
24
103
  - **Read-Only Verification (Stage 5.2)**: `gemstack verify` inspects context capsule freshness without modifying or rewriting disk state.
25
104
  - **CLI Commands**: `gemstack context generate`, `gemstack context show`, and `gemstack context verify`.
package/handoff.md CHANGED
@@ -15,25 +15,38 @@ Evolucionar Gemstack incorporando el feedback de producción real de proyectos a
15
15
  - Gates `ProviderCapabilityGate` y `BillableActionGate` implementados con fail-closed default deny.
16
16
  - Cost ledger (`cost-ledger.json`) validado, offline verification purity garantizada.
17
17
  - **Upgrade D (Context Capsule / Context Compression)**: CERRADO Y VERIFICADO (`closure.json` status `VERIFIED`, capsule `VALID` y `FRESH`).
18
- - 20/20 pruebas canónicas de Upgrade D pasando al 100% en 8 suites dedicadas.
19
- - Serializador canónico determinista, defensa de secretos fail-closed, presupuesto 32KB/64KB.
20
- - Comandos CLI `gemstack context` y etapa 5.2 en `gemstack verify`.
21
- - 100/100 pruebas físicas totales pasando en 25 suites sin dependencias externas.
22
- - Preparado para release estable `v1.3.0`.
18
+ - **Upgrade E (Agent Swarm & Visual QA)**: CERRADO Y VERIFICADO (`v1.4.0`).
19
+ - **Gemstack 2.0 Sprint A (P0 Trust Boundaries & Hardening)**: CERRADO Y ENVIADO (commit `ba58055`).
20
+ - Resolución de symlinks arbitrarios con `resolveSafeStrict` y denegación de rutas fuera de root.
21
+ - Validación e integridad de skills remotos vía SHA-256 (`allowed_sources`).
22
+ - Pre-commit hooks con bloqueo nativo de secretos.
23
+ - Sanitización de variables de entorno y redacción estricta en logs.
24
+ - **Gemstack 2.0 Sprint B (P1 Honest Evidence & Reliable Metrics)**: CERRADO Y ENVIADO (commit `2bf9157`).
25
+ - 14/14 pruebas canónicas aprobadas en `tests/honest-evidence-p1.test.js` (155 tests totales en 23 suites).
26
+ - Tokens de gasto autenticados con HMAC y validación de presupuestos acumulativos en `BillableActionGate`.
27
+ - Recálculo obligatorio de hashes de evidencia visual desde disco y degradación a `UNVERIFIED` en diff sin adaptador gráfico real.
28
+ - Redacción previa de secretos y credenciales en evidencias antes de persistir en disco.
29
+ - Eliminación de declaraciones superlativas sin evidencia; publicación de matriz 4-columnas `Control / Scope / Test / Limit` en README y reglas.
30
+ - Pinned GitHub Actions a commit SHAs de 40 dígitos con least-privilege `contents: read`.
31
+ - **Gemstack 2.0 Sprint C (SDD Adaptable & Specs Incrementales)**: CERRADO Y ENVIADO (commit `443ae6c`).
32
+ - 13/13 pruebas canónicas aprobadas en `tests/adaptable-sdd-p1.test.js`.
33
+ - Cuatro niveles de rigor formalizados: `quick`, `fix`, `feature`, `high-risk`.
34
+ - Declaración y aplicación de deltas incrementales `ADDED`, `MODIFIED`, `REMOVED`.
35
+ - Detección offline de colisiones de contratos y duplicados de tests (`gemstack spec merge`).
36
+ - Enmiendas auditables y firmadas criptográficamente para contratos congelados (`src/lib/contract-amendments.js`).
37
+ - **Gemstack 2.0 Sprint D (Contexto Eficiente y Memoria Persistente)**: CERRADO Y VERIFICADO.
38
+ - 12/12 pruebas canónicas aprobadas en `tests/context-memory-p1.test.js` (180 tests totales en 23 suites).
39
+ - Detección de fatiga de contexto y poda determinista de ruido (`src/lib/context-fatigue.js`).
40
+ - Auditoría offline de dependencias huérfanas, no declaradas y ciclos circulares en `gemstack doctor` (`src/lib/dependency-audit.js`).
41
+ - Verificación cruzada entre commits de Git y secciones de `handoff.md` en `gemstack verify` (`src/lib/memory-audit.js`).
42
+ - Eliminación estricta de ruido conversacional y presupuesto determinista (< 32KB) en context capsules.
23
43
 
24
44
  ## 3. Archivos y cambios
25
- - `src/lib/test-matrix.js`: Parser de `gemstack-test-matrix`, validación de esquema de 20 tests canónicos y cálculo de `acceptanceSignature` canónico SHA-256.
26
- - `src/lib/closure-context.js`: Parser de bindings y gates de `plan.md`, metadatos de `tasks.md`, trazabilidad bidireccional, resolución de `RelevantClosureFiles`, `computeContentAggregateHash` y cálculo de `closureContextHash`.
27
- - `src/lib/runner-adapters.js`: Adaptador nativo seguro de runner `node:test`, parser TAP de resultados, motor de reconciliación aritmética canónica, ejecutor seguro de compuertas `PACKAGE_SCRIPT` y serializador atómico de `closure.json`.
28
- - `src/commands/collect.js`: Comando mutador dedicado que ejecuta tests y gates para generar `specs/<feature>/closure.json`.
29
- - `src/commands/ship.js`: Compuerta de transición a `SHIPPED` que exige evidencia de cierre fresca y verificada.
30
- - `src/commands/verify.js`: Etapa 5/6 agregada de verificación de evidencia mecánica de cierre en modo estrictamente de solo lectura (0 mutaciones en disco).
31
- - `src/cli.js`: Registro de comandos `collect` y `ship`.
32
- - `specs/007-mechanical-test-matrix-closure-evidence/`: Artefactos congelados `spec.md`, `plan.md`, `tasks.md` y evidencia de cierre generada `closure.json`.
33
- - `tests/`: 6 nuevas suites de prueba (`test-matrix.test.js`, `reconciliation.test.js`, `runner-adapter.test.js`, `traceability.test.js`, `closure-manifest.test.js`, `closure-gates.test.js`).
34
- - `specs/templates/`: Actualizadas plantillas de `spec.md`, `plan.md` y `tasks.md` con bloques canónicos de Upgrade B.
35
- - `.agents/skills/`: Actualizados skills (`gemstack-spec`, `gemstack-plan`, `gemstack-tasks`, `gemstack-qa`, `gemstack-ship`).
36
- - `docs/`, `README.md`, `package.json`: Documentación técnica y script de test con enumeración explícita de las 11 suites físicas.
45
+ - `src/lib/sdd-rigor.js`, `src/lib/spec-delta.js`, `src/lib/spec-merge.js`, `src/lib/contract-amendments.js`, `src/commands/spec.js`: Motores de rigor adaptable, deltas incrementales, fusión de especificaciones y enmiendas de contratos.
46
+ - `src/lib/context-fatigue.js`, `src/lib/dependency-audit.js`, `src/lib/memory-audit.js`: Motores de fatiga de contexto, auditoría offline de dependencias y auditoría cruzada de memoria con Git.
47
+ - `src/commands/doctor.js`, `src/commands/verify.js`, `src/cli.js`: Integración de auditoría offline de dependencias, verificación de memoria y registro de CLI `spec`.
48
+ - `tests/adaptable-sdd-p1.test.js`, `tests/context-memory-p1.test.js`: Suites de prueba canónicas P1 para Sprint C y Sprint D.
49
+ - `specs/013-gemstack-2.0-adaptable-sdd/`, `specs/014-gemstack-2.0-context-memory/`: Especificaciones formales, planes, tareas y manifiestos de cierre verificados mecánicamente.
37
50
 
38
51
  ## 4. Intentos fallidos
39
52
  - Se confirmó en proyectos reales que scripts de prueba con sintaxis `2>nul` en `package.json` provocan que PowerShell/Bash enmascaren errores y retornen código de salida 0 con 0 tests ejecutados. Ahora esto es detectado como error por `gemstack verify` y prohibido en la Constitución.
@@ -41,7 +54,8 @@ Evolucionar Gemstack incorporando el feedback de producción real de proyectos a
41
54
  - **Node 20+ Subprocess Recursion**: Al ejecutar `node --test` como subproceso desde un proceso de test runner, `process.env.NODE_TEST_CONTEXT` suprimía la ejecución de archivos hijos con warning de recursión. Se resolvió sanitizando las variables `NODE_TEST_CONTEXT` y `NODE_TEST_WORKER_ID` en el entorno del proceso hijo.
42
55
  - **Windows spawn 'npm.cmd' EINVAL**: Node 22+ en Windows genera `EINVAL` al invocar `spawn('npm.cmd', ..., { shell: false })`. Se resolvió ejecutando directamente el binario `npm-cli.js` vía `process.execPath` cuando se detecta en Windows, respetando la regla constitucional de `shell: false`.
43
56
  - **Closure Manifest Self-Reference**: Al incluir `specs/<feature>/closure.json` en los archivos de implementación de `tasks.md`, `closureContextHash` cambiaba cada vez que `closure.json` era escrito, provocando que la evidencia se marcara como `STALE` inmediatamente después de recolectarse. Se resolvió excluyendo explícitamente `closure.json` de la agregación de hashes de contexto de implementación (`implementationContextHash`).
57
+ - **Memory Cross-Audit Missing Section Handling**: En `crossAuditMemoryWithGit`, lanzar un `Error` no capturado interrumpía la secuencia de verificación de `verify.js`. Se resolvió retornando un objeto de resultado `{ valid: false, handoff_intact: false, error }`, permitiendo que el framework acumule los fallos según el protocolo constitucional sin abortar abruptamente.
44
58
 
45
59
  ## 5. Próximos pasos
46
- 1. Completar la publicación y git tag de la versión minor `v1.3.0`.
47
- 2. Proceder a Upgrade E (SPEC ONLY) una vez autorizada la fase siguiente.
60
+ 1. Preparar la release `v2.0.0-alpha` unificando las 4 etapas de hardening de Gemstack 2.0 (Sprints A, B, C, D).
61
+ 2. Publicación de notas de release destacando las nuevas garantías de seguridad, rigores adaptables y auditorías offline.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemstack-ai",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "Agentic Spec-Driven Development framework for Gemini/Antigravity",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -10,16 +10,17 @@
10
10
  "node": ">=18.18.0"
11
11
  },
12
12
  "scripts": {
13
- "test": "node --test tests/contracts.test.js tests/hasher.test.js tests/findings.test.js tests/init.test.js tests/verify.test.js tests/test-matrix.test.js tests/reconciliation.test.js tests/runner-adapter.test.js tests/traceability.test.js tests/closure-manifest.test.js tests/closure-gates.test.js tests/cost-ledger.test.js tests/environment-provider-safety.test.js tests/provider-capability-gate.test.js tests/billable-action-gate.test.js tests/provider-fallback.test.js tests/verification-purity-cost.test.js tests/context-determinism.test.js tests/context-authority.test.js tests/context-freshness.test.js tests/context-constraints.test.js tests/context-secrets.test.js tests/context-size-budget.test.js tests/context-purity.test.js tests/context-legacy.test.js",
13
+ "test": "node --test tests/contracts.test.js tests/hasher.test.js tests/findings.test.js tests/init.test.js tests/verify.test.js tests/test-matrix.test.js tests/reconciliation.test.js tests/runner-adapter.test.js tests/traceability.test.js tests/closure-manifest.test.js tests/closure-gates.test.js tests/cost-ledger.test.js tests/environment-provider-safety.test.js tests/provider-capability-gate.test.js tests/billable-action-gate.test.js tests/provider-fallback.test.js tests/verification-purity-cost.test.js tests/context-determinism.test.js tests/context-authority.test.js tests/context-freshness.test.js tests/context-constraints.test.js tests/context-secrets.test.js tests/context-size-budget.test.js tests/context-purity.test.js tests/context-legacy.test.js tests/swarm-partitioning.test.js tests/swarm-review.test.js tests/visual-manifest.test.js tests/visual-diff.test.js tests/swarm-visual-purity.test.js tests/security-p0-hardening.test.js tests/honest-evidence-p1.test.js tests/adaptable-sdd-p1.test.js tests/context-memory-p1.test.js",
14
14
  "gemstack:verify": "node src/cli.js verify",
15
15
  "pack:dry": "npm pack --dry-run",
16
16
  "ci:frontmatter": "node scripts/ci/check-frontmatter.js",
17
17
  "ci:template": "node scripts/ci/check-template-clean.js",
18
18
  "ci:mojibake": "node scripts/ci/check-mojibake.js",
19
19
  "ci:package": "node scripts/ci/check-package-contents.js",
20
+ "ci:secrets": "node scripts/ci/check-secrets.js",
20
21
  "ci:smoke": "node scripts/ci/smoke-cli.js",
21
22
  "ci:demo": "npm --prefix demo-app install && npm --prefix demo-app run smoke",
22
- "ci:all": "npm test && npm run ci:frontmatter && npm run ci:template && npm run ci:mojibake && npm run ci:package && npm run ci:smoke && npm run ci:demo"
23
+ "ci:all": "npm test && npm run ci:frontmatter && npm run ci:template && npm run ci:mojibake && npm run ci:package && npm run ci:secrets && npm run ci:smoke && npm run ci:demo"
23
24
  },
24
25
  "dependencies": {},
25
26
  "devDependencies": {}
@@ -8,7 +8,7 @@ try {
8
8
  const files = result[0].files.map(f => f.path.replace(/\\/g, '/'));
9
9
 
10
10
  const required = ['src/cli.js', 'template/handoff.md', 'README.md', 'LICENSE', 'CHANGELOG.md', 'RELEASE_NOTES.md', 'package.json'];
11
- const forbidden = ['node_modules', 'securedocs.sqlite', 'demo-app/node_modules', '.git/', 'demo-app/securedocs.sqlite'];
11
+ const forbidden = ['node_modules', 'securedocs.sqlite', 'demo-app/node_modules', '.git/', 'demo-app/securedocs.sqlite', '.tgz'];
12
12
 
13
13
  let hasError = false;
14
14
  for (const req of required) {