gaia-framework 1.64.0 → 1.65.1

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 (74) hide show
  1. package/.claude/commands/gaia-add-feature.md +2 -2
  2. package/.claude/commands/gaia-change-request.md +16 -4
  3. package/.claude/commands/gaia-edit-ux.md +17 -0
  4. package/.claude/commands/gaia-resume.md +1 -1
  5. package/.claude/commands/gaia-validate-prd.md +9 -3
  6. package/CLAUDE.md +1 -1
  7. package/README.md +3 -3
  8. package/_gaia/_config/adversarial-triggers.yaml +91 -0
  9. package/_gaia/_config/files-manifest.csv +1 -0
  10. package/_gaia/_config/gaia-help.csv +10 -6
  11. package/_gaia/_config/global.yaml +2 -1
  12. package/_gaia/_config/lifecycle-sequence.yaml +26 -4
  13. package/_gaia/_config/manifest.yaml +3 -3
  14. package/_gaia/_config/skill-manifest.csv +3 -1
  15. package/_gaia/_config/workflow-manifest.csv +5 -3
  16. package/_gaia/core/config.yaml +1 -1
  17. package/_gaia/core/engine/workflow.xml +25 -5
  18. package/_gaia/core/workflows/brainstorming/template.md +6 -0
  19. package/_gaia/lifecycle/agents/pm.md +9 -10
  20. package/_gaia/lifecycle/agents/ux-designer.md +1 -0
  21. package/_gaia/lifecycle/agents/validator.md +2 -1
  22. package/_gaia/lifecycle/config.yaml +1 -1
  23. package/_gaia/lifecycle/module-help.csv +1 -1
  24. package/_gaia/lifecycle/skills/document-rulesets.md +166 -0
  25. package/_gaia/lifecycle/skills/memory-management-cross-agent.md +218 -0
  26. package/_gaia/lifecycle/skills/memory-management.md +32 -122
  27. package/_gaia/lifecycle/templates/story-template.md +1 -0
  28. package/_gaia/lifecycle/workflows/1-analysis/create-product-brief/workflow.yaml +1 -0
  29. package/_gaia/lifecycle/workflows/2-planning/create-prd/instructions.xml +4 -2
  30. package/_gaia/lifecycle/workflows/2-planning/create-prd/workflow.yaml +1 -0
  31. package/_gaia/lifecycle/workflows/2-planning/create-ux-design/workflow.yaml +1 -0
  32. package/_gaia/lifecycle/workflows/2-planning/edit-prd/instructions.xml +4 -4
  33. package/_gaia/lifecycle/workflows/2-planning/edit-prd/workflow.yaml +1 -0
  34. package/_gaia/lifecycle/workflows/2-planning/edit-ux-design/checklist.md +18 -0
  35. package/_gaia/lifecycle/workflows/2-planning/edit-ux-design/instructions.xml +66 -0
  36. package/_gaia/lifecycle/workflows/2-planning/edit-ux-design/workflow.yaml +27 -0
  37. package/_gaia/lifecycle/workflows/3-solutioning/create-architecture/instructions.xml +3 -1
  38. package/_gaia/lifecycle/workflows/3-solutioning/create-architecture/workflow.yaml +1 -0
  39. package/_gaia/lifecycle/workflows/3-solutioning/create-epics-stories/workflow.yaml +1 -0
  40. package/_gaia/lifecycle/workflows/3-solutioning/edit-architecture/instructions.xml +4 -7
  41. package/_gaia/lifecycle/workflows/3-solutioning/edit-architecture/workflow.yaml +1 -0
  42. package/_gaia/lifecycle/workflows/3-solutioning/security-threat-model/workflow.yaml +1 -0
  43. package/_gaia/lifecycle/workflows/4-implementation/add-feature/checklist.md +42 -0
  44. package/_gaia/lifecycle/workflows/4-implementation/add-feature/instructions.xml +197 -0
  45. package/_gaia/lifecycle/workflows/{cross-phase → 4-implementation}/add-feature/workflow.yaml +20 -9
  46. package/_gaia/lifecycle/workflows/4-implementation/add-stories/workflow.yaml +1 -0
  47. package/_gaia/lifecycle/workflows/4-implementation/code-review/workflow.yaml +1 -0
  48. package/_gaia/lifecycle/workflows/4-implementation/correct-course/workflow.yaml +1 -0
  49. package/_gaia/lifecycle/workflows/4-implementation/create-story/checklist.md +1 -1
  50. package/_gaia/lifecycle/workflows/4-implementation/create-story/instructions.xml +4 -3
  51. package/_gaia/lifecycle/workflows/4-implementation/dev-story/workflow.yaml +1 -1
  52. package/_gaia/lifecycle/workflows/4-implementation/retrospective/workflow.yaml +1 -0
  53. package/_gaia/lifecycle/workflows/4-implementation/sprint-planning/instructions.xml +3 -0
  54. package/_gaia/lifecycle/workflows/4-implementation/sprint-planning/workflow.yaml +2 -0
  55. package/_gaia/lifecycle/workflows/4-implementation/triage-findings/workflow.yaml +1 -0
  56. package/_gaia/lifecycle/workflows/4-implementation/val-refresh-ground-truth/checklist.md +15 -0
  57. package/_gaia/lifecycle/workflows/4-implementation/val-refresh-ground-truth/instructions.xml +153 -57
  58. package/_gaia/lifecycle/workflows/4-implementation/val-refresh-ground-truth/workflow.yaml +5 -0
  59. package/_gaia/lifecycle/workflows/4-implementation/val-validate-artifact/instructions.xml +23 -12
  60. package/_gaia/lifecycle/workflows/4-implementation/val-validate-artifact/workflow.yaml +11 -0
  61. package/_gaia/lifecycle/workflows/4-implementation/val-validate-plan/instructions.xml +0 -2
  62. package/_gaia/lifecycle/workflows/5-deployment/deployment-checklist/workflow.yaml +1 -0
  63. package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/instructions.xml +69 -1
  64. package/_gaia/lifecycle/workflows/anytime/memory-hygiene/instructions.xml +8 -18
  65. package/_gaia/testing/config.yaml +1 -1
  66. package/_gaia/testing/workflows/edit-test-plan/workflow.yaml +1 -0
  67. package/_gaia/testing/workflows/test-design/workflow.yaml +2 -0
  68. package/_gaia/testing/workflows/traceability/workflow.yaml +1 -0
  69. package/bin/gaia-framework.js +17 -3
  70. package/bin/generate-checksums.js +124 -0
  71. package/gaia-install.sh +46 -8
  72. package/package.json +6 -2
  73. package/_gaia/lifecycle/workflows/cross-phase/add-feature/checklist.md +0 -30
  74. package/_gaia/lifecycle/workflows/cross-phase/add-feature/instructions.xml +0 -85
@@ -19,6 +19,7 @@
19
19
  - NOT SELECTABLE: stories with files but status ≠ 'ready-for-dev' → "Story {key} is in '{status}' status — must be 'ready-for-dev' to be selectable. Run /gaia-validate-story {key} first."
20
20
  </action>
21
21
  <action>Display the classification to the user: selectable stories table (Key | Title | Priority | Size | Risk | Status) and non-selectable stories with reasons.</action>
22
+ <action>Priority flag scan: scan all selectable story files for priority_flag: "next-sprint" in their YAML frontmatter. If any flagged stories are found, display them with a visual indicator: "FLAGGED FOR NEXT SPRINT: Story {key} — {title} (priority_flag: next-sprint). This story was flagged by the add-feature workflow for priority inclusion." List all flagged stories before story selection begins so the scrum master is aware.</action>
22
23
  <action>Load most recent retro-{sprint_id}.md from {implementation_artifacts}/ if available</action>
23
24
  <action>If retro found: extract open action items — carry forward as sprint constraints or tasks. Present to user: "Previous retro action items to carry forward:" with status of each.</action>
24
25
  </step>
@@ -48,12 +49,14 @@
48
49
  <action>Priority surfacing: after story selection, check for P0 stories that are 'ready-for-dev' but were NOT selected. If any found, display: "WARNING: The following P0/critical stories are ready but not selected for this sprint:" followed by the list with their sizes. Ask user to confirm they intentionally excluded these high-priority stories.</action>
49
50
  <action>If {test_artifacts}/test-plan.md exists: apply risk levels to story selection — buffer 20% for high-risk stories in velocity estimate</action>
50
51
  <action>ATDD check (high-risk ONLY): for each story with risk = high, check if {test_artifacts}/atdd-{story_key}.md exists. If missing, add a sprint risk note: "HIGH-RISK story {key} has no ATDD file — run /gaia-atdd {key} before development." Do NOT flag medium or low risk stories — ATDD is required only for high-risk stories.</action>
52
+ <action>Auto-include flagged stories: after initial story selection, check if any SELECTABLE stories have priority_flag: "next-sprint" in their frontmatter but were NOT yet selected. For each such story: check remaining sprint capacity (velocity_capacity minus currently selected points). If the flagged story fits within remaining capacity, auto-include it in the sprint selection and inform the scrum master: "AUTO-INCLUDED: Story {key} — {title} (priority_flag: next-sprint, {points} pts). Flagged story auto-included — capacity allows." If the flagged story does NOT fit within remaining capacity, alert the scrum master for manual decision: "CAPACITY ALERT: Flagged story {key} — {title} ({points} pts) cannot be auto-included — insufficient capacity ({remaining} pts remaining). Include anyway (will exceed velocity) or defer to next sprint?"</action>
51
53
  </step>
52
54
  <step n="5" title="Update Story Files">
53
55
  <action>For each selected story that has an individual file in {implementation_artifacts}/: update the sprint_id field to "sprint-{N}"</action>
54
56
  <action>For each selected story: invoke status-sync protocol to assign the sprint — keep status as 'ready-for-dev' (do NOT change to backlog). Stories remain ready-for-dev until /gaia-dev-story transitions them to in-progress.
55
57
  <invoke-protocol ref="status-sync" story_key="{story_key}" new_status="ready-for-dev" sprint_id="sprint-{N}" source_workflow="sprint-planning" />
56
58
  Note: sprint-status.yaml may not exist yet at this point (created in Step 8) — the protocol will skip the sprint-status.yaml update if the file doesn't exist.</action>
59
+ <action>Clear priority flag on sprint assignment: for each selected story that has priority_flag: "next-sprint" in its frontmatter, set priority_flag back to null. This prevents the flag from persisting after the story has been assigned to a sprint. The flag is a one-time scheduling hint — once the story is sprint-assigned, it is no longer needed.</action>
57
60
  <action>Include all modified story files in the checkpoint files_touched with sha256 checksums</action>
58
61
  </step>
59
62
  <step n="6" title="Optional: Mobile Testing">
@@ -2,12 +2,14 @@ name: sprint-planning
2
2
  description: 'Generate sprint plan from epics and stories'
3
3
  module: lifecycle
4
4
  agent: sm
5
+ val_validate_output: true
5
6
  template_output_prompt: "auto"
6
7
  config_resolved: "{installed_path}/.resolved/sprint-planning.yaml"
7
8
  config_source: "{project-root}/_gaia/lifecycle/config.yaml"
8
9
  installed_path: "{project-root}/_gaia/lifecycle/workflows/4-implementation/sprint-planning"
9
10
  instructions: "{installed_path}/instructions.xml"
10
11
  validation: "{installed_path}/checklist.md"
12
+ template: "{project-root}/_gaia/lifecycle/templates/sprint-plan-template.md"
11
13
  input_file_patterns:
12
14
  epics:
13
15
  whole: "{planning_artifacts}/epics-and-stories.md"
@@ -2,6 +2,7 @@ name: triage-findings
2
2
  description: 'Triage development findings into backlog stories'
3
3
  module: lifecycle
4
4
  agent: sm
5
+ val_validate_output: true
5
6
  config_resolved: "{installed_path}/.resolved/triage-findings.yaml"
6
7
  config_source: "{project-root}/_gaia/lifecycle/config.yaml"
7
8
  installed_path: "{project-root}/_gaia/lifecycle/workflows/4-implementation/triage-findings"
@@ -42,6 +42,21 @@ validation-target: 'Ground truth refresh workflow'
42
42
  - [ ] ground-truth-management sections loaded JIT
43
43
  - [ ] Sections: full-refresh, incremental-refresh, entry-structure, conflict-resolution, token-budget
44
44
 
45
+ ## --agent Parameter (E9-S11)
46
+ - [ ] workflow.yaml declares agent parameter with flag --agent and allowed values [val, theo, derek, nate, all]
47
+ - [ ] Default agent is val (backward compatible — no --agent behaves identically to pre-E9-S11)
48
+ - [ ] Invalid agent names produce clear error with valid values list
49
+ - [ ] Per-agent sidecar initialization creates missing ground-truth.md for any Tier 1 agent
50
+ - [ ] Theo inventory scans filesystem structure + architecture.md
51
+ - [ ] Derek inventory scans prd.md + epics-and-stories.md + sprint-status.yaml
52
+ - [ ] Nate inventory scans sprint-status.yaml + story files in implementation-artifacts/
53
+ - [ ] Val inventory uses existing 6-target scan (unchanged)
54
+ - [ ] Decision log entries route to target agent's own decision-log.md
55
+ - [ ] Per-agent ground_truth_budget enforced (Val 200K, Theo 150K, Derek 100K, Nate 100K)
56
+ - [ ] --agent all runs val → theo → derek → nate sequentially
57
+ - [ ] --agent all continues on per-agent failure and reports which succeeded/failed
58
+ - [ ] --agent all presents combined summary with per-agent status
59
+
45
60
  ## Integration
46
61
  - [ ] Manifest entry exists in workflow-manifest.csv
47
62
  - [ ] Works identically standalone or as sub-step
@@ -7,95 +7,166 @@
7
7
  <mandate>Behavior must be identical whether called standalone or as sub-step from another workflow</mandate>
8
8
  </critical>
9
9
 
10
- <step n="1" title="Initialize Validator Sidecar">
11
- <action>Check if {memory_path}/validator-sidecar/ directory exists</action>
12
- <action if="directory missing">Create {memory_path}/validator-sidecar/ directory</action>
13
- <action if="ground-truth.md missing">Create {memory_path}/validator-sidecar/ground-truth.md with empty header containing last-refresh timestamp set to "never"</action>
14
- <action if="decision-log.md missing">Create {memory_path}/validator-sidecar/decision-log.md with header: "# Val Decision Log" and empty entries</action>
15
- <action if="conversation-context.md missing">Create {memory_path}/validator-sidecar/conversation-context.md with header: "# Val Conversation Context" and empty rolling state</action>
10
+ <step n="1" title="Resolve Agent Target">
11
+ <action>Parse $ARGUMENTS for --agent value. If --agent is absent, default to "val" for backward compatibility.</action>
12
+ <action>Validate agent name against allowed values: val, theo, derek, nate, all.
13
+ If the agent name is not in the allowed values list: HALT with error:
14
+ "Unknown agent '{agent_name}'. Valid values: val, theo, derek, nate, all."</action>
15
+ <action>Resolve target sidecar path and inventory source files based on agent:
16
+ - val: sidecar = {memory_path}/validator-sidecar/, inventory = 6-target scan (existing)
17
+ - theo: sidecar = {memory_path}/architect-sidecar/, inventory = filesystem structure + {planning_artifacts}/architecture.md
18
+ - derek: sidecar = {memory_path}/pm-sidecar/, inventory = {planning_artifacts}/prd.md + {planning_artifacts}/epics-and-stories.md + {implementation_artifacts}/sprint-status.yaml
19
+ - nate: sidecar = {memory_path}/sm-sidecar/, inventory = {implementation_artifacts}/sprint-status.yaml + story files in {implementation_artifacts}/
20
+ - all: run sequentially for val, theo, derek, nate (see Step 13)</action>
21
+ <action if="agent == all">Set agent_queue = [val, theo, derek, nate]. Proceed to Step 13 for orchestration.</action>
16
22
  </step>
17
23
 
18
- <step n="2" title="Determine Refresh Mode">
24
+ <step n="2" title="Initialize Agent Sidecar">
25
+ <action>Check if the resolved target sidecar directory exists (e.g., {memory_path}/validator-sidecar/ for val, {memory_path}/architect-sidecar/ for theo, {memory_path}/pm-sidecar/ for derek, {memory_path}/sm-sidecar/ for nate)</action>
26
+ <action if="directory missing">Create the resolved sidecar directory</action>
27
+ <action if="ground-truth.md missing">Create ground-truth.md in the resolved sidecar directory with empty header containing last-refresh timestamp set to "never"</action>
28
+ <action if="decision-log.md missing">Create decision-log.md in the resolved sidecar directory with header: "# {agent_display_name} Decision Log" and empty entries</action>
29
+ <action if="conversation-context.md missing">Create conversation-context.md in the resolved sidecar directory with header: "# {agent_display_name} Conversation Context" and empty rolling state</action>
30
+ </step>
31
+
32
+ <step n="3" title="Determine Refresh Mode">
19
33
  <action>Check if --incremental flag was passed</action>
20
34
  <action if="incremental">Set mode to incremental — only scan files modified since last-refresh timestamp from ground-truth.md header</action>
21
35
  <action if="not incremental">Set mode to full — scan all targets completely. Full refresh catches deletions and renames that incremental would miss.</action>
22
36
  </step>
23
37
 
24
- <step n="3" title="Load Entry Structure">
38
+ <step n="4" title="Load Entry Structure">
25
39
  <action>Load ground-truth-management skill section: entry-structure (JIT)</action>
26
40
  <action>Use entry-structure format for all ground truth entries written in subsequent steps</action>
27
41
  </step>
28
42
 
29
- <step n="4" title="Parse Previous State">
30
- <action>Read existing {memory_path}/validator-sidecar/ground-truth.md</action>
43
+ <step n="5" title="Parse Previous State">
44
+ <action>Read existing ground-truth.md from the resolved target sidecar directory</action>
31
45
  <action>Extract last-refresh timestamp from header</action>
32
46
  <action>Parse all existing entries into a lookup map keyed by file path for diff comparison</action>
33
47
  <action if="incremental mode">Filter scan targets to only files modified after last-refresh timestamp</action>
34
48
  </step>
35
49
 
36
- <step n="5" title="Scan Inventory Targets">
50
+ <step n="6" title="Scan Inventory Targets">
37
51
  <action>Load ground-truth-management skill section based on mode: full-refresh or incremental-refresh (JIT)</action>
38
- <action>Scan the following 6 inventory targets, showing section-by-section progress to the user after each target completes.</action>
39
52
 
40
- <action title="Exclusion list">
41
- ALWAYS exclude these directories and files from scanningthey are framework internals, not project code:
42
- _gaia/, .claude/, bin/, _memory/, node_modules/, .git/, build/, dist/, .DS_Store, *.lock
53
+ <action if="agent == val">
54
+ Scan the following 6 inventory targets (existing Val scan unchanged for backward compatibility), showing section-by-section progress to the user after each target completes.
55
+
56
+ <action title="Exclusion list">
57
+ ALWAYS exclude these directories and files from scanning — they are framework internals, not project code:
58
+ _gaia/, .claude/, bin/, _memory/, node_modules/, .git/, build/, dist/, .DS_Store, *.lock
59
+ </action>
60
+
61
+ <action title="Target 1: Project Source Files">
62
+ Scan {project-path}/**/* (excluding the exclusion list above)
63
+ Extract: file inventory, directory structure, languages used, entry points
64
+ Report progress: "Scanning project source files... found N files across N directories."
65
+ </action>
66
+
67
+ <action title="Target 2: Project Config Files">
68
+ Scan {project-path}/*.{json,yaml,yml,toml,xml,env.example} (root-level config files)
69
+ Extract: config keys, settings, dependency declarations
70
+ Report progress: "Scanning project config files... found N config files."
71
+ </action>
72
+
73
+ <action title="Target 3: Project Package Manifests">
74
+ Scan {project-path}/**/package.json, pubspec.yaml, pom.xml, build.gradle, requirements.txt, Cargo.toml, go.mod, Gemfile, *.csproj (whichever exist)
75
+ Extract: dependencies, versions, scripts, build targets
76
+ Report progress: "Scanning package manifests... found N manifests."
77
+ </action>
78
+
79
+ <action title="Target 4: Planning Artifacts">
80
+ Scan {project-root}/docs/planning-artifacts/*.md
81
+ Extract: artifact name, type, date
82
+ Report progress: "Scanning planning artifacts... found N artifacts."
83
+ </action>
84
+
85
+ <action title="Target 5: Implementation Artifacts">
86
+ Scan {project-root}/docs/implementation-artifacts/*.md
87
+ Extract: artifact name, type, story key if applicable
88
+ Report progress: "Scanning implementation artifacts... found N artifacts."
89
+ </action>
90
+
91
+ <action title="Target 6: Test Artifacts">
92
+ Scan {project-root}/docs/test-artifacts/*.md
93
+ Extract: artifact name, type, coverage area
94
+ Report progress: "Scanning test artifacts... found N artifacts."
95
+ </action>
43
96
  </action>
44
97
 
45
- <action title="Target 1: Project Source Files">
46
- Scan {project-path}/**/* (excluding the exclusion list above)
47
- Extract: file inventory, directory structure, languages used, entry points
48
- Report progress: "Scanning project source files... found N files across N directories."
49
- </action>
98
+ <action if="agent == theo">
99
+ Scan theo-specific inventory targets (architecture ground truth):
50
100
 
51
- <action title="Target 2: Project Config Files">
52
- Scan {project-path}/*.{json,yaml,yml,toml,xml,env.example} (root-level config files)
53
- Extract: config keys, settings, dependency declarations
54
- Report progress: "Scanning project config files... found N config files."
55
- </action>
101
+ <action title="Target 1: Filesystem Structure">
102
+ Scan {project-path}/ for directory structure, file types, and project layout.
103
+ Extract: tech stack, components, module boundaries, entry points, build configuration.
104
+ Report progress: "Scanning filesystem structure for Theo... found N directories, N files."
105
+ </action>
56
106
 
57
- <action title="Target 3: Project Package Manifests">
58
- Scan {project-path}/**/package.json, pubspec.yaml, pom.xml, build.gradle, requirements.txt, Cargo.toml, go.mod, Gemfile, *.csproj (whichever exist)
59
- Extract: dependencies, versions, scripts, build targets
60
- Report progress: "Scanning package manifests... found N manifests."
107
+ <action title="Target 2: Architecture Document">
108
+ Scan {planning_artifacts}/architecture.md
109
+ Extract: ADRs, architectural decisions, component diagrams, dependency info, integration points, tech stack decisions.
110
+ Report progress: "Scanning architecture.md for Theo... extracted N ADRs, N components."
111
+ </action>
61
112
  </action>
62
113
 
63
- <action title="Target 4: Planning Artifacts">
64
- Scan {project-root}/docs/planning-artifacts/*.md
65
- Extract: artifact name, type, date
66
- Report progress: "Scanning planning artifacts... found N artifacts."
114
+ <action if="agent == derek">
115
+ Scan derek-specific inventory targets (product ground truth):
116
+
117
+ <action title="Target 1: Product Requirements">
118
+ Scan {planning_artifacts}/prd.md
119
+ Extract: functional requirements, non-functional requirements, user stories overview, feature list, product goals.
120
+ Report progress: "Scanning prd.md for Derek... extracted N requirements."
121
+ </action>
122
+
123
+ <action title="Target 2: Epics and Stories">
124
+ Scan {planning_artifacts}/epics-and-stories.md
125
+ Extract: epic list, story breakdown, acceptance criteria summaries, dependency graph, sizing data.
126
+ Report progress: "Scanning epics-and-stories.md for Derek... extracted N epics, N stories."
127
+ </action>
128
+
129
+ <action title="Target 3: Sprint Status">
130
+ Scan {implementation_artifacts}/sprint-status.yaml
131
+ Extract: current sprint state, story statuses, velocity data, blocked items, completion rates.
132
+ Report progress: "Scanning sprint-status.yaml for Derek... extracted sprint state."
133
+ </action>
67
134
  </action>
68
135
 
69
- <action title="Target 5: Implementation Artifacts">
70
- Scan {project-root}/docs/implementation-artifacts/*.md
71
- Extract: artifact name, type, story key if applicable
72
- Report progress: "Scanning implementation artifacts... found N artifacts."
73
- </action>
136
+ <action if="agent == nate">
137
+ Scan nate-specific inventory targets (sprint ground truth):
138
+
139
+ <action title="Target 1: Sprint Status">
140
+ Scan {implementation_artifacts}/sprint-status.yaml
141
+ Extract: sprint metadata, story statuses, velocity metrics, blocked items, wave assignments.
142
+ Report progress: "Scanning sprint-status.yaml for Nate... extracted sprint state."
143
+ </action>
74
144
 
75
- <action title="Target 6: Test Artifacts">
76
- Scan {project-root}/docs/test-artifacts/*.md
77
- Extract: artifact name, type, coverage area
78
- Report progress: "Scanning test artifacts... found N artifacts."
145
+ <action title="Target 2: Story Files">
146
+ Scan all story files in {implementation_artifacts}/ matching pattern *-*.md (story files)
147
+ Extract: story statuses, completion rates, subtask progress, blockers, review gate states.
148
+ Report progress: "Scanning story files in implementation-artifacts for Nate... found N stories."
149
+ </action>
79
150
  </action>
80
151
  </step>
81
152
 
82
- <step n="6" title="Compare and Detect Changes">
83
- <action>Compare scan results against previous state from Step 4</action>
153
+ <step n="7" title="Compare and Detect Changes">
154
+ <action>Compare scan results against previous state from Step 5</action>
84
155
  <action>Classify each entry as: ADDED (new file not in previous state), UPDATED (file exists but metadata changed), UNCHANGED (no changes detected)</action>
85
156
  <action if="full mode">For entries in previous state not found in scan results: mark as REMOVED with detection date (e.g., "REMOVED (file deleted, detected 2026-03-19)"). Do NOT silently delete entries.</action>
86
157
  <action if="incremental mode">Skip deletion detection — incremental mode cannot detect deletions. This is a documented limitation.</action>
87
158
  <action>Load ground-truth-management skill section: conflict-resolution (JIT) if any conflicts are detected between scan results and existing entries</action>
88
159
  </step>
89
160
 
90
- <step n="7" title="Write Ground Truth">
91
- <action>Update {memory_path}/validator-sidecar/ground-truth.md with all scan results</action>
161
+ <step n="8" title="Write Ground Truth">
162
+ <action>Update ground-truth.md in the resolved target agent's sidecar directory with all scan results</action>
92
163
  <action>Write header with last-refresh timestamp set to current date/time</action>
93
- <action>Organize entries by category: Agents, Workflows, Skills, Commands, Manifests, Config, Artifacts</action>
164
+ <action>Organize entries by category appropriate to the target agent</action>
94
165
  <action>Include verified counts, locations, and structural patterns for each category</action>
95
166
  <action>Preserve REMOVED entries with their detection dates — do not purge</action>
96
167
  </step>
97
168
 
98
- <step n="8" title="Generate Diff Report">
169
+ <step n="9" title="Generate Diff Report">
99
170
  <action>Generate diff/delta report summarizing changes since last refresh</action>
100
171
  <action>Include counts by category: added, removed, updated entries</action>
101
172
  <action>Include total entry count across all categories</action>
@@ -103,23 +174,48 @@
103
174
  <action>Present the full diff report to the user</action>
104
175
  </step>
105
176
 
106
- <step n="9" title="Log to Decision Log">
107
- <action>Append the diff/delta report to {memory_path}/validator-sidecar/decision-log.md</action>
108
- <action>Include date, refresh mode (full or incremental), and summary</action>
109
- <action>Format: "## Refresh — {date} ({mode})\n{summary}"</action>
177
+ <step n="10" title="Log to Decision Log">
178
+ <action>Append the diff/delta report to the target agent's own decision-log.md in the resolved sidecar directory.
179
+ Route to the correct file based on resolved agent target:
180
+ - val: {memory_path}/validator-sidecar/decision-log.md
181
+ - theo: {memory_path}/architect-sidecar/decision-log.md
182
+ - derek: {memory_path}/pm-sidecar/decision-log.md
183
+ - nate: {memory_path}/sm-sidecar/decision-log.md
184
+ Never write to another agent's decision-log.md — this would violate cross-agent write isolation.</action>
185
+ <action>Include date, refresh mode (full or incremental), target agent name, and summary</action>
186
+ <action>Format: "## Refresh — {date} ({mode}) — Agent: {agent_name}\n{summary}"</action>
110
187
  </step>
111
188
 
112
- <step n="10" title="Check Token Budget">
189
+ <step n="11" title="Check Token Budget">
113
190
  <action>Load ground-truth-management skill section: token-budget (JIT)</action>
114
- <action>Estimate token count of ground-truth.md</action>
115
- <action>If token count exceeds budget threshold: trigger archival of oldest REMOVED entries per token-budget skill guidance</action>
191
+ <action>Load the correct per-agent ground_truth_budget from {memory_path}/config.yaml based on target agent:
192
+ - Val: 200K (200,000 tokens)
193
+ - Theo: 150K (150,000 tokens)
194
+ - Derek: 100K (100,000 tokens)
195
+ - Nate: 100K (100,000 tokens)
196
+ These are distinct from the 300K session_budget — ground_truth_budget controls only ground-truth.md size.</action>
197
+ <action>Estimate token count of the target agent's ground-truth.md</action>
198
+ <action>If token count exceeds the per-agent budget threshold: trigger archival of oldest REMOVED entries per token-budget skill guidance</action>
199
+ <action if="agent == all">Report per-agent usage separately (e.g., "Theo: 42K/150K, Derek: 18K/100K")</action>
116
200
  <action>Report token usage to user</action>
117
201
  </step>
118
202
 
119
- <step n="11" title="Present Results">
203
+ <step n="12" title="Present Results">
120
204
  <template-output file="{memory_path}/validator-sidecar/ground-truth.md">
121
- Ground truth refreshed with verified inventory of all framework components.
205
+ Ground truth refreshed for the target agent with verified inventory.
206
+ Output path is resolved at runtime based on --agent parameter (defaults to validator-sidecar).
122
207
  Includes last-refresh timestamp, categorized entries, and REMOVED markers for deleted files.
123
208
  </template-output>
124
209
  </step>
210
+
211
+ <step n="13" title="Orchestrate --agent all" if="agent == all">
212
+ <action>Run refresh sequentially for each agent in order: val, theo, derek, nate.
213
+ Each agent's refresh completes fully (Steps 2-12) before the next begins.
214
+ No cross-contamination of sidecar writes — each agent writes only to its own sidecar.</action>
215
+ <action>On per-agent failure (e.g., missing source file like prd.md): log the error with reason, continue with remaining agents. Do not halt the entire sequence.</action>
216
+ <action>After all agents complete: present a combined summary with per-agent status:
217
+ - Which agents succeeded and their entry counts
218
+ - Which agents failed and the failure reasons
219
+ Format: "Refresh complete. Results: Val: OK (N entries), Theo: OK (N entries), Derek: FAILED (prd.md not found), Nate: OK (N entries)."</action>
220
+ </step>
125
221
  </workflow>
@@ -9,6 +9,11 @@ installed_path: "{project-root}/_gaia/lifecycle/workflows/4-implementation/val-r
9
9
  instructions: "{installed_path}/instructions.xml"
10
10
  validation: "{installed_path}/checklist.md"
11
11
  parameters:
12
+ agent:
13
+ flag: "--agent"
14
+ description: "Which Tier 1 agent's ground truth to refresh. Defaults to val for backward compatibility."
15
+ default: "val"
16
+ allowed_values: [val, theo, derek, nate, all]
12
17
  incremental:
13
18
  flag: "--incremental"
14
19
  description: "Only scan files modified since last refresh timestamp. Full refresh is default."
@@ -18,7 +18,17 @@
18
18
  <action>Present the section map to confirm scope: "{N} sections identified, {M} chunks for validation"</action>
19
19
  </step>
20
20
 
21
- <step n="2" title="Extract Claims">
21
+ <step n="2" title="Detect Artifact Type and Run Document-Specific Rules">
22
+ <!-- SKILL-REF: document-rulesets.md SECTION: type-detection -->
23
+ <!-- Two-pass validation: document-specific structural rules first (Pass 1), then factual claim verification (Pass 2) -->
24
+ <action>Load the "type-detection" section from the document-rulesets skill (JIT)</action>
25
+ <action>Extract the basename from {artifact_path} and match against the type-detection mapping table to determine the artifact type and corresponding ruleset ID (prd-rules, arch-rules, ux-rules, test-plan-rules, epics-rules, or unknown)</action>
26
+ <action>If artifact type is unknown (no ruleset matches): skip structural rules entirely — no document-specific rules to apply. Log: "No document-specific ruleset for this artifact type — factual verification only." Release the type-detection section and proceed directly to Step 3 (Pass 2 — factual claims only).</action>
27
+ <action>If artifact type is recognized: load the matching ruleset section from document-rulesets skill (JIT). Execute Pass 1 — structural rules first: run all checks defined in the ruleset against the artifact content. Record structural findings with source tag [STRUCTURAL]. Release the ruleset section from context.</action>
28
+ <action>Release the "type-detection" section from context</action>
29
+ </step>
30
+
31
+ <step n="3" title="Extract Claims (Pass 2 — Factual Verification)">
22
32
  <!-- SKILL-REF: validation-patterns.md SECTION: claim-extraction -->
23
33
  <action>Load the "claim-extraction" section from the validation-patterns skill (JIT)</action>
24
34
  <action>For each chunk from Step 1, extract all verifiable factual claims:
@@ -33,7 +43,7 @@
33
43
  <action>Release the "claim-extraction" skill section from context</action>
34
44
  </step>
35
45
 
36
- <step n="3" title="Filesystem Verify">
46
+ <step n="4" title="Filesystem Verify">
37
47
  <!-- SKILL-REF: validation-patterns.md SECTION: filesystem-verification -->
38
48
  <action>Load the "filesystem-verification" section from the validation-patterns skill (JIT)</action>
39
49
  <action>For each extracted claim, verify against the actual filesystem:
@@ -45,32 +55,33 @@
45
55
  <action>Release the "filesystem-verification" skill section from context</action>
46
56
  </step>
47
57
 
48
- <step n="4" title="Cross-Reference Ground Truth">
58
+ <step n="5" title="Cross-Reference Ground Truth">
49
59
  <!-- SKILL-REF: validation-patterns.md SECTION: cross-reference -->
50
60
  <action>Check if {memory_path}/validator-sidecar/ground-truth.md exists and is non-empty</action>
51
- <action>If ground-truth.md is missing or empty: skip cross-reference checks. Record a note: "Ground truth not available — cross-reference checks skipped." Proceed to Step 5. Filesystem verification results from Step 3 are still valid.</action>
61
+ <action>If ground-truth.md is missing or empty: skip cross-reference checks. Record a note: "Ground truth not available — cross-reference checks skipped." Proceed to Step 6. Filesystem verification results from Step 4 are still valid.</action>
52
62
  <action>If ground-truth.md exists and is non-empty:
53
63
  — Load the "cross-reference" section from the validation-patterns skill (JIT)
54
- — For each claim that was VERIFIED in Step 3, cross-reference against ground truth:
64
+ — For each claim that was VERIFIED in Step 4, cross-reference against ground truth:
55
65
  — Check if ground truth contains a contradicting fact
56
66
  — Check if ground truth has a more recent or more precise version of the same fact
57
67
  — Flag any discrepancies between the artifact claim and ground truth
58
68
  — Release the "cross-reference" skill section from context</action>
59
69
  </step>
60
70
 
61
- <step n="5" title="Classify Findings">
71
+ <step n="6" title="Classify Findings">
62
72
  <!-- SKILL-REF: validation-patterns.md SECTION: severity-classification -->
73
+ <!-- SKILL-REF: document-rulesets.md SECTION: two-pass-logic -->
63
74
  <action>Load the "severity-classification" section from the validation-patterns skill (JIT)</action>
64
- <action>Compile all findings from Steps 3 and 4 only FAILED verifications and ground-truth discrepancies</action>
75
+ <action>Compile and merge findings from both passes — structural findings from Step 2 (Pass 1, tagged [STRUCTURAL]) and factual findings from Steps 3-5 (Pass 2, tagged [FACTUAL]). Include only FAILED verifications, ground-truth discrepancies, and structural quality issues.</action>
65
76
  <action>Classify each finding into exactly one severity level:
66
77
  — **CRITICAL**: Wrong file path (file does not exist), incorrect count (stated N but actual is M), broken reference (FR/ADR/component does not exist), contradicts ground truth on a verified fact
67
78
  — **WARNING**: Outdated reference (file exists but content has changed), stale data (version number is behind), ground truth has newer information
68
79
  — **INFO**: Style suggestion (naming inconsistency), minor inconsistency (non-breaking), cosmetic discrepancy</action>
69
- <action>If no findings were produced (all claims verified, no discrepancies): report "All {N} claims verified — no findings." Skip Steps 6 and 7 — proceed to workflow completion.</action>
80
+ <action>If no findings were produced (all claims verified, no discrepancies): report "All {N} claims verified — no findings." Skip Steps 7 and 8 — proceed to workflow completion.</action>
70
81
  <action>Release the "severity-classification" skill section from context</action>
71
82
  </step>
72
83
 
73
- <step n="6" title="Discussion Loop">
84
+ <step n="7" title="Discussion Loop">
74
85
  <action>Present all classified findings to the user in a structured table:
75
86
 
76
87
  | # | Severity | Section | Claim | Finding | Evidence |
@@ -88,11 +99,11 @@
88
99
  — APPROVE: finding is correct, include in written output
89
100
  — DISPUTE: finding is incorrect or not applicable, exclude from written output
90
101
  — EDIT: modify the finding description before approving</action>
91
- <action>Only findings explicitly approved by the user proceed to Step 7</action>
102
+ <action>Only findings explicitly approved by the user proceed to Step 8</action>
92
103
  <action>If the user disputes ALL findings: report "All findings disputed — no changes written to artifact." Complete the workflow gracefully.</action>
93
104
  </step>
94
105
 
95
- <step n="7" title="Write Approved Findings">
106
+ <step n="8" title="Write Approved Findings">
96
107
  <!-- SKILL-REF: validation-patterns.md SECTION: findings-formatting -->
97
108
  <action>Load the "findings-formatting" section from the validation-patterns skill (JIT)</action>
98
109
  <action>Check if the target artifact already contains a "## Validation Findings" section</action>
@@ -112,7 +123,7 @@
112
123
  <action>Release the "findings-formatting" skill section from context</action>
113
124
  </step>
114
125
 
115
- <step n="8" title="Save to Val Memory">
126
+ <step n="9" title="Save to Val Memory">
116
127
  <action>Auto-save all validation results to Val's memory sidecar (no user prompt required):
117
128
 
118
129
  1. Append to {memory_path}/validator-sidecar/decision-log.md using standardized format:
@@ -8,6 +8,17 @@ config_source: "{project-root}/_gaia/lifecycle/config.yaml"
8
8
  installed_path: "{project-root}/_gaia/lifecycle/workflows/4-implementation/val-validate-artifact"
9
9
  instructions: "{installed_path}/instructions.xml"
10
10
  validation: "{installed_path}/checklist.md"
11
+ required_skills:
12
+ - "{project-root}/_gaia/lifecycle/skills/validation-patterns.md"
13
+ - "{project-root}/_gaia/lifecycle/skills/document-rulesets.md"
14
+ required_skill_sections:
15
+ - "document-rulesets:type-detection"
16
+ - "document-rulesets:prd-rules"
17
+ - "document-rulesets:arch-rules"
18
+ - "document-rulesets:ux-rules"
19
+ - "document-rulesets:test-plan-rules"
20
+ - "document-rulesets:epics-rules"
21
+ - "document-rulesets:two-pass-logic"
11
22
  input_file_patterns:
12
23
  artifact:
13
24
  whole: "{artifact_path}"
@@ -131,8 +131,6 @@
131
131
  <template-output file="{plan_artifact_path}">
132
132
  Append Plan Validation Findings section with approved findings table, validation metadata, and summary counts.
133
133
  </template-output>
134
- </step>
135
- <step n="8" title="Save to Val Memory">
136
134
  <action>Auto-save all validation results to Val's memory sidecar (no user prompt required):
137
135
 
138
136
  1. Append to {project-root}/{memory_path}/validator-sidecar/decision-log.md using standardized format:
@@ -7,6 +7,7 @@ config_source: "{project-root}/_gaia/lifecycle/config.yaml"
7
7
  installed_path: "{project-root}/_gaia/lifecycle/workflows/5-deployment/deployment-checklist"
8
8
  instructions: "{installed_path}/instructions.xml"
9
9
  validation: "{installed_path}/checklist.md"
10
+ template: "{project-root}/_gaia/lifecycle/templates/deployment-template.md"
10
11
  input_file_patterns:
11
12
  architecture:
12
13
  whole: "{planning_artifacts}/architecture.md"
@@ -82,7 +82,7 @@
82
82
  /gaia-review-api (optional, if APIs) → /gaia-adversarial → /gaia-test-design → /gaia-test-framework (optional) → /gaia-create-epics → /gaia-threat-model → /gaia-infra-design → /gaia-trace → /gaia-ci-setup → /gaia-readiness-check</action>
83
83
  </step>
84
84
 
85
- <step n="7" title="Bootstrap Val Ground Truth" optional="true">
85
+ <step n="7" title="Bootstrap Agent Ground Truth" optional="true">
86
86
  <action>Check if Val is installed: verify {project-root}/_gaia/lifecycle/agents/validator.md exists AND {memory_path}/validator-sidecar/ directory exists</action>
87
87
  <check if="validator.md not found OR validator-sidecar/ not found">Skip Step 7 silently — Val is not installed. Brownfield onboarding continues without ground truth bootstrap.</check>
88
88
 
@@ -102,6 +102,74 @@
102
102
 
103
103
  <action>Write extracted project facts to {memory_path}/validator-sidecar/ground-truth.md. If ground-truth.md already exists with content: merge new facts with existing entries — add new facts, update changed facts, flag removed facts — never destructive overwrite. Follow merge semantics from ground-truth-management conflict-resolution section. If ground-truth.md is empty or new: write all extracted facts as initial seed entries with verification count = 1.</action>
104
104
  <action>Report: "Seeded {N} ground-truth entries from brownfield artifacts + filesystem scan"</action>
105
+
106
+ <!-- Step 7d/7e/7f: Tier 1 Agent Ground Truth Bootstrap (E9-S12) -->
107
+
108
+ <ask>Bootstrap Tier 1 agent ground truth (Theo, Derek, Nate)? [y/n]</ask>
109
+
110
+ <action>JIT load ground-truth-management skill sections from {project-root}/_gaia/lifecycle/skills/ground-truth-management.md: entry-structure, conflict-resolution, brownfield-extraction. All ground-truth entries must follow the canonical entry format from the entry-structure section. When the same fact appears in multiple source documents with conflicting values (e.g., different version numbers), annotate the entry with "conflicting sources: {source1} says X, {source2} says Y" and use the higher-precedence source (brownfield-assessment.md > project-documentation.md for tech stack facts).</action>
111
+
112
+ <!-- Step 7d: Theo (Architect) ground truth extraction (AC1) -->
113
+ <action>Step 7d — Theo ground truth extraction.
114
+ Read {planning_artifacts}/architecture.md and extract:
115
+ — Tech stack (languages, frameworks, runtime versions) → variable-inventory entries
116
+ — ADRs (architecture decision records — ID, title, status, rationale) → structural-pattern entries
117
+ — Component inventory (modules, packages, services) → file-inventory entries
118
+ — Dependency map (internal and external dependencies) → cross-reference entries
119
+
120
+ If {planning_artifacts}/architecture.md does not exist: fall back to {planning_artifacts}/brownfield-assessment.md for Theo. Extract tech stack, file counts, and project structure from the brownfield assessment instead.
121
+
122
+ Token budget guard: Theo has a 150K token budget (150,000 tokens). Estimate extraction size (characters / 4). If estimated tokens exceed 60% threshold (90,000 tokens), trim to highest-signal entries — prioritize ADRs and tech stack over detailed file inventories.
123
+
124
+ Write extracted entries to {memory_path}/architect-sidecar/ground-truth.md.
125
+ If the {memory_path}/architect-sidecar/ directory does not exist, create it along with a new ground-truth.md file with standard headers.
126
+ If ground-truth.md already exists with content: follow merge semantics from the conflict-resolution section — add new entries, update changed entries, preserve existing entries. Never perform a destructive overwrite.</action>
127
+
128
+ <!-- Step 7e: Derek (Product Manager) ground truth extraction (AC2) -->
129
+ <action>Step 7e — Derek ground truth extraction.
130
+ Read {planning_artifacts}/prd.md and extract:
131
+ — Functional requirements (feature list, requirement IDs) → structural-pattern entries
132
+ — User stories and acceptance criteria summaries → cross-reference entries
133
+
134
+ If {planning_artifacts}/prd.md does not exist: fall back to {planning_artifacts}/prd-brownfield-gaps.md as the alternate PRD path for Derek.
135
+
136
+ Read {planning_artifacts}/epics-and-stories.md and extract for Derek:
137
+ — Epic overview (epic IDs, titles, story counts) → file-inventory entries
138
+ — Story-to-epic mappings → cross-reference entries
139
+
140
+ Read {test_artifacts}/nfr-assessment.md (if present) and extract for Derek:
141
+ — Quality baselines (performance targets, security posture, test coverage) → variable-inventory entries
142
+ If {test_artifacts}/nfr-assessment.md does not exist: log warning "nfr-assessment.md not found in test_artifacts — skipping quality baselines for Derek" and continue without error.
143
+
144
+ Token budget guard: Derek has a 100K token budget (100,000 tokens). Estimate extraction size (characters / 4). If estimated tokens exceed 60% threshold (60,000 tokens), trim to highest-signal entries — prioritize functional requirements and epic summaries over detailed story mappings.
145
+
146
+ Write extracted entries to {memory_path}/pm-sidecar/ground-truth.md.
147
+ If the {memory_path}/pm-sidecar/ directory does not exist, create it along with a new ground-truth.md file with standard headers.
148
+ If ground-truth.md already exists with content: follow merge semantics from the conflict-resolution section — add new entries, update changed entries, preserve existing entries. Never perform a destructive overwrite.</action>
149
+
150
+ <!-- Step 7f: Nate (Scrum Master) ground truth extraction (AC3) -->
151
+ <action>Step 7f — Nate ground truth extraction.
152
+ Read {implementation_artifacts}/sprint-status.yaml (if it exists) and extract for Nate:
153
+ — Current sprint ID, story count, points total → variable-inventory entries
154
+ — Story status distribution → structural-pattern entries
155
+
156
+ Read {memory_path}/sm-sidecar/velocity-data.md (if it exists) and extract for Nate:
157
+ — Velocity history (sprint-over-sprint) → variable-inventory entries
158
+ — Capacity data → variable-inventory entries
159
+
160
+ If neither {implementation_artifacts}/sprint-status.yaml nor {memory_path}/sm-sidecar/velocity-data.md exists: complete this step gracefully with a log message "insufficient sprint data, velocity unavailable" and write ground-truth.md omitting velocity entries. Do not raise an error.
161
+
162
+ Token budget guard: Nate has a 100K token budget (100,000 tokens). Estimate extraction size (characters / 4). If estimated tokens exceed 60% threshold (60,000 tokens), trim to highest-signal entries — prioritize current sprint status over historical velocity data.
163
+
164
+ Write extracted entries to {memory_path}/sm-sidecar/ground-truth.md.
165
+ If the {memory_path}/sm-sidecar/ directory does not exist, create it along with a new ground-truth.md file with standard headers.
166
+ If ground-truth.md already exists with content: follow merge semantics from the conflict-resolution section — add new entries, update changed entries, preserve existing entries. Never perform a destructive overwrite.</action>
167
+
168
+ <!-- Summary report (AC6) -->
169
+ <action>After all Tier 1 extractions complete, output a summary report:
170
+ "Seeded {N} entries for Theo, {M} entries for Derek, {K} entries for Nate"
171
+ If sprint data was absent for Nate, append a note: "(sprint data absent — velocity entries omitted)"
172
+ Include token budget status for each agent (GREEN/YELLOW/RED).</action>
105
173
  </step>
106
174
 
107
175
  <next-step command="/gaia-review-api">