feat(rtm): add Requirements Traceability Matrix template and workflow

Create RTM infrastructure for Enterprise track:
- RTM template with bidirectional traceability tables
  (StRS→SyRS→PRD→Stories→Tests and reverse)
- Coverage analysis tables (forward coverage %)
- Orphan analysis (unlinked requirements, stories, tests)
- Requirement status summary tracking
- Change history tracking
- RTM generation/update workflow that scans all requirement
  documents, extracts IDs, maps traceability, identifies gaps
- Single-pass analytical workflow (not step-file based)
- Shared templates directory for cross-workflow templates

Part of ISO 29148 compliance initiative (Wave 1).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tolga Karatas 2026-02-16 01:05:46 +03:00
parent 124b7164bd
commit c892eaa00c
No known key found for this signature in database
GPG Key ID: C8389C243D70C4C9
2 changed files with 265 additions and 0 deletions

View File

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

View File

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