---
_version: '1'
uuid: ac723321-7356-4653-ab48-90be0359c906
created: 2025-11-14T08:33:36.093512287Z
parents:
- uuid: 2540b2c1-ea21-4732-aafb-ee1c836ca19b
fingerprint: 42e32f22dbbfaa35dea667b81a7ae1771caf6f8a34610c022d331080afbfc32d
hrid: USR-003
---
# SYS-021 HRID Correction Command
## Statement
The tool shall provide a `req clean` command that corrects outdated parent HRIDs in requirement files when parent requirements have been moved or renamed.
## Rationale
When requirements are reorganized or renumbered, the parent HRID references stored in child requirement frontmatter can become stale. While UUIDs remain stable and maintain link integrity, the HRID mismatch makes manual review and navigation confusing. An automated correction command ensures HRID references stay synchronized without requiring manual updates to potentially hundreds of files.
This supports USR-003's goal of maintaining traceability by keeping human-readable references accurate.
## Implementation Notes
- Scans all requirements in the repository
- For each parent link, compares stored HRID against current parent's HRID
- Updates HRID field if mismatch detected (UUID must match)
- Preserves UUID and fingerprint fields
- Reports number of corrections made
- Safe operation: only updates HRID field, never changes relationships
- Implemented in `src/cli.rs` lines 207-214
## Verification
- Command successfully updates outdated parent HRIDs
- UUIDs and fingerprints remain unchanged
- Reports accurate count of corrections
- No-op when all HRIDs are current
- Handles requirements with multiple parents correctly
- Does not create false suspect links