diff --git a/src/bmm/workflows/shared/rtm/workflow.md b/src/bmm/workflows/shared/rtm/workflow.md new file mode 100644 index 000000000..2cb8f1003 --- /dev/null +++ b/src/bmm/workflows/shared/rtm/workflow.md @@ -0,0 +1,182 @@ +--- +name: create-update-rtm +description: Generate or update the Requirements Traceability Matrix (RTM) by scanning all requirement documents and mapping bidirectional traceability. Enterprise track workflow. +track: enterprise +--- + +# Requirements Traceability Matrix (RTM) Workflow + +**Goal:** Generate or update the RTM by scanning all requirement documents (StRS, SyRS, PRD/SRS, Epics/Stories) and creating bidirectional traceability links with gap analysis. + +**Your Role:** You are a Requirements Traceability specialist. Your job is to systematically scan all requirement documents, extract requirement IDs, and map the traceability chain. This is a systematic, analytical task. + +**Track:** This workflow is part of the **Enterprise** track. + +--- + +## WORKFLOW ARCHITECTURE + +This is a **single-pass analytical workflow** (not step-file based). It runs as a complete analysis task. + +### Critical Rules + +- ๐Ÿ“– **ALWAYS** load ALL requirement documents before analysis +- ๐Ÿ”— **ALWAYS** trace in both directions (forward and backward) +- ๐Ÿ” **ALWAYS** identify orphan items (unlinked requirements, stories, tests) +- โš ๏ธ **NEVER** fabricate traceability links that don't exist in documents +- ๐Ÿ’พ **ALWAYS** save the RTM to the output file + +--- + +## INITIALIZATION SEQUENCE + +### 1. Configuration Loading + +Load and read full config from {project-root}/_bmad/bmm/config.yaml and resolve: + +- `project_name`, `output_folder`, `planning_artifacts`, `user_name` +- `communication_language`, `document_output_language` +- `date` as system-generated current datetime + +โœ… YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the configured `{communication_language}`. + +### 2. Document Discovery + +Search for all requirement documents: + +**Required Documents (load if found):** +- StRS: `{planning_artifacts}/*strs*.md` +- SyRS: `{planning_artifacts}/*syrs*.md` +- PRD/SRS: `{planning_artifacts}/*prd*.md` +- Epics & Stories: `{planning_artifacts}/*epic*.md` + +**Optional Documents:** +- Test documents: `{implementation_artifacts}/tests/**` +- Story files: `{implementation_artifacts}/*story*.md` + +**Report to user what was found and what's missing.** + +### 3. Check for Existing RTM + +Look for existing RTM: `{planning_artifacts}/rtm-{{project_name}}.md` +- If exists: Load and update (preserve change history) +- If not exists: Create new from template + +--- + +## RTM GENERATION SEQUENCE + +### Step 1: Extract All Requirement IDs + +Scan each document and extract all requirement identifiers: + +**From StRS:** +- Look for patterns: `BO-###`, `OP-###`, `UP-###`, `OS-###`, `BC-###`, `TC-###`, `RC-###` +- Or any consistent ID pattern in the document + +**From SyRS:** +- Look for patterns: `SYS-###`, `SYS-FUNC-###`, `SYS-IF-###`, `SYS-PERF-###` +- Or any consistent ID pattern in the document + +**From PRD/SRS:** +- Look for patterns: `FR-###`, `FR#`, `NFR-###` +- Look for Enterprise format: `FR-[AREA]-###`, `NFR-[AREA]-###` +- Or any consistent ID pattern in the document + +**From Epics/Stories:** +- Look for Epic numbers: `Epic N`, `Story N.M` +- Look for acceptance criteria patterns + +### Step 2: Map Forward Traceability + +For each requirement at each level, find its downstream references: + +**StRS โ†’ SyRS:** Match by content similarity, explicit references, or source fields +**SyRS โ†’ PRD:** Match by content similarity, explicit references, or source fields +**PRD โ†’ Stories:** Match by FR references in stories, acceptance criteria alignment +**Stories โ†’ Tests:** Match by test descriptions, acceptance criteria references + +### Step 3: Map Backward Traceability + +Verify backward links exist: +- Each test traces to a story +- Each story traces to a PRD requirement +- Each PRD requirement traces to SyRS (if SyRS exists) +- Each SyRS requirement traces to StRS (if StRS exists) + +### Step 4: Identify Orphans and Gaps + +**Orphan Requirements:** Requirements with no downstream trace +- These represent features that will NOT be implemented unless addressed + +**Orphan Stories:** Stories with no upstream requirement trace +- These represent scope creep or undocumented requirements + +**Orphan Tests:** Tests with no story or requirement trace +- These represent untraceable testing effort + +**Coverage Gaps:** Downstream levels with missing upstream links +- These represent broken traceability chains + +### Step 5: Generate Coverage Statistics + +Calculate: +- Forward traceability coverage percentage per level +- Total requirements per status (proposed, approved, implemented, verified) +- Orphan count per category + +### Step 6: Generate RTM Document + +Create or update the RTM document at: `{planning_artifacts}/rtm-{{project_name}}.md` + +Use the template from: `{project-root}/_bmad/bmm/workflows/shared/templates/rtm-template.md` + +Fill in all tables with extracted data. + +### Step 7: Present Results + +**Report to user:** + +"**RTM Analysis Complete for {{project_name}}** + +**Documents Scanned:** +- StRS: [found/not found] - [X requirements extracted] +- SyRS: [found/not found] - [X requirements extracted] +- PRD/SRS: [found/not found] - [X requirements extracted] +- Epics/Stories: [found/not found] - [X stories extracted] + +**Traceability Coverage:** +- StRS โ†’ SyRS: [X%] +- SyRS โ†’ PRD: [X%] +- PRD โ†’ Stories: [X%] +- Stories โ†’ Tests: [X%] + +**Issues Found:** +- Orphan requirements: [count] +- Orphan stories: [count] +- Orphan tests: [count] + +**RTM saved to:** `{planning_artifacts}/rtm-{{project_name}}.md` + +**Recommendations:** [List any actions needed to improve traceability]" + +--- + +## SUCCESS METRICS: + +โœ… All available requirement documents discovered and scanned +โœ… Requirement IDs extracted from all documents +โœ… Forward traceability mapped (StRSโ†’SyRSโ†’PRDโ†’Storiesโ†’Tests) +โœ… Backward traceability mapped (Testsโ†’Storiesโ†’PRDโ†’SyRSโ†’StRS) +โœ… Orphan items identified with clear actions needed +โœ… Coverage statistics calculated accurately +โœ… RTM document generated/updated with all data +โœ… Clear summary presented to user + +## FAILURE MODES: + +โŒ Not scanning all available documents +โŒ Fabricating traceability links that don't exist +โŒ Missing orphan identification +โŒ Not providing actionable recommendations +โŒ Not preserving change history when updating existing RTM diff --git a/src/bmm/workflows/shared/templates/rtm-template.md b/src/bmm/workflows/shared/templates/rtm-template.md new file mode 100644 index 000000000..c42472844 --- /dev/null +++ b/src/bmm/workflows/shared/templates/rtm-template.md @@ -0,0 +1,83 @@ +--- +workflowType: 'rtm' +track: 'enterprise' +version: '1.0' +status: 'draft' +last_updated: '{{date}}' +generated_by: '{{agent_name}}' +--- + +# Requirements Traceability Matrix - {{project_name}} + +**Author:** {{user_name}} +**Date:** {{date}} +**ISO 29148 Reference:** Requirements Traceability + +## Purpose + +This Requirements Traceability Matrix (RTM) provides bidirectional traceability across the entire requirements chain: + +**Forward Traceability:** StRS โ†’ SyRS โ†’ PRD/SRS โ†’ Stories โ†’ Tests +**Backward Traceability:** Tests โ†’ Stories โ†’ PRD/SRS โ†’ SyRS โ†’ StRS + +## Traceability Matrix + +### Stakeholder Requirements โ†’ System/Software Requirements + +| StRS Req ID | StRS Description | SyRS Ref(s) | PRD/SRS Ref(s) | Status | +|-------------|-----------------|-------------|----------------|--------| +| | | | | | + +### Software Requirements โ†’ Stories โ†’ Tests + +| PRD/SRS Req ID | Description | Priority | Story Ref(s) | Test Ref(s) | V&V Method | Status | +|---------------|-------------|----------|-------------|-------------|------------|--------| +| | | | | | | | + +## Coverage Analysis + +### Forward Traceability Coverage + +| Source Level | Total Reqs | Traced Forward | Not Traced | Coverage % | +|-------------|-----------|---------------|------------|------------| +| StRS | | | | | +| SyRS | | | | | +| PRD/SRS | | | | | +| Stories | | | | | + +### Orphan Analysis + +#### Orphan Requirements (not traced to any downstream artifact) + +| Req ID | Source | Description | Action Needed | +|--------|--------|-------------|--------------| +| | | | | + +#### Orphan Stories (not traced to any requirement) + +| Story ID | Epic | Description | Action Needed | +|----------|------|-------------|--------------| +| | | | | + +#### Orphan Tests (not traced to any story or requirement) + +| Test ID | Description | Action Needed | +|---------|-------------|--------------| +| | | | + +## Requirement Status Summary + +| Status | Count | Percentage | +|--------|-------|------------| +| Proposed | | | +| Approved | | | +| Implemented | | | +| Verified | | | +| Deferred | | | +| Rejected | | | + +## Change History + +| Date | Change | By | Affected Reqs | +|------|--------|-----|--------------| +| {{date}} | Initial RTM creation | {{agent_name}} | All |