Traceability

Cross-cutting quality validation: horizontal consistency (MECE) and vertical traceability.

Last Updated: 2026-02-15

Level 0: Stakeholder Needs (WHY)

Need: Review Requirements for Consistency NEED_TRACE_MECE
status: implemented
tags: traceability, agent, mece, review
priority: high

As a developer, I want to review all items on ONE level (US, REQ, or SPEC) for MECE properties, so that I catch redundancies, contradictions, gaps, and missing links within that level.

Acceptance Scenarios:

  1. Given I specify “NEED” level, When mece agent runs, Then it checks all Stakeholder Needs

  2. Given I specify “REQ” level, When mece agent runs, Then it checks all Requirements

  3. Given two items overlap, When agent reviews, Then it flags the overlap

  4. Given a gap exists, When agent reviews, Then it suggests missing item

  5. Given item A uses terms from item B, When no link exists, Then it flags missing link

Need: Trace Stakeholder Need Through All Levels NEED_TRACE_VERTICAL
status: implemented
tags: traceability, agent, trace, vertical
priority: high

As a developer, I want to trace ONE stakeholder need vertically through REQ → SPEC → Code → Test, so that I verify it’s fully implemented with meaningful links.

Acceptance Scenarios:

  1. Given I specify NEED_xxx, When trace agent runs, Then it finds all linked REQs

  2. Given REQs exist, When agent traces, Then it finds linked SPECs

  3. Given a link exists but content doesn’t match, When agent traces, Then it flags semantic mismatch

  4. Given full chain exists, When agent finishes, Then I get coverage report

Level 1: Requirements (WHAT)

Software Requirement: MECE Requirements Review REQ_TRACE_MECE
status: implemented
tags: traceability, agent, review, mece
priority: high

Description: ubFlow SHALL provide a mece agent that analyzes ONE level (US, REQ, or SPEC) for MECE properties (Mutually Exclusive, Collectively Exhaustive).

Rationale: Horizontal consistency within a level ensures no redundancies or contradictions. Focused scope prevents context overflow.

Acceptance Criteria:

  • AC-1: Accept level parameter (US, REQ, SPEC)

  • AC-2: Detect redundant items (same thing said differently)

  • AC-3: Detect contradictions (conflicting items)

  • AC-4: Detect gaps (missing items for completeness)

  • AC-5: Detect overlaps (unclear boundaries)

  • AC-6: Detect missing horizontal links (item uses terms from another without :links:)

  • AC-7: Produce report with severity and recommendations

Software Requirement: Vertical Traceability Verification REQ_TRACE_VERTICAL
status: implemented
tags: traceability, agent, trace, vertical
priority: high

Description: ubFlow SHALL provide a trace agent that verifies ONE stakeholder need or requirement is fully traced through all levels (US → REQ → SPEC → Code → Test).

Rationale: Vertical traceability ensures complete implementation. Semantic validation catches links that exist but don’t make sense.

Acceptance Criteria:

  • AC-1: Accept starting item (NEED_xxx or REQ_xxx)

  • AC-2: Follow all :links: to find connected items

  • AC-3: Check link completeness (are there REQs? SPECs? Tests?)

  • AC-4: Check semantic validity (does REQ actually implement US intent?)

  • AC-5: Report coverage: FULL / PARTIAL / MISSING

  • AC-6: Identify gaps at each level

Level 2: Design (HOW)

MECE Agent

Software Detailed Design: Horizontal MECE Analysis SPEC_MECE_HORIZONTAL_ANALYSIS
status: implemented
tags: traceability, mece, agent, horizontal

Design: The MECE Agent analyzes ONE level at a time for Mutually Exclusive, Collectively Exhaustive properties.

Scope:

┌──────────────────────────────────────────────────┐
│  NEED_001  ↔  NEED_002  ↔  NEED_003  ↔  NEED_004     │  ← MECE checks
└──────────────────────────────────────────────────┘

Horizontal only — vertical traceability is the Trace Agent’s job.

Input: Level parameter (US, REQ, SPEC). Defaults to REQ if unspecified.

Six Analysis Categories:

  1. Redundancy Detection — Same requirement stated differently. Symptoms: identical AC in multiple items, different wording / same meaning, subset relationships.

  2. Contradiction Detection — Conflicting requirements. Symptoms: mutually exclusive behaviors, different values for same parameter.

  3. Gap Analysis — Missing requirements for completeness. Symptoms: CRUD incomplete, error paths unspecified, edge cases missing.

  4. Overlap Detection — Partial coverage of same ground. Symptoms: shared AC, unclear scope boundaries.

  5. Abstraction Level Mismatch — Mixed granularity. Symptoms: system-level next to component-level, goals next to implementation details.

  6. Missing Horizontal Links — Implicit dependencies not expressed in :links:. Check: does item use terms defined in another item at the same level without linking?

File: .github/agents/ubFlow.mece.agent.md

Software Detailed Design: MECE Report Format SPEC_MECE_REPORT
status: implemented
tags: traceability, mece, report, format
links outgoing: REQ_TRACE_MECE

Design: The MECE Agent produces a structured report with categorized findings.

Report Structure:

# MECE Analysis Report
**Level**: US | REQ | SPEC
**Date**: YYYY-MM-DD
**Total Items Analyzed**: N

Summary Table:

| Category        | Count | Severity |
|-----------------|-------|----------|
| Redundancies    | 0     | -        |
| Contradictions  | 0     | -        |
| Gaps            | 0     | -        |
| Overlaps        | 0     | -        |
| Missing Links   | 0     | -        |

Findings by Severity:

  • 🔴 Contradictions (Critical) — with item IDs, issue description, recommendation

  • 🟡 Redundancies (Medium) — with merge recommendation

  • 🟢 Missing Links (Low) — with suggested :links: additions

  • ❓ Gaps Identified — with recommendation for new items

Handoffs: After analysis, suggests @ubFlow.change to fix issues or @ubFlow.trace for vertical verification.

Trace Agent

Software Detailed Design: Vertical Traceability Analysis SPEC_TRACE_VERTICAL_ANALYSIS
status: implemented
tags: traceability, trace, agent, vertical

Design: The Trace Agent traces ONE item vertically through all levels (US → REQ → SPEC → Code → Test) and validates semantic correctness.

Scope:

┌─────────────┐
│  NEED_CFG_001 │  ← START HERE
└──────┬──────┘
       ↓ :links:
┌──────┴──────┬──────────────┐
│ REQ_CFG_001 │ REQ_CFG_002  │  ← Find linked REQs
└──────┬──────┴──────┬───────┘
       ↓              ↓
┌──────┴──────┬──────┴───────┐
│SPEC_CFG_001 │SPEC_CFG_002  │  ← Find linked SPECs
└──────┬──────┴──────┬───────┘
       ↓              ↓
       Code  ←→  Tests          ← Find implementation

Vertical only — horizontal consistency is the MECE Agent’s job.

Input: Starting item (NEED_xxx or REQ_xxx). Asks user if unspecified.

Four Check Types:

  1. Link Completeness — Does the item have links at each level? US→REQ, REQ→SPEC, SPEC→Code, REQ→Test.

  2. Horizontal Dependencies — Does the item depend on other items at the same level? If so, are there explicit :links:?

  3. Semantic Validity — Does the link make sense? Does the REQ actually address the US intent? Does the SPEC implement the REQ behavior?

  4. Acceptance Criteria Coverage — For each AC in the starting item, is there a corresponding REQ/Test that addresses it?

Link Discovery:

# Trace downward with depth
get_need_links('NEED_xxx', max_depth=3)

# Trace upward (find needs linking TO this one)
find_needs(links='SPEC_xxx')

File: .github/agents/ubFlow.trace.agent.md

Software Detailed Design: Trace Report Format SPEC_TRACE_REPORT
status: implemented
tags: traceability, trace, report, format
links outgoing: REQ_TRACE_VERTICAL

Design: The Trace Agent produces a report with a visual trace tree and coverage summary.

Report Structure:

# Trace Report: [NEED_ID]
**Date**: YYYY-MM-DD
**Starting Point**: [NEED_ID]
**Direction**: Downward | Upward | Both

Trace Tree Visualization:

NEED_CFG_001: "Edit user settings"
├── REQ_CFG_001: "Allow email editing" ✅
│   ├── SPEC_CFG_001: "Settings form design" ✅
│   │   └── Code: src/settings.py ✅
│   └── Test: test_settings.py::test_email_edit ✅
├── REQ_CFG_002: "Persist to YAML" ✅
│   ├── SPEC_CFG_002: "YAML file format" ✅
│   │   └── Code: src/config.py ✅
│   └── Test: test_config.py::test_yaml_save ✅
└── REQ_CFG_003: "Validate email format" ⚠️
    └── SPEC: MISSING ❌

Coverage Summary Table:

Per-level counts of Total, Complete, and Missing items.

Sections: Gaps Found, Semantic Issues, Recommendations.

Handoffs: After analysis, suggests @ubFlow.mece for level consistency or @ubFlow.change to fix gaps.

Quality Check Workflow

Software Detailed Design: Independent Quality Check Workflow SPEC_TRACE_QUALITY_WORKFLOW
status: implemented
tags: traceability, workflow, quality, mece, trace

Design: MECE and Trace agents are usable as independent quality checks outside of a change workflow.

Usage Modes:

  • Standalone: Invoke @mece or @trace directly without a Change Document

  • Integrated: Change Agent invokes horizontal MECE checks per level during change processing (via REQ_CHG_MECE_PER_LEVEL)

Standalone Flow:

Developer
    │
    ├──→ @mece <level>  ──→ Horizontal MECE Report
    │
    └──→ @trace <ID>    ──→ Vertical Coverage Report
                                │
                                ▼ (issues found?)
                            @change  ──→ Fix via change workflow

Key Property: Quality checks are read-only — they never modify specification files. If issues are found, the developer starts a change workflow to fix them.

Traceability

Stakeholder Needs

ID

Title

Status

Priority

NEED_TRACE_MECE

Review Requirements for Consistency

implemented

high

NEED_TRACE_VERTICAL

Trace Stakeholder Need Through All Levels

implemented

high

Requirements

ID

Title

Status

Tags

REQ_TRACE_MECE

MECE Requirements Review

implemented

traceability; agent; review; mece

REQ_TRACE_VERTICAL

Vertical Traceability Verification

implemented

traceability; agent; trace; vertical

Design Specifications

ID

Title

Status

Links

SPEC_MECE_HORIZONTAL_ANALYSIS

Horizontal MECE Analysis

implemented

SPEC_MECE_REPORT

MECE Report Format

implemented

SPEC_TRACE_QUALITY_WORKFLOW

Independent Quality Check Workflow

implemented

SPEC_TRACE_REPORT

Trace Report Format

implemented

SPEC_TRACE_VERTICAL_ANALYSIS

Vertical Traceability Analysis

implemented