c_agri_trade/README.md

240 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# AI-Native Unified Process (UP-AI v1.2) — Universal Framework
[![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-19%20Canonical%20Skills-orange.svg)](.agents/skills/)
**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 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.
---
## Key Architecture & Philosophy
```
+-----------------------------------------------------------------------------------+
| PROJECT ARCHETYPE SELECTION |
| (via tech-profile.yaml) |
+-----------------------------------------------------------------------------------+
|
+---> GREENFIELD TRACK (0-to-1 Build):
| 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):
Stage 0 (Bootstrap) -> Stage 1 (BRD Target Scope) -> Stage 2 (AST & API Mining)
-> 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|
+-----------------------------------------------------------------------------------+
|
v
+-----------------------------------------------------------------------------------+
| ITERATIVE CONSTRUCTION LOOP (Repeats per Vertical Feature Slice): |
| Stage 10 (Plan & Surface Matrix) -> Stage 11 (Wireframes & Screen Specs) |
| -> Stage 12 (Test Model, Bruno, 21-Sheet QA Workbook) |
| -> Stage 13 (Wave-Based Code Gen: Backend + Frontend + Migrations + Sandboxes) |
| -> Stage 14 (Code Review, Defect Triage & Gate 14.1 Definition-of-Done) |
+-----------------------------------------------------------------------------------+
|
v
+-----------------------------------------------------------------------------------+
| TRANSITION PHASE: Stage 15 (CI/CD) -> Stage 16 (UAT) -> Stage 17 (Client Handover)|
| -> Stage 18 (Review-Ready Baselines) |
+-----------------------------------------------------------------------------------+
```
---
## The 8 Non-Negotiable UP-AI Principles
1. **Dual-Track Inception Routing:** Greenfield projects bypass legacy discovery (Stages 2–4) directly to PRD modeling and risk spikes; Brownfield projects perform automated AST code mining, database schema reconstruction, and visual UI discovery.
2. **Atomic Use Case Requirements Spine:** Requirements are authored *inside* their owning use case (`UC-xxx` $\rightarrow$ `FR-xxx`), preventing orphaned specifications.
3. **Continuous Deterministic Quality Gates:** Hard-blocking gates (Gate 5.1, Gate 9.1, Gate 14.1) validate graph completeness deterministically via `scripts/verify_traceability_gates.py` before stage transitions.
4. **First-Class Change Request (CR) Lifecycle:** Scope changes, requirement gaps, and NFR shifts compute blast-radius impact graphs *before* documents or code are modified (`up-change-request-impact`).
5. **Risk-Driven Architecture Spikes:** Disposable walking skeletons validate high-risk architectural bottlenecks (data isolation, concurrency, external integrations) before full-scale construction.
6. **Wave 0 Deterministic Sandboxing:** External dependencies MUST provide local, deterministic sandbox adapters under `app/integrations/sandbox/` to guarantee 100% offline, reproducible CI execution.
7. **Differentiated Automated Test Coverage Budgets:** Enforces multi-path automated testing across Happy Path, Alternate/Boundary, Negative/Failure, and FSM Invariant dimensions with tiered thresholds ($\ge 95\%$ core domain/FSMs, $\ge 90\%$ integration adapters, $\ge 80\%$ UI components + Playwright E2E).
8. **Dual Manual QA Deliverables:** Every iteration produces both a Markdown testing guide and a 30-column, 21-sheet Excel Manual QA Workbook (`.xlsx`) via deterministic compiler tooling (`scripts/generate_manual_qa_workbook.py`).
---
## Declarative Technology Profile (`tech-profile.yaml`)
The entire agent skill suite dynamically adapts to your project's technology stack via `tech-profile.yaml` at the repository root.
```yaml
project:
name: "Universal Enterprise Platform"
code: "UEP"
archetype: "greenfield" # 'greenfield' or 'brownfield'
governance:
tailoring_tier: "tier_2_standard_enterprise" # tier_1_high_assurance | tier_2_standard_enterprise | tier_3_fast_track
enforce_deterministic_gates: true
stack:
architecture_pattern: "modular_monolith" # modular_monolith | microservices | event_driven | serverless
multi_tenancy:
enabled: true
model: "row_level_security" # row_level_security | schema_per_tenant | database_per_tenant
backend:
language: "python" # python | typescript | go | java | csharp | rust
framework: "fastapi" # fastapi | django | express | nestjs | gin | spring_boot
orm: "sqlalchemy" # sqlalchemy | prisma | typeorm | gorm | hibernate
migrations: "alembic" # alembic | prisma | flyway | golang_migrate
test_framework: "pytest"
frontend:
framework: "react" # react | vue | angular | svelte | nextjs | flutter
language: "typescript"
ui_library: "tailwind_shadcn"
e2e_framework: "playwright"
quality_targets:
coverage_thresholds:
backend_domain_fsm: 95.0
integration_adapters: 90.0
frontend_components: 80.0
test_coverage_threshold: 95.0
```
---
## Autonomous Multi-Agent Topology
AI agents execute specialized roles across the lifecycle:
| Agent Persona | Role & Responsibilities | Primary Skills |
|---|---|---|
| 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` |
| **`@adversarial-tester`** | Multi-path test suites ($\ge 95\%$), Bruno API collections, 21-sheet QA workbooks | `up-test-model-generate`, `up-defect-fix` |
| **`@gatekeeper`** | Enforces quality gates (5.1, 9.1, 14.1), verifies delivery surfaces, computes CR impact | `up-traceability-gate`, `up-change-request-impact` |
---
## Quickstart: Creating a New Project from this Framework
1. **Clone or create a new repository from this branch:**
```bash
git clone -b process-generic <this-repo-url> my-new-project
cd my-new-project
git remote set-url origin <new-project-git-url>
git push -u origin main
```
2. **Configure project stack:**
```bash
cp 00_prompts/templates/tech-profile.template.yaml tech-profile.yaml
# Edit tech-profile.yaml with your project name, archetype, and stack choices
```
3. **Bootstrap governance workspace (Stage 0):**
```bash
# In your AI IDE prompt (Cursor / Claude / Antigravity / Gemini):
/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 (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
│ ├── up-arch-risk-spike/ # Stages 6-7: Architecture risk spike & walking skeleton
│ ├── up-srs-derive/ # Stage 8: System requirements & NFR derivation
│ ├── up-hld-lld-generate/ # Stage 9: High-level & low-level design
│ ├── up-iteration-plan/ # Stage 10: Construction iteration planning
│ ├── up-wireframe-spec/ # Stage 11: Screen specifications & routes
│ ├── up-test-model-generate/ # Stage 12: Multi-path tests & 21-sheet QA workbook
│ ├── up-code-generate/ # Stage 13: Wave-based code generation
│ ├── up-defect-fix/ # Stage 14: Defect triage & review
│ ├── up-traceability-gate/ # Gates 5.1, 9.1, 14.1 completeness checks
│ ├── up-parallel-work-integrate/ # Multi-branch AI lane reconciliation
│ ├── up-change-request-impact/ # Formal CR blast-radius analyzer
│ ├── up-context-checkpoint/ # AI session checkpoint & resume protocol
│ ├── 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.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)
│ ├── 00_process_control/ # Stage 0: Registers, Context, Decisions, Checkpoints
│ ├── 01_source_inventories/ # Stage 1: PRD/BRD Feature extractions (BRD-FR-xxx)
│ ├── 02_legacy_analysis/ # Stages 2–4: Brownfield code, DB & screen mining
│ ├── 03_requirements/ # Stages 5 & 8: Atomic Use Cases (UC-xxx) & System Reqs
│ ├── 04_architecture_design/ # Stages 6, 7, 9: Risk Spike, HLD, LLD API/Table Contracts
│ ├── 05_iteration_planning/ # Stage 10: Iteration Backlog, Plan, Surface Matrix
│ ├── 06_wireframes/ # Stage 11: Screen Specifications, Design Tokens (DESIGN.md)
│ ├── 07_test_design/ # Stage 12: Test Strategy, Multi-Path Models, QA Workbooks
│ └── 08_review_ready_baselines/ # Stage 18: Handover & Acceptance Baselines
├── scripts/
│ ├── init-new-project.sh # Scaffolds new projects with UP-AI directory structure
│ ├── generate_manual_qa_workbook.py # 21-sheet Excel Manual QA Workbook compiler
│ ├── verify_traceability_gates.py # Deterministic CLI quality gate validator (Gates 5.1, 9.1, 14.1)
│ └── run_tests.sh # Multi-level test runner (--scope project|iteration|uc|fr)
├── AGENTS.md # AI pair programming guidelines & transcript rules
├── CLAUDE.md # Claude Code instructions pointer
├── GEMINI.md # Gemini instructions pointer
├── tech-profile.yaml # Active declarative project configuration
└── README.md # Framework orientation & guide
```
---
## Single Traceability Chain
Every requirement, design artifact, code commit, and test case follows a strictly verifiable ID prefix:
```
PRD / BRD Feature: BRD-FR-xxx
│
▼
Use Case: UC-xxx
│
▼
Functional Req: FR-xxx (child of exactly one UC-xxx)
│
├──► System & NFR Req: SRS-xxx / NFR-xxx
├──► Architecture Spec: HLD-<SERVICE> / LLD-API-xxx / LLD-TBL-xxx
├──► Backlog User Story: STORY-xxx
└──► Multi-Path Tests: TC-xxx (Unit | API | Contract | E2E | Smoke | Usability)
```
---
## License & Governance
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).