gaia-framework 1.65.1 → 1.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +16 -1
- package/README.md +2 -2
- package/_gaia/_config/global.yaml +1 -1
- package/_gaia/core/engine/workflow.xml +6 -0
- package/_gaia/core/protocols/review-gate-check.xml +29 -1
- package/_gaia/lifecycle/knowledge/brownfield/config-contradiction-scan.md +137 -0
- package/_gaia/lifecycle/knowledge/brownfield/dead-code-scan.md +179 -0
- package/_gaia/lifecycle/knowledge/brownfield/test-execution-scan.md +209 -0
- package/_gaia/lifecycle/skills/document-rulesets.md +91 -6
- package/_gaia/lifecycle/templates/brownfield-scan-doc-code-prompt.md +219 -0
- package/_gaia/lifecycle/templates/brownfield-scan-hardcoded-prompt.md +169 -0
- package/_gaia/lifecycle/templates/brownfield-scan-integration-seam-prompt.md +127 -0
- package/_gaia/lifecycle/templates/brownfield-scan-runtime-behavior-prompt.md +141 -0
- package/_gaia/lifecycle/templates/brownfield-scan-security-prompt.md +212 -0
- package/_gaia/lifecycle/templates/gap-entry-schema.md +247 -0
- package/_gaia/lifecycle/templates/infra-prd-template.md +356 -0
- package/_gaia/lifecycle/templates/platform-prd-template.md +431 -0
- package/_gaia/lifecycle/templates/prd-template.md +70 -0
- package/_gaia/lifecycle/workflows/4-implementation/add-feature/checklist.md +1 -1
- package/_gaia/lifecycle/workflows/4-implementation/add-feature/instructions.xml +2 -3
- package/_gaia/lifecycle/workflows/4-implementation/add-stories/checklist.md +5 -0
- package/_gaia/lifecycle/workflows/4-implementation/add-stories/instructions.xml +73 -1
- package/_gaia/lifecycle/workflows/4-implementation/create-story/instructions.xml +1 -1
- package/_gaia/lifecycle/workflows/4-implementation/retrospective/instructions.xml +21 -1
- package/_gaia/lifecycle/workflows/4-implementation/retrospective/workflow.yaml +1 -1
- package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/checklist.md +12 -0
- package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/instructions.xml +244 -4
- package/_gaia/lifecycle/workflows/anytime/brownfield-onboarding/workflow.yaml +1 -0
- package/bin/gaia-framework.js +8 -6
- package/gaia-install.sh +28 -20
- package/package.json +1 -1
|
@@ -18,6 +18,18 @@ validation-target: 'Brownfield onboarding output'
|
|
|
18
18
|
- [ ] Event catalog subagent completed (if has_events) — {planning_artifacts}/event-catalog.md exists
|
|
19
19
|
- [ ] All API docs use Swagger/OpenAPI format
|
|
20
20
|
- [ ] All diagrams use Mermaid syntax
|
|
21
|
+
## Step 2.5: Deep Analysis Subagents
|
|
22
|
+
- [ ] Config contradiction scanner subagent completed — {planning_artifacts}/brownfield-scan-config-contradiction.md exists
|
|
23
|
+
- [ ] Scanner detected all supported config file types (.yaml, .yml, .json, .env, .toml, .ini, .properties, .xml)
|
|
24
|
+
- [ ] Stack-aware patterns applied based on {tech_stack}
|
|
25
|
+
- [ ] Gap entries conform to standardized schema (gap-entry-schema.md)
|
|
26
|
+
- [ ] Budget control enforced — max ~70 gap entries per scanner
|
|
27
|
+
## Step 2.75: Test Execution During Discovery
|
|
28
|
+
- [ ] Test execution subagent completed — {planning_artifacts}/brownfield-scan-test-execution.md exists (or warning logged if no test suite)
|
|
29
|
+
- [ ] Test runner auto-detection ran for supported runners (npm, pytest, Maven, Gradle, Go, Flutter)
|
|
30
|
+
- [ ] Test failures converted to gap entries conforming to E11-S1 schema
|
|
31
|
+
- [ ] Infrastructure errors distinguished from test failures
|
|
32
|
+
- [ ] Test execution non-blocking — failures did not halt workflow
|
|
21
33
|
## Step 3: NFR Assessment & Performance Test Plan
|
|
22
34
|
- [ ] NFR assessment subagent completed — {test_artifacts}/nfr-assessment.md exists
|
|
23
35
|
- [ ] NFR baseline summary table has real measured values (not placeholders)
|
|
@@ -17,9 +17,23 @@
|
|
|
17
17
|
<action>Frontend Detection: scan for React, Angular, Vue, Flutter, SwiftUI, UI frameworks, CSS/styling. Set {has_frontend} flag (true/false)</action>
|
|
18
18
|
<action>Testing infrastructure: identify test framework, coverage config, test count, test patterns</action>
|
|
19
19
|
<action>CI/CD: identify GitHub Actions, Jenkins, Docker, Terraform, or other pipeline files</action>
|
|
20
|
-
<action>
|
|
20
|
+
<action>Project Type Detection (ADR-022 Template Discriminator Pattern): scan {project-path} for infrastructure file patterns across 6 marker categories to determine {project_type}. Each category is independently detected:
|
|
21
|
+
— Terraform: *.tf, *.tfvars
|
|
22
|
+
— Docker: Dockerfile, docker-compose.yml
|
|
23
|
+
— Helm: helm/, Chart.yaml, values.yaml
|
|
24
|
+
— Kubernetes: k8s/, kustomization.yaml
|
|
25
|
+
— Pulumi: Pulumi.yaml
|
|
26
|
+
— CloudFormation: cloudformation*.yaml
|
|
27
|
+
If ANY infrastructure marker is detected, set {has_infra} = true.</action>
|
|
28
|
+
<action>Application code detection: scan for framework imports (Express, Spring Boot, Django, FastAPI, Angular, React, Next.js, NestJS, Flask, Gin, Fiber) in source files (*.ts, *.js, *.java, *.py, *.go, *.dart). If framework imports found, set {has_app_code} = true.</action>
|
|
29
|
+
<action>Classification decision tree — set {project_type}:
|
|
30
|
+
— If {has_infra} = true AND {has_app_code} = true → {project_type} = platform (infrastructure and application code both present)
|
|
31
|
+
— If {has_infra} = true AND {has_app_code} = false → {project_type} = infrastructure
|
|
32
|
+
— If {has_infra} = false → {project_type} = application (default — standard software project)
|
|
33
|
+
The {project_type} variable is set here in Step 1 so it is available before E11 scanners execute in Step 2.5.</action>
|
|
34
|
+
<action>Generate brownfield assessment: read {installed_path}/../../templates/brownfield-assessment-template.md — capture component inventory, technical debt, migration constraints, coexistence strategy, and adoption path. Include {project_type} in the assessment output. Output to {planning_artifacts}/brownfield-assessment.md</action>
|
|
21
35
|
<template-output file="{planning_artifacts}/project-documentation.md">
|
|
22
|
-
Generate enhanced project documentation following the project documentation conventions. Include all standard sections plus: detected capability flags (has_apis, has_events, has_external_deps, has_frontend), testing infrastructure summary, and CI/CD pipeline summary.
|
|
36
|
+
Generate enhanced project documentation following the project documentation conventions. Include all standard sections plus: detected capability flags (has_apis, has_events, has_external_deps, has_frontend), {project_type}, testing infrastructure summary, and CI/CD pipeline summary.
|
|
23
37
|
</template-output>
|
|
24
38
|
</step>
|
|
25
39
|
|
|
@@ -36,14 +50,154 @@
|
|
|
36
50
|
</template-output>
|
|
37
51
|
</step>
|
|
38
52
|
|
|
53
|
+
<step n="2.5" title="Deep Analysis Subagents (Infra-Aware)">
|
|
54
|
+
<action>Spawn deep analysis scan subagents in parallel using the Agent tool with multiple calls in a single message. These run alongside the Step 2 documentation subagents to detect gaps that structural analysis misses. Each scan subagent receives {tech_stack} (from Step 1), {project-path}, and {project_type} as context variables. When {project_type} is `infrastructure` or `platform`, infra-specific detection patterns are applied alongside application patterns. When {project_type} is `application`, only application patterns are applied.</action>
|
|
55
|
+
|
|
56
|
+
<action>Spawn subagent — Config Contradiction Scanner (infra-aware): "Read the config contradiction scan prompt template at {project-root}/_gaia/lifecycle/knowledge/brownfield/config-contradiction-scan.md. Follow the prompt instructions EXACTLY. Use tech stack: {tech_stack}. Project type: {project_type}. Scan the project at {project-path}. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. If project_type is infrastructure or platform: also apply infra-specific config contradiction patterns for terraform.tfvars, values.yaml, and kustomize overlays as specified in the prompt template. Output to {planning_artifacts}/brownfield-scan-config-contradiction.md"</action>
|
|
57
|
+
|
|
58
|
+
<action>Spawn subagent — Dead Code & Dead State Scanner: "Read the dead code scan prompt template at {project-root}/_gaia/lifecycle/knowledge/brownfield/dead-code-scan.md. Follow the prompt instructions EXACTLY. Use tech stack: {tech_stack}. Project type: {project_type}. Scan the project at {project-path}. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. Output to {planning_artifacts}/brownfield-scan-dead-code.md"</action>
|
|
59
|
+
|
|
60
|
+
<action>Spawn subagent — Hard-Coded Logic Detector (infra-aware): "Read the hard-coded logic scan prompt template at {project-root}/_gaia/lifecycle/templates/brownfield-scan-hardcoded-prompt.md. Follow the prompt instructions EXACTLY. Use tech stack: {tech_stack}. Project type: {project_type}. Scan the project at {project-path}. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. If project_type is infrastructure or platform: also detect hard-coded IPs, magic ports, embedded secrets/AMI IDs, and hard-coded resource limits in IaC files as specified in the prompt template. Output to {planning_artifacts}/brownfield-scan-hardcoded.md"</action>
|
|
61
|
+
|
|
62
|
+
<action>Spawn subagent — Security Endpoint Audit (infra-aware): "Read the security scan prompt template at {project-root}/_gaia/lifecycle/templates/brownfield-scan-security-prompt.md. Follow the prompt instructions EXACTLY. Use tech stack: {tech_stack}. Project type: {project_type}. Scan the project at {project-path}. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. If project_type is infrastructure or platform: also detect exposed ports in k8s manifests, permissive ingress rules, overly broad RBAC bindings, and missing NetworkPolicy as specified in the prompt template. Output to {planning_artifacts}/brownfield-scan-security.md"</action>
|
|
63
|
+
|
|
64
|
+
<action>Spawn subagent — Runtime Behavior Inventory (infra-aware): "Read the runtime behavior scan prompt template at {project-root}/_gaia/lifecycle/templates/brownfield-scan-runtime-behavior-prompt.md. Follow the prompt instructions EXACTLY. Use tech stack: {tech_stack}. Project type: {project_type}. Scan the project at {project-path}. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. If project_type is infrastructure or platform: also catalog CronJobs, DaemonSets, init containers, sidecar patterns, and health probes as specified in the prompt template. Output to {planning_artifacts}/brownfield-scan-runtime-behavior.md"</action>
|
|
65
|
+
|
|
66
|
+
<action>Spawn subagent — Documentation-Code Mismatch Scanner: "Read the doc-vs-code scan prompt template at {project-root}/_gaia/lifecycle/templates/brownfield-scan-doc-code-prompt.md. Follow the prompt instructions EXACTLY. Use tech stack: {tech_stack}. Project type: {project_type}. Scan the project at {project-path}. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. Output to {planning_artifacts}/brownfield-scan-doc-code.md"</action>
|
|
67
|
+
|
|
68
|
+
<action>Spawn subagent — Integration Seam Analyzer (infra-aware): "Read the integration seam scan prompt template at {project-root}/_gaia/lifecycle/templates/brownfield-scan-integration-seam-prompt.md. Follow the prompt instructions EXACTLY. Use tech stack: {tech_stack}. Project type: {project_type}. Scan the project at {project-path}. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. If project_type is infrastructure or platform: also map service mesh topology, ingress/egress routes, and cross-namespace dependencies as specified in the prompt template. Output to {planning_artifacts}/brownfield-scan-integration-seam.md"</action>
|
|
69
|
+
|
|
70
|
+
<action>Wait for all deep analysis subagents to complete. Verify output files exist at {planning_artifacts}/: brownfield-scan-config-contradiction.md, brownfield-scan-dead-code.md, brownfield-scan-hardcoded.md, brownfield-scan-security.md, brownfield-scan-runtime-behavior.md, brownfield-scan-doc-code.md, and brownfield-scan-integration-seam.md.</action>
|
|
71
|
+
<action>If any subagent failed to write its output file: log a warning and continue — individual scan failures should not block the overall brownfield workflow.</action>
|
|
72
|
+
|
|
73
|
+
<!-- Gap-to-Requirement Mapping Reference (E12-S6, ADR-022 §10.16.5)
|
|
74
|
+
When {project_type} is infrastructure or platform, infra gap categories
|
|
75
|
+
map to infra PRD sections as follows:
|
|
76
|
+
|
|
77
|
+
| Gap Category | Infra PRD Section |
|
|
78
|
+
|--------------------|----------------------------|
|
|
79
|
+
| resource-drift | Resource Specifications |
|
|
80
|
+
| config-sprawl | Environment Strategy & DX |
|
|
81
|
+
| secret-exposure | Security Posture |
|
|
82
|
+
| missing-policy | Verification Strategy |
|
|
83
|
+
| environment-skew | Environment Strategy & DX |
|
|
84
|
+
|
|
85
|
+
Application gap categories map to standard PRD sections:
|
|
86
|
+
| Gap Category | PRD Section |
|
|
87
|
+
|-----------------------|--------------------------|
|
|
88
|
+
| functional | Resource Specifications |
|
|
89
|
+
| behavioral | Operational SLOs |
|
|
90
|
+
| security | Security Posture |
|
|
91
|
+
| operational | Operational Runbooks |
|
|
92
|
+
| documentation | Overview & Scope |
|
|
93
|
+
| configuration | Environment Strategy & DX|
|
|
94
|
+
| data-integrity | Resource Specifications |
|
|
95
|
+
|
|
96
|
+
This mapping is consumed by the gap consolidation step (E11-S10/S12)
|
|
97
|
+
and the PRD generation step (Step 4) to route gap findings to the
|
|
98
|
+
correct sections of the generated PRD. -->
|
|
99
|
+
</step>
|
|
100
|
+
|
|
101
|
+
<step n="2.75" title="Test Execution During Discovery">
|
|
102
|
+
<action>After all Step 2/2.5 parallel scan subagents complete, execute the existing test suite at {project-path} to capture test failures as gap entries. This step is non-blocking — test execution failures must not halt the overall brownfield onboarding workflow.</action>
|
|
103
|
+
<action>Spawn subagent — Test Execution Scanner: "Read the test execution scan prompt template at {project-root}/_gaia/lifecycle/knowledge/brownfield/test-execution-scan.md. Follow the prompt instructions EXACTLY. Scan the project at {project-path} for test runners. Reference the gap entry schema at {project-root}/_gaia/lifecycle/templates/gap-entry-schema.md for output formatting. Auto-detect test runners (package.json with test script, pytest, Maven, Gradle, Go, Flutter) in priority order. Execute each detected runner with a 5-minute timeout. Parse test output for metrics (total, passing, failing, skipped). Convert failing tests to gap entries with severity mapped by test type (unit=medium, integration=high, e2e=critical). Detect infrastructure errors (ECONNREFUSED, missing env vars) and log as warning gaps instead of test failure gaps. For monorepo/polyglot projects, execute all detected runners sequentially and aggregate results. Truncate output per NFR-024 token budget if needed. If no test suite is detected, log an info-level gap entry GAP-TEST-INFO-001. Output to {planning_artifacts}/brownfield-scan-test-execution.md"</action>
|
|
104
|
+
<action>When subagent returns: verify output file exists at {planning_artifacts}/brownfield-scan-test-execution.md.</action>
|
|
105
|
+
<action>If the subagent failed to write its output file: log a warning and continue — test execution scan failures should not block the overall brownfield workflow.</action>
|
|
106
|
+
</step>
|
|
107
|
+
|
|
39
108
|
<step n="3" title="NFR Assessment & Performance Test Plan">
|
|
40
109
|
<action>Spawn a subagent — "Analyze the codebase at {project-path} for non-functional requirements. Read {installed_path}/../../templates/nfr-assessment-template.md for the output format. Assess: code quality (linting, complexity, duplication), security posture (dependency vulnerabilities, secrets handling, auth quality — load security-basics skill section vulnerability-scanning if needed), performance (bundle size if frontend, query patterns, caching, resource management), accessibility (ARIA, semantic HTML, keyboard nav if frontend), test coverage (framework, count, coverage %, untested areas, quality), CI/CD (build pipeline, deploy strategy, environments, IaC). Create NFR Baseline Summary Table with measured values (not placeholders). Output to {test_artifacts}/nfr-assessment.md. Then create a performance test plan: load {project-root}/_gaia/testing/knowledge/performance/k6-patterns.md for load testing patterns. If {has_frontend}: also load {project-root}/_gaia/testing/knowledge/performance/lighthouse-ci.md. Define performance budgets (P50/P95/P99) based on NFR baselines, load test scenarios (gradual, spike, soak), backend profiling targets (slow queries, N+1, connection pools), CI performance gates. If {has_frontend}: define Core Web Vitals targets (LCP under 2.5s, INP under 200ms, CLS under 0.1). Output to {test_artifacts}/performance-test-plan-{date}.md"</action>
|
|
41
110
|
<action>When subagent returns: verify both {test_artifacts}/nfr-assessment.md and {test_artifacts}/performance-test-plan-{date}.md exist. If the subagent failed to write files, the orchestrator MUST write them to {test_artifacts}/ as declared in workflow.yaml output.artifacts — do NOT fall back to {planning_artifacts}/.</action>
|
|
42
111
|
</step>
|
|
43
112
|
|
|
113
|
+
<step n="3.5" title="Gap Consolidation & Deduplication">
|
|
114
|
+
<action>Spawn a subagent using the Agent tool with this prompt:
|
|
115
|
+
|
|
116
|
+
"You are the Gap Consolidation subagent. Your task is to load all scan results, deduplicate them, rank them, and produce a single consolidated output file.
|
|
117
|
+
|
|
118
|
+
**Context:**
|
|
119
|
+
- Planning artifacts directory: {planning_artifacts}/
|
|
120
|
+
- Test artifacts directory: {test_artifacts}/
|
|
121
|
+
- Gap schema reference: {installed_path}/../../templates/gap-entry-schema.md
|
|
122
|
+
- Tech stack: {tech_stack}
|
|
123
|
+
|
|
124
|
+
**Step 1 — Load all scan outputs:**
|
|
125
|
+
Load gap entries from ALL of the following sources. For each file, if it exists, parse YAML gap entries matching the schema from gap-entry-schema.md. If a file is empty or missing, log a warning noting which scanner produced no results and continue processing the remaining files without error.
|
|
126
|
+
|
|
127
|
+
Deep analysis scan outputs (7 files):
|
|
128
|
+
- {planning_artifacts}/brownfield-scan-config-contradiction.md
|
|
129
|
+
- {planning_artifacts}/brownfield-scan-dead-code.md
|
|
130
|
+
- {planning_artifacts}/brownfield-scan-hard-coded-logic.md
|
|
131
|
+
- {planning_artifacts}/brownfield-scan-security-endpoint.md
|
|
132
|
+
- {planning_artifacts}/brownfield-scan-runtime-behavior.md
|
|
133
|
+
- {planning_artifacts}/brownfield-scan-doc-code-drift.md
|
|
134
|
+
- {planning_artifacts}/brownfield-scan-integration-seam.md
|
|
135
|
+
|
|
136
|
+
Step 2 documentation subagent outputs:
|
|
137
|
+
- {planning_artifacts}/api-documentation.md (API gaps)
|
|
138
|
+
- {planning_artifacts}/event-catalog.md (event/messaging gaps)
|
|
139
|
+
- {planning_artifacts}/ux-design.md (frontend/UX gaps)
|
|
140
|
+
- {planning_artifacts}/dependency-map.md (dependency gaps)
|
|
141
|
+
|
|
142
|
+
Step 3 test execution results:
|
|
143
|
+
- {test_artifacts}/nfr-assessment.md (test execution gap findings)
|
|
144
|
+
|
|
145
|
+
**Step 2 — Validate entries against schema:**
|
|
146
|
+
For each parsed gap entry, validate that all required fields are present: id, category, severity, title, description (or evidence), evidence_file, evidence_line, recommendation. Entries missing any required field are logged as warnings (noting the source file and which field is missing) and skipped from consolidation rather than causing a failure.
|
|
147
|
+
|
|
148
|
+
**Step 3 — Deduplicate:**
|
|
149
|
+
Group gap entries by evidence_file + evidence_line (exact match on both fields). For each group of duplicates:
|
|
150
|
+
a. Retain the entry with the highest severity (critical > high > medium > low)
|
|
151
|
+
b. Merge recommendations from all duplicate entries into the retained entry
|
|
152
|
+
c. Add a merged_from field listing all original gap IDs that were merged
|
|
153
|
+
d. If duplicates have different categories, retain the primary category from the highest-severity entry and note the alternate category in the description
|
|
154
|
+
|
|
155
|
+
**Step 4 — Rank:**
|
|
156
|
+
Sort the deduplicated gaps by:
|
|
157
|
+
1. severity DESC (critical first, then high, medium, low)
|
|
158
|
+
2. confidence DESC (high first, then medium, low)
|
|
159
|
+
3. category alphabetical within each severity+confidence tier
|
|
160
|
+
Assign final sequential numbering to the ranked list.
|
|
161
|
+
|
|
162
|
+
**Step 5 — Budget check:**
|
|
163
|
+
Estimate the token count of the output (~100 tokens per gap entry). If the estimated total exceeds the 40K token budget, truncate low-severity and info entries with a count summary: 'N additional low/info gaps omitted for budget'. Ensure the output stays within budget.
|
|
164
|
+
|
|
165
|
+
**Step 6 — Generate consolidated output:**
|
|
166
|
+
Write consolidated-gaps.md to {planning_artifacts}/ using the consolidated output format from gap-entry-schema.md. Include summary statistics at the top:
|
|
167
|
+
- Total raw gaps (pre-dedup count)
|
|
168
|
+
- Duplicates removed
|
|
169
|
+
- Final unique count
|
|
170
|
+
- Breakdown by category (all categories found)
|
|
171
|
+
- Breakdown by severity (critical, high, medium, low)
|
|
172
|
+
- Per-scanner source counts
|
|
173
|
+
|
|
174
|
+
Output to {planning_artifacts}/consolidated-gaps.md"
|
|
175
|
+
</action>
|
|
176
|
+
<action>When subagent returns: verify {planning_artifacts}/consolidated-gaps.md exists. If the subagent failed to write the file, log error and halt.</action>
|
|
177
|
+
<template-output file="{planning_artifacts}/consolidated-gaps.md">
|
|
178
|
+
Consolidated gap analysis with deduplicated, ranked gaps in standardized schema format. Includes summary statistics header.
|
|
179
|
+
</template-output>
|
|
180
|
+
</step>
|
|
181
|
+
|
|
44
182
|
<step n="4" title="Create PRD for Gaps">
|
|
45
|
-
<action>
|
|
183
|
+
<action>Select PRD template based on {project_type} (set by Step 1 discovery). Template selection is a simple lookup — no template inheritance or composition at runtime:
|
|
184
|
+
|
|
185
|
+
| project_type | Template File | Requirement ID Scheme |
|
|
186
|
+
|------------------|----------------------------|----------------------------------------------|
|
|
187
|
+
| application | prd-template.md | FR-###, NFR-### |
|
|
188
|
+
| infrastructure | infra-prd-template.md | IR-###, OR-###, SR-### |
|
|
189
|
+
| platform | platform-prd-template.md | FR-###, NFR-### and IR-###, OR-###, SR-### |
|
|
190
|
+
|
|
191
|
+
Resolve template path: {installed_path}/../../templates/{selected_template}.
|
|
192
|
+
Verify the selected template file exists before proceeding. If the template file is missing, HALT with: "Template {selected_template} not found at {installed_path}/../../templates/. Ensure E12-S2 (infra) or E12-S3 (platform) templates are installed."
|
|
193
|
+
If {project_type} is not set or unrecognized, default to application (prd-template.md) for backward compatibility.</action>
|
|
194
|
+
<action>Read the selected PRD template from {installed_path}/../../templates/{selected_template}</action>
|
|
195
|
+
<action>Set requirement ID scheme based on {project_type}:
|
|
196
|
+
— If application: use FR-### for functional requirements and NFR-### for non-functional requirements (existing behavior, backward compatible)
|
|
197
|
+
— If infrastructure: use IR-### for infrastructure requirements, OR-### for operational requirements, and SR-### for security requirements exclusively. Do NOT use FR/NFR prefixes.
|
|
198
|
+
— If platform: use BOTH ID scheme families — FR-###/NFR-### for application-layer requirements and IR-###/OR-###/SR-### for infrastructure-layer requirements. All requirement IDs are globally unique within the project — the prefix disambiguates (e.g., FR-001 and IR-001 are distinct, no collision).</action>
|
|
46
199
|
<action>Read upstream artifacts to inform gap analysis:</action>
|
|
200
|
+
<action>— consolidated-gaps.md → primary input: deduplicated, ranked, and code-verified gap list from Steps 3.5 and 5.5. If a '## Verification Corrections for PRD' section exists, use it to correct factual errors from contradicted claims.</action>
|
|
47
201
|
<action>— nfr-assessment.md → NFR section gets real "Current Baseline" and "Target" columns</action>
|
|
48
202
|
<action>— api-documentation.md (if exists) → extract API gaps (undocumented endpoints, missing validation)</action>
|
|
49
203
|
<action>— event-catalog.md (if exists) → extract messaging gaps (missing DLQ, missing schemas)</action>
|
|
@@ -73,6 +227,92 @@
|
|
|
73
227
|
</template-output>
|
|
74
228
|
</step>
|
|
75
229
|
|
|
230
|
+
<step n="5.5" title="Code-Verified Review">
|
|
231
|
+
<action>Spawn a subagent using the Agent tool with this prompt:
|
|
232
|
+
|
|
233
|
+
"You are the Code-Verified Review subagent. Your task is to verify every factual claim in the consolidated gap entries against the actual codebase, classify each gap, and update the consolidated output.
|
|
234
|
+
|
|
235
|
+
**Context:**
|
|
236
|
+
- Consolidated gaps file: {planning_artifacts}/consolidated-gaps.md
|
|
237
|
+
- Codebase root: {project-path}
|
|
238
|
+
- Tech stack: {tech_stack}
|
|
239
|
+
- Gap schema reference: {installed_path}/../../templates/gap-entry-schema.md
|
|
240
|
+
|
|
241
|
+
**Step 1 — Load and parse consolidated-gaps.md:**
|
|
242
|
+
Read {planning_artifacts}/consolidated-gaps.md. Parse all YAML gap entries matching the standardized gap schema. If the file is empty or contains zero parseable gap entries, output a summary stating '0 gaps to verify' and exit gracefully without error, producing an empty verification report.
|
|
243
|
+
|
|
244
|
+
Handle malformed gap entries: if a gap entry is missing required fields (id, category, severity, title, description, evidence_file, recommendation), log a warning noting which field is missing and which entry, skip the entry, and include it in the summary as a skipped entry.
|
|
245
|
+
|
|
246
|
+
**Step 2 — Extract verifiable claims from each gap entry:**
|
|
247
|
+
For each valid gap entry, extract all machine-verifiable claims:
|
|
248
|
+
a. File existence: extract the `evidence_file` field — this is a relative path from {project-path} that should exist in the codebase.
|
|
249
|
+
b. Line range validity: extract the `evidence_line` field — this line number must be within the file's total line count.
|
|
250
|
+
c. Pattern/string presence: extract patterns, strings, or code snippets from the `description` and `recommendation` fields that claim specific code patterns exist in the referenced file.
|
|
251
|
+
d. Configuration key existence: for gaps in the `configuration` category, extract config key paths claimed to exist in YAML/JSON config files.
|
|
252
|
+
|
|
253
|
+
For gap entries with no verifiable claims (purely subjective descriptions with no file/line/pattern references), classify as `unverifiable` with reason 'No machine-verifiable claims'.
|
|
254
|
+
|
|
255
|
+
**Step 3 — Verify each claim against the codebase at {project-path}:**
|
|
256
|
+
Use grep, glob, and read tools for all verification (not shell commands). For each claim:
|
|
257
|
+
|
|
258
|
+
a. File existence check: Use glob/read to check if {project-path}/{evidence_file} exists.
|
|
259
|
+
- If the file does not exist: classify the gap as `contradicted` with reason 'Referenced file not found: {evidence_file}'. Preserve the original gap with downgraded confidence.
|
|
260
|
+
- If the file is a binary file (detected by extension: .png, .jpg, .gif, .woff, .ttf, .ico, .pdf, .zip, .tar, .gz, .exe, .dll, .so, .dylib): classify as `unverifiable` with reason 'Binary file — cannot verify textual claims'.
|
|
261
|
+
|
|
262
|
+
b. Line range validation: Read the file and count total lines. Compare against `evidence_line`.
|
|
263
|
+
- If evidence_line exceeds the file's total line count: classify as `contradicted` with reason 'Line {evidence_line} exceeds file length ({actual_lines} lines)'. Flag the entry for correction.
|
|
264
|
+
|
|
265
|
+
c. Pattern search: Use grep to search for stated patterns in the referenced file. Handle regex special characters safely by escaping them.
|
|
266
|
+
- If the pattern is found: this claim is confirmed.
|
|
267
|
+
- If the pattern is not found: this contributes to a `contradicted` classification.
|
|
268
|
+
|
|
269
|
+
d. Config key verification: For configuration-category gaps, parse YAML/JSON config files and check for key existence at the stated paths.
|
|
270
|
+
- If the key exists: claim confirmed.
|
|
271
|
+
- If the key does not exist: contributes to `contradicted` classification.
|
|
272
|
+
|
|
273
|
+
**Step 4 — Apply tristate classification to each gap:**
|
|
274
|
+
Based on the verification results from Step 3:
|
|
275
|
+
- **verified**: All verifiable claims in the gap entry are confirmed by evidence in the codebase. Set `verification_status: verified`.
|
|
276
|
+
- **unverifiable**: Claims cannot be confirmed or denied from code alone (e.g., runtime behavior, subjective assessments, binary files, no verifiable claims). Set `verification_status: unverifiable`.
|
|
277
|
+
- **contradicted**: Evidence in the codebase directly contradicts one or more claims. Set `verification_status: contradicted`.
|
|
278
|
+
|
|
279
|
+
For contradicted gaps:
|
|
280
|
+
- Downgrade the confidence of the original gap entry.
|
|
281
|
+
- Attach a `reason` string explaining exactly what was contradicted and what was found instead.
|
|
282
|
+
- Generate a new gap entry using the standardized gap schema with:
|
|
283
|
+
- `id`: GAP-VERIFIED-{seq}
|
|
284
|
+
- `category`: preserved from original gap
|
|
285
|
+
- `severity`: inherited from original gap
|
|
286
|
+
- `verified_by: "code-verified"`
|
|
287
|
+
- `description`: details of the contradiction and the actual state found in codebase
|
|
288
|
+
|
|
289
|
+
**Step 5 — Update consolidated-gaps.md:**
|
|
290
|
+
Write back to {planning_artifacts}/consolidated-gaps.md with the following additions to each gap entry:
|
|
291
|
+
- `verification_status`: verified | unverifiable | contradicted
|
|
292
|
+
- `verified_by: "code-verified"`
|
|
293
|
+
Preserve all existing fields on each entry — do not remove or overwrite original data.
|
|
294
|
+
Append new gap entries generated from contradicted claims at the end of the file.
|
|
295
|
+
|
|
296
|
+
**Step 6 — Generate verification summary:**
|
|
297
|
+
Output a summary report including:
|
|
298
|
+
- Total gaps processed
|
|
299
|
+
- Verified count
|
|
300
|
+
- Unverifiable count
|
|
301
|
+
- Contradicted count
|
|
302
|
+
- New gap entries generated from contradicted claims
|
|
303
|
+
- Skipped entries (malformed) count
|
|
304
|
+
|
|
305
|
+
**Step 7 — Feed contradicted claims back to Step 4:**
|
|
306
|
+
Contradicted claims must be fed back to Step 4 (PRD generation) for correction. Write the list of contradicted entries and their reasons to a section at the top of consolidated-gaps.md marked '## Verification Corrections for PRD'. This section will be read by Step 4 when the PRD is regenerated to correct factual errors.
|
|
307
|
+
|
|
308
|
+
Output to {planning_artifacts}/consolidated-gaps.md"
|
|
309
|
+
</action>
|
|
310
|
+
<action>When subagent returns: verify {planning_artifacts}/consolidated-gaps.md has been updated with verification_status fields. If the subagent failed, log error and halt.</action>
|
|
311
|
+
<template-output file="{planning_artifacts}/consolidated-gaps.md">
|
|
312
|
+
Code-verified consolidated gaps with verification_status and verified_by fields on each entry. Includes verification summary and corrections section for PRD feedback.
|
|
313
|
+
</template-output>
|
|
314
|
+
</step>
|
|
315
|
+
|
|
76
316
|
<step n="6" title="Architecture">
|
|
77
317
|
<action>Architecture is created using the Phase 3 workflow which auto-detects brownfield mode from the PRD "Mode: Brownfield" header set in step 4.</action>
|
|
78
318
|
<action>If {planning_artifacts}/architecture.md already exists: WARN user — "An architecture document already exists. Continuing will overwrite it with the brownfield version. Choose: (a) overwrite, (b) save as architecture-brownfield.md instead." If user chooses (b), instruct the subagent to output to {planning_artifacts}/architecture-brownfield.md.</action>
|
|
@@ -92,7 +332,7 @@
|
|
|
92
332
|
<check if="refresh-ground-truth workflow directory not found">Val ground truth bootstrap skipped — refresh-ground-truth workflow not available. Run /gaia-refresh-ground-truth manually after E8-S9 is implemented. Brownfield onboarding completes successfully.</check>
|
|
93
333
|
|
|
94
334
|
<action>Invoke /gaia-refresh-ground-truth to scan the filesystem and populate framework inventory facts (workflows, agents, skills, commands) into ground-truth.md</action>
|
|
95
|
-
<invoke-workflow ref="refresh-ground-truth" mode="yolo" />
|
|
335
|
+
<invoke-workflow ref="val-refresh-ground-truth" mode="yolo" />
|
|
96
336
|
|
|
97
337
|
<action>Load brownfield-extraction section of ground-truth-management skill JIT from {project-root}/_gaia/lifecycle/skills/ground-truth-management.md</action>
|
|
98
338
|
<action>Read available brownfield artifacts and extract project-specific facts. For each artifact, check if the file exists before reading — skip missing artifacts without error:
|
package/bin/gaia-framework.js
CHANGED
|
@@ -183,6 +183,8 @@ function main(deps) {
|
|
|
183
183
|
const _join = (deps && deps.join) || join;
|
|
184
184
|
const _mkdtemp = (deps && deps.mkdtempSync) || mkdtempSync;
|
|
185
185
|
const _tmpdir = (deps && deps.tmpdir) || tmpdir;
|
|
186
|
+
const _isWindows = deps && typeof deps.isWindows === "boolean" ? deps.isWindows : IS_WINDOWS;
|
|
187
|
+
const _findBash = (deps && deps.findBash) || findBash;
|
|
186
188
|
|
|
187
189
|
const args = process.argv.slice(2);
|
|
188
190
|
|
|
@@ -212,13 +214,13 @@ function main(deps) {
|
|
|
212
214
|
tempDir = _mkdtemp(_join(_tmpdir(), "gaia-framework-"));
|
|
213
215
|
// Resolve 8.3 short names to long paths on Windows (e.g., ELIASN~1 → Elias Nasser)
|
|
214
216
|
// Node's realpathSync doesn't expand 8.3 names, so use PowerShell
|
|
215
|
-
if (
|
|
217
|
+
if (_isWindows) {
|
|
216
218
|
try {
|
|
217
|
-
const longPath =
|
|
219
|
+
const longPath = _exec(
|
|
218
220
|
`powershell -NoProfile -Command "(Get-Item -LiteralPath '${tempDir}').FullName"`,
|
|
219
221
|
{ encoding: "utf8", stdio: ["pipe", "pipe", "ignore"] }
|
|
220
222
|
).trim();
|
|
221
|
-
if (longPath &&
|
|
223
|
+
if (longPath && _exists(longPath)) tempDir = longPath;
|
|
222
224
|
} catch {}
|
|
223
225
|
}
|
|
224
226
|
|
|
@@ -259,7 +261,7 @@ function main(deps) {
|
|
|
259
261
|
passthrough.splice(1, 0, "--source", toPosixPath(tempDir));
|
|
260
262
|
|
|
261
263
|
// Locate bash (critical for Windows support)
|
|
262
|
-
const bashPath =
|
|
264
|
+
const bashPath = _findBash();
|
|
263
265
|
if (!bashPath) {
|
|
264
266
|
fail(
|
|
265
267
|
"bash is required but was not found.\n" +
|
|
@@ -273,12 +275,12 @@ function main(deps) {
|
|
|
273
275
|
try {
|
|
274
276
|
// Convert all passthrough args that look like paths (contain backslash or drive letter)
|
|
275
277
|
const posixArgs = passthrough.map((a) =>
|
|
276
|
-
|
|
278
|
+
_isWindows && /[\\:]/.test(a) && !a.startsWith("--") ? toPosixPath(a) : a
|
|
277
279
|
);
|
|
278
280
|
const posixScript = toPosixPath(scriptPath);
|
|
279
281
|
|
|
280
282
|
// Debug: on Windows, log the resolved paths if --verbose is passed
|
|
281
|
-
if (
|
|
283
|
+
if (_isWindows && args.includes("--verbose")) {
|
|
282
284
|
info(`Bash: ${bashPath} (${bashType})`);
|
|
283
285
|
info(`Script (Windows): ${scriptPath}`);
|
|
284
286
|
info(`Script (POSIX): ${posixScript}`);
|
package/gaia-install.sh
CHANGED
|
@@ -233,7 +233,7 @@ copy_gaia_files() {
|
|
|
233
233
|
|
|
234
234
|
# Fallback: cp -rp (preserves permissions like rsync -a)
|
|
235
235
|
if [[ "$copy_done" == false ]] && command -v cp >/dev/null 2>&1; then
|
|
236
|
-
if cp -rp "$src/_gaia
|
|
236
|
+
if cp -rp "$src/_gaia/." "$dst/_gaia/" 2>/dev/null; then
|
|
237
237
|
clean_resolved_yaml "$dst/_gaia"
|
|
238
238
|
detail "Copied framework files using cp -rp (rsync unavailable)"
|
|
239
239
|
copy_done=true
|
|
@@ -493,16 +493,18 @@ cmd_init() {
|
|
|
493
493
|
fi
|
|
494
494
|
fi
|
|
495
495
|
|
|
496
|
-
# Step 8: Create custom
|
|
497
|
-
step "Creating custom
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
496
|
+
# Step 8: Create custom directories (ADR-020: user-owned write targets)
|
|
497
|
+
step "Creating custom directories..."
|
|
498
|
+
for cdir in skills templates; do
|
|
499
|
+
if [[ "$OPT_DRY_RUN" == true ]]; then
|
|
500
|
+
detail "[dry-run] Would create: custom/$cdir/"
|
|
501
|
+
else
|
|
502
|
+
mkdir -p "$TARGET/custom/$cdir"
|
|
503
|
+
fi
|
|
504
|
+
if [[ -f "$source/custom/$cdir/README.md" ]]; then
|
|
505
|
+
copy_if_missing "$source/custom/$cdir/README.md" "$TARGET/custom/$cdir/README.md"
|
|
506
|
+
fi
|
|
507
|
+
done
|
|
506
508
|
|
|
507
509
|
# Step 9: Append GAIA entries to .gitignore
|
|
508
510
|
step "Updating .gitignore..."
|
|
@@ -687,15 +689,17 @@ cmd_update() {
|
|
|
687
689
|
fi
|
|
688
690
|
done
|
|
689
691
|
|
|
690
|
-
# Ensure custom
|
|
691
|
-
|
|
692
|
-
[[
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
692
|
+
# Ensure custom directories exist (user-owned, never overwritten — ADR-020)
|
|
693
|
+
for cdir in skills templates; do
|
|
694
|
+
if [[ "$OPT_DRY_RUN" == true ]]; then
|
|
695
|
+
[[ ! -d "$TARGET/custom/$cdir" ]] && detail "[dry-run] Would create: custom/$cdir/"
|
|
696
|
+
else
|
|
697
|
+
mkdir -p "$TARGET/custom/$cdir"
|
|
698
|
+
fi
|
|
699
|
+
if [[ -f "$source/custom/$cdir/README.md" ]]; then
|
|
700
|
+
copy_if_missing "$source/custom/$cdir/README.md" "$TARGET/custom/$cdir/README.md"
|
|
701
|
+
fi
|
|
702
|
+
done
|
|
699
703
|
|
|
700
704
|
# Update slash commands (add new ones, update existing with backup)
|
|
701
705
|
step "Updating slash commands..."
|
|
@@ -828,6 +832,10 @@ cmd_validate() {
|
|
|
828
832
|
[[ -d "$TARGET/docs/$dir" ]]; check "Docs: $dir" $?
|
|
829
833
|
done
|
|
830
834
|
|
|
835
|
+
# Custom directories (ADR-020: user-owned write targets)
|
|
836
|
+
[[ -d "$TARGET/custom/skills" ]]; check "custom/skills/ exists" $?
|
|
837
|
+
[[ -d "$TARGET/custom/templates" ]]; check "custom/templates/ exists" $?
|
|
838
|
+
|
|
831
839
|
# Version
|
|
832
840
|
local version
|
|
833
841
|
version="$(extract_yaml_value "$TARGET/_gaia/_config/global.yaml" "framework_version")"
|