gemstack-ai 1.4.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.
- package/.agents/rules/03-gemstack-security.md +2 -2
- package/.gemstack/state.json +10 -11
- package/CHANGELOG.md +33 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +47 -13
- package/RELEASE_NOTES.md +40 -1
- package/handoff.md +33 -19
- package/package.json +4 -3
- package/scripts/ci/check-package-contents.js +1 -1
- package/scripts/ci/check-secrets.js +84 -0
- package/specs/011-gemstack-2.0-hardening/.gemstack.json +5 -0
- package/specs/011-gemstack-2.0-hardening/closure.json +58 -0
- package/specs/011-gemstack-2.0-hardening/plan.md +210 -0
- package/specs/011-gemstack-2.0-hardening/spec.md +277 -0
- package/specs/011-gemstack-2.0-hardening/tasks.md +59 -0
- package/specs/012-gemstack-2.0-honest-evidence/.gemstack.json +5 -0
- package/specs/012-gemstack-2.0-honest-evidence/closure.json +58 -0
- package/specs/012-gemstack-2.0-honest-evidence/plan.md +202 -0
- package/specs/012-gemstack-2.0-honest-evidence/spec.md +222 -0
- package/specs/012-gemstack-2.0-honest-evidence/tasks.md +99 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/.gemstack.json +9 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/closure.json +58 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/context-capsule.json +227 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/plan.md +179 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/spec.md +212 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/tasks.md +90 -0
- package/specs/014-gemstack-2.0-context-memory/.gemstack.json +9 -0
- package/specs/014-gemstack-2.0-context-memory/closure.json +58 -0
- package/specs/014-gemstack-2.0-context-memory/plan.md +161 -0
- package/specs/014-gemstack-2.0-context-memory/spec.md +163 -0
- package/specs/014-gemstack-2.0-context-memory/tasks.md +79 -0
- package/src/cli.js +3 -0
- package/src/commands/doctor.js +18 -0
- package/src/commands/hooks.js +98 -14
- package/src/commands/init.js +1 -1
- package/src/commands/install.js +174 -49
- package/src/commands/spec.js +105 -0
- package/src/commands/update.js +1 -1
- package/src/commands/verify.js +10 -0
- package/src/lib/backup.js +3 -3
- package/src/lib/context-fatigue.js +165 -0
- package/src/lib/contract-amendments.js +109 -0
- package/src/lib/dependency-audit.js +202 -0
- package/src/lib/filesystem-safe.js +85 -15
- package/src/lib/memory-audit.js +121 -0
- package/src/lib/provider-boundary.js +5 -1
- package/src/lib/provider-registry.js +6 -4
- package/src/lib/safety-gates.js +176 -8
- package/src/lib/sdd-rigor.js +181 -0
- package/src/lib/spec-delta.js +194 -0
- package/src/lib/spec-merge.js +168 -0
- package/src/lib/swarm.js +2 -2
- package/src/lib/visual-qa.js +162 -9
- package/template/.agents/rules/03-gemstack-security.md +2 -2
- package/.github/workflows/main-ci.yml +0 -32
- package/.github/workflows/pr-ci.yml +0 -31
- package/.github/workflows/publish.yml +0 -52
- package/.github/workflows/release-readiness.yml +0 -43
- package/gemstack-ai-1.4.0.tgz +0 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://gemstack.dev/schemas/context-capsule-v1.json",
|
|
3
|
+
"acceptance_matrix": {
|
|
4
|
+
"canonical_ids": [
|
|
5
|
+
"TEST-AMEND-D01",
|
|
6
|
+
"TEST-AMEND-D02",
|
|
7
|
+
"TEST-AMEND-D03",
|
|
8
|
+
"TEST-DELTA-B01",
|
|
9
|
+
"TEST-DELTA-B02",
|
|
10
|
+
"TEST-DELTA-B03",
|
|
11
|
+
"TEST-MERGE-C01",
|
|
12
|
+
"TEST-MERGE-C02",
|
|
13
|
+
"TEST-MERGE-C03",
|
|
14
|
+
"TEST-RIGOR-A01",
|
|
15
|
+
"TEST-RIGOR-A02",
|
|
16
|
+
"TEST-RIGOR-A03",
|
|
17
|
+
"TEST-RIGOR-A04"
|
|
18
|
+
],
|
|
19
|
+
"signature": "6ae546034e43677a9ce51b451415db890d27b57e36df3163286897fcd6720e07",
|
|
20
|
+
"total_required": 13
|
|
21
|
+
},
|
|
22
|
+
"architecture_summary": {
|
|
23
|
+
"core_purpose": "Deterministic context compression and safe continuation for AI-assisted engineering.",
|
|
24
|
+
"critical_boundaries": [
|
|
25
|
+
"Capsule is strictly derived, never authoritative",
|
|
26
|
+
"Semantic constraint losslessness: MUST/MUST NOT survive compression",
|
|
27
|
+
"Verification is read-only and never regenerates capsules"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"canonical_invariants": [
|
|
31
|
+
{
|
|
32
|
+
"id": "INV-001",
|
|
33
|
+
"normative": "MUST",
|
|
34
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
35
|
+
"source_ref": "spec.md#4"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "INV-002",
|
|
39
|
+
"normative": "MUST",
|
|
40
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
41
|
+
"source_ref": "spec.md#4"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "INV-003",
|
|
45
|
+
"normative": "MUST",
|
|
46
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
47
|
+
"source_ref": "spec.md#4"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "INV-004",
|
|
51
|
+
"normative": "MUST",
|
|
52
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
53
|
+
"source_ref": "spec.md#4"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "INV-005",
|
|
57
|
+
"normative": "MUST",
|
|
58
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
59
|
+
"source_ref": "spec.md#4"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "INV-006",
|
|
63
|
+
"normative": "MUST",
|
|
64
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
65
|
+
"source_ref": "spec.md#4"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "INV-007",
|
|
69
|
+
"normative": "MUST",
|
|
70
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
71
|
+
"source_ref": "spec.md#4"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "INV-008",
|
|
75
|
+
"normative": "MUST",
|
|
76
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
77
|
+
"source_ref": "spec.md#4"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "INV-009",
|
|
81
|
+
"normative": "MUST",
|
|
82
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
83
|
+
"source_ref": "spec.md#4"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "INV-010",
|
|
87
|
+
"normative": "MUST",
|
|
88
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
89
|
+
"source_ref": "spec.md#4"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "INV-011",
|
|
93
|
+
"normative": "MUST",
|
|
94
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
95
|
+
"source_ref": "spec.md#4"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "INV-012",
|
|
99
|
+
"normative": "MUST",
|
|
100
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
101
|
+
"source_ref": "spec.md#4"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "INV-013",
|
|
105
|
+
"normative": "MUST",
|
|
106
|
+
"rule": "\"gate\": \"REQUIRED\"",
|
|
107
|
+
"source_ref": "spec.md#4"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"deferred_items": [
|
|
111
|
+
"Autonomous cross-repo capsule federations (out of scope)",
|
|
112
|
+
"LLM narrative fine-tuning (non-authoritative)"
|
|
113
|
+
],
|
|
114
|
+
"frozen_contracts": [
|
|
115
|
+
{
|
|
116
|
+
"id": "formal-contract-amendment",
|
|
117
|
+
"type": "ENUM_SET",
|
|
118
|
+
"value": true
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "incremental-spec-deltas",
|
|
122
|
+
"type": "ENUM_SET",
|
|
123
|
+
"value": true
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": "sdd-rigor-levels",
|
|
127
|
+
"type": "ENUM_SET",
|
|
128
|
+
"value": true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "spec-conflict-detector",
|
|
132
|
+
"type": "BOOLEAN_INVARIANT",
|
|
133
|
+
"value": true
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"generated_at": "2026-09-23T02:29:29.366Z",
|
|
137
|
+
"generator": {
|
|
138
|
+
"name": "gemstack",
|
|
139
|
+
"version": "1.2.0"
|
|
140
|
+
},
|
|
141
|
+
"historical_context": [
|
|
142
|
+
{
|
|
143
|
+
"feature": "specs/006-architecture-consistency-engine",
|
|
144
|
+
"key_guarantees": [
|
|
145
|
+
"Anti-loop findings",
|
|
146
|
+
"Deterministic hashing",
|
|
147
|
+
"Frozen contracts"
|
|
148
|
+
],
|
|
149
|
+
"status": "CLOSED"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"feature": "specs/007-mechanical-test-matrix-closure-evidence",
|
|
153
|
+
"key_guarantees": [
|
|
154
|
+
"Mechanical test matrix",
|
|
155
|
+
"VERIFY = VALIDATE",
|
|
156
|
+
"closure.json evidence"
|
|
157
|
+
],
|
|
158
|
+
"status": "CLOSED"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"feature": "specs/008-cost-provider-safety-gates",
|
|
162
|
+
"key_guarantees": [
|
|
163
|
+
"Fail-closed gates",
|
|
164
|
+
"NO PROOF = NO EXECUTION",
|
|
165
|
+
"Zero network verify"
|
|
166
|
+
],
|
|
167
|
+
"status": "CLOSED"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"project": {
|
|
171
|
+
"active_feature": "specs/013-gemstack-2.0-adaptable-sdd",
|
|
172
|
+
"current_phase": "shipped",
|
|
173
|
+
"lifecycle_status": "SHIPPED",
|
|
174
|
+
"name": "gemstack-ai",
|
|
175
|
+
"next_permitted_phase": "PLAN"
|
|
176
|
+
},
|
|
177
|
+
"provenance": {
|
|
178
|
+
"source_set_hash": "d4707b57238b7461acbd3809b03d09a676ca98b796108ec60da512ed51f61275",
|
|
179
|
+
"sources": [
|
|
180
|
+
{
|
|
181
|
+
"hash": "eaf7d2b071dccf4422b57109ef6ee76637e40c0a7d27e2868c3f26f76ea681cb",
|
|
182
|
+
"path": ".gemstack/state.json",
|
|
183
|
+
"role": "LIFECYCLE_STATE"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"hash": "484cdcb089ee6a2950ddd3e7a9d7ebe22585c058566a8699392f97f2753e8737",
|
|
187
|
+
"path": "specs/013-gemstack-2.0-adaptable-sdd/closure.json",
|
|
188
|
+
"role": "CLOSURE_EVIDENCE"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"hash": "8be9cb72e649dbdc53819c8fac9029fc73241d7c267e3ff596e0104927a1b5c1",
|
|
192
|
+
"path": "specs/013-gemstack-2.0-adaptable-sdd/plan.md",
|
|
193
|
+
"role": "PLAN"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"hash": "32f326f279a7083e67bd3b386597718c203abbcca99f71d8426b50ca3616d93d",
|
|
197
|
+
"path": "specs/013-gemstack-2.0-adaptable-sdd/spec.md",
|
|
198
|
+
"role": "SPECIFICATION"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"hash": "843f2d12bf20c0ba844f0b7979aeb9b829faba32b2bcc04aa67f254126ceb9c4",
|
|
202
|
+
"path": "specs/013-gemstack-2.0-adaptable-sdd/tasks.md",
|
|
203
|
+
"role": "TASKS"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
"relevant_files": [
|
|
208
|
+
"src/commands/context.js",
|
|
209
|
+
"src/lib/context-capsule.js",
|
|
210
|
+
"tests/context-determinism.test.js"
|
|
211
|
+
],
|
|
212
|
+
"schema_version": 1,
|
|
213
|
+
"tasks_state": {
|
|
214
|
+
"active_task_ids": [
|
|
215
|
+
"TASK-001",
|
|
216
|
+
"TASK-002",
|
|
217
|
+
"TASK-003",
|
|
218
|
+
"TASK-004",
|
|
219
|
+
"TASK-005",
|
|
220
|
+
"TASK-006"
|
|
221
|
+
],
|
|
222
|
+
"completed": 0,
|
|
223
|
+
"in_progress": "TASK-001",
|
|
224
|
+
"total": 6
|
|
225
|
+
},
|
|
226
|
+
"unresolved_blockers": []
|
|
227
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Implementation Plan: Gemstack 2.0 Sprint C — Adaptable SDD & Incremental Specs
|
|
2
|
+
|
|
3
|
+
**Feature ID:** `013-gemstack-2.0-adaptable-sdd`
|
|
4
|
+
**Phase:** `plan`
|
|
5
|
+
**Parent Release:** `gemstack-ai@2.0.0-alpha`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Inherited Architecture Contracts
|
|
10
|
+
|
|
11
|
+
```gemstack-inherited-contracts
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
"id": "sdd-rigor-levels",
|
|
15
|
+
"type": "ENUM_SET",
|
|
16
|
+
"values": [
|
|
17
|
+
"quick",
|
|
18
|
+
"fix",
|
|
19
|
+
"feature",
|
|
20
|
+
"high-risk"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "incremental-spec-deltas",
|
|
25
|
+
"type": "ENUM_SET",
|
|
26
|
+
"values": [
|
|
27
|
+
"added",
|
|
28
|
+
"modified",
|
|
29
|
+
"removed"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "spec-conflict-detector",
|
|
34
|
+
"type": "BOOLEAN_INVARIANT",
|
|
35
|
+
"value": true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "formal-contract-amendment",
|
|
39
|
+
"type": "ENUM_SET",
|
|
40
|
+
"values": [
|
|
41
|
+
"amendment-id",
|
|
42
|
+
"contract-id",
|
|
43
|
+
"version",
|
|
44
|
+
"reason",
|
|
45
|
+
"approved-by",
|
|
46
|
+
"signature"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 2. Technical Architecture & Modules
|
|
55
|
+
|
|
56
|
+
### 2.1 Rigor Engine (`src/lib/sdd-rigor.js`)
|
|
57
|
+
- `detectRigorLevel(specContent)`: Extracts declared rigor level from frontmatter or document metadata (`rigor: quick | fix | feature | high-risk`, default: `feature`).
|
|
58
|
+
- `validateRigorRequirements(rigorLevel, context)`:
|
|
59
|
+
- `quick`: Requires single valid artifact (`quick.md` or `spec.md`). Does not require `plan.md` or `tasks.md`.
|
|
60
|
+
- `fix`: Requires test matrix with at least one regression test (`category: REGRESSION` or ID containing `REG`).
|
|
61
|
+
- `feature`: Standard 3-phase SDD with full `plan.md`, `tasks.md`, and complete traceability.
|
|
62
|
+
- `high-risk`: Must include explicit Threat Model, Rollback Plan, and 2 distinct human approval signatures in sidecar (`approvals: [{ approver, signature, timestamp }, ...]`).
|
|
63
|
+
|
|
64
|
+
### 2.2 Incremental Spec Engine (`src/lib/spec-delta.js`)
|
|
65
|
+
- `parseSpecDelta(deltaContent)`: Parses structured delta declarations containing `ADDED`, `MODIFIED`, and `REMOVED` sections for contracts, requirements, and test matrices.
|
|
66
|
+
- `applySpecDelta(baseSpec, delta)`: Applies diff onto base spec without clobbering unmentioned baseline requirements. Fails closed with `DELTA_TARGET_NOT_FOUND` if modifying a non-existent item.
|
|
67
|
+
|
|
68
|
+
### 2.3 Spec Conflict & Merge Engine (`src/lib/spec-merge.js`)
|
|
69
|
+
- `detectSpecConflicts(specA, specB)`:
|
|
70
|
+
- Compares `gemstack-contracts` across both specs. Flags `CONTRACT_COLLISION` if the same contract ID exists with different types, values, or schemas.
|
|
71
|
+
- Compares `gemstack-test-matrix`. Flags `DUPLICATE_TEST_ID` if identical test IDs exist across both specs with divergent descriptions or layers.
|
|
72
|
+
- `mergeSpecs(specA, specB)`: Produces merged spec when conflict checks pass cleanly.
|
|
73
|
+
|
|
74
|
+
### 2.4 Contract Amendment Engine (`src/lib/contract-amendments.js`)
|
|
75
|
+
- `computeAmendmentSignature(amendment, secret)`: Computes HMAC-SHA256 or SHA-256 over normalized amendment properties (`amendment_id`, `contract_id`, `version`, `reason`, `approved_by`).
|
|
76
|
+
- `validateContractAmendments(upstreamContracts, currentContracts, amendments, options)`:
|
|
77
|
+
- Verifies that any contract modified or removed from upstream is justified by a valid, signed amendment record.
|
|
78
|
+
- Rejects unapproved or signature-mismatched amendments (`AMENDMENT_SIGNATURE_INVALID`).
|
|
79
|
+
|
|
80
|
+
### 2.5 CLI Integration (`src/commands/spec.js` and `src/cli.js`)
|
|
81
|
+
- `gemstack spec merge <targetSpecDir>`: Merges another spec directory or branch into active spec with automated conflict detection.
|
|
82
|
+
- `gemstack spec validate`: Validates rigor compliance and amendment integrity.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 3. Physical Test Bindings
|
|
87
|
+
|
|
88
|
+
```gemstack-test-bindings
|
|
89
|
+
[
|
|
90
|
+
{
|
|
91
|
+
"id": "TEST-RIGOR-A01",
|
|
92
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
93
|
+
"symbol": "Quick rigor level validates with single artifact without requiring plan/tasks"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "TEST-RIGOR-A02",
|
|
97
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
98
|
+
"symbol": "Fix rigor level enforces presence of linked regression test in test matrix"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "TEST-RIGOR-A03",
|
|
102
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
103
|
+
"symbol": "Feature rigor level enforces complete 3-phase SDD artifacts and closure manifest"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "TEST-RIGOR-A04",
|
|
107
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
108
|
+
"symbol": "High-risk rigor level fails closed without Threat Model, Rollback Plan, and 2 approvals"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "TEST-DELTA-B01",
|
|
112
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
113
|
+
"symbol": "Parses and applies ADDED, MODIFIED, and REMOVED deltas onto a base spec"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "TEST-DELTA-B02",
|
|
117
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
118
|
+
"symbol": "Preserves untouched baseline requirements and contracts when applying deltas"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "TEST-DELTA-B03",
|
|
122
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
123
|
+
"symbol": "Fails closed when an incremental delta modifies or removes a non-existent item"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": "TEST-MERGE-C01",
|
|
127
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
128
|
+
"symbol": "Spec merge detects colliding contract IDs with divergent values or schemas"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "TEST-MERGE-C02",
|
|
132
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
133
|
+
"symbol": "Spec merge detects colliding canonical test IDs declared across concurrent specs"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "TEST-MERGE-C03",
|
|
137
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
138
|
+
"symbol": "Spec merge succeeds cleanly when contract sets and test IDs are disjoint or identical"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "TEST-AMEND-D01",
|
|
142
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
143
|
+
"symbol": "Accepts contract modification only when accompanied by a valid formal amendment record"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "TEST-AMEND-D02",
|
|
147
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
148
|
+
"symbol": "Rejects contract amendments that are unapproved or have invalid signatures"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"id": "TEST-AMEND-D03",
|
|
152
|
+
"file": "tests/adaptable-sdd-p1.test.js",
|
|
153
|
+
"symbol": "Verifies amendment integrity hash over amendment fields"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 4. Mandatory Package Script Closure Gates
|
|
161
|
+
|
|
162
|
+
```gemstack-closure-gates
|
|
163
|
+
[
|
|
164
|
+
{
|
|
165
|
+
"id": "gate-test",
|
|
166
|
+
"type": "PACKAGE_SCRIPT",
|
|
167
|
+
"script": "test",
|
|
168
|
+
"requirement": "REQUIRED",
|
|
169
|
+
"waivable": false
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"id": "gate-ci-all",
|
|
173
|
+
"type": "PACKAGE_SCRIPT",
|
|
174
|
+
"script": "ci:all",
|
|
175
|
+
"requirement": "REQUIRED",
|
|
176
|
+
"waivable": false
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
```
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Specification: Gemstack 2.0 Sprint C — Adaptable SDD & Incremental Specs
|
|
2
|
+
|
|
3
|
+
**Feature ID:** `013-gemstack-2.0-adaptable-sdd`
|
|
4
|
+
**Phase:** `spec`
|
|
5
|
+
**Parent Release:** `gemstack-ai@2.0.0-alpha`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Context & Objectives
|
|
10
|
+
|
|
11
|
+
Gemstack's core strength is Spec-Driven Development (SDD) with strict frozen contracts. However, real-world development highlighted key friction points:
|
|
12
|
+
1. **One-size-fits-all overhead**: A one-line cosmetic fix or documentation update required the full overhead of 3 separate artifacts (`spec.md` -> `plan.md` -> `tasks.md`).
|
|
13
|
+
2. **High-risk blindness**: Critical architectural changes or auth refactors were treated with the same validation depth as regular features, lacking mandatory threat models or dual human sign-off.
|
|
14
|
+
3. **Destructive spec overwrites in concurrent features**: Parallel branches modifying specs routinely clobbered baseline requirements instead of declaring incremental diffs (`ADDED`, `MODIFIED`, `REMOVED`).
|
|
15
|
+
4. **Silent contract tampering vs. Audited amendments**: Contracts were either completely immutable or subject to uncontrolled modification without auditable justification and cryptographic approval.
|
|
16
|
+
|
|
17
|
+
Sprint C resolves these challenges by introducing:
|
|
18
|
+
- **Four Rigor Levels**: `quick`, `fix`, `feature`, and `high-risk`.
|
|
19
|
+
- **Incremental Spec Deltas**: Structured `ADDED`, `MODIFIED`, and `REMOVED` declarations.
|
|
20
|
+
- **Spec Merge & Conflict Detector**: `gemstack spec merge` to detect colliding contract IDs and canonical test IDs across branches.
|
|
21
|
+
- **Auditable Contract Amendments**: Formal versioned amendments replacing silent mutations.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. User Scenarios & Acceptance Criteria
|
|
26
|
+
|
|
27
|
+
### User Story 1 — Flexible Rigor Levels (Priority: P1)
|
|
28
|
+
As an engineer making a minor tweak or bugfix, I want an appropriate SDD rigor level so I can deliver safe code without unnecessary bureaucracy, while critical changes enforce maximum scrutiny.
|
|
29
|
+
- **Scenario 1.1 (quick)**: A cosmetic change with `rigor: quick` is verified with a single concise artifact without blocking on missing `plan.md` or `tasks.md`.
|
|
30
|
+
- **Scenario 1.2 (fix)**: A bugfix with `rigor: fix` requires a linked regression test (`REGRESSION` category or `REG` ID) that validates the fix.
|
|
31
|
+
- **Scenario 1.3 (feature)**: A standard feature enforces the full 3-phase lifecycle.
|
|
32
|
+
- **Scenario 1.4 (high-risk)**: A critical change fails closed unless it contains an explicit Threat Model, Rollback Plan, and 2 distinct human approval signatures.
|
|
33
|
+
|
|
34
|
+
### User Story 2 — Incremental Spec Deltas (Priority: P1)
|
|
35
|
+
As an agent or engineer building on an existing feature, I want to declare spec deltas (`ADDED`, `MODIFIED`, `REMOVED`) so that concurrent work doesn't clobber baseline requirements.
|
|
36
|
+
- **Scenario 2.1**: An incremental delta successfully parses and overlays onto the base specification.
|
|
37
|
+
- **Scenario 2.2**: Unmodified baseline requirements are preserved intact in the effective merged specification.
|
|
38
|
+
- **Scenario 2.3**: Unmatched modifications fail closed with clear error messaging.
|
|
39
|
+
|
|
40
|
+
### User Story 3 — Offline Spec Conflict & Collision Detection (Priority: P1)
|
|
41
|
+
As a lead architect merging feature branches, I want `gemstack spec merge` to mechanically detect contract and test ID collisions before merging.
|
|
42
|
+
- **Scenario 3.1**: Identifies colliding contract IDs with divergent values or schemas across branches and aborts.
|
|
43
|
+
- **Scenario 3.2**: Detects duplicate canonical test IDs declared across concurrent specs.
|
|
44
|
+
- **Scenario 3.3**: Merges cleanly when contract and test sets are disjoint or mutually consistent.
|
|
45
|
+
|
|
46
|
+
### User Story 4 — Formal Contract Amendments (Priority: P1)
|
|
47
|
+
As a security auditor, I want any change to a frozen architectural contract to require a formal, signed amendment record so that contract evolution is auditable and non-repudiable.
|
|
48
|
+
- **Scenario 4.1**: Contract changes accompanied by a valid, approved amendment record pass verification.
|
|
49
|
+
- **Scenario 4.2**: Unapproved, missing, or signature-mismatched amendments fail closed.
|
|
50
|
+
- **Scenario 4.3**: Amendment integrity hash validates against canonical amendment fields.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 3. Architecture Contracts
|
|
55
|
+
|
|
56
|
+
```gemstack-contracts
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
"id": "sdd-rigor-levels",
|
|
60
|
+
"type": "ENUM_SET",
|
|
61
|
+
"values": [
|
|
62
|
+
"quick",
|
|
63
|
+
"fix",
|
|
64
|
+
"feature",
|
|
65
|
+
"high-risk"
|
|
66
|
+
],
|
|
67
|
+
"description": "Supported SDD rigor levels defining required artifacts, testing depth, and review requirements."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "incremental-spec-deltas",
|
|
71
|
+
"type": "ENUM_SET",
|
|
72
|
+
"values": [
|
|
73
|
+
"added",
|
|
74
|
+
"modified",
|
|
75
|
+
"removed"
|
|
76
|
+
],
|
|
77
|
+
"description": "Allowed delta actions for incremental spec declarations."
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "spec-conflict-detector",
|
|
81
|
+
"type": "BOOLEAN_INVARIANT",
|
|
82
|
+
"value": true,
|
|
83
|
+
"description": "Offline conflict detection detects colliding contract IDs and duplicate test IDs across branches or spec directories."
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "formal-contract-amendment",
|
|
87
|
+
"type": "ENUM_SET",
|
|
88
|
+
"values": [
|
|
89
|
+
"amendment-id",
|
|
90
|
+
"contract-id",
|
|
91
|
+
"version",
|
|
92
|
+
"reason",
|
|
93
|
+
"approved-by",
|
|
94
|
+
"signature"
|
|
95
|
+
],
|
|
96
|
+
"description": "Mandatory fields for formal contract amendment records."
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 4. Mechanical Acceptance Matrix
|
|
104
|
+
|
|
105
|
+
```gemstack-test-matrix
|
|
106
|
+
[
|
|
107
|
+
{
|
|
108
|
+
"id": "TEST-RIGOR-A01",
|
|
109
|
+
"category": "RIGOR",
|
|
110
|
+
"layer": "UNIT",
|
|
111
|
+
"description": "Quick rigor level validates with single artifact without requiring plan/tasks when verified",
|
|
112
|
+
"pass_criteria": "validateRigorRequirements returns valid=true for quick spec with 1 artifact",
|
|
113
|
+
"gate": "REQUIRED"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "TEST-RIGOR-A02",
|
|
117
|
+
"category": "RIGOR",
|
|
118
|
+
"layer": "UNIT",
|
|
119
|
+
"description": "Fix rigor level enforces presence of linked regression test in test matrix",
|
|
120
|
+
"pass_criteria": "Fails closed when fix spec has no regression test; passes when regression test is bound",
|
|
121
|
+
"gate": "REQUIRED"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "TEST-RIGOR-A03",
|
|
125
|
+
"category": "RIGOR",
|
|
126
|
+
"layer": "UNIT",
|
|
127
|
+
"description": "Feature rigor level enforces complete 3-phase SDD artifacts and closure manifest",
|
|
128
|
+
"pass_criteria": "Rejects missing plan/tasks in feature mode; passes when full lifecycle is present",
|
|
129
|
+
"gate": "REQUIRED"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "TEST-RIGOR-A04",
|
|
133
|
+
"category": "RIGOR",
|
|
134
|
+
"layer": "UNIT",
|
|
135
|
+
"description": "High-risk rigor level fails closed without Threat Model, Rollback Plan, and 2 distinct human approvals",
|
|
136
|
+
"pass_criteria": "Rejects high-risk spec missing threat model, rollback plan, or dual human signatures",
|
|
137
|
+
"gate": "REQUIRED"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "TEST-DELTA-B01",
|
|
141
|
+
"category": "DELTA",
|
|
142
|
+
"layer": "UNIT",
|
|
143
|
+
"description": "Parses and applies ADDED, MODIFIED, and REMOVED deltas onto a base spec",
|
|
144
|
+
"pass_criteria": "Merged specification accurately reflects additions, modifications, and removals",
|
|
145
|
+
"gate": "REQUIRED"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"id": "TEST-DELTA-B02",
|
|
149
|
+
"category": "DELTA",
|
|
150
|
+
"layer": "UNIT",
|
|
151
|
+
"description": "Preserves untouched baseline requirements and contracts when applying incremental deltas",
|
|
152
|
+
"pass_criteria": "Baseline items not mentioned in delta remain intact in effective merged spec",
|
|
153
|
+
"gate": "REQUIRED"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "TEST-DELTA-B03",
|
|
157
|
+
"category": "DELTA",
|
|
158
|
+
"layer": "UNIT",
|
|
159
|
+
"description": "Fails closed when an incremental delta modifies or removes a non-existent item",
|
|
160
|
+
"pass_criteria": "Throws DELTA_TARGET_NOT_FOUND error when target item does not exist in base",
|
|
161
|
+
"gate": "REQUIRED"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"id": "TEST-MERGE-C01",
|
|
165
|
+
"category": "MERGE",
|
|
166
|
+
"layer": "UNIT",
|
|
167
|
+
"description": "Spec merge detects colliding contract IDs with divergent values or schemas across branches",
|
|
168
|
+
"pass_criteria": "detectSpecConflicts flags CONTRACT_COLLISION with conflicting values",
|
|
169
|
+
"gate": "REQUIRED"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"id": "TEST-MERGE-C02",
|
|
173
|
+
"category": "MERGE",
|
|
174
|
+
"layer": "UNIT",
|
|
175
|
+
"description": "Spec merge detects colliding canonical test IDs declared across concurrent specs",
|
|
176
|
+
"pass_criteria": "detectSpecConflicts flags DUPLICATE_TEST_ID across merged specs",
|
|
177
|
+
"gate": "REQUIRED"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"id": "TEST-MERGE-C03",
|
|
181
|
+
"category": "MERGE",
|
|
182
|
+
"layer": "UNIT",
|
|
183
|
+
"description": "Spec merge succeeds cleanly when contract sets and test IDs are disjoint or identical",
|
|
184
|
+
"pass_criteria": "detectSpecConflicts returns conflicts=[] and valid=true for clean specs",
|
|
185
|
+
"gate": "REQUIRED"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"id": "TEST-AMEND-D01",
|
|
189
|
+
"category": "AMENDMENT",
|
|
190
|
+
"layer": "UNIT",
|
|
191
|
+
"description": "Accepts contract modification only when accompanied by a valid formal amendment record",
|
|
192
|
+
"pass_criteria": "validateContractAmendments approves modification with valid amendment; fails without it",
|
|
193
|
+
"gate": "REQUIRED"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "TEST-AMEND-D02",
|
|
197
|
+
"category": "AMENDMENT",
|
|
198
|
+
"layer": "UNIT",
|
|
199
|
+
"description": "Rejects contract amendments that are unapproved or have invalid cryptographic signatures",
|
|
200
|
+
"pass_criteria": "Fails closed with AMENDMENT_SIGNATURE_INVALID on tampered signature",
|
|
201
|
+
"gate": "REQUIRED"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"id": "TEST-AMEND-D03",
|
|
205
|
+
"category": "AMENDMENT",
|
|
206
|
+
"layer": "UNIT",
|
|
207
|
+
"description": "Verifies amendment integrity hash over amendment fields (amendment_id, contract_id, reason)",
|
|
208
|
+
"pass_criteria": "computeAmendmentSignature matches expected SHA-256 digest over normalized fields",
|
|
209
|
+
"gate": "REQUIRED"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
```
|