c_agri_trade/00_prompts/AI_Native_Unified_Process_v...

24 KiB
Raw Blame History

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.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 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).

0. Executive Summary

0.1 Universal AI-Native Principles (v1.1)

Eight core mechanics govern this universal process across all project types:

  1. Dual-Track Inception Routing: Greenfield projects proceed via PRD extraction, Domain-Driven Design (DDD) Bounded Contexts, and Architecture Spikes; Brownfield projects execute automated AST code mining, DB schema reverse-engineering, screenshot visual analysis, and parity gap mapping.
  2. Use Case as the Atomic Requirement Unit; FRS as a Generated Rollup: Requirements are authored inside their owning use case from the start (Stage 5), eliminating requirement-UC orphan discrepancies.
  3. Continuous Deterministic Quality Gates: Mandatory Gate Checks (Gate 5.1, Gate 9.1, Gate 14.1) validate graph completeness deterministically via scripts/verify_traceability_gates.py before stage transitions, blocking progress if any story or delivery surface lacks specification or test evidence.
  4. First-Class Change Request (CR) Lifecycle & Blast Radius Analysis: Scope adjustments, defect remediations, and NFR changes compute impact graphs before document or code edits.
  5. Risk-Driven Architecture-Centric Elaboration: Walking skeletons and disposable architecture spikes validate high-risk non-functional bottlenecks (concurrency, data tenancy, integration resilience) before full-breadth implementation.
  6. Wave-Based Construction Loops with Explicit Delivery Surfaces: Construction decomposes every story across frontend, API/backend, database, integration, infrastructure, and QA surfaces.
  7. Wave 0 Deterministic Sandboxing & Test Idempotency: External dependencies MUST provide local, deterministic sandbox adapters under app/integrations/sandbox/, enabling 100% offline, reproducible automated testing without third-party flakiness.
  8. Differentiated Multi-Path Automated Test Coverage & Dual QA: Enforces multi-path automated testing (Happy, Alternate, Boundary, Negative, FSM Invariants) with tiered coverage budgets (\ge 95\% core domain/FSMs, \ge 90\% integration adapters, \ge 80\% UI component branch coverage + Playwright E2E) and auto-compiled 21-sheet manual QA workbooks.

1. Process Philosophy — Mapping Stages to Unified Process Phases

+-----------------------------------------------------------------------------------+
|                               PROJECT ARCHETYPE ROUTING                           |
+-----------------------------------------------------------------------------------+
  |
  +---> GREENFIELD TRACK (0-to-1):
  |     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):
        Stage 0 (Bootstrap) -> Stage 1 (BRD Scope) -> Stage 2 (AST & API Mining)
        -> Stage 3 (DB Schema & UI Mining) -> Stage 4 (Gap/Parity Analysis) -> Stage 5 (Use Cases)
  |
  v
+-----------------------------------------------------------------------------------+
| ELABORATION: Gate 5.1 -> Stage 8 (SRS Derivation) -> Stage 9 (HLD/LLD) -> Gate 9.1|
+-----------------------------------------------------------------------------------+
  |
  v
+-----------------------------------------------------------------------------------+
| CONSTRUCTION LOOP (Repeats per Iteration Slice):                                 |
| Stage 10 (Plan) -> Stage 11 (Screens/Specs) -> Stage 12 (Test Model & QA Workbook) |
| -> Stage 13 (Wave-Based Code Gen) -> Stage 14 (Review, Defect Fix & Gate 14.1)    |
+-----------------------------------------------------------------------------------+
  |
  v
+-----------------------------------------------------------------------------------+
| TRANSITION: Stage 15 (DevOps/CI-CD) -> Stage 16 (UAT) -> Stage 17 (Handover)      |
+-----------------------------------------------------------------------------------+

1.1 UP Phases & Risk Retirement

UP Phase Stages Primary objective Risk being retired
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

1.2 Multi-Agent & Sub-Agent Topology

AI-Native execution delegates specialized tasks to defined agent roles:

  • @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)

2.1 The Chain

BRD-FR-xxx  (business requirement, from BRD)
   └─▶ UC-xxx  (use case — the atomic requirement-owning unit)
          └─▶ FR-xxx  (functional requirement, CHILD of exactly one UC; may cite one or more BRD-FR)
                 ├─▶ NFR-xxx / SRS-xxx  (system requirement derived from FR + cross-cutting NFRs)
                 ├─▶ HLD-<SERVICE>  (owning architecture component)
                 │        └─▶ LLD-API-xxx / LLD-TBL-xxx / LLD-EVT-xxx
                 │                 └─▶ STORY-xxx  (implementation story, scoped to one iteration)
                 │                        └─▶ TC-xxx  (test case — carries a `test_level`: Unit | API-Integration |
                 │                               Contract | Browser-E2E | Smoke | Usability | Regression;
                 │                               `TC-UAT-*` is the naming subtype for acceptance/UAT scenarios)

Cross-cutting governance IDs: DEC-xxx (decision), AMB-xxx (ambiguity), ASM-xxx (assumption), CR-xxx (change request), RISK-xxx (architectural risk score).

2.2 Non-negotiable Rules (enforced by Gates)

  1. Every UC-xxx must have at least one FR-xxx child before Stage 5 can exit. Every FR-xxx must declare exactly one parent_uc.
  2. Every FR-xxx must resolve to at least one SRS-xxx/NFR-xxx, one HLD component, and one LLD artifact before Stage 9 can exit.
  3. Every STORY-xxx delivered inside an iteration must resolve to at least one passing TC-xxx before that iteration's Gate 14.1 can close.
  4. Every in-scope FR/story must have an iteration delivery-surface row covering applicable frontend portal/screen, API/backend, database, integration, infrastructure, and QA work. A non-applicable or deferred surface must be explicitly recorded with its reason and governing CR-xxx/DEC-xxx.
  5. Every artifact file carries a front-matter block: id, parent_id(s), version, status (Draft / Reviewed / Baselined / Superseded), last_cr (the CR-xxx that most recently touched it, or "none").
  6. There is exactly one traceability graph (00_process_control/traceability_graph.md).
  7. Every STORY-xxx must carry an explicit per-type test applicability decision for Unit, Smoke, and Usability — each recorded as Required (with derived TC-xxx) or N/A (with a stated reason) — before Gate 14.1 can close.
  8. Differentiated Automated Test Coverage Budgets: All code must meet the coverage thresholds configured in tech-profile.yaml:
    • Backend Domain Services & State Machines: ≥95.0% statement and branch coverage (Hard Gate).
    • Integration Adapters & Sandboxes: ≥90.0% statement and branch coverage against Wave 0 mocks.
    • Frontend UI Components: ≥80.0% component branch coverage + mandatory Playwright browser-E2E test suites for all primary user journeys. Every user story must be tested across at least four dimensions: Happy Path, Alternate & Boundary/Edge Cases, Negative/Validation Failures, and FSM Invariant/Concurrency flows.
  9. Deterministic Gate Verification: Quality Gates 5.1, 9.1, and 14.1 MUST be executed and verified via scripts/verify_traceability_gates.py. AI agents cannot self-certify gate closure without clean CLI validation evidence.

3. Chronological Folder Structure

04_generated_documentation/
├── 00_process_control/                 # Stage 0: Master Context, Registers, Decisions, Checkpoints
│   ├── master_context.md
│   ├── assumptions_register.md
│   ├── vocabulary_glossary.md
│   ├── decision_log.md
│   ├── ambiguity_register.md
│   ├── architecture_risk_register.md
│   ├── traceability_index.md
│   ├── traceability_graph.md          # SINGLE source of truth for the traceability spine
│   ├── change_request_register.md
│   └── checkpoints/
│       ├── checkpoint_index.md
│       └── checkpoint-001-bootstrap-baseline.md
├── 01_source_inventories/              # Stage 1: PRD/BRD Feature Extractions (BRD-FR-xxx)
│   └── brd_inventory.md
├── 02_legacy_analysis/                 # Stages 2–4: Brownfield Legacy AST, DB & Screen Mining
├── 03_requirements/                    # Stages 5 & 8: Atomic Use Cases (UC-xxx) & System Reqs
│   └── use_cases/
│       └── uc-001_user-authentication/
│           ├── use-case.md
│           └── functional-reqs.md
├── 04_architecture_design/             # Stages 6, 7, 9: Risk Spike, HLD, LLD API/Table Contracts
│   ├── hld.md
│   └── lld/
│       └── LLD-001_auth_service.md
├── 05_iteration_planning/              # Stage 10: Iteration Backlog, Plan, Surface Matrix
│   └── iterations/
│       └── iteration-01/
│           ├── iteration_plan.md
│           ├── iteration_backlog.md
│           ├── iteration_surface_matrix.md
│           └── parallel_work_plan.md
├── 06_wireframes/                      # Stage 11: Screen Specifications, Design Tokens (DESIGN.md)
│   ├── DESIGN.md
│   └── wireframe_index.md
├── 07_test_design/                     # Stage 12: Test Strategy, Multi-Path Models, QA Workbooks
│   ├── test_strategy.md
│   ├── regression_test_cases.md
│   ├── functional_test_cases/
│   │   └── TC-001_auth_service.md
│   └── manual_qa/
│       ├── iteration-01/
│       │   └── MANUAL_TESTING_GUIDE.md
│       └── workbooks/
└── 08_review_ready_baselines/          # Stage 18: Handover & Acceptance Baselines

4. PHASE I — INCEPTION (Stages 0–4)

Stage 0 — Workspace and Governance Bootstrap

Objective: Create a controlled workspace, parse tech-profile.yaml, and generate governance registers before deep analysis.

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.

Stages 2–4 — Brownfield Legacy Code, DB & Screen Mining (Brownfield Only)

Objective: Reverse-engineer legacy codebases, extract database schemas, and map screen flows into 02_legacy_analysis/.


5. PHASE II — ELABORATION (Stages 5–9)

Stage 5 — Use Case Authoring with Embedded Functional Requirements

Objective: Author each use case as the single, atomic requirements-owning artifact under 03_requirements/use_cases/uc-xxx/ containing use-case.md and functional-reqs.md (FR-xxx).

Stage 6 — Architectural Risk Ranking

Objective: Score every use case across 5 risk dimensions (Data Isolation, External Dependencies, Financial Sensitivity, Throughput, Novelty) in 00_process_control/architecture_risk_register.md to identify architecturally significant use cases.

Stage 7 — Architecture Spike & Walking Skeleton Validation

Objective: Build and validate a thin end-to-end walking skeleton against the highest-risk use cases before full-breadth implementation.

Stage 8 — System Requirements (SRS/NFR) Derivation

Objective: Derive system requirements (APIs, data models, integration formats, audit rules, NFRs) from the gated functional requirements under 03_requirements/.

Stage 9 — High-Level & Low-Level Design (HLD/LLD) Fan-Out

Objective: Produce modular HLD service designs and detailed LLD contracts (API endpoints, database tables, event schemas) in 04_architecture_design/.


6. PHASE III — CONSTRUCTION LOOP (Stages 10–14)

Repeats iteratively for each vertical slice of 3–8 use cases:

Stage 10 — Iteration Planning & Delivery Surface Matrix

Objective: Produce 05_iteration_planning/iterations/iteration-NN/ containing iteration_plan.md, iteration_backlog.md, iteration_surface_matrix.md, and parallel_work_plan.md.

Stage 11 — Wireframe & Field-Level Screen Specifications

Objective: Reconcile screens against 06_wireframes/DESIGN.md and produce screen specifications and wireframe_index.md.

Stage 12 — Multi-Path Test Modeling, Bruno API Collections & QA Workbooks

Objective: Generate unit, API, contract, browser-E2E, smoke, and usability test cases in 07_test_design/, create Bruno API collections under docs/api/bruno/, and produce both the Markdown testing guide and the 21-sheet Excel workbook.

Stage 13 — Wave-Based Code Generation (≥95% Coverage)

Objective: Implement stories across backend, frontend, database migrations, and integration adapters, achieving ≥95.0% automated statement and branch coverage.

Stage 14 — Code Review, Defect Fix & Gate 14.1 Definition of Done

Objective: Review code, resolve defects, integrate parallel lanes (up-parallel-work-integrate), and verify Gate 14.1 closure.


7. PHASE IV — TRANSITION (Stages 15–18)

Stage 15 — DevOps & CI/CD Pipeline Scaffolding

Stage 16 — UAT Release Preparation & Verification

Stage 17 — Client Handover Packaging

Stage 18 — Review-Ready Baselines (08_review_ready_baselines/)


8. Cross-Cutting Governance Mechanics

8.1 Change Request (CR) Lifecycle & Blast Radius Analysis

Any scope change, requirements gap, or NFR adjustment is raised as CR-xxx. The agent walks the single traceability graph to compute the blast radius across requirements, architecture, wireframes, stories, and test models BEFORE modifying any document or code.

8.2 Checkpoint / Resume Mechanic (up-context-checkpoint)

Stores lightweight checkpoints in 00_process_control/checkpoints/ capturing the active stage, completed scope, open items, and exact next action, enabling multi-agent continuity.

8.3 Parallel Work & Lane Isolation Protocol (up-parallel-work-integrate)

Governs parallel AI-assisted work across isolated branches and reconciles governance IDs and contracts semantically at integration.

8.4 Multi-Level Test Execution (scripts/run_tests.sh)

Unified command surface running automated tests at project, iteration, use case, or requirement scope (--scope <project|iteration-NN|uc-xxx|fr-xxx>).

8.5 CMMI-Compliant 3-Tier Tailoring Framework

To balance engineering rigor with cycle-time economics across initiatives of varying risk, UP-AI v1.1 defines three standardized process tailoring tiers configured in tech-profile.yaml:

Tailoring Tier Target Project Profile Mandatory Stages & Gates Quality & Coverage Profile
Tier 1: High-Assurance Financial, medical, mission-critical, or multi-tenant compliance systems. All 18 Stages; Gates QG-I, 5.1, 9.1, QG-E, 14.1, QG-T. All CRs require pre-blast analysis. \ge 95\% coverage across all layers; 21-sheet Excel QA workbooks; dual browser/API suites.
Tier 2: Standard Enterprise (Default) Commercial web apps, SaaS services, internal line-of-business platforms. Stages 0, 1, 5, 6–7, 8, 9, 10–14, 15, 16, 17. Gates 5.1, 9.1, 14.1. \ge 95\% backend domain/FSMs, \ge 90\% integration adapters, \ge 80\% frontend components + Playwright E2E; Markdown QA guide.
Tier 3: Fast-Track Prototype Internal proofs-of-concept, hackathons, non-production exploratory spikes. Stage 0 (Bootstrap), Stage 10 (Plan), Stage 13 (Code Gen), Stage 14 (Review). Gate 14.1 only. \ge 80\% backend; smoke tests; minimal documentation overhead.

8.6 Human Review Optimization & Decision Diff Briefs

To prevent reviewer cognitive fatigue and "automation bias" (rubber-stamping voluminous AI-generated markdown), every major milestone submission to human authorities MUST include a concise, high-signal Human Review Brief:

  1. Core Problem & Solved Need: One-paragraph executive rationale.
  2. Key Architectural Decisions & Trade-offs: Rejected alternatives and reasons.
  3. Assumptions & Security Boundaries: Tenancy, RBAC, and data isolation assumptions.
  4. Targeted Review Points: Explicit request for human evaluation on identified ambiguities or edge-case business logic.

8.7 Deterministic Quality Gate Automation (scripts/verify_traceability_gates.py)

Quality Gates 5.1, 9.1, and 14.1 are enforced via an executable Python tool that verifies referential integrity, orphan-freedom, and delivery completeness across file frontmatters and directories. Passing this deterministic CLI check is mandatory before gate closure.

8.8 Meta-Governance Process Updates (up-process-change)

Process adjustments follow the same formal change lifecycle as product code, incrementing document minor versions (v1.1, v1.2, ...) with an audit trail in Appendix A.


9. Quality Gates Master Table

Gate Before Moving To Approval Criteria Enforced By
QG-I Elaboration BRD catalogued (BRD-FR-xxx assigned); domain context established; gap list produced. @requirements-analyst
Gate 5.1 Stage 6 (Risk Ranking) Zero UC with no FR; zero FR with invalid parent_uc. python3 scripts/verify_traceability_gates.py --gate 5.1
Gate 9.1 Construction Zero FR without SRS + HLD + LLD linkage. python3 scripts/verify_traceability_gates.py --gate 9.1
QG-E Construction (Stage 10) Architecture baseline validated; Gates 5.1 and 9.1 both pass. @gatekeeper
Gate 14.1 Next Iteration / Transition Every STORY has a passing TC; explicit Unit/Smoke/Usability applicability decisions; automated coverage meets tiered budget (\ge 95\% domain, \ge 90\% adapter, \ge 80\% frontend); cumulative regression suite passes; all delivery surfaces evidenced; real browser QA validated; required QA deliverables present; parallel lanes integrated cleanly. python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-NN
QG-T Production Deployment UAT passed; production readiness checklist passed; traceability graph 100% Delivered-or-Deferred-with-CR. @gatekeeper

Appendix A — Version Changelog

Version Date Scope Summary
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 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.