gaia-framework 1.65.1 → 1.83.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.claude/commands/gaia-create-stakeholder.md +20 -0
  2. package/.claude/commands/gaia-test-gap-analysis.md +17 -0
  3. package/CLAUDE.md +102 -1
  4. package/README.md +2 -2
  5. package/_gaia/_config/global.yaml +5 -1
  6. package/_gaia/_config/lifecycle-sequence.yaml +20 -0
  7. package/_gaia/_config/skill-manifest.csv +2 -0
  8. package/_gaia/_config/workflow-manifest.csv +3 -1
  9. package/_gaia/core/engine/workflow.xml +11 -1
  10. package/_gaia/core/protocols/review-gate-check.xml +29 -1
  11. package/_gaia/core/workflows/party-mode/steps/step-01-agent-loading.md +60 -9
  12. package/_gaia/creative/workflows/problem-solving/checklist.md +64 -14
  13. package/_gaia/creative/workflows/problem-solving/instructions.xml +367 -22
  14. package/_gaia/creative/workflows/problem-solving/workflow.yaml +31 -1
  15. package/_gaia/dev/agents/_base-dev.md +7 -1
  16. package/_gaia/dev/skills/_skill-index.yaml +9 -0
  17. package/_gaia/dev/skills/figma-integration.md +296 -0
  18. package/_gaia/lifecycle/knowledge/brownfield/config-contradiction-scan.md +137 -0
  19. package/_gaia/lifecycle/knowledge/brownfield/dead-code-scan.md +179 -0
  20. package/_gaia/lifecycle/knowledge/brownfield/test-execution-scan.md +209 -0
  21. package/_gaia/lifecycle/skills/document-rulesets.md +91 -6
  22. package/_gaia/lifecycle/templates/brownfield-scan-doc-code-prompt.md +219 -0
  23. package/_gaia/lifecycle/templates/brownfield-scan-hardcoded-prompt.md +169 -0
  24. package/_gaia/lifecycle/templates/brownfield-scan-integration-seam-prompt.md +127 -0
  25. package/_gaia/lifecycle/templates/brownfield-scan-runtime-behavior-prompt.md +141 -0
  26. package/_gaia/lifecycle/templates/brownfield-scan-security-prompt.md +440 -0
  27. package/_gaia/lifecycle/templates/gap-entry-schema.md +282 -0
  28. package/_gaia/lifecycle/templates/infra-prd-template.md +356 -0
  29. package/_gaia/lifecycle/templates/platform-prd-template.md +431 -0
  30. package/_gaia/lifecycle/templates/prd-template.md +70 -0
  31. package/_gaia/lifecycle/templates/story-template.md +22 -1
  32. package/_gaia/lifecycle/workflows/2-planning/create-ux-design/instructions.xml +52 -3
  33. package/_gaia/lifecycle/workflows/4-implementation/add-feature/checklist.md +1 -1
  34. package/_gaia/lifecycle/workflows/4-implementation/add-feature/instructions.xml +2 -3
  35. package/_gaia/lifecycle/workflows/4-implementation/add-stories/checklist.md +5 -0
  36. package/_gaia/lifecycle/workflows/4-implementation/add-stories/instructions.xml +73 -1
  37. package/_gaia/lifecycle/workflows/4-implementation/create-stakeholder/checklist.md +25 -0
  38. package/_gaia/lifecycle/workflows/4-implementation/create-stakeholder/instructions.xml +79 -0
  39. package/_gaia/lifecycle/workflows/4-implementation/create-stakeholder/workflow.yaml +22 -0
  40. package/_gaia/lifecycle/workflows/4-implementation/create-story/instructions.xml +11 -1
  41. package/_gaia/lifecycle/workflows/4-implementation/retrospective/instructions.xml +21 -1
  42. package/_gaia/lifecycle/workflows/4-implementation/retrospective/workflow.yaml +1 -1
  43. package/_gaia/lifecycle/workflows/4-implementation/validate-story/instructions.xml +11 -0
  44. package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/checklist.md +12 -0
  45. package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/instructions.xml +248 -4
  46. package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/workflow.yaml +1 -0
  47. package/_gaia/testing/workflows/test-gap-analysis/checklist.md +8 -0
  48. package/_gaia/testing/workflows/test-gap-analysis/instructions.xml +53 -0
  49. package/_gaia/testing/workflows/test-gap-analysis/workflow.yaml +38 -0
  50. package/bin/gaia-framework.js +44 -8
  51. package/bin/helpers/derive-bump-label.js +41 -0
  52. package/bin/helpers/validate-bump-labels.js +38 -0
  53. package/gaia-install.sh +96 -21
  54. package/package.json +1 -1
  55. package/_gaia/_memory/tier2-results/.gitkeep +0 -0
  56. package/_gaia/_memory/tier2-results/checkpoint-resume-2026-03-24.yaml +0 -6
  57. package/_gaia/_memory/tier2-results/engine-scenarios-2026-03-22.yaml +0 -14
@@ -0,0 +1,431 @@
1
+ ---
2
+ template: 'platform-prd'
3
+ version: 1.0.0
4
+ used_by: ['create-prd']
5
+ domain: '{domain}'
6
+ ---
7
+
8
+ # Platform PRD: {product_name}
9
+
10
+ > **Project:** {project_name}
11
+ > **Domain:** {domain}
12
+ > **Date:** {date}
13
+ > **Author:** {agent_name}
14
+ > **Status:** Draft | In Review | Approved
15
+ > **Project Type:** Platform (application + infrastructure)
16
+
17
+ > Requirement IDs use prefixes to disambiguate scope: FR-### and NFR-### for application requirements, IR-###, OR-###, and SR-### for infrastructure requirements. IDs are globally unique within a project — each prefix defines a separate namespace.
18
+
19
+ ---
20
+
21
+ # Part I: Application Requirements
22
+
23
+ ## 1. Overview
24
+
25
+ {Brief product overview and context. What is being built and why.}
26
+
27
+ ## 2. Goals and Non-Goals
28
+
29
+ ### Goals
30
+ - {Goal 1}
31
+ - {Goal 2}
32
+
33
+ ### Non-Goals
34
+ - {Explicitly out of scope item 1}
35
+
36
+ ## 3. User Stories
37
+
38
+ | ID | As a... | I want to... | So that... | Priority |
39
+ |----|---------|-------------|-----------|----------|
40
+ | US-01 | {role} | {action} | {benefit} | {P0-P3} |
41
+
42
+ ## 4. Functional Requirements
43
+
44
+ ### 4.1 {Feature Area}
45
+
46
+ - **FR-01:** {Requirement description}
47
+ - **FR-02:** {Requirement description}
48
+
49
+ ## 5. Non-Functional Requirements
50
+
51
+ | ID | Category | Requirement | Target |
52
+ |----|----------|------------|--------|
53
+ | NFR-001 | Performance | {requirement} | {target} |
54
+ | NFR-002 | Security | {requirement} | {target} |
55
+ | NFR-003 | Accessibility | {requirement} | {target} |
56
+
57
+ ## 6. Out of Scope
58
+
59
+ | Exclusion | Reason |
60
+ |-----------|--------|
61
+ | {feature or integration} | {deferred / not needed / separate product} |
62
+
63
+ ## 7. UX Requirements
64
+
65
+ {Key interaction patterns, wireframe references, accessibility needs.}
66
+
67
+ ## 8. Technical Constraints
68
+
69
+ - {Platform, language, or integration constraint}
70
+
71
+ ## 9. Dependencies
72
+
73
+ | Dependency | Type | Failure Mode | Fallback Behavior | SLA Expectation |
74
+ |------------|------|-------------|-------------------|-----------------|
75
+ | {service or system} | {API / Database / Message Queue / CDN / Auth Provider} | {What happens when it's unavailable} | {Graceful degradation / Retry / Queue / Circuit breaker / Hard fail} | {Expected uptime / latency / throughput} |
76
+
77
+ ## 10. Milestones
78
+
79
+ | Milestone | Target Date | Deliverables |
80
+ |-----------|------------|-------------|
81
+ | {milestone} | {date} | {deliverables} |
82
+
83
+ ---
84
+
85
+ # Part II: Infrastructure Requirements
86
+
87
+ ## 11. Platform Overview & Scope
88
+
89
+ {Platform purpose, target environments, and team ownership.}
90
+
91
+ ### Platform Purpose
92
+
93
+ {What this infrastructure provides and why it exists.}
94
+
95
+ ### Target Environments
96
+
97
+ | Environment | Purpose | Region(s) | Owner |
98
+ |-------------|---------|-----------|-------|
99
+ | {env_name} | {purpose} | {regions} | {team} |
100
+
101
+ ### Team Ownership
102
+
103
+ | Component | Owning Team | Escalation |
104
+ |-----------|-------------|------------|
105
+ | {component} | {team} | {contact} |
106
+
107
+ ## 12. Platform Capabilities
108
+
109
+ {What the infrastructure enables. Each capability follows the format below.}
110
+
111
+ | ID | Capability | SLO |
112
+ |----|-----------|-----|
113
+ | PC-01 | Enable {team/service} to {capability} with {SLO} | {target} |
114
+ | PC-02 | Enable {team/service} to {capability} with {SLO} | {target} |
115
+
116
+ ## 13. Resource Specifications
117
+
118
+ {Compute, storage, networking, IAM provisioning. Per-environment breakdown.}
119
+
120
+ ### Compute
121
+
122
+ | Resource | Environment | Spec | Scaling |
123
+ |----------|-------------|------|---------|
124
+ | {resource} | {env} | {cpu/memory} | {auto/manual, min-max} |
125
+
126
+ ### Storage
127
+
128
+ | Store | Type | Size | IOPS | Backup |
129
+ |-------|------|------|------|--------|
130
+ | {store} | {block/object/file} | {size} | {iops} | {policy} |
131
+
132
+ ### Networking
133
+
134
+ | Component | CIDR/Range | Protocol | Purpose |
135
+ |-----------|-----------|----------|---------|
136
+ | {component} | {cidr} | {protocol} | {purpose} |
137
+
138
+ ### IAM Provisioning
139
+
140
+ | Role/Policy | Scope | Permissions | Lifecycle |
141
+ |-------------|-------|-------------|-----------|
142
+ | {role} | {scope} | {permissions} | {create/rotate/revoke} |
143
+
144
+ ### State Management
145
+
146
+ {State backend strategy — e.g., Terraform remote state, locking, encryption.}
147
+
148
+ | Backend | Lock Provider | Encryption | Workspace Strategy |
149
+ |---------|--------------|------------|-------------------|
150
+ | {backend} | {lock} | {encryption} | {workspace} |
151
+
152
+ ### Data Persistence Requirements
153
+
154
+ | Data Store | Durability | Replication | Retention |
155
+ |------------|-----------|-------------|-----------|
156
+ | {store} | {durability} | {replication} | {retention} |
157
+
158
+ ## 14. Operational SLOs
159
+
160
+ {Availability targets, MTTR, RTO/RPO, error budgets, resource utilization targets.}
161
+
162
+ ### Availability & Recovery
163
+
164
+ | Metric | Target | Measurement |
165
+ |--------|--------|-------------|
166
+ | Availability | {99.x%} | {how measured} |
167
+ | MTTR | {minutes} | {how measured} |
168
+ | RTO | {minutes} | {recovery time objective} |
169
+ | RPO | {minutes} | {recovery point objective} |
170
+ | Error Budget | {x% per month} | {how calculated} |
171
+
172
+ ### Resource Utilization Targets
173
+
174
+ | Resource | Target Utilization | Alert Threshold |
175
+ |----------|-------------------|-----------------|
176
+ | CPU | {target%} | {alert%} |
177
+ | Memory | {target%} | {alert%} |
178
+ | Storage IOPS | {target} | {threshold} |
179
+ | Network Bandwidth | {target Gbps} | {threshold} |
180
+ | Network Latency | {target ms} | {threshold} |
181
+
182
+ ## 15. Security Posture
183
+
184
+ {Security requirements tailored for infrastructure projects.}
185
+
186
+ ### IAM/RBAC
187
+
188
+ {Identity and access management, role-based access control policies.}
189
+
190
+ | Principal | Role | Scope | MFA Required | Review Cadence |
191
+ |-----------|------|-------|-------------|----------------|
192
+ | {principal} | {role} | {scope} | {yes/no} | {quarterly/annually} |
193
+
194
+ ### Network Segmentation
195
+
196
+ {Network isolation, security groups, firewall rules, zero-trust boundaries.}
197
+
198
+ | Zone | CIDR | Ingress Rules | Egress Rules | Purpose |
199
+ |------|------|---------------|-------------|---------|
200
+ | {zone} | {cidr} | {rules} | {rules} | {purpose} |
201
+
202
+ ### Secrets Management
203
+
204
+ {Secrets storage, rotation, injection, and audit strategy.}
205
+
206
+ | Secret Type | Store | Rotation | Injection Method |
207
+ |-------------|-------|----------|-----------------|
208
+ | {type} | {vault/kms/ssm} | {cadence} | {env var/sidecar/init container} |
209
+
210
+ ### Image Provenance
211
+
212
+ {Container image signing, scanning, and supply chain verification.}
213
+
214
+ | Registry | Signing | Scanning | Admission Policy |
215
+ |----------|---------|----------|-----------------|
216
+ | {registry} | {cosign/notary} | {trivy/grype} | {policy} |
217
+
218
+ ### Compliance Mapping
219
+
220
+ {Regulatory and compliance framework alignment.}
221
+
222
+ | Framework | Controls | Evidence | Audit Frequency |
223
+ |-----------|----------|----------|----------------|
224
+ | {SOC2/HIPAA/PCI/ISO} | {control IDs} | {how demonstrated} | {cadence} |
225
+
226
+ ## 16. Environment Strategy & Developer Experience
227
+
228
+ {Environment parity, promotion pipeline, drift detection, self-service provisioning.}
229
+
230
+ ### Environment Parity
231
+
232
+ | Dimension | Dev | Staging | Production |
233
+ |-----------|-----|---------|-----------|
234
+ | {dimension} | {dev config} | {staging config} | {prod config} |
235
+
236
+ ### Promotion Pipeline
237
+
238
+ {How changes flow from dev to production.}
239
+
240
+ ```
241
+ {dev} → {staging} → {production}
242
+ ```
243
+
244
+ ### Drift Detection
245
+
246
+ {How configuration drift is detected and remediated.}
247
+
248
+ | Tool | Schedule | Remediation | Notification |
249
+ |------|----------|-------------|-------------|
250
+ | {tool} | {cron} | {auto/manual} | {channel} |
251
+
252
+ ### Self-Service Provisioning
253
+
254
+ {Developer self-service capabilities and guardrails.}
255
+
256
+ | Capability | Interface | Guardrails | Approval |
257
+ |------------|-----------|-----------|----------|
258
+ | {capability} | {CLI/portal/API} | {policy} | {auto/manual} |
259
+
260
+ ### Onboarding
261
+
262
+ {New team member and new service onboarding procedures.}
263
+
264
+ ### Observability
265
+
266
+ {Monitoring, logging, tracing, and alerting strategy.}
267
+
268
+ | Signal | Tool | Retention | Alerting |
269
+ |--------|------|-----------|---------|
270
+ | Metrics | {prometheus/cloudwatch} | {retention} | {pagerduty/slack} |
271
+ | Logs | {elk/cloudwatch} | {retention} | {rules} |
272
+ | Traces | {jaeger/xray} | {retention} | {rules} |
273
+
274
+ ## 17. Dependencies & Provider Constraints
275
+
276
+ {Cloud provider limits, Terraform provider versions, upstream service contracts.}
277
+
278
+ ### Cloud Provider Limits
279
+
280
+ | Provider | Service | Limit | Current Usage | Headroom |
281
+ |----------|---------|-------|--------------|----------|
282
+ | {provider} | {service} | {limit} | {current} | {remaining} |
283
+
284
+ ### Terraform Provider Versions
285
+
286
+ | Provider | Version | Constraint | Notes |
287
+ |----------|---------|-----------|-------|
288
+ | {provider} | {version} | {~> x.y} | {notes} |
289
+
290
+ ### Upstream Service Contracts
291
+
292
+ | Service | SLA | API Version | Deprecation |
293
+ |---------|-----|------------|-------------|
294
+ | {service} | {sla} | {version} | {date or N/A} |
295
+
296
+ ## 18. Cost Model
297
+
298
+ {Per-environment resource cost estimates, scaling cost projections, and cost-per-unit efficiency metrics.}
299
+
300
+ ### Per-Environment Resource Cost Estimates
301
+
302
+ | Resource | Dev (monthly) | Staging (monthly) | Production (monthly) |
303
+ |----------|--------------|-------------------|---------------------|
304
+ | Compute | ${cost} | ${cost} | ${cost} |
305
+ | Storage | ${cost} | ${cost} | ${cost} |
306
+ | Networking | ${cost} | ${cost} | ${cost} |
307
+ | Monitoring | ${cost} | ${cost} | ${cost} |
308
+ | **Total** | **${total}** | **${total}** | **${total}** |
309
+
310
+ ### Scaling Cost Projections
311
+
312
+ | Scenario | Trigger | Additional Cost | Timeline |
313
+ |----------|---------|----------------|----------|
314
+ | {scenario} | {trigger condition} | ${projection} | {timeframe} |
315
+
316
+ ### Cost-Per-Unit Efficiency Metrics
317
+
318
+ | Metric | Current | Target | Optimization |
319
+ |--------|---------|--------|-------------|
320
+ | Cost per request | ${cost} | ${target} | {strategy} |
321
+ | Cost per GB stored | ${cost} | ${target} | {strategy} |
322
+ | Cost per environment | ${cost} | ${target} | {strategy} |
323
+
324
+ ## 19. Verification Strategy
325
+
326
+ {Policy-as-code (OPA/Rego, Checkov, tfsec), plan validation, smoke tests, drift detection, chaos testing.}
327
+
328
+ ### Policy-as-Code
329
+
330
+ | Tool | Scope | Rules | Enforcement |
331
+ |------|-------|-------|-------------|
332
+ | OPA/Rego | {scope} | {rule count} | {warn/deny} |
333
+ | Checkov | {scope} | {rule count} | {warn/deny} |
334
+ | tfsec | {scope} | {rule count} | {warn/deny} |
335
+
336
+ ### Plan Validation
337
+
338
+ {Terraform plan review, cost estimation, blast radius analysis.}
339
+
340
+ | Check | Tool | Gate | Threshold |
341
+ |-------|------|------|-----------|
342
+ | {check} | {tool} | {CI/manual} | {threshold} |
343
+
344
+ ### Smoke Tests
345
+
346
+ {Post-deployment verification tests.}
347
+
348
+ | Test | Target | Expected | Timeout |
349
+ |------|--------|----------|---------|
350
+ | {test} | {endpoint/resource} | {result} | {timeout} |
351
+
352
+ ### Drift Detection
353
+
354
+ {Scheduled plan diffs, state file monitoring, compliance scanning.}
355
+
356
+ ### Chaos Testing
357
+
358
+ {Failure injection, resilience validation.}
359
+
360
+ | Experiment | Target | Hypothesis | Blast Radius |
361
+ |-----------|--------|-----------|-------------|
362
+ | {experiment} | {target} | {hypothesis} | {scope} |
363
+
364
+ ## 20. Operational Runbooks
365
+
366
+ {Scaling, failover, incident response, rollback procedures.}
367
+
368
+ ### Scaling Procedures
369
+
370
+ | Trigger | Action | Rollback | Owner |
371
+ |---------|--------|----------|-------|
372
+ | {trigger} | {action} | {rollback} | {team} |
373
+
374
+ ### Failover Procedures
375
+
376
+ | Scenario | Detection | Response | RTO |
377
+ |----------|-----------|----------|-----|
378
+ | {scenario} | {detection} | {response steps} | {rto} |
379
+
380
+ ### Incident Response
381
+
382
+ | Severity | Notification | Escalation | Runbook |
383
+ |----------|-------------|------------|---------|
384
+ | P1 | {channel} | {escalation path} | {link} |
385
+ | P2 | {channel} | {escalation path} | {link} |
386
+
387
+ ### Rollback Procedures
388
+
389
+ | Change Type | Rollback Method | Verification | Duration |
390
+ |-------------|----------------|-------------|----------|
391
+ | {type} | {method} | {verification} | {estimate} |
392
+
393
+ ---
394
+
395
+ # Part III: Combined Requirements Summary
396
+
397
+ ## 21. Requirements Summary
398
+
399
+ > IDs are globally unique within a project. The prefix disambiguates the requirement scope: FR/NFR for application, IR/OR/SR for infrastructure.
400
+
401
+ ### Application Requirements
402
+
403
+ | ID | Description | Priority | Status |
404
+ |----|------------|----------|--------|
405
+ | FR-001 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
406
+ | NFR-001 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
407
+
408
+ ### Infrastructure Requirements
409
+
410
+ | ID | Description | Priority | Status |
411
+ |----|------------|----------|--------|
412
+ | IR-001 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
413
+ | IR-002 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
414
+
415
+ ### Operational Requirements
416
+
417
+ | ID | Description | Priority | Status |
418
+ |----|------------|----------|--------|
419
+ | OR-001 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
420
+ | OR-002 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
421
+
422
+ ### Security Requirements
423
+
424
+ | ID | Description | Priority | Status |
425
+ |----|------------|----------|--------|
426
+ | SR-001 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
427
+ | SR-002 | {description} | {Must-Have/Should-Have/Nice-to-Have} | {Draft/Approved} |
428
+
429
+ ## 22. Open Questions
430
+
431
+ - [ ] {Unresolved question}
@@ -81,3 +81,73 @@ used_by: ['create-prd']
81
81
  ## 12. Open Questions
82
82
 
83
83
  - [ ] {Unresolved question}
84
+
85
+ <!-- BROWNFIELD-ONLY-START -->
86
+
87
+ ## Gap Analysis Summary
88
+
89
+ | Category | Critical | High | Medium | Low | Total |
90
+ |----------|----------|------|--------|-----|-------|
91
+ | Config Contradictions | {count} | {count} | {count} | {count} | {count} |
92
+ | Dead Code & Dead State | {count} | {count} | {count} | {count} | {count} |
93
+ | Hard-Coded Business Logic | {count} | {count} | {count} | {count} | {count} |
94
+ | Security Endpoints | {count} | {count} | {count} | {count} | {count} |
95
+ | Runtime Behaviors | {count} | {count} | {count} | {count} | {count} |
96
+ | Documentation Drift | {count} | {count} | {count} | {count} | {count} |
97
+ | Integration Seams | {count} | {count} | {count} | {count} | {count} |
98
+ | **Overall** | **{count}** | **{count}** | **{count}** | **{count}** | **{count}** |
99
+
100
+ ## Gap Analysis by Category
101
+
102
+ ### Config Contradictions (`configuration`)
103
+
104
+ | ID | Severity | Title | Description | Evidence | Recommendation | Verified By | Confidence |
105
+ |----|----------|-------|-------------|----------|----------------|-------------|------------|
106
+ | — | — | No gaps detected in this category. | — | — | — | — | — |
107
+
108
+ ### Dead Code & Dead State (`functional`)
109
+
110
+ | ID | Severity | Title | Description | Evidence | Recommendation | Verified By | Confidence |
111
+ |----|----------|-------|-------------|----------|----------------|-------------|------------|
112
+ | — | — | No gaps detected in this category. | — | — | — | — | — |
113
+
114
+ ### Hard-Coded Business Logic (`functional`, `behavioral`)
115
+
116
+ | ID | Severity | Title | Description | Evidence | Recommendation | Verified By | Confidence |
117
+ |----|----------|-------|-------------|----------|----------------|-------------|------------|
118
+ | — | — | No gaps detected in this category. | — | — | — | — | — |
119
+
120
+ ### Security Endpoints (`security`)
121
+
122
+ | ID | Severity | Title | Description | Evidence | Recommendation | Verified By | Confidence |
123
+ |----|----------|-------|-------------|----------|----------------|-------------|------------|
124
+ | — | — | No gaps detected in this category. | — | — | — | — | — |
125
+
126
+ ### Runtime Behaviors (`behavioral`, `operational`)
127
+
128
+ | ID | Severity | Title | Description | Evidence | Recommendation | Verified By | Confidence |
129
+ |----|----------|-------|-------------|----------|----------------|-------------|------------|
130
+ | — | — | No gaps detected in this category. | — | — | — | — | — |
131
+
132
+ ### Documentation Drift (`documentation`)
133
+
134
+ | ID | Severity | Title | Description | Evidence | Recommendation | Verified By | Confidence |
135
+ |----|----------|-------|-------------|----------|----------------|-------------|------------|
136
+ | — | — | No gaps detected in this category. | — | — | — | — | — |
137
+
138
+ ### Integration Seams (`data-integrity`, `operational`)
139
+
140
+ | ID | Severity | Title | Description | Evidence | Recommendation | Verified By | Confidence |
141
+ |----|----------|-------|-------------|----------|----------------|-------------|------------|
142
+ | — | — | No gaps detected in this category. | — | — | — | — | — |
143
+
144
+ ### Verified By Legend
145
+
146
+ | Value | Description |
147
+ |-------|-------------|
148
+ | `machine-detected` | Gap found by automated scan subagent |
149
+ | `adversarial-review-detected` | Gap found during adversarial review |
150
+ | `code-verified` | Gap confirmed by code-verified review step |
151
+ | `human-reported` | Gap reported manually by a human reviewer |
152
+
153
+ <!-- BROWNFIELD-ONLY-END -->
@@ -12,6 +12,8 @@ points: "{story_points}"
12
12
  risk: "{high/medium/low}"
13
13
  sprint_id: null
14
14
  priority_flag: null
15
+ origin: null
16
+ origin_ref: null
15
17
  depends_on: []
16
18
  blocks: []
17
19
  traces_to: []
@@ -116,4 +118,23 @@ As a {role}, I want to {action}, so that {benefit}.
116
118
 
117
119
  ## Definition of Done
118
120
 
119
- - [ ] Define all the Definition of Done
121
+ ### Acceptance
122
+
123
+ - [ ] All acceptance criteria verified and checked off
124
+ - [ ] All subtasks marked complete
125
+
126
+ ### Testing
127
+
128
+ - [ ] All tests pass (unit, integration, e2e as applicable)
129
+ - [ ] No linting or formatting errors
130
+
131
+ ### Code Quality & CI
132
+
133
+ - [ ] Code compiles / builds without errors
134
+ - [ ] Code follows project conventions
135
+ - [ ] No hardcoded secrets or credentials
136
+ - [ ] PR merged to staging with all CI checks passing
137
+
138
+ ### Documentation
139
+
140
+ - [ ] Documentation updated (if applicable)
@@ -32,12 +32,61 @@
32
32
  <action>Plan keyboard navigation, screen reader support</action>
33
33
  <action>Define color contrast and text sizing standards</action>
34
34
  </step>
35
- <step n="7" title="Generate Output">
35
+ <step n="7" title="Figma MCP Detection and Mode Selection">
36
+ <action>Probe for available Figma MCP server. Load figma-integration.md detection section JIT to determine if a design tool adapter is available.</action>
37
+ <action if="figma_mcp_available">Present mode selection to user: [Generate] Create Figma frames alongside ux-design.md | [Import] Import existing Figma designs (read-only) | [Skip] Text-only UX spec, no Figma integration</action>
38
+ <action if="not figma_mcp_available">Skip Figma integration — proceed with text-only UX design output. Log: "No Figma MCP server detected. Generating markdown-only ux-design.md."</action>
39
+ </step>
40
+ <step n="8" title="Generate Mode — UI Kit Page Creation" if="figma_mcp_available AND user_selected_generate">
41
+ <critical>
42
+ <mandate>Generate mode is the ONLY mode that performs write operations to Figma (FR-140). All other modes are read-only. Write operations: create pages, create frames, create component instances. Minimum required Figma API scopes: files:read + file_content:read + files:write.</mandate>
43
+ </critical>
44
+ <action>Load figma-integration.md frames section JIT from _gaia/dev/skills/figma-integration.md</action>
45
+ <action>Create a UI Kit page named "UI Kit — Generated" in the Figma design file via MCP</action>
46
+ <action>Extract design tokens from {planning_artifacts}/design-system/design-tokens.json (W3C DTCG format)</action>
47
+ <action>Create color styles with semantic aliases from token definitions (e.g., color.surface.primary, color.text.primary)</action>
48
+ <action>Create typography styles from composite token specs (heading-1, heading-2, body, caption)</action>
49
+ <action>Create spacing grid tokens and base components with state variants (default, hover, active, disabled, focus)</action>
50
+ <action>Error handling: on HTTP 429 rate limit, perform a single retry after backoff. If 429 persists, graceful fallback to markdown-only flow — log warning and skip remaining Figma operations.</action>
51
+ </step>
52
+ <step n="9" title="Generate Mode — Per-Screen Frame Generation" if="figma_mcp_available AND user_selected_generate">
53
+ <action>Parse PRD user journeys to determine screens needing frames</action>
54
+ <action>For each screen, generate frames at 6 viewports: 280px (foldable inner, FR-174), 375px (mobile), 600px (foldable outer, FR-174), 768px (tablet portrait), 1024px (tablet landscape, FR-174), 1280px (desktop)</action>
55
+ <action>Compose frames using UI Kit components from the previous step — apply auto-layout with responsive constraints from component specs</action>
56
+ <action>Label frames using naming convention: {ScreenName}/{Viewport} (e.g., Dashboard/Desktop, Login/Mobile)</action>
57
+ <action>Collect all generated Figma node IDs for downstream recording in ux-design.md</action>
58
+ </step>
59
+ <step n="10" title="Generate Mode — Prototype Flow Setup" if="figma_mcp_available AND user_selected_generate">
60
+ <action>Map PRD user journey steps to the generated screen frames</action>
61
+ <action>Create prototype flow connections between frames via Figma MCP, linking screens in the order defined by each user journey</action>
62
+ <action>Validate flow completeness: every user journey step must map to a generated frame. Flag any unmapped journey steps as warnings.</action>
63
+ </step>
64
+ <step n="11" title="Generate Mode — Asset Export Configuration" if="figma_mcp_available AND user_selected_generate">
65
+ <action>Configure PNG export at 1x, 2x, 3x densities for raster assets (images, illustrations)</action>
66
+ <action>Configure SVG export for icon components</action>
67
+ <action>Generate platform-specific asset catalogs per FR-175: iOS .xcassets catalog structure with Contents.json manifests, Android drawable-mdpi/drawable-hdpi/drawable-xhdpi/drawable-xxhdpi/drawable-xxxhdpi directories</action>
68
+ <action>Write export configuration and asset manifest to {planning_artifacts}/design-system/assets/ directory</action>
69
+ <action>Check {project-path}/.figma-cache/ for cached responses (1h TTL) before making MCP read calls — use cached data if fresh, fetch and cache if stale or missing</action>
70
+ </step>
71
+ <step n="12" title="Generate Mode — Record Figma Node IDs and Enhance ux-design.md" if="figma_mcp_available AND user_selected_generate">
72
+ <action>Build Screen-to-Frame mapping table from all generated Figma node IDs: columns Screen Name | Viewport | Figma Node ID | Page</action>
73
+ <action>Add figma: YAML frontmatter block to ux-design.md containing: file_key, pages array with node IDs for each generated page, and last_synced ISO 8601 timestamp</action>
74
+ <action>Add Design Tokens reference section linking to {planning_artifacts}/design-system/design-tokens.json with token category summary</action>
75
+ <action>Add Component Inventory section listing all generated UI Kit components with their Figma node IDs, variant counts, and state definitions</action>
76
+ <action>Add Screen-to-Frame mapping table with all generated frames across all viewports</action>
77
+ <action>Ensure backward compatibility: existing text-only ux-design.md content is preserved. Figma sections are additive — they appear after the standard UX design sections.</action>
78
+ </step>
79
+ <step n="13" title="Generate Output">
36
80
  <template-output file="{planning_artifacts}/ux-design.md">
37
- Generate UX design document with: personas, information architecture, wireframe descriptions, interaction patterns, component specifications, accessibility plan, and FR-to-Screen Mapping table (FR ID | Screen/Page | Wireframe Section).
81
+ Generate UX design document with: personas, information architecture, wireframe descriptions, interaction patterns, component specifications, accessibility plan, FR-to-Screen Mapping table (FR ID | Screen/Page | Wireframe Section). If Generate mode was active: include figma: frontmatter block, Design Tokens section, Component Inventory with Figma node IDs, and Screen-to-Frame mapping table.
38
82
  </template-output>
39
83
  </step>
40
- <step n="8" title="Optional: Accessibility Review">
84
+ <step n="14" title="FR-140 Compliance Check" if="figma_mcp_available AND user_selected_generate">
85
+ <action>Audit all MCP calls executed during Generate mode: classify each as READ (get_file, get_styles, get_components, get_images, get_frames) or WRITE (create_frame, create_component_instance, create_page)</action>
86
+ <action>Verify FR-140 constraint: write operations only occurred during Generate mode steps (8–12). Import mode and Skip mode must have zero write calls.</action>
87
+ <action>Document minimum required Figma API scopes: files:read + file_content:read (default for all modes), files:write (Generate mode only)</action>
88
+ </step>
89
+ <step n="15" title="Optional: Accessibility Review">
41
90
  <ask>Would you like to review the UX design for WCAG 2.1 accessibility compliance? This spawns a subagent in a separate context. Recommended for user-facing applications. (yes / skip)</ask>
42
91
  <action>If yes: spawn a subagent using the Agent tool: "Load {project-root}/_gaia/core/tasks/review-accessibility.xml. Read its entire contents. Target: {planning_artifacts}/ux-design.md. Follow the flow steps EXACTLY. Generate accessibility findings report."</action>
43
92
  <action>If skip: accessibility review can be run anytime later with /gaia-review-a11y</action>
@@ -32,7 +32,7 @@ validation-target: 'Feature/Enhancement/Patch Triage and Cascade'
32
32
  - [ ] Failed steps handled with retry/skip/abort options
33
33
  - [ ] Checkpoint saved for /gaia-resume recovery
34
34
  ## Story
35
- - [ ] Implementation stories created (or patch story recommended)
35
+ - [ ] Implementation stories created (patch, enhancement, and feature all create stories via subagent)
36
36
  - [ ] Story keys captured
37
37
  ## Assessment Doc
38
38
  - [ ] Assessment document generated at {planning_artifacts}/add-feature-{feature_id}.md
@@ -148,7 +148,7 @@
148
148
  <action>If classification is 'feature' or 'enhancement': spawn subagent to create implementation stories.</action>
149
149
  <action>Spawn subagent: "Load {project-root}/_gaia/core/engine/workflow.xml, then process {project-root}/_gaia/lifecycle/workflows/4-implementation/add-stories/workflow.yaml as workflow-config. Run in YOLO mode. Context: {classification} — {description}. New requirements: {prd_diff}. Architecture changes: {arch_diff}. Feature ID: {feature_id}."</action>
150
150
  <action>When subagent returns: capture new story keys and epic assignments.</action>
151
- <action>If classification is 'patch': create a single fix story inline or recommend /gaia-create-story.</action>
151
+ <action>If classification is 'patch': spawn subagent to create a fix story. Spawn subagent: "Load {project-root}/_gaia/core/engine/workflow.xml, then process {project-root}/_gaia/lifecycle/workflows/4-implementation/create-story/workflow.yaml as workflow-config. Run in YOLO mode. Context: patch fix — {description}. Feature ID: {feature_id}." When subagent returns: capture the new story key.</action>
152
152
  <action>Priority flag integration: if the feature driver is high-urgency (P0 priority, business-critical, or regulatory driver), set priority_flag: "next-sprint" in each created story's frontmatter. This signals sprint planning to auto-include these stories in the next sprint cycle. For non-urgent features, priority_flag remains null (default).</action>
153
153
  </step>
154
154
 
@@ -181,8 +181,7 @@
181
181
  <action>Present summary and recommended next actions based on classification and outcome:
182
182
 
183
183
  **Patch:**
184
- - If story created: "Run /gaia-dev-story {story_key} to implement the fix."
185
- - If no story: "The patch is straightforward — apply directly or create a story with /gaia-create-story."
184
+ - "Run `/gaia-dev-story {story_key}` to implement the fix."
186
185
 
187
186
  **Enhancement:**
188
187
  - "New stories created: {story_keys}. Run /gaia-sprint-plan or /gaia-correct-course to schedule."
@@ -22,6 +22,11 @@ validation-target: 'Updated epics-and-stories.md'
22
22
  - [ ] Source: CR-{cr_id} added (if change request linked)
23
23
  ## Change Log
24
24
  - [ ] Change log entry added with date, feature name, and CR ID
25
+ ## Inline Validation
26
+ - [ ] Inline validation invoked for each new story
27
+ - [ ] Fix loop executed if CRITICAL/WARNING findings found (max 3 attempts)
28
+ - [ ] Validation results recorded per story (validated / validating / degraded)
29
+ - [ ] Graceful degradation handled if Val unavailable (prerequisites missing or invocation failure)
25
30
  ## Existing Content
26
31
  - [ ] Existing stories not modified
27
32
  - [ ] Existing epic structure preserved