gemstack-ai 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.gemstack/state.json +11 -10
  2. package/CHANGELOG.md +97 -0
  3. package/README.md +89 -9
  4. package/RELEASE_NOTES.md +77 -0
  5. package/{gemstack-ai-1.2.0.tgz → gemstack-ai-1.4.0.tgz} +0 -0
  6. package/handoff.md +14 -12
  7. package/package.json +2 -2
  8. package/specs/008-cost-provider-safety-gates/.gemstack.json +5 -0
  9. package/specs/008-cost-provider-safety-gates/closure.json +59 -0
  10. package/specs/008-cost-provider-safety-gates/plan.md +456 -0
  11. package/specs/008-cost-provider-safety-gates/spec.md +633 -0
  12. package/specs/008-cost-provider-safety-gates/tasks.md +635 -0
  13. package/specs/009-context-capsule/closure.json +59 -0
  14. package/specs/009-context-capsule/context-capsule.json +428 -0
  15. package/specs/009-context-capsule/plan.md +663 -0
  16. package/specs/009-context-capsule/spec.md +913 -0
  17. package/specs/009-context-capsule/tasks.md +720 -0
  18. package/specs/010-agent-swarm-visual-qa/.gemstack.json +5 -0
  19. package/specs/010-agent-swarm-visual-qa/closure.json +59 -0
  20. package/specs/010-agent-swarm-visual-qa/plan.md +759 -0
  21. package/specs/010-agent-swarm-visual-qa/spec.md +842 -0
  22. package/specs/010-agent-swarm-visual-qa/swarm.json +49 -0
  23. package/specs/010-agent-swarm-visual-qa/tasks.md +873 -0
  24. package/specs/010-agent-swarm-visual-qa/visual-qa.json +41 -0
  25. package/src/cli.js +10 -0
  26. package/src/commands/context.js +95 -0
  27. package/src/commands/swarm.js +111 -0
  28. package/src/commands/verify.js +92 -0
  29. package/src/commands/visual.js +82 -0
  30. package/src/lib/closure-context.js +18 -1
  31. package/src/lib/context-capsule.js +594 -0
  32. package/src/lib/cost-ledger.js +355 -0
  33. package/src/lib/provider-boundary.js +186 -0
  34. package/src/lib/provider-registry.js +265 -0
  35. package/src/lib/safety-gates.js +277 -0
  36. package/src/lib/swarm.js +639 -0
  37. package/src/lib/visual-qa.js +499 -0
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "version": "0.1",
3
- "current_phase": "shipped",
3
+ "current_phase": "closure",
4
4
  "status": "SHIPPED",
5
- "stop_reason": "UPGRADE_B_SHIPPED_DONE",
6
- "active_spec": null,
5
+ "stop_reason": "UPGRADE_C_SHIPPED_DONE",
6
+ "active_spec": "specs/010-agent-swarm-visual-qa",
7
7
  "completed_phases": [
8
8
  "spec",
9
- "plan"
9
+ "plan",
10
+ "tasks"
10
11
  ],
11
12
  "phase_hashes": {
12
- "spec": "75f7b5aee9a7d45836128f619ba67d0870c9be3a2634d9152b01c6501faa513d",
13
- "plan": "c77a3b1410d3b3028b72d66db524c6a23b0998dce12dddaee2507b4e446aec3b",
14
- "tasks": "69ea9ae8557a41f98102c7b91905f74b3645ea59cbe301a54425216d5789b1d8"
13
+ "spec": "767c75151f9c53a70cfa6fcec85d29bccf5e3021004580878fb81ea3c4955ed7",
14
+ "plan": "d6f960f97bc6bcdb20daddc3c749c5f9f155c1407e0a8b81210cdf350bdad72c",
15
+ "tasks": "9931dda795d31bf29349ba5f20dc7631cb6a8974b91134ff577c57dd6b9aad7e"
15
16
  },
16
17
  "consistency": {
17
18
  "status": "PASS",
@@ -22,6 +23,6 @@
22
23
  "freeze": false,
23
24
  "allowed_paths": []
24
25
  },
25
- "last_update": "2026-09-11T16:49:53.470Z",
26
- "last_completed_feature": "specs/007-mechanical-test-matrix-closure-evidence/"
27
- }
26
+ "last_update": "2026-09-11T17:38:04.916Z",
27
+ "last_completed_feature": "specs/008-cost-provider-safety-gates"
28
+ }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,103 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [v1.4.0] - 2026-09-11
6
+
7
+ ### Added
8
+ - **Agent Swarm Planning & Validation (Upgrade E)**: Deterministic multi-worker wave planning and coordination verification framework.
9
+ - Deterministic swarm planning contracts and canonical `swarm.json` manifest schema.
10
+ - Task ownership and write-set partitioning: enforces disjoint write boundaries per wave (`write_set(T1) ∩ write_set(T2) = ∅`).
11
+ - Write-collision detection: automatically detects overlapping write sets and serializes conflicting tasks into sequential waves.
12
+ - Dependency wave scheduling: preserves task prerequisite graphs and rejects circular dependencies (`SWARM_DEPENDENCY_CYCLE`).
13
+ - Task-scoped context projections: compiles minimal, role-tailored contexts derived from `context-capsule.json`.
14
+ - Context freshness validation: verifies live capsule hash against `source_capsule_hash` to reject stale projections (`SWARM_CONTEXT_STALE`).
15
+ - Separation of duties gate: mechanically enforces `AUTHOR != REVIEWER` (`SWARM_SELF_REVIEW_DETECTED`).
16
+ - Provider policy and budget gating: integrates with Upgrade C `ProviderCapabilityGate` and `BillableActionGate` to prevent budget runaway.
17
+ - Subagent limits enforcement: strictly blocks unauthorized recursive worker spawning.
18
+ - Pure offline read-only verification (Stage 5.3 in `gemstack verify`): validates swarm manifests without worker or agent execution.
19
+ - Explicit non-execution invariant: Gemstack core does NOT execute autonomous coding agents.
20
+ - **Visual QA Evidence (Upgrade E)**: Mechanical, offline visual verification architecture based on cryptographic digests and neutral masking.
21
+ - Canonical `visual-qa.json` manifest schema declaring route, deterministic viewport dimensions, and approved baseline references.
22
+ - Deterministic viewport specifications: standard profiles with explicit width, height, and device scale factor.
23
+ - Cryptographic baseline pinning: baseline images tracked via canonical SHA-256 byte digests (`image_sha256`).
24
+ - Tampering detection: flags baseline image mutations on disk (`VQA_BASELINE_TAMPERED`).
25
+ - Neutral selector masking: masks dynamic elements (`[MASKED_NEUTRAL]`) to prevent flaky subpixel and timestamp diffs.
26
+ - Mandatory automatic password & credential masking: automatically replaces sensitive input fields (`type=password`, `data-sensitive=true`) with `[MASKED_SECRET]`.
27
+ - Structured visual evidence comparison: fast SHA-256 digest match path with offline tolerance-bounded diffing (`max_diff_percentage`).
28
+ - Explicit baseline promotion: baselines are NEVER auto-updated or healed during test or verify; requires explicit `gemstack vqa promote <scenario-id>`.
29
+ - Pure offline read-only verification (Stage 5.4 in `gemstack verify`): zero browser launches, zero network calls, zero file mutations.
30
+ - Explicit non-execution invariant: Gemstack core does NOT launch browsers and does NOT capture screenshots automatically.
31
+ - **New CLI Surfaces**:
32
+ - `gemstack swarm plan [--json]`: compiles `tasks.md` into deterministic concurrent waves.
33
+ - `gemstack swarm validate [--json]`: validates write partitions, review separation, and context freshness.
34
+ - `gemstack vqa validate [--json]` (or `gemstack visual validate`): validates visual QA manifests, viewports, baselines, and evidence offline.
35
+ - `gemstack vqa promote <scenario-id>` (or `gemstack visual promote`): explicitly promotes live evidence to approved canonical baseline.
36
+
37
+ ### Changed
38
+ - `gemstack verify` extended with Stage 5.3 (Swarm Audit) and Stage 5.4 (Visual QA Audit) running in pure read-only mode.
39
+ - `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`).
40
+ - `package.json` test script updated to register the 5 new Upgrade E test suites.
41
+
42
+ ### Compatibility
43
+ - 100% backward compatible with existing Gemstack repositories and frozen contracts from Upgrades A, B, C, and D.
44
+ - Zero external runtime npm dependencies added (`package.json` dependencies remain `{}`).
45
+ - Zero external development npm dependencies added (`package.json` devDependencies remain `{}`).
46
+
47
+ ### Validation
48
+ - 29/29 Upgrade E tasks COMPLETE.
49
+ - 20/20 Upgrade E canonical acceptance tests passing (`TEST-SWARM-A01`..`E02`, `TEST-VISUAL-A01`..`E02`).
50
+ - 10/10 Upgrade E bootstrap contracts passing.
51
+ - 26/26 adversarial test cases passing.
52
+ - 126/126 physical tests passing across 14 suites with 0 failures and 0 skipped.
53
+ - Full CI test matrix (`npm run ci:all`) passing cleanly.
54
+ - `gemstack verify` exit code 0 with 0 errors and 0 open blockers.
55
+ - Swarm manifest verified: `VALID` and `FRESH`.
56
+ - Visual QA manifest verified: `VALID` and `FRESH`.
57
+ - Closure evidence: `specs/010-agent-swarm-visual-qa/closure.json` status `VERIFIED`.
58
+
59
+ ## [v1.3.0] - 2026-09-11
60
+
61
+ ### Added
62
+ - **Cost & Provider Safety Gates (Upgrade C)**: Deterministic, fail-closed safety and cost verification framework for commercial, external, and AI provider interactions.
63
+ - `ProviderCapabilityGate`: validates that requested capabilities are declared and supported by the active provider adapter before invocation.
64
+ - `BillableActionGate`: blocks billable actions unless explicit spending authorization tokens are granted.
65
+ - Provider Registry: canonical provider directory with declared capability contracts and deterministic rejection of unknown providers.
66
+ - Cost Ledger (`cost-ledger.json`): auditable schema validating provider cost assumptions, freshness thresholds, and currency units.
67
+ - Fail-Closed Unknown Cost Policy: unclassified or ambiguous operations are strictly treated as commercial rather than defaulted to free.
68
+ - Environment Safety Isolation: prevents accidental commercial provider invocations in `test` and `ci` environments even if ambient credentials exist.
69
+ - Trusted Mock Boundaries: enforces that test mocks execute strictly in memory with zero network escapes.
70
+ - Re-Entrant Fallback Authorization: secondary fallback providers trigger independent gate re-evaluation before execution.
71
+ - Verification Purity: guarantees `gemstack verify` executes offline with zero network sockets and zero ledger file mutations.
72
+ - **Context Capsule / Context Compression (Upgrade D)**: Deterministic, auditable, constraint-lossless context compression architecture for cross-session AI continuation.
73
+ - Deterministic Context Capsule Generation: compiles authoritative sources (`spec.md`, `plan.md`, `tasks.md`, `.gemstack/state.json`, `closure.json`) into `context-capsule.json`.
74
+ - Constraint-Lossless Compression: 100% of normative `MUST` and `MUST NOT` constraints, frozen contracts, and acceptance signatures survive compression.
75
+ - Canonical Authority Precedence: authoritative repository sources unconditionally govern over derived capsule claims (`SPEC` > `PLAN` > `TASKS` > implementation).
76
+ - Provenance & Freshness Hashing: live SHA-256 source digests detect drift or manual tampering immediately (`STALE` / `TAMPERED`).
77
+ - Strict Secrets Defense: automatic regex and property pattern scanner rejects tokens, API keys, private keys, and `.env` references fail-closed.
78
+ - Size Budget Enforcement: 32 KB target budget with deterministic 3-tier condensation and 64 KB fail-closed hard limit.
79
+ - Pure Offline & Atomic Writing: generation and validation execute 100% offline with atomic write semantics (`.tmp` + rename).
80
+ - Read-Only Verification (Stage 5.2): `gemstack verify` inspects context capsule freshness without disk writes or file mutation.
81
+ - New CLI Surface: `gemstack context generate`, `gemstack context show`, and `gemstack context verify`.
82
+ - Progressive Legacy Support: repositories or features lacking capsules operate cleanly with informational notices and zero blockers.
83
+
84
+ ### Changed
85
+ - `gemstack verify` pipeline extended to include Stage 5.2 Context Capsule read-only audit.
86
+ - `package.json` test script updated to explicitly enumerate all 25 physical test suites across Upgrades A, B, C, and D.
87
+ - Closure context resolution (`src/lib/closure-context.js`) incorporates `context-capsule.json` in relevant files hashing.
88
+
89
+ ### Compatibility
90
+ - 100% backward compatible with existing Gemstack repositories and frozen contracts from Upgrades A, B, and C.
91
+ - Zero external runtime npm dependencies added (`package.json` dependencies remain `{}`).
92
+
93
+ ### Validation
94
+ - 20/20 Upgrade C canonical acceptance tests passing (`TEST-COST-A01` through `H01`).
95
+ - 20/20 Upgrade D canonical acceptance tests passing (`TEST-CONTEXT-A01` through `H01`).
96
+ - 85/85 combined canonical acceptance tests passing (25 Upgrade A + 20 Upgrade B + 20 Upgrade C + 20 Upgrade D).
97
+ - 100/100 physical tests passing with 0 failures and 0 regressions.
98
+ - Full CI test matrix (`npm run ci:all`) passing cleanly.
99
+ - `gemstack verify` exit code 0 with 0 errors and 0 open blockers.
100
+ - Context capsule verified: `VALID` and `FRESH` (11,873 bytes < 32 KB budget).
101
+
5
102
  ## [v1.2.0] - 2026-09-11
6
103
  ### Added
7
104
  - **Mechanical Test Matrix & Closure Evidence (Upgrade B)**: Full mechanical closure verification framework eliminating false closure and test discovery hallucinations.
package/README.md CHANGED
@@ -108,17 +108,96 @@ Gemstack Upgrade B guarantees that what was planned is what was physically teste
108
108
  - **`gemstack ship`**: Gatekeeper requiring verified evidence before allowing transition to `SHIPPED`.
109
109
  - **Git Optionality & Legacy Support**: Works identically on clean Git, dirty Git, and non-Git projects, with graceful legacy fallback.
110
110
 
111
- ## 🐝 Advanced Autonomy (The WOW Update)
111
+ ## 🛡️ Cost & Provider Safety Gates
112
+
113
+ Gemstack Upgrade C guarantees fail-closed safety for commercial, remote, and AI providers:
114
+ - **`ProviderCapabilityGate`**: Validates provider capability declarations before invocation without network attempts.
115
+ - **`BillableActionGate`**: Enforces strict spending authorization tokens before executing billable operations.
116
+ - **Cost Ledger (`cost-ledger.json`)**: Auditable schema tracking provider cost assumptions, freshness thresholds, and currency units.
117
+ - **Fail-Closed Unknown Cost Policy**: Operations with unclassified or ambiguous costs are strictly blocked.
118
+ - **Environment Safety**: Commercial provider execution is forbidden in `test` and `ci` environments.
119
+ - **Trusted Mock Boundaries**: Test mocks operate strictly in memory with zero network escapes.
120
+ - **Offline Purity**: `gemstack verify` runs 100% offline with zero external network or provider charges.
121
+ - **Core Invariant**: `NO PROOF OF AUTHORIZATION = NO COMMERCIAL EXECUTION`.
122
+
123
+ ## 📦 Context Capsule & Compression
124
+
125
+ Gemstack Upgrade D enables deterministic, constraint-lossless context compression for cross-session continuation:
126
+ - **`gemstack context generate`**: Compiles authoritative specifications, plans, tasks, contracts, and closure evidence into `context-capsule.json`.
127
+ - **Constraint Losslessness**: 100% of normative `MUST`/`MUST NOT` constraints, frozen contracts, and acceptance criteria survive compression.
128
+ - **Authority Precedence**: Authoritative repository artifacts unconditionally override derived capsule claims (`SPEC` > `PLAN` > `TASKS` > implementation).
129
+ - **Drift & Tampering Detection**: Live SHA-256 source hashing flags modified or manually tampered capsules as `STALE`.
130
+ - **Secret Defense**: Fail-closed regex scanning strictly blocks credentials, tokens, private keys, and `.env` data.
131
+ - **Size Budgeting**: 32 KB target budget with deterministic priority condensation and 64 KB fail-closed hard cap.
132
+ - **`gemstack context show`**: Displays human-readable continuation context summary or raw JSON.
133
+ - **`gemstack context verify`**: Read-only validation of context capsule freshness and integrity.
134
+ - **Core Invariant**: `Context Capsule = derived continuation context NOT project authority`.
135
+
136
+ ## 🐝 Agent Swarm Planning & Validation
137
+
138
+ Gemstack Upgrade E introduces deterministic multi-worker planning and write-set partition validation:
139
+ - **`gemstack swarm plan`**: Compiles parallelizable `tasks.md` items into deterministic concurrent waves in `specs/<feature>/swarm.json`.
140
+ - **Exclusive Write Boundaries**: Validates that concurrent tasks possess strictly disjoint write sets (`write_set(T1) ∩ write_set(T2) = ∅`), mathematically preventing write collisions.
141
+ - **Collision Avoidance**: Overlapping write sets are automatically serialized into sequential waves (`SWARM_WRITE_COLLISION_PREVENTED`).
142
+ - **Separation of Duties Gate**: Non-waivable mechanical check enforcing `author != reviewer` on all task reviews (`SWARM_SELF_REVIEW_DETECTED`).
143
+ - **Task-Scoped Context Projections**: Projects minimal, structured context payloads derived from `context-capsule.json` without raw chat transcripts or prompt noise.
144
+ - **Provider & Budget Integration**: Intercepts model invocations via Upgrade C `ProviderCapabilityGate` and `BillableActionGate` to prevent budget breaches.
145
+ - **`gemstack swarm validate`**: Pure read-only validation of wave partitions, task ownership, and review independence.
146
+ - **Explicit Boundary**: *Gemstack core coordinates and validates; Gemstack core does NOT execute autonomous coding agents.*
147
+
148
+ ## 👁️ Visual QA Evidence & Offline Verification
149
+
150
+ Gemstack Upgrade E provides mechanical visual verification grounded in cryptographic digests and offline comparisons:
151
+ - **Canonical Visual Manifest (`visual-qa.json`)**: Declares scenario routes, deterministic viewports, selector masks, baseline digests, and diff tolerances.
152
+ - **Deterministic Viewports**: Standardized profiles (Desktop, Mobile, Tablet) with locked width, height, and device scale factor.
153
+ - **Cryptographic Baseline Hashing**: Baselines are tracked and pinned via canonical SHA-256 hashes (`image_sha256`); flags disk tampering (`VQA_BASELINE_TAMPERED`).
154
+ - **Neutral & Secret Masking**: Eliminates dynamic timestamp/counter diff flakiness (`[MASKED_NEUTRAL]`) and enforces mandatory automatic masking on password and credential fields (`[MASKED_SECRET]`).
155
+ - **Structured Evidence Comparison**: Fast SHA-256 match path with offline tolerance-bounded diffing (`max_diff_percentage`).
156
+ - **Explicit Promotion Semantics**: Baselines are NEVER auto-updated or healed during test or verify; requires explicit `gemstack vqa promote <scenario-id>`.
157
+ - **`gemstack vqa validate`**: Pure read-only offline validation of manifests, baselines, and evidence completeness.
158
+ - **Explicit Boundary**: *Gemstack core inspects and diffs evidence; Gemstack core does NOT launch browsers and does NOT capture screenshots automatically. Capture remains external/adapted.*
159
+
160
+ ## 🏛️ Architectural Principles
161
+
162
+ Gemstack operates on strict, non-negotiable architectural principles:
163
+
164
+ ```text
165
+ authority > derived artifacts
166
+ evidence ≠ authority
167
+ verify = validate
168
+ agent output ≠ architecture
169
+ visual evidence ≠ architecture
170
+ credentials ≠ authorization
171
+ provider availability ≠ permission
172
+ unknown cost ≠ free
173
+ fallback ≠ inherited authorization
174
+ agent says done ≠ task mechanically complete
175
+ author ≠ reviewer where independent review is required
176
+ ```
112
177
 
113
- Gemstack isn't just passive documents; it actively orchestrates agentic capabilities:
178
+ ## 💻 CLI Reference
114
179
 
115
- | Command | Action |
116
- |---------|--------|
117
- | `/swarm` | Orchestrates parallel subagents for tasks marked `[P]` |
118
- | `/qa-visual` | Spawns sandbox browsers to visually assert Acceptance Criteria |
119
- | `/dashboard` | Generates a rich, interactive inline UI of your project's progress |
120
- | `/heal` | Hooks into GitHub CLI (`gh`) to read failing CI logs and auto-push fixes |
121
- | `/sandbox` | Wraps risky AI execution inside an ephemeral Docker container |
180
+ Gemstack provides a focused, deterministic CLI surface:
181
+
182
+ ```bash
183
+ # Core verification & collection
184
+ gemstack verify [--json] [--target <dir>] # 6-stage read-only audit (0 mutations, 0 network)
185
+ gemstack collect [--target <dir>] # Executes test runner & records closure.json
186
+ gemstack ship [--target <dir>] # Transitions lifecycle to SHIPPED if closure is VERIFIED
187
+
188
+ # Context capsule (Upgrade D)
189
+ gemstack context generate [--force] # Compiles deterministic context-capsule.json
190
+ gemstack context show [--raw] # Displays continuation context summary or JSON
191
+ gemstack context verify # Verifies capsule freshness and provenance
192
+
193
+ # Agent swarm (Upgrade E)
194
+ gemstack swarm plan [--json] # Compiles tasks into disjoint concurrent waves
195
+ gemstack swarm validate [--json] # Validates write sets and review attestations
196
+
197
+ # Visual QA (Upgrade E)
198
+ gemstack vqa validate [--json] # Validates visual manifest, viewports, and baselines
199
+ gemstack vqa promote <scenario-id> # Explicitly promotes live evidence to baseline
200
+ ```
122
201
 
123
202
  ## 🪝 Active Security (Git Hooks)
124
203
 
@@ -134,6 +213,7 @@ You can install agent skills created by the community directly into your project
134
213
  npx gemstack-ai install https://raw.githubusercontent.com/community/gemstack-skills/main/django-expert/SKILL.md
135
214
  ```
136
215
 
216
+
137
217
  ## 🤖 MCP Server (Model Context Protocol)
138
218
 
139
219
  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).
package/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,82 @@
1
1
  # Gemstack Release Notes
2
2
 
3
+ # Gemstack v1.4.0 — Agent Swarm & Visual QA
4
+
5
+ ## Highlights
6
+
7
+ ### Upgrade E — Agent Swarm Planning & Validation
8
+ - **Deterministic Multi-Worker Planning**: Compiles parallelizable `tasks.md` items into deterministic, phased execution waves recorded in canonical `swarm.json`.
9
+ - **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.
10
+ - **Automatic Collision Avoidance**: Automatically serializes conflicting tasks into sequential waves during planning (`SWARM_WRITE_COLLISION_PREVENTED`).
11
+ - **Separation of Duties Gate**: Non-waivable mechanical check enforcing `author != reviewer` on all task reviews (`SWARM_SELF_REVIEW_DETECTED`).
12
+ - **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.
13
+ - **Cryptographic Provenance & Freshness**: Pinned `source_capsule_hash` ensures workers operate against verified project state; flags drift fail-closed (`SWARM_CONTEXT_STALE`).
14
+ - **Provider & Budget Gating**: Intercepts model invocations via Upgrade C `ProviderCapabilityGate` and `BillableActionGate` to prevent runaway spending across concurrent workers.
15
+ - **Worker Limits**: Prevents recursive child agent spawning (`SWARM_RECURSIVE_SPAWN_DENIED`).
16
+ - **Explicit Invariant**: Gemstack core coordinates and validates; it does NOT execute autonomous coding agents.
17
+
18
+ ### Upgrade E — Visual QA Evidence & Offline Verification
19
+ - **Canonical Visual QA Manifest (`visual-qa.json`)**: Declares explicit routes, deterministic viewports, selector masks, baseline references, and diff tolerances.
20
+ - **Deterministic Viewport Specifications**: Locks standardized viewport profiles (Desktop, Mobile, Tablet) with explicit width, height, and device scale factor.
21
+ - **Cryptographic Baseline Hashing**: Baselines are tracked and verified via canonical SHA-256 byte digests (`image_sha256`); flags disk tampering (`VQA_BASELINE_TAMPERED`).
22
+ - **Neutral & Secret Selector Masking**: Neutral masks (`[MASKED_NEUTRAL]`) eliminate font/timestamp flakiness; mandatory automatic masking replaces sensitive input fields (`type=password`) with `[MASKED_SECRET]`.
23
+ - **Structured Evidence Comparison**: Fast SHA-256 digest comparison with offline tolerance-bounded diffing (`max_diff_percentage`).
24
+ - **Explicit Baseline Promotion**: Baselines are NEVER mutated during verification; updates require explicit `gemstack vqa promote <scenario-id>`.
25
+ - **Pure Offline Verification (Stages 5.3 & 5.4)**: `gemstack verify` runs 100% offline with zero browser launches, zero network calls, and zero file mutations.
26
+ - **Explicit Invariant**: Gemstack core inspects evidence; it does NOT launch browsers or capture screenshots.
27
+
28
+ ## Acceptance & Regression Baseline
29
+ - 25 Upgrade A canonical acceptance tests passing.
30
+ - 20 Upgrade B canonical acceptance tests passing.
31
+ - 20 Upgrade C canonical acceptance tests passing.
32
+ - 20 Upgrade D canonical acceptance tests passing.
33
+ - 20 Upgrade E canonical acceptance tests passing (`TEST-SWARM-A01`..`E02`, `TEST-VISUAL-A01`..`E02`).
34
+ - 10 Upgrade E bootstrap contracts passing.
35
+ - 26 Upgrade E adversarial cases passing.
36
+ - 105 total canonical acceptance tests passing.
37
+ - 126 total physical tests passing across 14 explicitly enumerated suites with 0 failures and 0 skipped.
38
+ - Full CI suite (`npm run ci:all`) passing cleanly.
39
+ - Upgrade E closed with closure status `VERIFIED`.
40
+
41
+ ---
42
+
43
+ # Gemstack v1.3.0 — Cost & Provider Safety Gates + Context Capsule
44
+
45
+ ## Highlights
46
+
47
+ ### Upgrade C — Cost & Provider Safety Gates
48
+ - **Deterministic Provider & Capability Validation (`ProviderCapabilityGate`)**: Validates requested provider capabilities ahead of invocation and fail-closes on undeclared or unsupported capabilities without network calls.
49
+ - **Spending Authorization Barrier (`BillableActionGate`)**: Enforces the central invariant "NO PROOF = NO EXECUTION"; commercial or billable actions are strictly blocked unless accompanied by valid explicit spending tokens.
50
+ - **Auditable Cost Ledger (`cost-ledger.json`)**: Machine-readable schema establishing strict freshness dates, provider cost classifications, and zero-secrets immunity.
51
+ - **Fail-Closed Unknown Cost Policy**: Unclassified or unknown operations are never assumed free; they are treated fail-closed as commercial risks.
52
+ - **Environment Safety & CI Isolation**: Prevents accidental commercial provider calls during tests and CI builds regardless of ambient developer credentials.
53
+ - **Trusted Mock Enforcement**: Verifies in-memory mocks remain isolated and fail-closed against external network socket leaks.
54
+ - **Re-Entrant Provider Fallback**: Fallback target providers trigger independent gate re-evaluation before execution.
55
+ - **Verification Purity**: Guarantees `gemstack verify` runs strictly offline with zero provider charges and zero file mutations.
56
+
57
+ ### Upgrade D — Context Capsule / Context Compression
58
+ - **Deterministic Context Compression**: Compiles authoritative specification, plan, tasks, lifecycle, and closure artifacts into compact, machine-readable continuation context (`context-capsule.json`).
59
+ - **Constraint-Lossless Compression**: 100% of normative behavioral constraints (`MUST`, `MUST NOT`), frozen architectural contracts, and acceptance criteria survive compression without semantic loss.
60
+ - **Canonical Authority Precedence**: Authoritative repository artifacts unconditionally govern over derived capsule claims (`SPEC` > `PLAN` > `TASKS` > implementation).
61
+ - **Cryptographic Provenance & Drift Detection**: Live SHA-256 source digests detect artifact modifications or tampering immediately (`STALE` / `TAMPERED`).
62
+ - **Strict Secrets Barrier**: Automated regex scanner blocks credential properties (`apiKey`, `token`, `secret`, `clientSecret`), token patterns (`sk-...`, `AIza...`, `ghp_...`), private keys, and `.env` references.
63
+ - **Deterministic Size Budgeting**: 32 KB target budget with prioritized 3-tier condensation and a 64 KB hard fail-closed limit.
64
+ - **Read-Only Verification (Stage 5.2)**: `gemstack verify` inspects context capsule freshness without modifying or rewriting disk state.
65
+ - **CLI Commands**: `gemstack context generate`, `gemstack context show`, and `gemstack context verify`.
66
+ - **Zero Runtime Dependencies**: Native Node.js standard library implementation (`node:crypto`, `node:fs`, `node:path`, `node:test`).
67
+
68
+ ## Acceptance & Regression Baseline
69
+ - 25 Upgrade A canonical acceptance tests passing (`TEST-CONSISTENCY-A01` through `H02`).
70
+ - 20 Upgrade B canonical acceptance tests passing (`TEST-CLOSURE-A01` through `H01`).
71
+ - 20 Upgrade C canonical acceptance tests passing (`TEST-COST-A01` through `H01`).
72
+ - 20 Upgrade D canonical acceptance tests passing (`TEST-CONTEXT-A01` through `H01`).
73
+ - 85 total canonical acceptance tests passing.
74
+ - 100 total physical tests passing across 25 explicitly enumerated suites.
75
+ - Full CI suite (`npm run ci:all`) passing with 0 warnings and 0 errors.
76
+ - Both Upgrade C and Upgrade D closed with closure status `VERIFIED`.
77
+
78
+ ---
79
+
3
80
  # Gemstack v1.2.0 — Mechanical Test Matrix & Closure Evidence
4
81
 
5
82
  ## Highlights
package/handoff.md CHANGED
@@ -8,16 +8,18 @@ Evolucionar Gemstack incorporando el feedback de producción real de proyectos a
8
8
  4. Comando unificado `gemstack verify` (alias `audit`) para auditoría integral en un solo paso.
9
9
 
10
10
  ## 2. Estado actual
11
- - **Upgrade A (Consistency Core & Phase Freezing)**: CERRADO Y PUBLICADO OFICIALMENTE como `gemstack-ai@1.1.2` en npm y GitHub Release.
12
- - **Upgrade B (Mechanical Test Matrix & Closure Evidence)**: CERRADO Y PREPARADO PARA RELEASE como `gemstack-ai@1.2.0`.
13
- - 20/20 pruebas canónicas P1 de Upgrade B pasando al 100% en 6 nuevas suites.
14
- - 25/25 pruebas canónicas P1 de Upgrade A preservadas con 0 regresiones.
15
- - 53/53 pruebas físicas totales ejecutadas y pasando con 0 errores en CI/CD local (`npm test`, `npm run ci:all`).
16
- - Comando mutador `gemstack collect` implementado y probado en Feature 007, generando `closure.json` atómicamente.
17
- - Comando `gemstack verify` ampliado a 6 etapas estrictamente read-only con validación de frescura contra `closureContextHash`.
18
- - Compuerta de cierre `gemstack ship` ejecutada exitosamente con estado `VERIFIED` y transición de ciclo de vida formal.
19
- - Zero dependencias externas añadidas en producción.
20
- - Excluidos completamente Upgrade C y Upgrade D.
11
+ - **Upgrade A (Consistency Core & Phase Freezing)**: CERRADO Y PUBLICADO OFICIALMENTE en `v1.1.2`.
12
+ - **Upgrade B (Mechanical Test Matrix & Closure Evidence)**: CERRADO Y PUBLICADO OFICIALMENTE en `v1.2.0`.
13
+ - **Upgrade C (Cost & Provider Safety Gates)**: CERRADO Y VERIFICADO (`closure.json` status `VERIFIED`).
14
+ - 20/20 pruebas canónicas P1 de Upgrade C pasando al 100% en 6 suites dedicadas.
15
+ - Gates `ProviderCapabilityGate` y `BillableActionGate` implementados con fail-closed default deny.
16
+ - Cost ledger (`cost-ledger.json`) validado, offline verification purity garantizada.
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`.
21
23
 
22
24
  ## 3. Archivos y cambios
23
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.
@@ -41,5 +43,5 @@ Evolucionar Gemstack incorporando el feedback de producción real de proyectos a
41
43
  - **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`).
42
44
 
43
45
  ## 5. Próximos pasos
44
- 1. Completar la publicación de la versión minor v1.2.0 en GitHub Release y npm.
45
- 2. Iniciar la fase de arquitectura de Upgrade C (Cost & Provider Safety Gates) en su ciclo correspondiente.
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemstack-ai",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Agentic Spec-Driven Development framework for Gemini/Antigravity",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -10,7 +10,7 @@
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",
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",
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",
@@ -0,0 +1,5 @@
1
+ {
2
+ "phase_hashes": {},
3
+ "historical_findings": [],
4
+ "accepted_exceptions": []
5
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "schema": "gemstack-closure",
3
+ "version": 1,
4
+ "feature": "specs/008-cost-provider-safety-gates",
5
+ "generated_at": "2026-09-11T17:33:08.020Z",
6
+ "status": "VERIFIED",
7
+ "closure_context": {
8
+ "closure_context_hash": "551b1853a7bbac24decba595284104f24dc34f5feed858808e3f59bdfa36c7ff",
9
+ "repository_type": "git",
10
+ "git_commit": "1e19c3d7cc527099e6e7c74cbfdbd4cdf4c23584",
11
+ "working_tree_clean": false,
12
+ "relevant_files_digest": "5886c19984cde85fae8b2acdedc4a890b9f7d0e46df3622bc738de482325c625"
13
+ },
14
+ "acceptance_signature": "456b3799bb96ce72a8b82d9739bcf469b9fa1e9eb170a2726ea2308bcbb4cf9c",
15
+ "canonical_summary": {
16
+ "required_total": 20,
17
+ "required_passed": 20,
18
+ "supplemental_total": 0,
19
+ "supplemental_passed": 0
20
+ },
21
+ "physical_summary": {
22
+ "supporting_total": 6,
23
+ "supporting_passed": 6,
24
+ "total_executed": 26,
25
+ "total_passed": 26,
26
+ "total_failed": 0,
27
+ "total_skipped": 0
28
+ },
29
+ "reconciliation": {
30
+ "math_valid": true,
31
+ "phantoms_detected": 0,
32
+ "orphans_detected": 0,
33
+ "missing_canonical_ids": []
34
+ },
35
+ "task_traceability_summary": {
36
+ "tasks_total": 20,
37
+ "tasks_with_validation": 20,
38
+ "tasks_documentation_only": 0,
39
+ "unmapped_canonical_tests": []
40
+ },
41
+ "required_gates": {
42
+ "project-tests": "PASS",
43
+ "gate-ci-frontmatter": "PASS",
44
+ "gate-ci-mojibake": "PASS"
45
+ },
46
+ "supplemental_gates": {},
47
+ "exceptions": [],
48
+ "evidence_sources": [
49
+ {
50
+ "type": "PACKAGE_SCRIPT",
51
+ "script": "test",
52
+ "runner": "node:test",
53
+ "exit_code": 0,
54
+ "duration_ms": 790
55
+ }
56
+ ],
57
+ "blockers": [],
58
+ "warnings": []
59
+ }