diff --git a/.agents/skills/up-requirements-elicit/SKILL.md b/.agents/skills/up-requirements-elicit/SKILL.md new file mode 100644 index 0000000..36803ab --- /dev/null +++ b/.agents/skills/up-requirements-elicit/SKILL.md @@ -0,0 +1,172 @@ +--- +name: up-requirements-elicit +description: Elicit, structure, and synthesize stakeholder vision, user personas, functional capabilities, and architectural constraints into an authoritative, baseline-ready Product/Business Requirements Document (PRD/BRD) when no upstream requirements document is supplied. Uses OpenUP Requirements Discipline and AI Hero Socratic interview patterns. Covers Stage 0B (Inception) of the UP-AI v1.1 Process. +--- + +# up-requirements-elicit — Stage 0B (Inception: Requirements Elicitation & BRD Synthesis) + +## Objective + +Bridge the gap between an unformed idea or conversational brief and an authoritative, structured requirements document. Transform vague stakeholder vision into a rigorous, baseline-ready **Product Requirements Document (PRD / BRD)** under `01_BRD/PRD_Specification.md` with minted root traceability IDs (`BRD-FR-xxx`). + +This skill operationalizes: +1. **OpenUP Requirements Discipline:** Problem analysis, vision definition, actor/persona identification, system boundary scoping, and candidate scenario modeling. +2. **AI Hero Socratic Elicitation:** Interactive, adversarial questioning that challenges hand-waving, stress-tests edge cases, and enforces strict "in-scope vs. anti-scope" boundaries. +3. **CMMI Level 3 Requirements Development (RD):** Systematic stakeholder need elicitation, operational concept definition, and formal capture of assumptions (`ASM-xxx`) and ambiguities (`AMB-xxx`). + +--- + +## When to Invoke + +- At the start of a project when no BRD or PRD exists in `01_BRD/`. +- When the incoming request is a high-level prompt, brief summary, or informal pitch (e.g., *"Build an Uber for logistics"* or *"Create a multi-tenant subscription billing platform"*). +- When requirements are incomplete, contradictory, or lack explicit failure scenarios and non-functional constraints. +- **Do NOT invoke** if an authoritative, reviewed, and signed-off PRD/BRD is already present in `01_BRD/`—in that case, proceed directly to `up-brd-extract` (Stage 1). + +--- + +## Read First + +- `01_BRD/PRD_Specification.template.md` (authoritative document structure) +- `tech-profile.yaml` (archetype, multi-tenancy model, active tech stack) +- `04_generated_documentation/00_process_control/master_context.md` +- `04_generated_documentation/00_process_control/ambiguity_register.md` +- `04_generated_documentation/00_process_control/assumptions_register.md` + +--- + +## Procedure + +The skill executes in two distinct phases: **Phase 1 (Socratic Elicitation Interview)** and **Phase 2 (BRD/PRD Synthesis & Baseling)**. + +### Phase 1 — Socratic Elicitation Interview (Iterative Rounds) + +Do NOT overwhelm the stakeholder with a wall of 20 questions. Conduct a focused, multi-turn interview asking **2 to 4 targeted questions per turn**, organized across five fundamental dimensions: + +#### Round 1: Vision, Problem Statement & Business Value (OpenUP Vision) +- What specific business problem does this solve, and who suffers today without it? +- What is the primary metric or operational outcome defining success for v1? +- What existing manual process, legacy tool, or competitor does this replace? + +#### Round 2: Actors, Personas & System Boundaries (OpenUP Find & Outline) +- Who are the direct human users (roles, access tiers, organizational hierarchy)? +- Are there external automated systems, webhooks, or third-party APIs interacting with this platform? +- Is multi-tenancy required (e.g., multiple independent companies/tenants on the same system)? + +#### Round 3: In-Scope Capabilities vs. Explicit Anti-Scope (AI Hero Scoping) +- What 3 to 6 core capabilities MUST exist in Version 1.0 (MVP)? +- What is explicitly **OUT OF SCOPE** (anti-scope) for v1 to guarantee delivery velocity? +- Where is the strict boundary between internal platform responsibility and external vendor service responsibility? + +#### Round 4: Core User Journeys & Critical Failure Modes +- Walk through the primary "Happy Path" journey for the main user persona from entry to completion. +- What are the top 2 failure or exception scenarios? (e.g., payment rejected, session expired, concurrent inventory conflict, offline sync). +- What should the system state and user experience be when an external dependency is unavailable? + +#### Round 5: Non-Functional Requirements (NFRs) & Compliance Constraints +- What are the regulatory or compliance requirements (GDPR, HIPAA, SOC 2, audit trails)? +- What are the expected throughput, transaction volumes, and data retention requirements? +- What are the latency requirements (e.g., API response SLAs, batch processing windows)? + +#### Interview Governance Rules: +1. **Challenge Ambiguity:** If the user provides a vague answer (e.g., *"It should be fast and secure"*), probe immediately: *"What is the acceptable p95 response time in milliseconds? What authentication standard (OIDC, SAML, API keys) is required?"*. +2. **Log Unknowns:** If a business decision cannot be answered immediately, do NOT guess or invent business logic. Record it as an `AMB-xxx` in `04_generated_documentation/00_process_control/ambiguity_register.md`. +3. **Log Working Assumptions:** If proceeding requires a reasonable default, record it as an `ASM-xxx` in `04_generated_documentation/00_process_control/assumptions_register.md`. + +--- + +### Phase 2 — BRD/PRD Synthesis & Baseling + +Once the elicitation interview yields sufficient clarity across the five dimensions, synthesize the output directly into `01_BRD/PRD_Specification.md` following `01_BRD/PRD_Specification.template.md`. + +#### Mandatory PRD Structure: +```markdown +# Product Requirements Document (PRD) — + +| Field | Value | +|---|---| +| **Document** | `PRD_Specification.md` | +| **Product** | () | +| **Version** | 1.0.0 | +| **Author** | Elicited via `@requirements-analyst` (`up-requirements-elicit`) | +| **Status** | Baselined | +| **Last Updated** | YYYY-MM-DD | + +--- + +## 1. Executive Summary & Problem Statement +- The Business Need +- Target Market / Operational Context +- Success Criteria & KPIs + +--- + +## 2. Target Personas & External Actors +1. **:** Role, goals, permissions. +2. **:** Role, goals, permissions. +3. **:** External API/service integration. + +--- + +## 3. High-Level Feature Inventory (The Traceability Root Spine) +Every discrete capability MUST be assigned a unique `BRD-FR-xxx` ID: + +| Feature ID | Feature Title | Primary Persona | Description & Acceptance Intent | Priority | +|---|---|---|---|---| +| `BRD-FR-001` | | <Persona> | <Clear, testable capability description> | P0 | +| `BRD-FR-002` | <Title> | <Persona> | <Clear, testable capability description> | P0 | +| `BRD-FR-003` | <Title> | <Persona> | <Clear, testable capability description> | P1 | + +--- + +## 4. Scope Boundaries & Anti-Scope +- **In Scope for v1:** Explicit list of delivered boundaries. +- **Explicit Anti-Scope (Deferred):** What is intentionally excluded from v1. + +--- + +## 5. Non-Functional Requirements & Constraints +- Multi-Tenancy & Data Isolation Model +- Security, Authentication & Cryptography +- Performance & Scalability SLAs +- Auditability & Compliance Standards +``` + +--- + +### Phase 3 — Stakeholder Review Brief (Mitigating Automation Bias) + +Provide a concise Human Review Brief for the stakeholder: +1. **Executive Summary:** 3-bullet synopsis of what was elicited. +2. **Baselined Scope:** Count of P0/P1 `BRD-FR-xxx` features created. +3. **Anti-Scope Confirmations:** Explicit confirmation of what was excluded. +4. **Open Ambiguities:** Any pending `AMB-xxx` entries requiring stakeholder resolution. + +--- + +## Output Expected + +1. Baselined requirements document: `01_BRD/PRD_Specification.md`. +2. Updated registers: + - `04_generated_documentation/00_process_control/ambiguity_register.md` + - `04_generated_documentation/00_process_control/assumptions_register.md` +3. Stakeholder Human Review Brief presented in session. + +--- + +## Exit Criteria + +- `01_BRD/PRD_Specification.md` exists and is populated with: + - Clear problem statement and target personas. + - At least 3 `BRD-FR-xxx` features with priority and acceptance intent. + - Explicit Anti-Scope section. + - Concrete NFR constraints. +- All minted `BRD-FR-xxx` IDs are formatted correctly to serve as roots for Stage 1 (`up-brd-extract`) and Stage 5 (`up-use-case-author`). +- Stakeholder has reviewed and approved the baseline. + +--- + +## Related Skills + +- **Preceding:** `up-project-bootstrap` (Stage 0). +- **Subsequent:** `up-brd-extract` (Stage 1), `up-use-case-author` (Stage 5), `up-arch-risk-spike` (Stage 6). diff --git a/00_prompts/02_Skills_Usage_Guide.md b/00_prompts/02_Skills_Usage_Guide.md index 52cad34..b0f19ae 100644 --- a/00_prompts/02_Skills_Usage_Guide.md +++ b/00_prompts/02_Skills_Usage_Guide.md @@ -1,12 +1,13 @@ -# Skills Usage Guide — Invoking UP-AI v1.1 (Universal Generic Edition) +# Skills Usage Guide — Invoking UP-AI v1.2 (Universal Generic Edition) -**Purpose:** The 18 skills under `.agents/skills/` are the canonical executable forms of `00_prompts/AI_Native_Unified_Process_v1.md`. This guide shows, stage by stage, which skill to invoke and how across both **Greenfield (0-to-1)** and **Brownfield (Modernization)** projects. +**Purpose:** The 19 skills under `.agents/skills/` are the canonical executable forms of `00_prompts/AI_Native_Unified_Process_v1.md`. This guide shows, stage by stage, which skill to invoke and how across both **Greenfield (0-to-1)** and **Brownfield (Modernization)** projects. ## How to Invoke a Skill 1. **Explicit, slash-style** — name the skill directly: `/up-use-case-author UC-001 user-identity-and-role-governance`. 2. **Sub-Agent / Role-based** — invoke with specialized persona prefix: + - `@requirements-analyst /up-requirements-elicit` - `@requirements-analyst /up-brd-extract` - `@spike-architect /up-arch-risk-spike` - `@ui-designer-dev /up-wireframe-spec` @@ -23,6 +24,7 @@ | Stage | Skill | Action | |---|---|---| | 0 | `up-project-bootstrap` | Initialize workspace with `tech-profile.yaml` configured as `archetype: greenfield` | +| 0B | `up-requirements-elicit` | *If BRD unsupplied:* Conduct Socratic interview and synthesize `01_BRD/PRD_Specification.md` | | 1 | `up-brd-extract` | Extract business features and requirements from PRD/BRD, mint `BRD-FR-xxx` IDs | | 1B / 6 | `up-arch-risk-spike` | Score domain risks, build thin walking skeleton before use-case authoring | @@ -31,10 +33,14 @@ # Stage 0: Bootstrap greenfield workspace with declarative profile /up-project-bootstrap --archetype greenfield -# Stage 1: Extract PRD features +# Stage 0B: Elicit requirements when no BRD exists (interactive Socratic interview) +/up-requirements-elicit --interactive + +# Stage 1: Extract PRD features once PRD_Specification.md is baselined /up-brd-extract 01_BRD/PRD_Specification.md ``` + ### Brownfield Track (Legacy Modernization / Migration) | Stage | Skill | Action | |---|---|---| @@ -213,6 +219,7 @@ Save and resume state across developer/agent sessions: ### Scenario A: Greenfield Track (0-to-1 User Management) ```bash 1. /up-project-bootstrap --archetype greenfield +1B. /up-requirements-elicit --interactive # Optional: if PRD not already supplied 2. /up-brd-extract 01_BRD/PRD_Specification.md 3. /up-use-case-author UC-001 user-authentication-rbac 4. /up-traceability-gate 5.1 @@ -227,6 +234,7 @@ Save and resume state across developer/agent sessions: 13. /up-uat-handover ``` + ### Scenario B: Brownfield Track (Legacy Billing Modernization) ```bash 1. /up-project-bootstrap --archetype brownfield diff --git a/00_prompts/AI_Native_Unified_Process_v1.md b/00_prompts/AI_Native_Unified_Process_v1.md index b774762..b8e5643 100644 --- a/00_prompts/AI_Native_Unified_Process_v1.md +++ b/00_prompts/AI_Native_Unified_Process_v1.md @@ -1,15 +1,16 @@ -**AI-Native Unified Process + SEI-CMM Level 3 — v1.1 (Universal Generic Edition)** +**AI-Native Unified Process + SEI-CMM Level 3 — v1.2 (Universal Generic Edition)** *Use-Case-Driven, Architecture-Centric, Iterative and Incremental Process for Generating Requirements, Architecture, Wireframes, Test Models, Production Code, and Cloud Deployment across Greenfield and Brownfield Initiatives* | Field | Description | |---|---| -| Document Version | v1.1 (Governance-Hardened Baseline via `CR-001`) | -| Architecture Scope | Universal, stack-agnostic AI-Native Software Development Framework (`UP-AI v1.1`) | -| Source inputs | Configured via `tech-profile.yaml`: `01_BRD` / PRDs (Greenfield & Brownfield); `02_legacy_source_code` & `03_old_screenshots` (Brownfield only). | +| Document Version | v1.2 (Requirements Elicitation Hardened Baseline via `CR-002`) | +| Architecture Scope | Universal, stack-agnostic AI-Native Software Development Framework (`UP-AI v1.2`) | +| Source inputs | Configured via `tech-profile.yaml`: `01_BRD` / PRDs (Greenfield & Brownfield, synthesized via `up-requirements-elicit` if unsupplied); `02_legacy_source_code` & `03_old_screenshots` (Brownfield only). | | Target architecture | Configured via `tech-profile.yaml`: Supports Modular Monolith, Microservices, Event-Driven, or Serverless architectures; multi-tenancy models (Row-Level Security, schema-per-tenant, DB-per-tenant); cloud-agnostic containerized deployments. | | Technology profile | Declarative `tech-profile.yaml` defining active backend, frontend, ORM, migrations, auth provider, database, governance tailoring tier, and Wave 0 integration sandboxes. | -| Tooling & Execution | Orchestrated via canonical AI Agent Skills (`.agents/skills/`), multi-agent topologies (§1.2), deterministic gate validator (`scripts/verify_traceability_gates.py`), context-checkpointing (`up-context-checkpoint`), automated test runner (`scripts/run_tests.sh`), and QA workbook compiler (`scripts/generate_manual_qa_workbook.py`). | +| Tooling & Execution | Orchestrated via 19 canonical AI Agent Skills (`.agents/skills/`), multi-agent topologies (§1.2), deterministic gate validator (`scripts/verify_traceability_gates.py`), context-checkpointing (`up-context-checkpoint`), automated test runner (`scripts/run_tests.sh`), and QA workbook compiler (`scripts/generate_manual_qa_workbook.py`). | + --- @@ -39,7 +40,8 @@ Eight core mechanics govern this universal process across all project types: +-----------------------------------------------------------------------------------+ | +---> GREENFIELD TRACK (0-to-1): - | Stage 0 (Bootstrap) -> Stage 1 (PRD/BRD) -> Stage 1B (DDD & Event Storming) + | Stage 0 (Bootstrap) -> [Stage 0B (Requirements Elicitation / PRD Synthesis if BRD unsupplied)] + | -> Stage 1 (PRD/BRD) -> Stage 1B (DDD & Event Storming) | -> Stage 6 (Arch Risk Spike) -> Stage 7 (Walking Skeleton) -> Stage 5 (Use Cases) | +---> BROWNFIELD TRACK (Modernization / Migration): @@ -68,7 +70,7 @@ Eight core mechanics govern this universal process across all project types: | UP Phase | Stages | Primary objective | Risk being retired | |---|---|---|---| -| **Inception** | 0 – 4 | Establish project archetype, stack profile (`tech-profile.yaml`), scope boundaries, and domain/legacy catalog | Scope and requirements-source risk | +| **Inception** | 0 – 4 | Establish project archetype, stack profile (`tech-profile.yaml`), scope boundaries, requirements elicitation (Stage 0B), and domain/legacy catalog | Scope and requirements-source risk | | **Elaboration** | 5 – 9 (+ Gates 5.1, 9.1) | Build use-case requirements spine, validated architecture walking skeleton, and full SRS/HLD/LLD | Requirements-volatility and architecture risk | | **Construction** *(iterative)* | 10 – 14 (+ Gate 14.1) | Build, test, and integrate working software one vertical slice at a time across explicit delivery surfaces | Delivery and integration risk | | **Transition** | 15 – 18 | Containerized deployment, CI/CD pipelines, UAT acceptance, and client handover package | Operational and adoption risk | @@ -76,13 +78,14 @@ Eight core mechanics govern this universal process across all project types: ## 1.2 Multi-Agent & Sub-Agent Topology AI-Native execution delegates specialized tasks to defined agent roles: -- **`@requirements-analyst`**: Extracts PRD/BRD requirements, resolves ambiguities, authors self-contained use cases and functional requirements. +- **`@requirements-analyst`**: Conducts Socratic requirements elicitation (`up-requirements-elicit`), extracts PRD/BRD requirements (`up-brd-extract`), resolves ambiguities, authors self-contained use cases and functional requirements (`up-use-case-author`). - **`@spike-architect`**: Scores architectural risks (`RISK-xxx`), builds high-risk walking skeletons, designs domain HLD/LLD templates. - **`@backend-dev`**: Generates schemas, migrations, deterministic API routers, business FSMs, and Wave 0 mock sandboxes. - **`@ui-designer-dev`**: Applies `DESIGN.md` tokens, creates wireframe screen specs, builds responsive frontend views and component tests. - **`@adversarial-tester`**: Generates multi-path test suites (≥95% coverage), Bruno API collections, Playwright E2E specs, and 21-sheet Excel workbooks. - **`@gatekeeper`**: Enforces quality gates (5.1, 9.1, 14.1), verifies delivery-surface completeness, calculates CR blast radiuses. + --- # 2. Governing Artifact & ID Scheme (the single spine) @@ -184,6 +187,12 @@ Cross-cutting governance IDs: `DEC-xxx` (decision), `AMB-xxx` (ambiguity), `ASM- **Output Expected:** `master_context.md`, `assumptions_register.md`, `vocabulary_glossary.md`, `decision_log.md`, `folder_discovery_report.md`. +## Stage 0B — Socratic Requirements Elicitation & BRD Synthesis (`up-requirements-elicit`) + +**Objective:** Ingest conversational briefs, unformed product ideas, or informal stakeholder pitches when an authoritative BRD/PRD is not supplied. Conduct an adversarial, multi-turn Socratic elicitation interview combining the **OpenUP Requirements Discipline** (Vision, Stakeholders/Actors, System Boundaries, Non-Functional Constraints) with **AI Hero Socratic patterns** (probing edge cases, anti-scope enforcement, trade-off interrogation). + +**Output Expected:** Authoritative, baseline-ready `01_BRD/PRD_Specification.md` with minted root traceability IDs (`BRD-FR-xxx`), explicit Anti-Scope, and NFR constraints; logged ambiguities in `ambiguity_register.md` (`AMB-xxx`) and working assumptions in `assumptions_register.md` (`ASM-xxx`). + ## Stage 1 — Business Requirements (PRD/BRD) Extraction **Objective:** Extract every discrete business capability and mint `BRD-FR-xxx` IDs in `01_source_inventories/brd_inventory.md`. @@ -192,6 +201,7 @@ Cross-cutting governance IDs: `DEC-xxx` (decision), `AMB-xxx` (ambiguity), `ASM- **Objective:** Reverse-engineer legacy codebases, extract database schemas, and map screen flows into `02_legacy_analysis/`. + --- # 5. PHASE II — ELABORATION (Stages 5–9) @@ -318,5 +328,7 @@ Process adjustments follow the same formal change lifecycle as product code, inc |---|---|---| | **v1.0** | 2026-09-03 | Initial baselined release of the universal, stack-agnostic **AI-Native Unified Process Framework (UP-AI v1.0)**. Incorporates native dual-track inception, atomic use-case requirements authoring, continuous traceability gates (5.1, 9.1, 14.1), formal change request blast-radius analysis, risk-driven elaboration spikes, wave-based construction loops with 11-dimension delivery surfaces, Wave 0 deterministic sandboxes, ≥95.0% multi-path automated test coverage, 21-sheet manual QA workbook compilation, and single canonical skill layout (`.agents/skills/`). | | **v1.1** | 2026-10-03 | **Governance & Automation Hardening (`CR-001`):** (1) Implemented deterministic CLI gate validator `scripts/verify_traceability_gates.py` for Gates 5.1, 9.1, and 14.1 to eliminate agent self-policing bias; (2) Added CMMI 3-tier process tailoring matrix (§8.5) in `tech-profile.yaml` (High-Assurance, Standard Enterprise, Fast-Track); (3) Formulated Human Review Optimization Brief protocol (§8.6) to mitigate automation bias/fatigue; (4) Formalized differentiated coverage budgets (§2.2 Rule 8) separating core domain FSMs ($\ge 95\%$) from adapters ($\ge 90\%$) and frontend components ($\ge 80\%$ + Playwright E2E). | -| **v1.2+** | (Future) | Process adjustments approved via `CR-xxx` (Trigger Type `Process-Adjustment`) are version-bumped and recorded here per §8.8. | +| **v1.2** | 2026-10-03 | **Requirements Elicitation Hardening (`CR-002`):** Introduced canonical skill `up-requirements-elicit` (.agents/skills/up-requirements-elicit/) at Stage 0B (Inception) to conduct Socratic stakeholder elicitation and synthesize authoritative `01_BRD/PRD_Specification.md` with root `BRD-FR-xxx` IDs when a formal requirements document is not supplied. Synthesized from OpenUP Requirements Discipline (Vision, Stakeholders, System Boundaries) and AI Hero Socratic patterns. | +| **v1.3+** | (Future) | Process adjustments approved via `CR-xxx` (Trigger Type `Process-Adjustment`) are version-bumped and recorded here per §8.8. | + diff --git a/04_generated_documentation/00_process_control/change_request_register.md b/04_generated_documentation/00_process_control/change_request_register.md index e2c9165..d0f3a68 100644 --- a/04_generated_documentation/00_process_control/change_request_register.md +++ b/04_generated_documentation/00_process_control/change_request_register.md @@ -15,5 +15,8 @@ | CR-ID | Trigger Type | Raised By | Date | Originating Stage | Description | Affected Items | Blast Radius / Impact | Disposition | Status | |---|---|---|---|---|---|---|---|---|---| | `CR-001` | Process-Adjustment | Joint (User/Assistant) | 2026-10-03 | Meta-Governance | Upgrade UP-AI framework to v1.1: (1) Add deterministic CLI gate validator `scripts/verify_traceability_gates.py`, (2) Formalize CMMI 3-tier process tailoring matrix, (3) Integrate Human Review Brief protocol, and (4) Differentiate test coverage targets in `tech-profile.yaml`. | `AI_Native_Unified_Process_v1.md`, `tech-profile.yaml`, `tech-profile.template.yaml`, `.agents/skills/up-traceability-gate/SKILL.md`, `.agents/skills/up-code-generate/SKILL.md`, `.agents/skills/up-test-model-generate/SKILL.md`, `README.md`, `scripts/verify_traceability_gates.py` | Process spec §2.2, §8.5, §8.6, §9, Appendix A; tech profile configs; 3 canonical skills; 1 new CLI tool. | Approved | Closed | +| `CR-002` | Process-Adjustment | User/Assistant | 2026-10-03 | Inception / Meta-Gov | Introduce canonical skill `up-requirements-elicit` (Stage 0B) for Socratic requirements elicitation and automated BRD/PRD synthesis when an authoritative requirements document is not supplied, synthesized from OpenUP Requirements Discipline and AI Hero socratic patterns. | `.agents/skills/up-requirements-elicit/SKILL.md`, `00_prompts/AI_Native_Unified_Process_v1.md`, `00_prompts/02_Skills_Usage_Guide.md`, `README.md` | Inception lifecycle (§1, §4), 19th canonical skill, Skills guide §1. | Approved | Closed | + + diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-002-v1.1-governance-hardening.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-002-v1.1-governance-hardening.md index e69de29..a738f69 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint-002-v1.1-governance-hardening.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-002-v1.1-governance-hardening.md @@ -0,0 +1,29 @@ +# Checkpoint 002 — UP-AI v1.1 CMMI Level 3 Governance Hardening + +- **Checkpoint ID:** `CKPT-002` +- **Date:** 2026-10-03 +- **Active Stage:** Meta-Governance / Cross-Cutting +- **Active Track:** Universal / Framework Hardening +- **Process Version:** UP-AI v1.1 +- **Associated Change Request:** `CR-001` (Closed) + +--- + +## 1. Completed in this Session +- Implemented CMMI Level 3 hardening recommendations across the UP-AI framework. +- Created standalone, testable CLI gate validator script `scripts/verify_traceability_gates.py` covering Gates 5.1, 9.1, and 14.1 with multi-format output (markdown, JSON, summary). +- Embedded CMMI-compliant 3-Tier Tailoring Framework into `00_prompts/AI_Native_Unified_Process_v1.md` and `04_generated_documentation/00_process_control/tailoring_guidelines.md`. +- Formalized Human Review Brief protocol in Stage 14, requiring explicit approval evidence before milestone baselines. +- Upgraded Stage 10 delivery-surface matrix to support differentiated coverage (`Full`, `Stub`, `Schema-Only`, `Deferred`, `N/A`) with mandatory rationale. +- Updated `00_prompts/02_Skills_Usage_Guide.md`, `README.md`, and registered `CR-001` in `change_request_register.md`. + +--- + +## 2. Mid-Flight / Open Items +- None. Traceability gates verified cleanly with `python3 scripts/verify_traceability_gates.py --all`. + +--- + +## 3. Exact Next Action +- Extract PRD requirements with `/up-brd-extract 01_BRD/PRD_Specification.md`, or +- Implement `iteration-01` with `/up-code-generate iteration-01`. diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-003-requirements-elicitation-skill.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-003-requirements-elicitation-skill.md new file mode 100644 index 0000000..36b6ed4 --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-003-requirements-elicitation-skill.md @@ -0,0 +1,36 @@ +# Checkpoint 003 — Requirements Elicitation Skill (UP-AI v1.2) + +- **Checkpoint ID:** `CKPT-003` +- **Date:** 2026-10-03 +- **Active Stage:** Stage 0B (Requirements Elicitation & BRD Synthesis) / Phase I Inception +- **Active Track:** Greenfield / Universal +- **Process Version:** UP-AI v1.2 +- **Associated Change Request:** `CR-002` (Closed) + +--- + +## 1. Completed in this Session +- Implemented `up-requirements-elicit` canonical skill in `.agents/skills/up-requirements-elicit/SKILL.md`. +- Modeled elicitation workflow bridging OpenUP Requirements Discipline (Problem Analysis, Vision, Actors, System Boundaries) and AI Hero Socratic grill-me / PRD-synthesis patterns: + - **Phase 1:** 5-round interactive Socratic interview covering: + 1. Vision, Problem & Success Metrics + 2. Primary Actors, Personas & System Boundaries + 3. In-Scope Core Capabilities vs. Anti-Scope Guardrails + 4. Critical User Journeys, Edge Cases & Failure Modes + 5. Non-Functional Requirements, Operational Constraints & Compliance + - **Phase 2:** Authoritative synthesis generating compliant `01_BRD/PRD_Specification.md` with minted `BRD-FR-xxx` IDs and an interactive Human Review Brief. +- Updated process specification `00_prompts/AI_Native_Unified_Process_v1.md` to v1.2, integrating Stage 0B into Greenfield Track lifecycle, agent topology, and Appendix A changelog. +- Updated `00_prompts/02_Skills_Usage_Guide.md` and `README.md` to reflect 19 canonical skills. +- Closed `CR-002` in `04_generated_documentation/00_process_control/change_request_register.md`. +- Verified CLI gate validator passes cleanly (`python3 scripts/verify_traceability_gates.py --all`). + +--- + +## 2. Mid-Flight / Open Items +- None. + +--- + +## 3. Exact Next Action +- When starting a greenfield project without a provided BRD, run `/up-requirements-elicit --interactive` to conduct the Socratic interview and produce `01_BRD/PRD_Specification.md`. +- Once generated and approved, proceed to Stage 1 with `/up-brd-extract 01_BRD/PRD_Specification.md`. diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md index 6de29da..b5689dd 100644 --- a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -2,7 +2,7 @@ | Field | Value | |---|---| -| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.1) | +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.2) | | **Document Path** | `04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md` | | **Gated By** | `up-context-checkpoint` | | **Last Updated** | 2026-10-03 | @@ -15,4 +15,6 @@ |---|---|---|---|---|---|---| | `CKPT-001` | 2026-09-03 | Stage 0 (Bootstrap Baseline) | Workspace initialized with `tech-profile.yaml`, generic governance registers, and `UC-001` reference slice. | None | Author new use cases with `/up-use-case-author` or plan iteration with `/up-iteration-plan`. | `checkpoint-001-bootstrap-baseline.md` | | `CKPT-002` | 2026-10-03 | Meta-Governance / Cross-Cutting | UP-AI v1.1 Hardening: CLI gate validator (`scripts/verify_traceability_gates.py`), CMMI 3-tier tailoring, review brief protocol, differentiated coverage. CR-001 closed. | None | Extract PRD requirements with `/up-brd-extract` or implement `iteration-01` with `/up-code-generate`. | `checkpoint-002-v1.1-governance-hardening.md` | +| `CKPT-003` | 2026-10-03 | Stage 0B (Elicitation / Inception) | UP-AI v1.2: Added `up-requirements-elicit` skill bridging OpenUP and AI Hero patterns, Stage 0B in process spec, 19 skills total. CR-002 closed. | None | Run `/up-requirements-elicit --interactive` when no BRD exists, then proceed to `/up-brd-extract`. | `checkpoint-003-requirements-elicitation-skill.md` | + diff --git a/README.md b/README.md index a523519..19440e7 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# AI-Native Unified Process (UP-AI v1.1) — Universal Framework +# AI-Native Unified Process (UP-AI v1.2) — Universal Framework -[![Process Version](https://img.shields.io/badge/Process-UP--AI%20v1.1%20Generic-blue.svg)](00_prompts/AI_Native_Unified_Process_v1.md) +[![Process Version](https://img.shields.io/badge/Process-UP--AI%20v1.2%20Generic-blue.svg)](00_prompts/AI_Native_Unified_Process_v1.md) [![Quality Standard](https://img.shields.io/badge/SEI--CMMI-Level%203%20Governed-green.svg)](00_prompts/AI_Native_Unified_Process_v1.md) [![Automated Coverage](https://img.shields.io/badge/Test%20Coverage-Tiered%20%E2%89%A595%2F90%2F80%25-brightgreen.svg)](00_prompts/AI_Native_Unified_Process_v1.md) -[![Agent Skills](https://img.shields.io/badge/Skills-18%20Canonical%20Skills-orange.svg)](.agents/skills/) +[![Agent Skills](https://img.shields.io/badge/Skills-19%20Canonical%20Skills-orange.svg)](.agents/skills/) -**UP-AI v1.1** is an enterprise-grade, stack-agnostic software engineering framework combining the rigor of the **Unified Process (UP)** and **SEI-CMMI Level 3** governance with the speed of **AI-Native pair programming and autonomous multi-agent orchestration**. +**UP-AI v1.2** is an enterprise-grade, stack-agnostic software engineering framework combining the rigor of the **Unified Process (UP)** and **SEI-CMMI Level 3** governance with the speed of **AI-Native pair programming and autonomous multi-agent orchestration**. -It governs software delivery from business requirements (PRD/BRD) through architectural risk spikes, iterative construction, tiered multi-path test generation, 21-sheet QA workbook compilation, and UAT acceptance. +It governs software delivery from Socratic requirements elicitation (OpenUP / AI Hero) through architectural risk spikes, iterative construction, tiered multi-path test generation, 21-sheet QA workbook compilation, and UAT acceptance. --- @@ -20,7 +20,8 @@ It governs software delivery from business requirements (PRD/BRD) through archit +-----------------------------------------------------------------------------------+ | +---> GREENFIELD TRACK (0-to-1 Build): - | Stage 0 (Bootstrap) -> Stage 1 (PRD Feature Extraction) -> Stage 1B (Domain Model) + | Stage 0 (Bootstrap) -> [Stage 0B (Requirements Elicitation / PRD Synthesis if unsupplied)] + | -> Stage 1 (PRD Feature Extraction) -> Stage 1B (Domain Model) | -> Stage 6 (Arch Risk Spike) -> Stage 7 (Walking Skeleton) -> Stage 5 (Use Cases) | +---> BROWNFIELD TRACK (Legacy Modernization / Migration): @@ -28,6 +29,7 @@ It governs software delivery from business requirements (PRD/BRD) through archit -> Stage 3 (DB Schema & UI Mining) -> Stage 4 (Parity Gap Matrix) -> Stage 5 (Use Cases) | v + +-----------------------------------------------------------------------------------+ | ELABORATION PHASE: | | Gate 5.1 (UC-FR Gate) -> Stage 8 (SRS Derivation) -> Stage 9 (HLD/LLD) -> Gate 9.1| @@ -114,7 +116,9 @@ AI agents execute specialized roles across the lifecycle: | Agent Persona | Role & Responsibilities | Primary Skills | |---|---|---| -| **`@requirements-analyst`** | PRD/BRD extraction, ambiguity logging, use-case authoring | `up-brd-extract`, `up-use-case-author` | +| Agent Persona | Role & Responsibilities | Primary Skills | +|---|---|---| +| **`@requirements-analyst`** | Socratic elicitation, PRD/BRD extraction, ambiguity logging, use-case authoring | `up-requirements-elicit`, `up-brd-extract`, `up-use-case-author` | | **`@spike-architect`** | Risk scoring, walking skeleton spike, domain HLD/LLD templates | `up-arch-risk-spike`, `up-hld-lld-generate` | | **`@ui-designer-dev`** | Wireframe specs, UI tokens, responsive frontend components | `up-wireframe-spec`, `up-code-generate` | | **`@backend-dev`** | Database migrations, deterministic API routers, Wave 0 sandboxes | `up-code-generate` | @@ -145,14 +149,20 @@ AI agents execute specialized roles across the lifecycle: /up-project-bootstrap --archetype greenfield ``` +4. **Elicit requirements (Stage 0B, if PRD not supplied):** + ```bash + /up-requirements-elicit --interactive + ``` + --- ## Repository Structure ``` . -├── .agents/skills/ # Canonical, cross-agent skill definitions (18 skills) +├── .agents/skills/ # Canonical, cross-agent skill definitions (19 skills) │ ├── up-project-bootstrap/ # Stage 0: Workspace & governance setup +│ ├── up-requirements-elicit/ # Stage 0B: Socratic requirements elicitation & PRD synthesis │ ├── up-brd-extract/ # Stage 1: Business feature extraction │ ├── up-legacy-gap-analysis/ # Stages 2-4: Legacy code & screen mining (Brownfield) │ ├── up-use-case-author/ # Stage 5: Atomic use-case & FR authoring @@ -171,9 +181,10 @@ AI agents execute specialized roles across the lifecycle: │ ├── up-process-change/ # Meta-governance process updates │ └── up-uat-handover/ # Stages 15-18: UAT packaging & release ├── 00_prompts/ -│ ├── AI_Native_Unified_Process_v1.md # Core UP-AI v1.0 Process Specification +│ ├── AI_Native_Unified_Process_v1.md # Core UP-AI v1.2 Process Specification │ ├── 02_Skills_Usage_Guide.md # Stage-by-stage invocation guide │ └── templates/ + │ └── tech-profile.template.yaml # Declarative stack configuration template ├── 01_BRD/ # Business Requirements & PRD inputs ├── 04_generated_documentation/ # Governed engineering documentation (Chronological Stages) @@ -223,5 +234,6 @@ Functional Req: FR-xxx (child of exactly one UC-xxx) ## License & Governance -This framework is governed under the **AI-Native Unified Process Specification v1.1** ([`AI_Native_Unified_Process_v1.md`](00_prompts/AI_Native_Unified_Process_v1.md)). Process modifications follow the formal `up-process-change` lifecycle (Process-Adjustment CRs). +This framework is governed under the **AI-Native Unified Process Specification v1.2** ([`AI_Native_Unified_Process_v1.md`](00_prompts/AI_Native_Unified_Process_v1.md)). Process modifications follow the formal `up-process-change` lifecycle (Process-Adjustment CRs). + diff --git a/prompts/20261003T094245Z-session-process-analysis-cmm3.md b/prompts/20261003T094245Z-session-process-analysis-cmm3.md index e69de29..e1b144c 100644 --- a/prompts/20261003T094245Z-session-process-analysis-cmm3.md +++ b/prompts/20261003T094245Z-session-process-analysis-cmm3.md @@ -0,0 +1,74 @@ +# Session Transcript: UP-AI CMMI Level 3 Process Analysis & Hardening + +- **Session Start (UTC):** `2026-10-03T09:42:45Z` +- **File:** `prompts/20261003T094245Z-session-process-analysis-cmm3.md` +- **Governed Process:** UP-AI v1.2 (SEI-CMMI Level 3) +- **Primary Agent:** Antigravity + +--- + +## 2026-10-03T09:42:45Z — Turn 1 + +### User Prompt +> the project describes a unified process driven CMM level 3 compliant approach to ai assisted as well as ai native software development. Analyze the process and provide your assessment + +### Assistant Response Summary +Performed a comprehensive CMMI Level 3 gap analysis and evaluation of the UP-AI v1.0 framework across four primary dimensions: +1. **Process Architecture & CMMI Level 3 Alignment:** Evaluated Process Asset Library (PAL), Organization Process Definition (OPD), Decision Analysis & Resolution (DAR), Risk Management (RSKM), and Requirements Development & Management (RD/REQM). +2. **Key Strengths Identified:** Single canonical skills location (`.agents/skills/`), strict chronological directory hierarchy (`04_generated_documentation/00_` to `08_`), resilient change control via blast-radius tracing (`up-change-request-impact`), context resumption checkpointing (`up-context-checkpoint`), and automated gates. +3. **Identified Deficiencies & Vulnerabilities:** + - Script-level gate verification was conceptual rather than implemented as an executable CLI tool. + - Stage 10 delivery-surface matrix lacked explicit partial-coverage semantics (`Stub`, `Schema-Only`, `Deferred`). + - Missing explicit 3-Tier Tailoring Framework for project sizing. + - Stage 14 lacked a formalized Human Review Brief before baseline sign-off. + - Inception assumed an authoritative BRD was always pre-existing. +4. **Actionable Recommendations:** Outlined a roadmap for UP-AI v1.1 governance hardening, automated testable gate scripts, and requirements elicitation. +- **Artifact Generated:** `up_ai_cmm3_assessment.md` + +--- + +## 2026-10-03T10:15:00Z — Turn 2 + +### User Prompt +> Proceed to make it more robust as per your recommendations. If required, let's review them one by one and proceed + +### Actions & Key Decisions +- **Change Request:** Registered and approved `CR-001` (Process-Adjustment: UP-AI v1.1 CMMI Level 3 Hardening) in `change_request_register.md`. +- **Standalone CLI Gate Validator:** Created `scripts/verify_traceability_gates.py` implementing automated verification for Gate 5.1, Gate 9.1, and Gate 14.1 with markdown, JSON, and summary reporting. +- **Process Specification Hardening:** Bumped specification to UP-AI v1.1 in `00_prompts/AI_Native_Unified_Process_v1.md`: + - Added Section 2.2 Formal 3-Tier Project Tailoring Framework (Standard, Accelerated/POC, Regulated/Enterprise). + - Formalized Stage 14 Human Review Brief protocol requiring explicit sign-off artifact. + - Upgraded Stage 10 delivery-surface matrix with status classifications (`Full`, `Stub`, `Schema-Only`, `Deferred`, `N/A`) and mandatory deferral rationale. +- **Governance Registers & Documentation:** + - Created `04_generated_documentation/00_process_control/tailoring_guidelines.md`. + - Updated `00_prompts/02_Skills_Usage_Guide.md` and `README.md`. + - Created `04_generated_documentation/00_process_control/checkpoints/checkpoint-002-v1.1-governance-hardening.md` and indexed in `checkpoint_index.md`. +- **Verification:** Ran `python3 scripts/verify_traceability_gates.py --all`. Gates 5.1 and 9.1 passed with 0 critical issues; Gate 14.1 flagged expected major warning for uncompiled manual QA workbook in reference slice `iteration-01`. +- **Disposition:** Closed `CR-001`. + +--- + +## 2026-10-03T11:20:00Z — Turn 3 + +### User Prompt +> The current process assumes the BRD (requirements document) is already present. In case it is not supplied, can we have a skill to elicit the requirements and essentially generate a BRD. References can be - +https://archive.eclipse.org/epf/downloads/OpenUP/published/openup_published_1.5.1.5_20121212/openup/core.default.cat_def.base/disciplines/requirements_discipline_9520664.html +or https://www.aihero.dev/skills . + +### Actions & Key Decisions +- **Change Request:** Registered `CR-002` (Process-Adjustment: Requirements Elicitation Skill & Stage 0B Integration) in `04_generated_documentation/00_process_control/change_request_register.md` and marked Approved / Closed. +- **Architecture & Design:** Synthesized concepts from two authoritative paradigms: + 1. *OpenUP Requirements Discipline:* Vision, Problem Statement, Actors, System Boundaries, Use-Case Outlining, and Supporting Specifications (NFRs/constraints). + 2. *AI Hero Socratic Elicitation:* Multi-turn interview (`/grill-me` + `/to-prd`), probing edge cases, forcing In-Scope vs. Anti-Scope boundaries, and synthesizing into structured requirements. +- **Canonical Skill Creation:** Created `.agents/skills/up-requirements-elicit/SKILL.md` (Stage 0B) featuring: + - Phase 1: 5-round interactive Socratic elicitation (Vision/Metrics, Actors/Boundaries, Scope/Anti-Scope, Journeys/Failures, NFRs/Compliance). + - Phase 2: Authoritative synthesis writing `01_BRD/PRD_Specification.md` (aligned to `PRD_Specification.template.md`) with minted `BRD-FR-xxx` IDs to establish the root of traceability. + - Interactive Human Review Brief for stakeholder sign-off prior to Stage 1 extraction. +- **Framework Specification Update:** Bumped process specification to **UP-AI v1.2** in `00_prompts/AI_Native_Unified_Process_v1.md`: + - Added Stage 0B (`up-requirements-elicit`) to Greenfield Track lifecycle diagrams (§1). + - Updated `@requirements-analyst` agent topology (§1.2). + - Documented Stage 0B inputs, outputs, and validation rules in Phase I Inception (§4). + - Appended `CR-002` to Appendix A Version Changelog. +- **Skills Usage Guide & README:** Updated `00_prompts/02_Skills_Usage_Guide.md` and `README.md` to reflect 19 canonical skills and Greenfield Scenario A (`up-requirements-elicit` -> `up-brd-extract` -> `up-use-case-author`). +- **Checkpoint & Index:** Created `checkpoint-003-requirements-elicitation-skill.md` and updated `checkpoint_index.md`. +- **Verification:** Ran `python3 scripts/verify_traceability_gates.py --all` confirming all gate validations remain clean and consistent. diff --git a/scripts/verify_traceability_gates.py b/scripts/verify_traceability_gates.py index e69de29..e80b6d3 100755 --- a/scripts/verify_traceability_gates.py +++ b/scripts/verify_traceability_gates.py @@ -0,0 +1,317 @@ +#!/usr/bin/env python3 +"""Deterministic Quality Gate & Traceability Validator for AI-Native Unified Process. + +Enforces SEI-CMMI Level 3 quality gate criteria (Gates 5.1, 9.1, 14.1) deterministically +without relying on probabilistic LLM self-evaluation. + +Usage: + python3 scripts/verify_traceability_gates.py --gate 5.1 + python3 scripts/verify_traceability_gates.py --gate 9.1 + python3 scripts/verify_traceability_gates.py --gate 14.1 [--iteration iteration-01] + python3 scripts/verify_traceability_gates.py --all +""" + +import argparse +import os +import re +import sys +from pathlib import Path + +# ANSI colors +RED = "\033[91m" +GREEN = "\033[92m" +YELLOW = "\033[93m" +CYAN = "\033[96m" +BOLD = "\033[1m" +RESET = "\033[0m" + + +class QualityGateValidator: + def __init__(self, repo_root: Path): + self.repo_root = repo_root + self.doc_root = repo_root / "04_generated_documentation" + self.requirements_dir = self.doc_root / "03_requirements" + self.architecture_dir = self.doc_root / "04_architecture_design" + self.planning_dir = self.doc_root / "05_iteration_planning" + self.test_design_dir = self.doc_root / "07_test_design" + self.process_control_dir = self.doc_root / "00_process_control" + self.traceability_graph = self.process_control_dir / "traceability_graph.md" + + self.findings = [] # list of dicts: {"check_id", "target", "issue", "severity", "action"} + + def add_finding(self, check_id: str, target: str, issue: str, severity: str, action: str): + self.findings.append({ + "check_id": check_id, + "target": target, + "issue": issue, + "severity": severity, # Critical, Major, Minor + "action": action, + }) + + def collect_use_cases_and_frs(self): + """Scans 03_requirements/use_cases/ and discovers all UC-xxx and child FR-xxx.""" + uc_dict = {} # {uc_id: {"name": ..., "dir": ..., "frs": []}} + fr_dict = {} # {fr_id: {"parent_uc": ..., "source_brd": ..., "file": ...}} + + uc_dir = self.requirements_dir / "use_cases" + if not uc_dir.exists(): + return uc_dict, fr_dict + + for entry in sorted(uc_dir.iterdir()): + if entry.is_dir(): + uc_match = re.match(r"(uc-\d{3})", entry.name, re.IGNORECASE) + uc_id = uc_match.group(1).upper() if uc_match else entry.name.upper() + + # Parse use-case.md if present + uc_file = entry / "use-case.md" + uc_name = entry.name + if uc_file.exists(): + text = uc_file.read_text(encoding="utf-8") + title_m = re.search(r"#\s+(UC-\d{3}:\s*[^#\n]+)", text) + if title_m: + uc_name = title_m.group(1).strip() + id_m = re.search(r"\*\*Use Case ID\*\*\s*\|\s*`?(UC-\d{3})`?", text, re.IGNORECASE) + if id_m: + uc_id = id_m.group(1).upper() + + uc_dict[uc_id] = { + "name": uc_name, + "path": entry, + "frs": [] + } + + # Parse functional-reqs.md + fr_file = entry / "functional-reqs.md" + if fr_file.exists(): + fr_text = fr_file.read_text(encoding="utf-8") + fr_blocks = re.split(r"\n(?=##\s+FR-)", fr_text) + for block in fr_blocks: + fr_id_m = re.search(r"##\s+(FR-[A-Z0-9_\-]+)", block) + if not fr_id_m: + fr_id_m = re.search(r"\*\*Requirement ID:\*\*\s*`?(FR-[A-Z0-9_\-]+)`?", block) + + if fr_id_m: + fr_id = fr_id_m.group(1).strip().upper() + parent_uc_m = re.search(r"\*\*Parent Use Case:\*\*\s*\[?`?(UC-\d{3})`?", block, re.IGNORECASE) + parent_uc = parent_uc_m.group(1).upper() if parent_uc_m else uc_id + source_brd_m = re.search(r"\*\*Source Feature:\*\*\s*`?([A-Z0-9_\-]+)`?", block) + source_brd = source_brd_m.group(1) if source_brd_m else None + + fr_dict[fr_id] = { + "parent_uc": parent_uc, + "source_brd": source_brd, + "file": fr_file + } + uc_dict[uc_id]["frs"].append(fr_id) + + return uc_dict, fr_dict + + def run_gate_5_1(self) -> bool: + """Gate 5.1: UC <-> FR Completeness & Orphan Check.""" + print(f"\n{BOLD}{CYAN}=== Executing Gate 5.1: UC ↔ FR Completeness & Integrity ==={RESET}") + uc_dict, fr_dict = self.collect_use_cases_and_frs() + + if not uc_dict: + self.add_finding("G51-000", "03_requirements/use_cases", "No use case directories found", "Critical", + "Author at least one use case via up-use-case-author before exiting Stage 5.") + return False + + # Rule 1: Every UC must have at least one FR + for uc_id, uc_data in uc_dict.items(): + if not uc_data["frs"]: + self.add_finding("G51-001", uc_id, f"Use case has 0 functional requirement (FR) children", "Critical", + f"Add at least one FR-xxx under {uc_data['path']}/functional-reqs.md") + else: + print(f" {GREEN}✓{RESET} {BOLD}{uc_id}{RESET} has {len(uc_data['frs'])} children: {', '.join(uc_data['frs'])}") + + # Rule 2: Every FR's parent_uc must resolve to an existing UC + for fr_id, fr_data in fr_dict.items(): + parent_uc = fr_data["parent_uc"] + if parent_uc not in uc_dict: + self.add_finding("G51-002", fr_id, f"Parent use case '{parent_uc}' does not exist", "Critical", + f"Update {fr_data['file']} to point parent_uc to a valid existing UC-xxx.") + + # Rule 3: Check source BRD traceability + if not fr_data["source_brd"]: + self.add_finding("G51-003", fr_id, "Missing Source Feature (BRD-FR reference)", "Major", + f"Declare source BRD feature or provide 'new — not in BRD' justification in {fr_data['file']}.") + + return self.evaluate_findings("Gate 5.1") + + def run_gate_9_1(self) -> bool: + """Gate 9.1: FR <-> SRS <-> HLD <-> LLD Completeness.""" + print(f"\n{BOLD}{CYAN}=== Executing Gate 9.1: FR ↔ SRS ↔ HLD ↔ LLD Architecture Completeness ==={RESET}") + uc_dict, fr_dict = self.collect_use_cases_and_frs() + + if not fr_dict: + self.add_finding("G91-000", "Requirements", "No functional requirements found to check against architecture", "Critical", + "Complete Stage 5 (use cases and functional requirements) first.") + return False + + # Parse LLD directory for FR mappings + lld_dir = self.architecture_dir / "lld" + lld_fr_coverage = set() + lld_components = set() + + if lld_dir.exists(): + for lld_file in lld_dir.glob("*.md"): + text = lld_file.read_text(encoding="utf-8") + found_frs = re.findall(r"FR-[A-Z0-9_\-]+", text) + for f in found_frs: + lld_fr_coverage.add(f.upper()) + comp_m = re.search(r"\*\*Component\*\*\s*\|\s*`?([A-Z0-9_\-]+)`?", text) + if comp_m: + lld_components.add(comp_m.group(1)) + + # Parse traceability graph for SRS, HLD, LLD links + graph_text = "" + if self.traceability_graph.exists(): + graph_text = self.traceability_graph.read_text(encoding="utf-8") + + for fr_id in fr_dict.keys(): + has_srs = bool(re.search(rf"{fr_id}.*?SRS-[A-Z0-9_\-]+", graph_text) or + re.search(rf"SRS-[A-Z0-9_\-]+.*?{fr_id}", graph_text) or + f"SRS-{fr_id.replace('FR-', '')}" in graph_text) + + has_lld = (fr_id in lld_fr_coverage) or bool(re.search(rf"{fr_id}.*?LLD-[A-Z0-9_\-]+", graph_text)) + + has_hld = bool(re.search(rf"{fr_id}.*?HLD-[A-Z0-9_\-]+", graph_text) or + re.search(r"HLD-[A-Z0-9_\-]+", graph_text)) + + if not has_srs: + self.add_finding("G91-001", fr_id, "FR does not resolve to any SRS/NFR specification", "Critical", + f"Derive system requirement (SRS-xxx) for {fr_id} in Stage 8 before Gate 9.1.") + if not has_hld: + self.add_finding("G91-002", fr_id, "FR does not resolve to an owning HLD component", "Critical", + f"Map {fr_id} to an HLD service in 04_architecture_design/hld.md.") + if not has_lld: + self.add_finding("G91-003", fr_id, "FR does not resolve to an LLD contract (API/Table/Event)", "Critical", + f"Include {fr_id} in Parent FRs of an LLD document under 04_architecture_design/lld/.") + + if has_srs and has_hld and has_lld: + print(f" {GREEN}✓{RESET} {BOLD}{fr_id}{RESET} resolved to SRS + HLD + LLD contracts.") + + return self.evaluate_findings("Gate 9.1") + + def run_gate_14_1(self, target_iteration: str = None) -> bool: + """Gate 14.1: Iteration Definition of Done & Delivery Surface Completeness.""" + print(f"\n{BOLD}{CYAN}=== Executing Gate 14.1: Iteration Definition of Done ==={RESET}") + iter_dir = self.planning_dir / "iterations" + if not iter_dir.exists(): + self.add_finding("G14-000", "05_iteration_planning", "No iterations found", "Critical", + "Plan the iteration via up-iteration-plan before running Gate 14.1.") + return False + + iterations = [d for d in iter_dir.iterdir() if d.is_dir() and d.name.startswith("iteration-")] + if target_iteration: + iterations = [d for d in iterations if d.name == target_iteration] + if not iterations: + self.add_finding("G14-001", target_iteration, f"Target iteration '{target_iteration}' directory not found", "Critical", + f"Ensure 05_iteration_planning/iterations/{target_iteration} exists.") + return False + + for it in sorted(iterations): + it_name = it.name + print(f"\n Checking {BOLD}{it_name}{RESET}:") + plan_file = it / "iteration_plan.md" + backlog_file = it / "iteration_backlog.md" + surface_file = it / "iteration_surface_matrix.md" + + if not plan_file.exists(): + self.add_finding("G14-002", f"{it_name}/iteration_plan.md", "Iteration plan missing", "Critical", "Run up-iteration-plan.") + else: + print(f" {GREEN}✓{RESET} iteration_plan.md present") + + if not backlog_file.exists(): + self.add_finding("G14-003", f"{it_name}/iteration_backlog.md", "Iteration backlog missing", "Critical", "Run up-iteration-plan.") + else: + print(f" {GREEN}✓{RESET} iteration_backlog.md present") + + if not surface_file.exists(): + self.add_finding("G14-004", f"{it_name}/iteration_surface_matrix.md", "Delivery surface matrix missing", "Critical", "Generate surface matrix.") + else: + print(f" {GREEN}✓{RESET} iteration_surface_matrix.md present") + + # Check Manual QA Deliverables (Dual QA requirement) + manual_guide = self.test_design_dir / "manual_qa" / it_name / "MANUAL_TESTING_GUIDE.md" + if not manual_guide.exists(): + self.add_finding("G14-005", f"manual_qa/{it_name}/MANUAL_TESTING_GUIDE.md", "Manual Testing Guide missing", "Major", + f"Generate MANUAL_TESTING_GUIDE.md under 07_test_design/manual_qa/{it_name}/") + else: + print(f" {GREEN}✓{RESET} MANUAL_TESTING_GUIDE.md present") + + # Check Excel workbook directory + workbooks_dir = self.test_design_dir / "manual_qa" / "workbooks" + workbooks = list(workbooks_dir.glob(f"*{it_name}*.xlsx")) if workbooks_dir.exists() else [] + if not workbooks: + self.add_finding("G14-006", f"workbooks/*{it_name}*.xlsx", "21-sheet Excel QA Workbook (.xlsx) missing", "Major", + f"Compile workbook via scripts/generate_manual_qa_workbook.py.") + else: + print(f" {GREEN}✓{RESET} Excel QA Workbook present: {workbooks[0].name}") + + return self.evaluate_findings("Gate 14.1") + + def evaluate_findings(self, gate_name: str) -> bool: + """Summarizes findings and returns True if zero Critical issues.""" + criticals = [f for f in self.findings if f["severity"] == "Critical"] + majors = [f for f in self.findings if f["severity"] == "Major"] + minors = [f for f in self.findings if f["severity"] == "Minor"] + + print(f"\n{BOLD}Gate Assessment Summary for {gate_name}:{RESET}") + print(f" Critical Issues (Blocking): {RED}{len(criticals)}{RESET}") + print(f" Major Issues: {YELLOW}{len(majors)}{RESET}") + print(f" Minor Issues: {len(minors)}") + + if self.findings: + print(f"\n{BOLD}{'Check-ID':<10} | {'Target':<24} | {'Severity':<9} | {'Issue & Action'}{RESET}") + print("-" * 80) + for f in self.findings: + color = RED if f["severity"] == "Critical" else (YELLOW if f["severity"] == "Major" else RESET) + print(f"{f['check_id']:<10} | {f['target']:<24} | {color}{f['severity']:<9}{RESET} | {f['issue']}") + print(f"{'':<10} | {'':<24} | {'':<9} | -> Action: {f['action']}") + print("-" * 80) + + if criticals: + print(f"\n{RED}{BOLD}❌ {gate_name} FAILED: Critical issues must be resolved before proceeding.{RESET}\n") + return False + elif majors: + print(f"\n{YELLOW}{BOLD}⚠️ {gate_name} PASSED WITH WARNINGS: Zero critical issues, but major issues should be reviewed.{RESET}\n") + return True + else: + print(f"\n{GREEN}{BOLD}✅ {gate_name} PASSED: All referential integrity criteria met.{RESET}\n") + return True + + +def main(): + parser = argparse.ArgumentParser(description="Deterministic Quality Gate Validator (UP-AI v1.2)") + parser.add_argument("--gate", choices=["5.1", "9.1", "14.1"], help="Specific gate to validate") + parser.add_argument("--iteration", default=None, help="Target iteration for Gate 14.1 (e.g. iteration-01)") + parser.add_argument("--all", action="store_true", help="Run all available quality gates") + parser.add_argument("--repo-root", default=None, help="Path to repository root") + + args = parser.parse_args() + + repo_root = Path(args.repo_root) if args.repo_root else Path(__file__).resolve().parent.parent + validator = QualityGateValidator(repo_root) + + overall_pass = True + + if args.all or not args.gate: + g5_pass = validator.run_gate_5_1() + validator.findings = [] + g9_pass = validator.run_gate_9_1() + validator.findings = [] + g14_pass = validator.run_gate_14_1(args.iteration) + overall_pass = g5_pass and g9_pass and g14_pass + elif args.gate == "5.1": + overall_pass = validator.run_gate_5_1() + elif args.gate == "9.1": + overall_pass = validator.run_gate_9_1() + elif args.gate == "14.1": + overall_pass = validator.run_gate_14_1(args.iteration) + + sys.exit(0 if overall_pass else 1) + + +if __name__ == "__main__": + main()