Change Management

Full change lifecycle: analyze, implement, verify, and recover.

Last Updated: 2026-02-15

Level 0: Stakeholder Needs (WHY)

Change Management Stakeholder Needs

Stories covering the full change lifecycle: analyze, implement, verify, recover.

Last Updated: 2026-02-06

Need: Analyze Changes Before Implementation NEED_CHG_ANALYZE
status: implemented
tags: agent, change
priority: mandatory

As a developer, I want to have an agent analyze my change request against existing Stakeholder Needs, Requirements, and Specs, so that I understand the full impact before coding.

Acceptance Scenarios:

  1. Given I describe a feature, When I invoke change agent, Then I get a Change Proposal

  2. Given the proposal lists US/REQ/SPEC changes, When I review, Then I see affected areas

  3. Given conflicting requirements exist, When agent analyzes, Then it flags them and discusses resolution

Need: Implement with Full Traceability NEED_CHG_IMPLEMENT
status: implemented
tags: agent, implementation
priority: mandatory

As a developer, I want to have an agent implement changes with automatic traceability, so that I don’t have to manually link docs, code, and tests.

Acceptance Scenarios:

  1. Given an approved Change Proposal, When implement agent runs, Then docs are updated first

  2. Given code is written, When I check, Then it references SPEC IDs

  3. Given tests are written, When I check, Then they reference REQ IDs

Need: Verify Implementation Completeness NEED_CHG_VERIFY
status: implemented
tags: agent, verification
priority: mandatory

As a developer, I want to verify that implementation matches the change proposal, so that I don’t miss requirements or acceptance criteria.

Acceptance Scenarios:

  1. Given implementation is done, When verify agent runs, Then it checks all ACs

  2. Given a requirement has no test, When agent verifies, Then it reports gap

  3. Given all checks pass, When agent finishes, Then I get PASS report

Need: Recover from Agent Failures NEED_CHG_RECOVERY
status: draft
tags: agent, recovery, error-handling
priority: medium

As a developer, I want to recover gracefully when an agent fails mid-operation, so that I don’t end up with inconsistent state between docs and code.

Acceptance Scenarios:

  1. Given agent fails during doc update, When I check, Then partial changes are rolled back

  2. Given agent fails during code generation, When I retry, Then it picks up where it left off

  3. Given unrecoverable error, When agent stops, Then it reports what was completed

Need: Iterative Level-Based Change Analysis NEED_CHG_ITERATIVE
status: implemented
tags: agent, change, iterative
priority: mandatory

As a developer, I want to have the change agent work iteratively through specification levels (Stakeholder Need → Requirements → Design) with a persistent change document, so that large projects don’t overflow context and I have a complete change history.

Acceptance Scenarios:

  1. Given I start a change, When agent works on NEED level, Then it shows impacted Stakeholder Needs

  2. Given US level complete, When I confirm, Then we proceed to REQ level

  3. Given I’m at REQ level, When links are followed, Then impacted REQs are found automatically

  4. Given I’m at DESIGN level, When implementation isn’t feasible, Then I can go back to REQ

  5. Given all levels complete, When agent finishes, Then Change Document has full history

  6. Given Change is merged, When cleanup runs, Then Change Document is deleted (preserved in Git)

Level 1: Requirements (WHAT)

Change Management Requirements

Requirements for the change analysis, implementation, and verification workflow.

Last Updated: 2026-02-06

Software Requirement: Change Analysis Agent REQ_CHG_ANALYSIS_AGENT

Description: ubFlow SHALL provide a change agent that:

  1. Analyzes user requests against current specifications AND current implementation

  2. Produces a structured Change Document with analysis and decisions

  3. Updates US/REQ/SPEC RST files directly after user approval

Rationale: The change agent has full context during analysis and should capture this in the specification immediately. Separating analysis from spec-writing would require duplicate work and risk information loss.

Acceptance Criteria:

  • AC-1: Agent reads current Stakeholder Needs, Requirements, and Design docs

  • AC-2: Agent reads current implementation (code, scripts, agents) to understand what exists

  • AC-3: Agent identifies affected US, REQ, and SPEC items

  • AC-4: Agent produces Change Document with analysis, decisions, and affected IDs

  • AC-5: Agent supports ADD, MODIFY, DELETE actions

  • AC-6: Agent detects conflicting requirements and discusses resolution with user

  • AC-7: Agent ensures every REQ change traces back to a Stakeholder Need

  • AC-8: Agent updates US/REQ/SPEC RST files after user approval

Software Requirement: Implementation Agent with Full Traceability REQ_CHG_IMPL_AGENT

Description: ubFlow SHALL provide an implement agent that:

  1. Reads the Change Document to identify affected SPECs

  2. Reads only the relevant SPEC sections as identified in the Change Document

  3. Implements code, scripts, and agents according to these SPECs

  4. Writes tests that verify the implementation

  5. Maintains traceability via comments and references

Rationale: The Change Document provides focused context. The implement agent works only with the pre-identified scope, avoiding context overflow.

Acceptance Criteria:

  • AC-1: Agent reads Change Document to get list of affected SPECs

  • AC-2: Agent reads only the SPECs identified in Change Document

  • AC-3: Agent runs sphinx-build to validate docs before coding

  • AC-4: Agent writes code with traceability comments (SPEC IDs)

  • AC-5: Agent writes tests referencing requirement IDs

  • AC-6: Agent runs tests and ensures they pass

Software Requirement: Verification Agent REQ_CHG_VERIFY_AGENT

Description: ubFlow SHALL provide a verify agent that validates implementation completeness against the change proposal.

Rationale: Verification ensures no requirements are missed and traceability is complete.

Acceptance Criteria:

  • AC-1: Agent compares implementation to change proposal

  • AC-2: Agent checks all acceptance criteria have tests

  • AC-3: Agent validates traceability (REQ → SPEC → Code → Test)

  • AC-4: Agent produces verification report with PASS/PARTIAL/FAIL

Software Requirement: Workflow Step Suggestions REQ_CHG_WORKFLOW_STEPS

Description: ubFlow SHALL suggest appropriate next workflow steps after agent completion.

Rationale: Users need guidance on which agent to invoke next based on the current workflow state. This reduces cognitive load and ensures the correct workflow is followed.

Acceptance Criteria:

  • AC-1: After agent execution, VS Code displays handoff suggestions in UI

  • AC-2: Main workflow chain (change→implement→verify) has directional handoffs

  • AC-3: Analysis agents (mece/trace) have bidirectional handoffs

  • AC-4: Memory agent is suggested after verify or on-demand

  • AC-5: Each handoff includes a default prompt for the target agent

Iterative Change Processing

Software Requirement: Persistent Change Document REQ_CHG_CHANGE_DOC
status: implemented
tags: agent, change, document
priority: mandatory

Description: The Change Agent SHALL maintain a persistent Change Document in Markdown that records all analysis, decisions, and changes.

Rationale: A persistent document provides context across sessions, enables review, and creates audit trail.

Acceptance Criteria:

  • AC-1: Change Document created at start of change process

  • AC-2: Each level’s work recorded in dedicated section

  • AC-3: Decisions and conflicts documented

  • AC-4: Navigation between levels logged

  • AC-5: Document deleted after merge (preserved in Git history)

Software Requirement: Horizontal MECE Check per Level REQ_CHG_MECE_PER_LEVEL
status: implemented
tags: agent, change, mece
priority: high

Description: The Change Agent SHALL perform horizontal consistency check within each level before proceeding to the next.

Rationale: Catching conflicts early prevents cascading issues at lower levels.

Acceptance Criteria:

  • AC-1: Check for contradictions with existing items at same level

  • AC-2: Check for redundancies

  • AC-3: Report conflicts before proceeding

  • AC-4: Document resolutions

Software Requirement: Bidirectional Level Navigation REQ_CHG_BIDIR_NAV
status: implemented
tags: agent, change, navigation
priority: high

Description: The Change Agent SHALL support navigation back to previous levels when issues are discovered.

Rationale: Design feasibility issues may require requirement changes, which may require stakeholder need adjustments.

Acceptance Criteria:

  • AC-1: User can request to go back to any previous level

  • AC-2: Previous level work preserved in Change Document

  • AC-3: New iteration marked in document

  • AC-4: Navigation logged with reason

Software Requirement: Final Consistency Check REQ_CHG_FINAL_CHECK
status: implemented
tags: agent, change, verification
priority: mandatory

Description: The Change Agent SHALL perform final consistency check across all levels after completing the Design level.

Rationale: Bidirectional navigation can introduce inconsistencies that need final verification before implementation.

Acceptance Criteria:

  • AC-1: Verify all links are valid (US→REQ→SPEC)

  • AC-2: Verify no orphaned elements

  • AC-3: Verify Change Document is internally consistent

  • AC-4: Produce sign-off checklist

Level 2: Design (HOW)

Change Agent Design

Design specifications for the Change Agent — iterative level-based change analysis.

Document Version: 0.1 Last Updated: 2026-02-06

Software Detailed Design: Iterative Level Processing SPEC_CHG_LEVEL_PROCESSING
status: implemented
tags: change, agent, workflow

Design: The Change Agent processes change requests one level at a time, following the hierarchy US → REQ → SPEC with user discussion at each level.

Level Definitions:

  • Level 0: Stakeholder Needs (WHY — stakeholder perspective)

  • Level 1: Requirements (WHAT — observable system behavior)

  • Level 2: Design (HOW — technical implementation decisions)

Processing Flow per Level:

  1. Identify Affected Items — Search docs at current level using horizontal search (Level 0) or upward links from previous level (Levels 1–2)

  2. Horizontal MECE Check — Check linked/related items for overlaps, contradictions, and gaps (scoped to affected subset, not entire level)

  3. Propose Changes — Present new/modified items with rationale

  4. Discuss with User — Resolve questions and conflicts interactively

  5. Update Change Document — Record agreements immediately

  6. Ask Navigation — Confirm that the current level is saved to the Change Document, then present navigation using ask_questions: “Level N is saved to the Change Document. Where do you want to continue?” Options: Proceed to Level N+1 / Revise Level N-1 / Pause (see SPEC_AGENT_INTERACTION for format)

Don’t Skip Levels Rule: Even if the answer seems obvious, the agent processes each level systematically to ensure complete traceability (US → REQ → SPEC).

Link Discovery: Uses ubCode MCP Server tools to find impacted elements:

# Find linked items for a specific ID
find_needs(need_id='<ID>')

# Trace with depth
get_need_links('<ID>', max_depth=3)

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

Software Detailed Design: Change Document Management SPEC_CHG_CHANGE_DOCUMENT
status: implemented
tags: change, document, persistence

Design: The Change Agent maintains a persistent Markdown document that records all analysis, decisions, and changes throughout the process.

Lifecycle:

  1. Create — Derive short name (<15 chars) from user request (e.g., “iterative level processing” → iterative-level)

  2. Populate — Copy from templates/change-document.md

  3. Update — Record agreements immediately as they are reached

  4. Simplify — After final approval, reduce to ID/title summary

  5. Delete — After merge (preserved in Git history)

Location: docs/changes/<name>.md

Content Modes:

  • During Analysis (verbose): Full RST content for each new/modified element embedded in the Change Document. Enables conversation compression and session pause/resume without context loss.

  • After Approval (simplified): Only affected IDs and titles. Full RST content moved to actual .rst files.

Example (during analysis):

## Level 1: Requirements

### New Requirements

#### REQ_REL_SEMVER: Semantic Versioning

```rst
.. req:: Semantic Versioning
   :id: REQ_REL_SEMVER
   :status: draft
   ...
```

Example (after approval):

## Level 1: Requirements

### New Requirements
- REQ_REL_SEMVER: Semantic Versioning
- REQ_REL_GITHUB_PUBLISH: GitHub Release Publication
Software Detailed Design: Bidirectional Level Navigation SPEC_CHG_BIDIR_NAVIGATION
status: implemented
tags: change, navigation

Design: The Change Agent supports navigating back to any previous level when design feasibility issues or requirement adjustments are needed.

Trigger: User says “go back to requirements” or “the stakeholder need needs adjustment” at any point during analysis.

Navigation Procedure:

  1. Navigate to the requested level section in the Change Document

  2. Make necessary changes to that level

  3. Mark all lower level sections with: **⚠️ DEPRECATED NEEDS REVIEW**

  4. Continue working forward from the requested level

Preservation: Previous level work is preserved in the Change Document. Each iteration is marked so the full decision history is retained.

Rationale: Design feasibility issues may require requirement changes, which may require stakeholder need adjustments. Linear-only processing would force restarting the entire analysis.

Software Detailed Design: Atomic RST Updates with Status Lifecycle SPEC_CHG_ATOMIC_UPDATE
status: implemented
tags: change, commit, status

Design: RST files are only updated after final approval of all levels together, never during analysis. This prevents broken cross-level links.

Status Lifecycle:

  • During analysis: All new/modified elements set to :status: draft (in Change Document only, not in RST files)

  • After final approval: Change Agent atomically writes all RST files (US + REQ + SPEC together) and sets :status: approved

  • After implementation: Verify Agent sets :status: implemented

Final Consistency Check (before writing RST):

  1. Traceability — Every REQ links to a US, every SPEC links to a REQ

  2. Cross-Level Consistency — No semantic drift between levels

  3. MECE Across Levels — All US aspects covered by REQs, all REQs by SPECs

  4. Document Completeness — No DEPRECATED markers remaining

  5. User Approval — Explicit sign-off before writing

After Writing:

  • RST files updated atomically (all levels in one operation)

  • Change Document simplified to ID/title summary

  • Changes committed with traceability message

Rationale: Atomic updates ensure sphinx-build always succeeds. Writing levels individually would create periods with broken links.

Implement Agent Design

Design specifications for the Implement Agent — code implementation with traceability.

Document Version: 0.1 Last Updated: 2026-02-06

Software Detailed Design: Pre-Implementation Environment Check SPEC_IMPL_PRE_CHECK
status: implemented
tags: implement, init, validation

Design: The Implement Agent checks for sphinx-needs availability before starting work.

Check Sequence:

  1. Run sphinx-build --version (or uv run sphinx-build --version)

  2. If NOT found → run init script to bootstrap environment

  3. If found → proceed with implementation

Rationale: Cloud environments or fresh checkouts may lack dependencies. Catching this early avoids mid-implementation failures.

File: .github/agents/ubFlow.implement.agent.md (section: “Pre-Implementation Check”)

Software Detailed Design: Change Document Consumption SPEC_IMPL_CHANGE_DOC_INPUT
status: implemented
tags: implement, input, change-document

Design: The Implement Agent reads the Change Document to determine implementation scope and then queries linked specs for detailed instructions.

Input Resolution:

The Change Document can come from:

  • A markdown file in docs/changes/<name>.md

  • A GitHub Issue assigned to the implement agent

  • Direct handoff from the Change Agent

Consumption Workflow:

  1. Read Change Document — Extract summary, scope, and affected IDs

  2. Query Needs — Use get_need_links() to get all linked SPEC_* and REQ_* items

  3. Read SPEC Files — Understand implementation details and constraints

  4. Read REQ Files — Understand expected behavior and acceptance criteria

Scope Constraint: The Implement Agent works only with pre-identified scope from the Change Document, avoiding context overflow.

Boundary Rules:

  • Do NOT modify Stakeholder Needs, Requirements, or Design Specs

  • Do NOT change specification statuses (that’s the Verify Agent’s job)

  • Do NOT update version.json (that’s the Release Agent’s job)

Software Detailed Design: Implementation Quality Gates SPEC_IMPL_QUALITY_GATES
status: implemented
tags: implement, quality, validation
links outgoing: REQ_CHG_IMPL_AGENT

Design: The Implement Agent runs sphinx-build as quality gate before and after coding.

Quality Gate Workflow:

  1. Pre-Implementation Build — Run sphinx-build to establish baseline

  2. If FAIL → fix docs before proceeding (do not start coding)

  3. If PASS → implement code with SPEC references

  4. Write tests with REQ references

  5. Run tests

  6. Post-Implementation Build — Final sphinx-build validation

Commands:

# Build docs (validates all)
sphinx-build -b html docs docs/_build/html -W --keep-going

# Run tests
pytest tests/ -v

Fail-Fast Rule: If pre-implementation build fails, the agent fixes documentation issues before touching any code.

Software Detailed Design: Code and Test Traceability SPEC_IMPL_CODE_TRACEABILITY
status: implemented
tags: implement, traceability, code

Design: All code and tests written by the Implement Agent include traceability comments linking back to Design Specs and Requirements.

Code Traceability Format:

# Implementation: SPEC_xxx
# Requirements: REQ_xxx_1, REQ_xxx_2

def my_function():
    """
    Brief description.

    Implements:
        - REQ_xxx_1: [What this satisfies]
        - SPEC_xxx: [Design reference]
    """
    pass

Test Traceability Format:

class TestFeatureName:
    """
    Tests for REQ_xxx_1, REQ_xxx_2
    """

    def test_acceptance_criteria_1(self):
        """
        Verifies: REQ_xxx_1 AC-1
        """
        pass

Commit Traceability Format:

feat: [Feature name]

Implements: [Change Document name]

Requirements:
- REQ_xxx_1: [description]

Design:
- SPEC_xxx_1: [description]

Rationale: Traceability comments enable the Verify Agent and Trace Agent to validate implementation coverage without parsing complex code logic.

Verify Agent Design

Design specifications for the Verify Agent — implementation verification and status lifecycle.

Document Version: 0.1 Last Updated: 2026-02-06

Software Detailed Design: Five-Category Verification SPEC_VERIFY_CATEGORIES
status: implemented
tags: verify, agent, categories

Design: The Verify Agent validates implementations across five categories, each with specific check questions.

Category 1 — Requirements Verification:

Check | Question |
Exists | Is REQ_xxx documented? |
Complete | Does it have all required fields (status, priority, AC)? |
Implemented | Is there a SPEC linking to it? |
Tested | Is there a test referencing it? |

Category 2 — Design Verification:

Check | Question |
Exists | Is SPEC_xxx documented? |
Linked | Does it reference requirements? |
Implemented | Is there code implementing it? |
Accurate | Does code match the design? |

Category 3 — Code Verification:

Check | Question |
Traceability | Does code reference SPEC IDs? |
Completeness | Are all design items implemented? |
Quality | Does it follow project conventions? |

Category 4 — Test Verification:

Check | Question |
Coverage | Is every Acceptance Criterion tested? |
References | Do tests reference REQ IDs? |
Passing | Do all tests pass? |

Category 5 — Traceability Verification:

Bidirectional link chain:

REQ → SPEC → Code → Test
 ↑      ↑      ↑      ↑
 └──────┴──────┴──────┘ (all linked back)

Common Issues Checklist:

  • Requirements: missing AC, untestable requirements, orphan requirements

  • Design: design–implementation mismatch, missing error handling

  • Code: missing traceability comments, coding standard violations

  • Tests: missing tests for AC, tests don’t reference REQ IDs

  • Traceability: broken links, missing matrix entries

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

Software Detailed Design: Verification Report Format SPEC_VERIFY_REPORT
status: implemented
tags: verify, report, format
links outgoing: REQ_CHG_VERIFY_AGENT

Design: The Verify Agent produces a structured Verification Report with coverage matrix and issue tracking.

Report Header:

# Verification Report: [Feature/Change Name]
**Date**: YYYY-MM-DD
**Change Proposal**: [reference]
**Status**: ✅ PASSED | ⚠️ PARTIAL | ❌ FAILED

Summary Table:

| Category       | Total | Verified | Issues |
|----------------|-------|----------|--------|
| Requirements   | n     | n        | 0      |
| Designs        | n     | n        | 0      |
| Implementations| n     | n        | 0      |
| Tests          | n     | n        | 0      |
| Traceability   | n     | n        | 0      |

Requirements Coverage Matrix:

Per-REQ row showing SPEC link, Code presence, Test presence, and Status.

Acceptance Criteria Verification:

Per-REQ section listing each AC with test mapping:

### REQ_xxx_1
- [x] AC-1: [criterion] → Test: test_module.py::test_ac1
- [ ] AC-2: [criterion] → **MISSING TEST**

Issue Format:

Each issue includes: Severity (High/Medium/Low), Category, Description, Expected vs Actual, and Recommendation.

Software Detailed Design: Verification Status Lifecycle SPEC_VERIFY_STATUS_LIFECYCLE
status: implemented
tags: verify, status, lifecycle

Design: The Verify Agent manages the approved implemented status transition based on verification results.

Transition Rules:

  • ✅ PASSED — Update all verified REQ_* and SPEC_* from :status: approved to :status: implemented

  • ⚠️ PARTIAL — Do NOT update statuses; hand off to Implement Agent for fixes, then re-verify

  • ❌ FAILED — Do NOT update statuses; hand off to Implement Agent or Change Agent depending on issue severity

Severity Levels and Actions:

  • High — Requirement not implemented or major deviation → block merge

  • Medium — Partial implementation or missing traceability → should fix before merge

  • Low — Minor issues, documentation gaps → can fix in follow-up

Status Update Process:

# Edit docs/11_requirements/req_*.rst
# Edit docs/12_design/spec_*.rst
# Change :status: approved → :status: implemented for verified items

git commit -m "docs: mark verified specs as implemented"

Rationale: Status reflects actual verification, not just code existence. Only the Verify Agent updates status to implemented, ensuring independent confirmation that the implementation matches the specification.

Traceability

Stakeholder Needs

ID

Title

Status

Priority

NEED_CHG_ANALYZE

Analyze Changes Before Implementation

implemented

mandatory

NEED_CHG_IMPLEMENT

Implement with Full Traceability

implemented

mandatory

NEED_CHG_ITERATIVE

Iterative Level-Based Change Analysis

implemented

mandatory

NEED_CHG_RECOVERY

Recover from Agent Failures

draft

medium

NEED_CHG_VERIFY

Verify Implementation Completeness

implemented

mandatory

Requirements

ID

Title

Status

Tags

REQ_CHG_ANALYSIS_AGENT

Change Analysis Agent

implemented

agent; change

REQ_CHG_BIDIR_NAV

Bidirectional Level Navigation

implemented

agent; change; navigation

REQ_CHG_CHANGE_DOC

Persistent Change Document

implemented

agent; change; document

REQ_CHG_FINAL_CHECK

Final Consistency Check

implemented

agent; change; verification

REQ_CHG_IMPL_AGENT

Implementation Agent with Full Traceability

implemented

agent; implementation

REQ_CHG_LINK_DISCOVERY

Sphinx-Needs Link Discovery

implemented

agent; change; links

REQ_CHG_MECE_PER_LEVEL

Horizontal MECE Check per Level

implemented

agent; change; mece

REQ_CHG_VERIFY_AGENT

Verification Agent

implemented

agent; verification

REQ_CHG_WORKFLOW_STEPS

Workflow Step Suggestions

implemented

agent; handoffs; workflow

Design Specifications

ID

Title

Status

Links

SPEC_CHG_ATOMIC_UPDATE

Atomic RST Updates with Status Lifecycle

implemented

SPEC_CHG_BIDIR_NAVIGATION

Bidirectional Level Navigation

implemented

SPEC_CHG_CHANGE_DOCUMENT

Change Document Management

implemented

SPEC_CHG_LEVEL_PROCESSING

Iterative Level Processing

implemented

SPEC_IMPL_CHANGE_DOC_INPUT

Change Document Consumption

implemented

SPEC_IMPL_CODE_TRACEABILITY

Code and Test Traceability

implemented

SPEC_IMPL_PRE_CHECK

Pre-Implementation Environment Check

implemented

SPEC_IMPL_QUALITY_GATES

Implementation Quality Gates

implemented

SPEC_VERIFY_CATEGORIES

Five-Category Verification

implemented

SPEC_VERIFY_REPORT

Verification Report Format

implemented

SPEC_VERIFY_STATUS_LIFECYCLE

Verification Status Lifecycle

implemented