gaia-framework 1.66.0 → 1.87.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 (40) 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 +87 -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 +5 -1
  10. package/_gaia/core/workflows/party-mode/steps/step-01-agent-loading.md +60 -9
  11. package/_gaia/creative/workflows/problem-solving/checklist.md +64 -14
  12. package/_gaia/creative/workflows/problem-solving/instructions.xml +367 -22
  13. package/_gaia/creative/workflows/problem-solving/workflow.yaml +31 -1
  14. package/_gaia/dev/agents/_base-dev.md +13 -2
  15. package/_gaia/dev/skills/_skill-index.yaml +15 -0
  16. package/_gaia/dev/skills/figma-integration.md +498 -0
  17. package/_gaia/lifecycle/templates/brownfield-scan-security-prompt.md +228 -0
  18. package/_gaia/lifecycle/templates/gap-entry-schema.md +39 -4
  19. package/_gaia/lifecycle/templates/story-template.md +29 -1
  20. package/_gaia/lifecycle/workflows/2-planning/create-ux-design/instructions.xml +96 -3
  21. package/_gaia/lifecycle/workflows/4-implementation/code-review/instructions.xml +10 -0
  22. package/_gaia/lifecycle/workflows/4-implementation/create-stakeholder/checklist.md +25 -0
  23. package/_gaia/lifecycle/workflows/4-implementation/create-stakeholder/instructions.xml +79 -0
  24. package/_gaia/lifecycle/workflows/4-implementation/create-stakeholder/workflow.yaml +22 -0
  25. package/_gaia/lifecycle/workflows/4-implementation/create-story/instructions.xml +10 -0
  26. package/_gaia/lifecycle/workflows/4-implementation/dev-story/instructions.xml +10 -0
  27. package/_gaia/lifecycle/workflows/4-implementation/retrospective/instructions.xml +3 -3
  28. package/_gaia/lifecycle/workflows/4-implementation/validate-story/instructions.xml +11 -0
  29. package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/instructions.xml +11 -7
  30. package/_gaia/testing/workflows/test-gap-analysis/checklist.md +8 -0
  31. package/_gaia/testing/workflows/test-gap-analysis/instructions.xml +53 -0
  32. package/_gaia/testing/workflows/test-gap-analysis/workflow.yaml +38 -0
  33. package/bin/gaia-framework.js +36 -2
  34. package/bin/helpers/derive-bump-label.js +41 -0
  35. package/bin/helpers/validate-bump-labels.js +38 -0
  36. package/gaia-install.sh +71 -4
  37. package/package.json +1 -1
  38. package/_gaia/_memory/tier2-results/.gitkeep +0 -0
  39. package/_gaia/_memory/tier2-results/checkpoint-resume-2026-03-24.yaml +0 -6
  40. package/_gaia/_memory/tier2-results/engine-scenarios-2026-03-22.yaml +0 -14
@@ -3,37 +3,382 @@
3
3
  <mandate>Always identify root cause before proposing solutions</mandate>
4
4
  <mandate>Separate symptoms from causes — refuse to treat symptoms</mandate>
5
5
  <mandate>Challenge assumed constraints — are they real or inherited?</mandate>
6
+ <mandate>NEVER interrogate the user for information that exists in project artifacts — gather context automatically</mandate>
7
+ <mandate>ALL code-change resolutions MUST route through /gaia-create-story — no invisible work</mandate>
6
8
  </critical>
7
- <step n="1" title="Problem Framing">
8
- <action>Articulate the problem clearly and precisely</action>
9
- <action>Separate symptoms from root causes</action>
10
- <action>Define what "solved" looks like — success criteria</action>
9
+
10
+ <!-- ═══════════════════════════════════════════════════════════ -->
11
+ <!-- PHASE 1: INTAKE -->
12
+ <!-- ═══════════════════════════════════════════════════════════ -->
13
+
14
+ <step n="1" title="Problem Intake">
15
+ <ask>What is the problem? Describe the symptom or issue you are experiencing.</ask>
16
+ <ask>Urgency level? (critical — production outage / high — blocks work / medium — needs attention / low — backlog)</ask>
17
+ <action>Record: problem_statement, urgency_level</action>
18
+ <action>Extract domain keywords from the problem statement. Parse for four categories:
19
+ 1. **File names** — any foo.ts, bar.yaml, config.json patterns mentioned
20
+ 2. **Module names** — recognized GAIA module names (core, lifecycle, dev, creative, testing) or project-specific module references
21
+ 3. **Error signatures** — stack trace patterns, error codes, exception names, HTTP status codes
22
+ 4. **Domain terms** — expanded semantically using domain knowledge (e.g., "login fails" expands to: login, authentication, auth, session, JWT, token, sign-in, timeout, credentials)
23
+ No external lookup table required — use domain knowledge for semantic expansion.</action>
11
24
  </step>
12
- <step n="2" title="Root Cause Analysis">
25
+
26
+ <step n="2" title="Context Gathering">
27
+ <action>Execute Tier 1 — Artifact Scan (always). Use expanded keywords to search. Enforce token budget cap: total gathered context must stay within 30K tokens (configurable via global.yaml problem_solving.context_budget). Apply sub-budgets per source, prioritized by relevance to the problem statement:</action>
28
+
29
+ <action>**Stories (budget: 8K tokens):** Glob {implementation_artifacts}/ for story files matching domain keywords. For each match, extract: story key, title, status, acceptance criteria, Review Gate table, findings. Prioritize stories with status in-progress, review, or done over backlog.</action>
30
+
31
+ <action>**Architecture (budget: 5K tokens):** Grep {planning_artifacts}/architecture.md for sections matching keywords. Extract: affected components, relevant ADRs, API contracts, data models. Summarize if section exceeds budget.</action>
32
+
33
+ <action>**PRD (budget: 5K tokens):** Grep {planning_artifacts}/prd.md for requirement sections matching keywords. Extract: relevant FR/NFR IDs, acceptance criteria, feature descriptions. Summarize if section exceeds budget.</action>
34
+
35
+ <action>**Decision Logs (budget: 3K tokens):** Read agent memory sidecars for domain-relevant entries:
36
+ - {memory_path}/pm-sidecar/decision-log.md — PM decisions
37
+ - {memory_path}/architect-sidecar/decision-log.md — architecture decisions
38
+ - {memory_path}/sm-sidecar/decision-log.md — sprint decisions
39
+ Skip any sidecar that does not exist (no error). Extract only entries matching keywords.</action>
40
+
41
+ <action>**Test Artifacts (budget: 4K tokens):** Check {test_artifacts}/test-plan.md for coverage of the affected area. Check {test_artifacts}/traceability-matrix.md to map requirements to tests. Identify coverage gaps and recent test review findings.</action>
42
+
43
+ <action>Determine if the problem is technical (runtime bug, code error, performance issue) or non-technical (process, requirements, strategy). If technical, execute Tier 2.</action>
44
+
45
+ <action if="problem is technical">**Tier 2 — Codebase Scan (budget: 5K tokens):**
46
+ - Grep {project-path}/ for affected routes, services, components, functions matching keywords
47
+ - Run: git log --oneline -20 -- {affected_paths} to find recent changes in the area
48
+ - Identify related test files and check if they exist
49
+ Summarize findings — do not dump raw code.</action>
50
+
51
+ <action>Synthesize all gathered context into a **Context Brief**:
52
+ ## Context Brief
53
+ **Problem:** {problem_statement}
54
+ **Urgency:** {urgency_level}
55
+ **Keywords:** {expanded_keywords}
56
+
57
+ ### Relevant Requirements
58
+ {FR/NFR IDs and summaries from PRD}
59
+
60
+ ### Architecture Context
61
+ {affected components, ADRs, design decisions}
62
+
63
+ ### Related Stories
64
+ {story keys, titles, statuses, review gate results}
65
+
66
+ ### Sprint History
67
+ {relevant sprint notes, findings, tech debt entries}
68
+
69
+ ### Decision Log Entries
70
+ {relevant decisions from PM, architect, SM sidecars}
71
+
72
+ ### Test Coverage
73
+ {coverage status, gaps identified, recent test findings}
74
+
75
+ ### Codebase Context (if technical)
76
+ {affected files, recent changes, test file status}
77
+
78
+ ### Keyword Hit Counts
79
+ {table of each keyword and how many matches it had across Tier 1 and Tier 2 sources}
80
+
81
+ ### Token Usage
82
+ {breakdown of tokens consumed per source type vs. sub-budget, total token usage vs. 30K cap}
83
+ </action>
84
+
85
+ <action if="no relevant or matching context found across all tiers">Proceed gracefully with an empty Context Brief. Log an info-level note: "No relevant context found — proceeding with user-provided information only." Do not halt or error.</action>
86
+
87
+ <ask>Here is what I found. Is anything missing from this context? Any recent changes not captured in artifacts?</ask>
88
+ <action>Incorporate any additional context the user provides.</action>
89
+ <action>Persist the validated Context Brief to the workflow checkpoint for use by subsequent analysis steps. Save to {checkpoint_path}/ so downstream steps (Problem Framing, Root Cause Analysis) can reference the gathered context without re-scanning.</action>
90
+ </step>
91
+
92
+ <!-- ═══════════════════════════════════════════════════════════ -->
93
+ <!-- PHASE 2: CONTEXT-INFORMED ANALYSIS -->
94
+ <!-- ═══════════════════════════════════════════════════════════ -->
95
+
96
+ <step n="3" title="Problem Framing">
97
+ <!-- context-informed: uses gathered context from Step 2, falls back to user interrogation if unavailable -->
98
+ <action>Check if a Context Brief is available from the Step 2 checkpoint. Set context_brief_available = true if the checkpoint contains a non-empty Context Brief; false otherwise (Step 0 was skipped, or Context Brief is empty).</action>
99
+
100
+ <action if="context_brief_available">**Context-informed path (AC1, AC2):** Using the Context Brief, articulate the problem clearly and precisely. Distinguish the user's reported symptom from the underlying issue revealed by artifact context:
101
+ - Read **Architecture Context** section for component design and API contracts
102
+ - Read **Related Stories** section for implementation state and acceptance criteria
103
+ - Read **Relevant Requirements** section for PRD-level expectations
104
+ Do NOT ask the user for project context that is already present in the Context Brief.</action>
105
+
106
+ <action if="context_brief_available">Separate symptoms from root causes — cross-reference the reported symptom against architecture design (from Context Brief), story implementation notes, and test results. Only ask the user for clarification on information NOT present in the Context Brief (AC3).</action>
107
+
108
+ <action if="context_brief_available">Define what "solved" looks like — success criteria grounded in existing acceptance criteria from related stories and PRD requirements found in the Context Brief.</action>
109
+
110
+ <action if="not context_brief_available">**Fallback path (AC6):** Context Brief is not available — fall back to interrogation-based problem framing with no errors or degraded experience.</action>
111
+ <ask if="not context_brief_available">Describe your project architecture and the components involved in this problem.</ask>
112
+ <ask if="not context_brief_available">What related stories or features have been implemented in this area?</ask>
113
+ <action if="not context_brief_available">Articulate the problem clearly and precisely based on user-provided information.</action>
114
+ <action if="not context_brief_available">Separate symptoms from root causes based on the user's description.</action>
115
+ <action if="not context_brief_available">Define what "solved" looks like — success criteria based on the user's stated goals.</action>
116
+ </step>
117
+
118
+ <step n="4" title="Root Cause Analysis">
13
119
  <action>Load methods from {data_path}/solving-methods.csv</action>
14
- <action>Apply appropriate methodology: 5 Whys, Fishbone Diagram, or TRIZ</action>
15
- <action>Trace causal chains to their source</action>
16
- <action>Validate root cause does fixing it fix the symptoms?</action>
120
+
121
+ <action if="context_brief_available">**Context-informed path (AC1, AC2):** Apply appropriate methodology: 5 Whys, Fishbone Diagram, or TRIZ. Ground each "why" in evidence from the Context Brief:
122
+ - Use **Decision Log Entries** to understand WHY components were built this way
123
+ - Use **Architecture Context** to identify design constraints that may have caused the issue
124
+ - Use **Test Coverage** section to identify existing gaps
125
+ Do NOT ask the user for information already present in the Context Brief.</action>
126
+
127
+ <action if="context_brief_available">Trace causal chains to their source. Use decision logs from the Context Brief to understand design rationale. Only ask the user for clarification when the Context Brief lacks specific causal information (AC3).</action>
128
+
129
+ <action if="context_brief_available">Validate root cause — does fixing it fix the symptoms? Cross-check against the architecture constraints and related story acceptance criteria from the Context Brief.</action>
130
+
131
+ <action if="not context_brief_available">**Fallback path (AC6):** Context Brief is not available — fall back to interrogation-based root cause analysis.</action>
132
+ <action if="not context_brief_available">Apply appropriate methodology: 5 Whys, Fishbone Diagram, or TRIZ.</action>
133
+ <ask if="not context_brief_available">What decisions led to the current architecture in the affected area? Why was it built this way?</ask>
134
+ <ask if="not context_brief_available">What test coverage exists for the affected components?</ask>
135
+ <action if="not context_brief_available">Trace causal chains to their source based on user-provided information.</action>
136
+ <action if="not context_brief_available">Validate root cause — does fixing it fix the symptoms?</action>
137
+
138
+ <action>Identify **test gaps** (AC4, AC5): analyze what tests should have caught this problem but did not. For each gap found, create a test gap entry. Populate the `test_gaps` output as an array of objects, each containing:
139
+ - `file_path` (string): the file or module path where the test gap exists
140
+ - `gap_description` (string): what test is missing or inadequate
141
+ - `suggested_test_type` (enum: unit | integration | e2e): the type of test that should be added
142
+ - `severity` (enum: critical | high | medium | low): how important the missing coverage is
143
+ If no test gaps are identified (well-tested area), set `test_gaps` to an empty array — never omit the field.</action>
144
+
145
+ <action>Persist `test_gaps` array to the workflow checkpoint at {checkpoint_path}/ so downstream steps (Resolution Routing, Step 9 artifact) can reference it without re-analysis.</action>
17
146
  </step>
18
- <step n="3" title="Constraint Identification">
19
- <action>What are the REAL constraints vs assumed constraints?</action>
20
- <action>Challenge each constraint: who said this? when? is it still true?</action>
21
- <action>Identify contradictions what two things seem mutually exclusive?</action>
147
+
148
+ <step n="5" title="Constraint Identification">
149
+ <!-- context-informed: checks ADRs and decision logs for real constraints, falls back to interrogation -->
150
+ <action if="context_brief_available">**Context-informed path (AC1, AC2):** Identify REAL constraints vs assumed constraints by reading the **Architecture Context** section of the Context Brief:
151
+ - Check ADRs directly — are constraints documented and still valid?
152
+ - Read **Decision Log Entries** for historical constraint rationale
153
+ Do NOT ask the user about constraints that are documented in the Context Brief.</action>
154
+
155
+ <action if="context_brief_available">Challenge each constraint using decision log evidence from the Context Brief: who decided this? when? has the context changed since? Only ask the user about constraints NOT documented in available artifacts (AC3).</action>
156
+
157
+ <action if="not context_brief_available">**Fallback path (AC6):** Context Brief is not available — fall back to interrogation-based constraint identification.</action>
158
+ <ask if="not context_brief_available">What are the known constraints in this area? (technical, business, timeline)</ask>
159
+ <ask if="not context_brief_available">Who established these constraints and when? Are they still valid?</ask>
160
+ <action if="not context_brief_available">Determine what are the REAL constraints vs assumed constraints based on user input.</action>
161
+
162
+ <action>Identify contradictions — what two things seem mutually exclusive? Use TRIZ contradiction matrix if applicable.</action>
22
163
  </step>
23
- <step n="4" title="Solution Generation">
164
+
165
+ <step n="6" title="Solution Generation">
24
166
  <action>Use TRIZ inventive principles or Theory of Constraints approach</action>
25
167
  <action>Apply First Principles thinking — reason up from fundamentals</action>
26
- <action>Generate at least 5 candidate solutions</action>
168
+
169
+ <action if="context_brief_available">**Context-informed path (AC1, AC2):** Generate at least 5 candidate solutions. For each, use the Context Brief to:
170
+ - Note which **architecture components** (from Architecture Context section) would be affected
171
+ - Identify which **stories** (from Related Stories section) would need changes
172
+ - Cross-check against **ADR constraints** from the Architecture Context — flag solutions that would violate existing decisions
173
+ - Cross-check against **PRD requirements** from the Relevant Requirements section
174
+ Do NOT ask the user for architecture or requirement context that exists in the Context Brief.</action>
175
+
176
+ <action if="not context_brief_available">**Fallback path (AC6):** Generate at least 5 candidate solutions. For each, note which architecture components and stories would be affected.</action>
177
+ <ask if="not context_brief_available">What architecture patterns and components are involved in this area?</ask>
178
+ <action if="not context_brief_available">Cross-check each solution against known constraints and requirements as described by the user. Flag solutions that may violate existing decisions.</action>
27
179
  </step>
28
- <step n="5" title="Solution Evaluation">
29
- <action>Assess feasibility, impact, and effort for each solution</action>
180
+
181
+ <step n="7" title="Solution Evaluation">
182
+ <action if="context_brief_available">**Context-informed path (AC1, AC2):** Assess feasibility, impact, and effort for each solution:
183
+ - Use **Codebase Context** (Tier 2 data) from the Context Brief to ground effort estimates in actual code complexity
184
+ - Map solutions against **architecture constraints** and **PRD requirements** from the Context Brief
185
+ Do NOT ask the user for codebase details or effort estimates when that information is available in the Context Brief. Only ask for clarification on information NOT present (AC3).</action>
186
+
187
+ <action if="not context_brief_available">**Fallback path (AC6):** Assess feasibility, impact, and effort for each solution.</action>
188
+ <ask if="not context_brief_available">How complex is the codebase in the affected area? What is the estimated effort for each solution?</ask>
189
+
30
190
  <action>Map solutions to a 2x2: impact vs effort</action>
31
- <action>Select the solution that best resolves the root cause</action>
191
+ <action>Select the solution that best resolves the root cause without violating architecture constraints.</action>
192
+ <action>Document rejected solutions with clear reasons — these will be passed to the dev agent to prevent re-exploration.</action>
193
+ </step>
194
+
195
+ <!-- ═══════════════════════════════════════════════════════════ -->
196
+ <!-- PHASE 3: RESOLUTION ROUTING -->
197
+ <!-- ═══════════════════════════════════════════════════════════ -->
198
+
199
+ <step n="8" title="Resolution Classification">
200
+ <critical>
201
+ <mandate>Classification is based on analysis output — do NOT invoke agents for classification</mandate>
202
+ <mandate>User MUST confirm or override classification before routing proceeds</mandate>
203
+ </critical>
204
+
205
+ <action>Read the analysis output from the prior steps. Evaluate the root cause against the classification decision matrix:
206
+
207
+ **Quick fix / isolated-fix** (&lt; 1 story point):
208
+ - Affects 1-2 files in a single component (component_count = 1, requires_upstream = false)
209
+ - Root cause is clear and fix is bounded (config error, typo, off-by-one, missing condition)
210
+ - No new requirements needed
211
+
212
+ **Bug fix** (bounded scope, needs story):
213
+ - Affects multiple files or components
214
+ - Needs acceptance criteria and targeted testing
215
+ - Clear root cause with bounded fix
216
+
217
+ **Critical / Production** (any scope, urgent):
218
+ - Urgency is critical — production outage or blocking issue
219
+ - Same as quick fix or bug fix but with priority:critical and priority_flag:next-sprint
220
+
221
+ **Enhancement** (design gap revealed):
222
+ - Root cause is a missing capability or design limitation (component_count > 1 OR design gap identified)
223
+ - Requires PRD/architecture/UX changes — broader than a fix
224
+ - Route through /gaia-add-feature for proper cascade
225
+
226
+ **Systemic** (architecture or requirements problem):
227
+ - Root cause is in the architecture design or requirements definition (requires_upstream = true)
228
+ - Fix requires upstream changes before implementation
229
+ - Escalate to Theo (architecture) or Derek (requirements)
230
+
231
+ If the scope analysis is inconclusive or the root cause does not match any single category, present all options without a highlighted recommendation. Otherwise, highlight the recommended classification.</action>
232
+
233
+ <action>Present the recommended classification to the user with reasoning. Include: classification, affected components, estimated scope, and the resolution path that will be taken.</action>
234
+ <ask>Do you agree with this classification?
235
+
236
+ Options:
237
+ [1] Confirm classification as the recommended type and proceed to routing
238
+ [2] Override classification — choose a different type:
239
+ - quick-fix/bug/critical: route to /gaia-create-story
240
+ - enhancement: route to /gaia-add-feature
241
+ - systemic: generate Problem Brief + escalation
242
+ [3] Decline routing — complete workflow with action plan only, skip all downstream routing
243
+
244
+ If override is selected, re-route to the selected classification path.
245
+ If decline is selected, skip routing and complete with action plan output only.</ask>
246
+ </step>
247
+
248
+ <step n="9" title="Problem-Solving Artifact">
249
+ <template-output file="{creative_artifacts}/problem-solving-{date}.md">
250
+ Generate the problem-solving artifact with the following structure:
251
+
252
+ ---
253
+ template: problem-solving
254
+ date: {date}
255
+ urgency: {urgency_level}
256
+ classification: {resolution_classification}
257
+ status: resolved
258
+ keywords: [{expanded_keywords}]
259
+ affected_components: [{components}]
260
+ root_cause: "{root_cause_summary}"
261
+ test_gaps: [{test_gaps_array}]
262
+ resolution_path: "{quick-fix|bug|critical|enhancement|systemic}"
263
+ ---
264
+
265
+ # Problem-Solving Report: {problem_title}
266
+
267
+ ## Problem Statement
268
+ {user's original problem description}
269
+
270
+ ## Urgency
271
+ {urgency_level} — {urgency_justification}
272
+
273
+ ## Context Brief
274
+ {summarized context gathered in Step 2}
275
+
276
+ ## Root Cause Analysis
277
+ **Methodology:** {5 Whys / Fishbone / TRIZ}
278
+ **Root Cause:** {identified root cause with evidence}
279
+ **Causal Chain:** {documented chain from symptom to root cause}
280
+
281
+ ### Test Gaps
282
+ | # | File Path | Gap Description | Suggested Test Type | Severity |
283
+ |---|-----------|-----------------|---------------------|----------|
284
+ {for each entry in test_gaps array: file_path, gap_description, suggested_test_type, severity}
285
+ (Empty table if no test gaps identified)
286
+
287
+ ## Constraints
288
+ {real vs assumed constraints, with ADR references}
289
+
290
+ ## Solutions Considered
291
+ | # | Solution | Impact | Effort | Feasibility | Status |
292
+ |---|----------|--------|--------|-------------|--------|
293
+ {5+ solutions with selected and rejected status}
294
+
295
+ ## Selected Solution
296
+ {detailed description of chosen solution and why}
297
+
298
+ ## Rejected Solutions
299
+ {each rejected solution with clear reasoning — passed to dev agent}
300
+
301
+ ## Resolution Route
302
+ **Classification:** {quick-fix / bug / critical / enhancement / systemic}
303
+ **Path:** {/gaia-create-story / /gaia-add-feature / Escalate to {agent}}
304
+ **Pre-populated story context:** {summary of what will be passed to story creation}
305
+
306
+ ## Risk Assessment
307
+ {risks of the selected solution and mitigation strategies}
308
+
309
+ ## Success Metrics
310
+ {how to measure that the problem is truly solved}
311
+ </template-output>
312
+ </step>
313
+
314
+ <step n="10" title="Resolution Execution">
315
+ <action if="classification is quick-fix or bug or critical">
316
+ Prepare context for /gaia-create-story invocation with pre-populated fields:
317
+ - title: derived from problem statement and root cause
318
+ - epic: auto-detected from related stories found in Context Brief (or ask user if ambiguous)
319
+ - priority: P0 for critical, P1 for high urgency, P2 for medium/low
320
+ - priority_flag: "next-sprint" if urgency is critical or high
321
+ - origin: "problem-solving"
322
+ - origin_ref: "{creative_artifacts}/problem-solving-{date}.md"
323
+ - root_cause, affected_components, acceptance_criteria, rejected_solutions
324
+ - Include in Dev Notes: root cause, affected components, selected solution, rejected solutions, test_gaps array
325
+ - Include in acceptance criteria: criteria that verify the root cause is resolved + each test gap in test_gaps is closed
326
+
327
+ If test_gaps were identified during analysis, propagate them into the created story's Dev Notes section with structured fields: file path, gap description, suggested test type, severity.
328
+ If no test_gaps exist, create the story without a test gaps section — no error.
329
+ If the invocation fails (crash, context too large), log a warning and fall back to the action plan output only.
330
+ </action>
331
+ <invoke-workflow if="classification is quick-fix or bug or critical" ref="create-story" context="Pre-populated from problem-solving analysis: title, epic, priority, origin=problem-solving, origin_ref={creative_artifacts}/problem-solving-{date}.md, root_cause, affected_components, acceptance_criteria, test_gaps (propagated to Dev Notes), rejected_solutions" />
332
+
333
+ <action if="classification is enhancement">
334
+ Route to /gaia-add-feature with the problem-solving artifact as context.
335
+ Present to user: "This resolution reveals a design gap. Routing to /gaia-add-feature for proper triage and cascade."
336
+ Pass: scope_analysis, affected_components, proposed_changes, context_ref={creative_artifacts}/problem-solving-{date}.md
337
+ If the invocation fails (crash, context too large), log a warning and fall back to the action plan output only.
338
+ </action>
339
+ <invoke-workflow if="classification is enhancement" ref="add-feature" context="Scope analysis and affected components from problem-solving: scope_analysis, affected_components, proposed_changes, context_ref={creative_artifacts}/problem-solving-{date}.md" />
340
+
341
+ <!-- Problem Brief output path: docs/planning-artifacts/problem-brief-{date}.md -->
342
+ <action if="classification is systemic">
343
+ Do NOT invoke a subagent. Present the escalation to the user:
344
+ "This is a systemic issue requiring upstream changes. Escalating to {Theo if architecture / Derek if requirements}."
345
+
346
+ Generate a **Problem Brief** for the receiving agent:
347
+ ## Problem Brief (for {agent_name})
348
+ **From:** Nova (Problem-Solving)
349
+ **Source:** {creative_artifacts}/problem-solving-{date}.md
350
+ **Root Cause:** {root_cause}
351
+ **Affected Components:** {components}
352
+ **Constraints:** {real constraints identified}
353
+ **Evidence:** {key evidence from context gathering}
354
+ **Rejected Approaches:** {solutions that don't work and why}
355
+ **Recommendation:** {what Nova thinks should change at the architecture/requirements level}
356
+
357
+ Present the Problem Brief and suggest: "Run /gaia-agent-architect or /gaia-agent-pm to continue."
358
+ </action>
359
+ <template-output if="classification is systemic" file="{planning_artifacts}/problem-brief-{date}.md" />
360
+
361
+ <action>When subagent returns (if applicable): capture the created story key or add-feature ID. Update the problem-solving artifact with the resolution reference.</action>
32
362
  </step>
33
- <step n="6" title="Action Plan">
34
- <action>Define concrete next steps with owners and timelines</action>
35
- <action>Identify risks and mitigation strategies</action>
36
- <action>Define how to measure success</action>
37
- <template-output file="{creative_artifacts}/problem-solving-{date}.md" />
363
+
364
+ <step n="11" title="Completion Summary">
365
+ <action>Present final summary:
366
+
367
+ **Problem-Solving Complete**
368
+
369
+ | Field | Value |
370
+ |-------|-------|
371
+ | Problem | {problem_statement} |
372
+ | Root Cause | {root_cause} |
373
+ | Classification | {classification} |
374
+ | Resolution | {story_key or add-feature ID or escalation target} |
375
+ | Test Gaps | {test_gaps.length} identified ({test_gaps summary}) |
376
+ | Artifact | {creative_artifacts}/problem-solving-{date}.md |
377
+
378
+ **Next steps:**
379
+ - Quick fix / Bug / Critical: "Run `/gaia-dev-story {story_key}` to implement the fix."
380
+ - Enhancement: "Add-feature cascade in progress. Check assessment doc when complete."
381
+ - Systemic: "Consult with {agent_name} to resolve the upstream issue before implementation."
382
+ </action>
38
383
  </step>
39
384
  </workflow>
@@ -1,13 +1,43 @@
1
1
  name: problem-solving
2
- description: 'Apply systematic problem-solving methodologies to complex challenges'
2
+ description: 'Context-aware problem-solving with auto artifact gathering and tiered resolution routing'
3
3
  module: creative
4
4
  agent: problem-solver
5
+ execution_mode: planning
5
6
  config_resolved: "{installed_path}/.resolved/problem-solving.yaml"
6
7
  config_source: "{project-root}/_gaia/creative/config.yaml"
7
8
  installed_path: "{project-root}/_gaia/creative/workflows/problem-solving"
8
9
  instructions: "{installed_path}/instructions.xml"
9
10
  validation: "{installed_path}/checklist.md"
11
+
12
+ # Context gathering configuration
13
+ context_budget: 30000
14
+ context_sub_budgets:
15
+ stories: 8000
16
+ architecture: 5000
17
+ prd: 5000
18
+ decision_logs: 3000
19
+ codebase: 5000
20
+ test_artifacts: 4000
21
+
22
+ input_file_patterns:
23
+ prd:
24
+ whole: "{planning_artifacts}/prd.md"
25
+ load_strategy: "SELECTIVE_LOAD"
26
+ architecture:
27
+ whole: "{planning_artifacts}/architecture.md"
28
+ load_strategy: "SELECTIVE_LOAD"
29
+ sprint_status:
30
+ whole: "{implementation_artifacts}/sprint-status.yaml"
31
+ load_strategy: "SELECTIVE_LOAD"
32
+ test_plan:
33
+ whole: "{test_artifacts}/test-plan.md"
34
+ load_strategy: "SELECTIVE_LOAD"
35
+ traceability:
36
+ whole: "{test_artifacts}/traceability-matrix.md"
37
+ load_strategy: "SELECTIVE_LOAD"
38
+
10
39
  output:
11
40
  primary: "{creative_artifacts}/problem-solving-{date}.md"
41
+
12
42
  data_files:
13
43
  methods: "{data_path}/solving-methods.csv"
@@ -62,11 +62,21 @@ abstract: true
62
62
  - Mark each as checked or document why it can't be checked
63
63
  - All DoD items must pass before status changes to `review`
64
64
 
65
+ ## Figma Design Consumption
66
+ - When a story file or ux-design.md contains a `figma:` metadata block, load the figma-integration skill (tokens, components, export sections) via JIT
67
+ - Extract design tokens and component specs using MCP, then generate stack-specific scaffolded code using the export section's resolution table
68
+ - If no `figma:` metadata is present, skip all Figma operations and read ux-design.md text as-is (zero behavioral change)
69
+
65
70
  ## Skill Access
66
- - All 8 shared skills available via JIT loading
71
+ - All 8 shared skills + figma-integration available via JIT loading
67
72
  - Load skill sections only when needed for current step
68
73
  - Drop skill from context when step completes
69
- - Skills can be overridden via customize.yaml (skill_overrides for full file, skill_section_overrides for individual sections)
74
+ - Skills can be overridden via .customize.yaml (skill_overrides for full file, skill_section_overrides for individual sections)
75
+ - .customize.yaml lookup order (file-level replacement — no merge between locations):
76
+ 1. `custom/skills/{agent-id}.customize.yaml` — primary location (survives framework upgrades)
77
+ 2. `custom/skills/all-dev.customize.yaml` — shared dev agent overrides (primary)
78
+ 3. `_gaia/_config/agents/{agent-id}.customize.yaml` — legacy fallback
79
+ 4. `_gaia/_config/agents/all-dev.customize.yaml` — legacy fallback for dev agents
70
80
  - Override resolution: agent-specific customize.yaml → all-dev.customize.yaml → default skill-registry path
71
81
 
72
82
  ## Checkpoint Writing
@@ -175,6 +185,7 @@ abstract: true
175
185
  <skill name="code-review-standards" path="_gaia/dev/skills/code-review-standards.md" />
176
186
  <skill name="documentation-standards" path="_gaia/dev/skills/documentation-standards.md" />
177
187
  <skill name="security-basics" path="_gaia/dev/skills/security-basics.md" />
188
+ <skill name="figma-integration" path="_gaia/dev/skills/figma-integration.md" />
178
189
  </skill-registry>
179
190
 
180
191
  </agent>
@@ -53,3 +53,18 @@ skills:
53
53
  - { id: input-validation, line_range: [69, 118], description: "Validation at system boundaries" }
54
54
  - { id: secrets-management, line_range: [119, 166], description: "Environment-based secrets" }
55
55
  - { id: cors-csrf, line_range: [167, 230], description: "CORS and CSRF configuration, protection" }
56
+
57
+ - file: figma-integration.md
58
+ sections:
59
+ - { id: detection, line_range: [48, 135], description: "Figma MCP detection probe, failure handling, adapter selection, security guardrails, API scopes, error sanitization" }
60
+ - { id: tokens, line_range: [136, 166], description: "Design token extraction in W3C DTCG format" }
61
+ - { id: components, line_range: [167, 202], description: "Component spec extraction to tech-agnostic YAML" }
62
+ - { id: frames, line_range: [203, 223], description: "UI kit frame generation across viewports" }
63
+ - { id: assets, line_range: [224, 247], description: "Asset export at multiple densities" }
64
+ - { id: export, line_range: [248, 299], description: "Per-stack token resolution table, path resolution rules, and semantic alias resolution for all dev agents" }
65
+ - { id: import-detection, line_range: [300, 322], description: "Import mode entry point — URL/key validation, error handling" }
66
+ - { id: import-discovery, line_range: [323, 347], description: "Import mode page and frame discovery via MCP" }
67
+ - { id: import-tokens, line_range: [348, 366], description: "Import mode design token extraction to W3C DTCG" }
68
+ - { id: import-screens, line_range: [367, 390], description: "Import mode screen inventory and frame-to-screen mapping" }
69
+ - { id: import-generate, line_range: [391, 419], description: "Import mode ux-design.md generation with figma: frontmatter" }
70
+ - { id: fidelity, line_range: [420, 498], description: "Design-to-implementation fidelity gate — token drift detection, per-category reporting, threshold-based gating" }