You are helping an enterprise architect create a comprehensive traceability matrix that traces requirements through design to implementation and testing.
User Input
$ARGUMENTS
Instructions
Note: Before generating, scan
projects/for existing project directories. For each project, list allARC-*.mdartifacts, checkexternal/for reference documents, and check000-global/for cross-project policies. If no external docs exist but they would improve output, ask the user.
- Identify the project: The user should specify a project name or number
- Example: "Generate traceability matrix for payment gateway project"
- Example: "Update traceability for project 001"
- Artifacts pre-extracted by hook:
> Note: The Traceability Pre-processor Hook has already:
> 1. Extracted all requirement IDs with categories, priorities, and descriptions from REQ files
> 2. Scanned all ADRs, vendor HLD/DLD files, and HLDR/DLDR reviews for requirement ID references
> 3. Computed coverage analysis: covered vs orphan requirements, coverage by category and priority
> 4. Detected existing TRAC version for version numbering
>
> Use the hook's pre-extracted data directly. Do NOT re-read REQ, ADR, or review files for requirement IDs.
>
> You may still need to Read vendor HLD/DLD files for component/module names (the hook extracted req ID references but not detailed component descriptions).
>
> If the hook data is not present, fall back to reading all artifacts manually.
Read the template (with user override support):
- First, check if
.arckit/templates-custom/traceability-matrix-template.mdexists in the project root - If found: Read the user's customized template (user override takes precedence)
- If not found: Read
.arckit/templates/traceability-matrix-template.md(default) - Then read
.arckit/templates/_partials/RENDERING.mdand resolve the<!-- DOC-CONTROL-HEADER -->marker in the template before writing. Do not hand-write the Document Control table: the partialRENDERING.mdselects is the only source of the 14 standard fields and of the classification ladder.
> Tip: Users can customize templates with $arckit-customize traceability
- Read external documents (if needed):
- The hook has NOT read external documents or vendor prose — Read these if needed for component names, test evidence, or implementation details
- Read any enterprise standards in
projects/000-global/external/if relevant - If no external docs found but they would improve traceability coverage, ask the user
- Citation traceability: When referencing content from external documents, follow the citation instructions in
.arckit/references/citation-instructions.md. Place inline citation markers (e.g.,[PP-C1]) next to findings informed by source documents and populate the "External References" section in the template.
- Trace delivery through Spec Kit (when a Spec Kit
specs/folder exists):
- If the hook output has a SPEC KIT DELIVERY section, use it directly. It lists, for each requirement, the features owned by this project whose
spec.md,plan.mdortasks.mdcarry an[ArcKit <ID>]tag, with tagged task progress from thetasks.mdcheckboxes, and every feature it did not count and why. - If the hook data is not present, read
specs/*/spec.md,plan.mdandtasks.mdat the repository root, or in the folder named bySPECS=<path>in the arguments, and apply the same rules: - Ownership first. A feature belongs to this project only when its files carry this project's ownership tag,
[ArcKit Project NNN]with this project's three-digit ID, and no other project's. Requirement IDs repeat across projects, so never credit a feature without that tag, or with tags for two projects, even when its requirement IDs match. - From owned features only, take the requirement IDs inside
[ArcKit ...]tags and the- [x]and- [ ]task lines that carry them. - Only IDs inside
[ArcKit ...]tags are ArcKit IDs. Spec Kit numbers each feature's own requirementsFR-001,FR-002and so on; never match one of those to an ArcKit requirement. - Fill the template's Delivery Trace (Spec Kit) subsection. Add each owned feature with no requirement tags, each feature with no ownership tag or more than one, and each tagged ID that REQ does not contain to the Action Items as a gap. If there is no specs folder, omit the subsection.
- Build the traceability matrix:
### Forward Traceability (Requirements → Design → Implementation → Tests)
For each requirement (BR, FR, NFR, INT, DR) from the hook's requirements table:
Step 1: Requirement Details (pre-extracted by hook)
- Requirement ID, description, and category are in the hook's table
- The "Covered" and "Referenced By" columns show which design docs already reference each requirement
- The Priority column is the MoSCoW value on each requirement's
**Priority**:line:MUST_HAVE,SHOULD_HAVE,COULD_HAVEorWONT_HAVE.UNSPECIFIEDmeans the requirement has no priority line, or only the template's unfilled placeholder. Report those as a gap rather than guessing a priority. Use these values in every Priority column of the matrix
Step 2: Design Mapping
- Which HLD components implement this requirement?
- Which DLD modules/classes handle this?
- Architecture patterns used
- Design decisions made
Step 3: Implementation Mapping
- Source code files/modules (if available)
- APIs/endpoints that satisfy this
- Database tables/schemas involved
- Configuration requirements
Step 4: Test Coverage
- Unit test references
- Integration test scenarios
- Performance test cases (for NFRs)
- Security test cases (for security requirements)
- UAT test cases
Step 5: Status
- ✅ Fully implemented and tested
- 🔄 In progress
- ⏳ Planned
- ❌ Not covered (GAP!)
### Backward Traceability (Tests → Implementation → Design → Requirements)
For each test case:
- Which requirements does it verify?
- Which design components does it test?
- What's the expected outcome?
### Gap Analysis
Use the hook's pre-computed data directly:
- Orphan Requirements: Listed in the hook's "Orphan Requirements" section — requirements with NO design references
- Orphan Design Elements: Listed in the hook's "Design-Only References" section — IDs referenced in design docs but absent from REQ files (scope creep?)
- Orphan Tests: Tests not linked to requirements (what are they testing?)
- Coverage Gaps: Requirements without adequate test coverage
- Analyze coverage metrics:
Use the hook's COVERAGE SUMMARY table directly — it already provides:
- Overall coverage (covered / total / percentage)
- Breakdown by category (Business, Functional, Non-Functional, Integration, Data)
- Breakdown by MoSCoW priority (
MUST_HAVE,SHOULD_HAVE,COULD_HAVE,WONT_HAVE, andUNSPECIFIEDwhen any requirement has no priority)
Do NOT recalculate these metrics. Enrich the metrics with additional context:
- Implementation Coverage: % of requirements with implementation evidence (from vendor HLD/DLD prose)
- Test Coverage: % of requirements with test references (from project artifacts)
Apply these thresholds when flagging gaps:
- MUST_HAVE requirements: Should be 100% covered
- SHOULD_HAVE requirements: Should be > 80% covered
- COULD_HAVE requirements: Can be < 50% covered
- WONT_HAVE requirements: agreed not to be delivered this time, so list them but leave them out of the coverage percentages and do not report them as gaps
- Risk Assessment:
Flag high-risk gaps:
- CRITICAL: MUST_HAVE requirements not covered
- HIGH: Security/compliance requirements without tests
- MEDIUM: Performance requirements without validation
- LOW: Optional features not implemented
- Generate Traceability Report:
Create comprehensive report with:
Executive Summary:
- Overall traceability score (0-100)
- Coverage by requirement type
- Critical gaps requiring attention
- Recommendation (Ready for Release / Gaps Must Be Addressed)
Detailed Traceability Matrix:
Large table with columns:
| Req ID | Requirement | Priority | HLD Component | DLD Module | Implementation | Tests | Status |
Gap Analysis:
- List of orphan requirements (requirements not in design)
- List of orphan design elements (design not in requirements - scope creep!)
- List of untested requirements
- Recommendations for each gap
Coverage Metrics:
- Visual representation (can use markdown tables/charts)
- Breakdown by requirement type
- Breakdown by MoSCoW priority (MUST_HAVE, SHOULD_HAVE, COULD_HAVE, WONT_HAVE), from Step 5
- Trend over time (if multiple traceability runs)
Action Items:
- BLOCKING gaps (must fix before release)
- Non-blocking gaps (fix in next sprint)
- Technical debt to track
Before writing the file, read .arckit/references/quality-checklist.md and verify all Common Checks plus the TRAC per-type checks pass. Fix any failures before proceeding.
- Write output:
projects/{project-dir}/ARC-{PROJECT_ID}-TRAC-v${VERSION}.md- Full traceability matrix including coverage metrics and gap analysis (all in one document)
CRITICAL - Show Summary Only:
After writing the file, show ONLY a brief summary with coverage metrics and key gaps. Do NOT output the full traceability matrix content in your response, as matrices can be 800+ lines with detailed requirement-to-test mappings.
CRITICAL - Auto-Populate Document Control Fields:
Before completing the document, populate ALL document control fields in the header:
Step 0: Detect Version
The hook provides the existing TRAC version and a suggested next version. Use these directly:
- If hook says "Existing TRAC version: none": Use VERSION="1.0"
- If hook provides an existing version (e.g., "v1.0"):
- Use the hook's suggested next version as the default (minor increment, e.g., 1.0 → 1.1)
- Major increment (e.g., 1.0 → 2.0): Only if scope materially changed — new requirement categories traced, fundamentally different coverage, significant new artifacts added
- Carry the version through the document and its Revision History as
.arckit/references/version-detection.mddescribes. If the hook gave no version line at all, follow that reference from the start forARC-{PROJECT_ID}-TRAC-v*.md
Step 1: Construct Document ID
- Document ID:
ARC-{PROJECT_ID}-TRAC-v{VERSION}(e.g.,ARC-001-TRAC-v1.0)
Step 2: Populate Required Fields
Auto-populated fields (populate these automatically):
[PROJECT_ID]→ Extract from project path (e.g., "001" from "projects/001-project-name")[VERSION]→ Determined version from Step 0[DATE]/[YYYY-MM-DD]→ Current date in YYYY-MM-DD format[DOCUMENT_TYPE_NAME]→ "Requirements Traceability Matrix"ARC-[PROJECT_ID]-TRAC-v[VERSION]→ Construct using format from Step 1[COMMAND]→ "arckit.traceability"{ARCKIT_VERSION}→ Use the ArcKit Version from the hook's Project section (do NOT search for VERSION files)
User-provided fields (extract from project metadata or user input):
[PROJECT_NAME]→ Full project name from project metadata or user input[OWNER_NAME_AND_ROLE]→ Document owner (prompt user if not in metadata)- Classification → comes from the resolved Document Control header, not from a placeholder.
_partials/RENDERING.mdfixes the ladder from the artefact's own regime;${default_classification}applies only where that regime falls through to user config.
Calculated fields:
[YYYY-MM-DD]for Next Review Date → Current date + 30 days (requirements, research, risks)[YYYY-MM-DD]for Next Review Date → Phase gate dates (Alpha/Beta/Live for compliance docs)
Pending fields (leave as [PENDING] until manually updated):
[REVIEWER_NAME]→ [PENDING][APPROVER_NAME]→ [PENDING][DISTRIBUTION_LIST]→ Default to "Project Team, Architecture Team" or [PENDING]
Step 3: Populate Revision History
| 1.0 | {DATE} | ArcKit AI | Initial creation from `$arckit-traceability` command | [PENDING] | [PENDING] |
Step 4: Populate Generation Metadata Footer
The footer should be populated with:
**Generated by**: ArcKit `$arckit-traceability` command
**Generated on**: {DATE} {TIME} GMT
**ArcKit Version**: {ARCKIT_VERSION}
**Project**: {PROJECT_NAME} (Project {PROJECT_ID})
**AI Model**: [Use actual model name, e.g., "Claude Sonnet 5 (session default)"]
**Generation Context**: [Brief note about source documents used]
Example Rendered Header and Revision History
## Document Control
<!-- DOC-CONTROL-HEADER -->
<!-- Resolved at command-execution time per _partials/RENDERING.md. -->
## Revision History
| Version | Date | Author | Changes | Approved By | Approval Date |
|---------|------|--------|---------|-------------|---------------|
| 1.0 | 2025-10-29 | ArcKit AI | Initial creation from `$arckit-traceability` command | [PENDING] | [PENDING] |
Example Usage
User: $arckit-traceability Generate traceability matrix for payment gateway project
You should:
- Use the hook's requirements table (70 requirements pre-extracted with IDs, categories, coverage status)
- Grep the REQ file's
**Priority**:lines for each requirement's MoSCoW priority (MUST_HAVE / SHOULD_HAVE / COULD_HAVE / WONT_HAVE) - Use the hook's coverage summary (by category) as the baseline metrics, and build the breakdown by MoSCoW priority from the Grep
- Use the hook's orphan requirements and design-only references for gap analysis
- Read vendor HLD/DLD files for component/module names (hook only extracted req ID references)
- Build forward traceability using hook data + vendor prose:
- FR-001 (Process payment) → PaymentService (HLD) → PaymentController.processPayment() (DLD) → Test: TC-001, TC-002
- NFR-SEC-001 (PCI-DSS) → SecurityArchitecture (HLD) → TokenVault, Encryption (DLD) → Test: SEC-001 to SEC-015
- BR-003 (Cost savings) → [NO DESIGN MAPPING] - ORPHAN! (from hook's orphan list)
- Flag gaps using hook's coverage data:
- CRITICAL: BR-003 (Cost savings) has no success metrics defined
- HIGH: NFR-A-001 (99.99% uptime) has no disaster recovery tests
- MEDIUM: NFR-P-003 (Database performance) missing load tests
- Overall Score: 85/100 (Good, but gaps must be addressed)
- Recommendation: APPROVED WITH CONDITIONS - address 3 critical gaps
- Write detailed matrix (including gap analysis) to
projects/001-payment-gateway/ARC-001-TRAC-v1.0.md
Important Notes
- Traceability is required for compliance (ISO, FDA, automotive, etc.)
- Every MUST_HAVE requirement MUST be traced to tests (non-negotiable)
- Orphan design elements may indicate scope creep (investigate!)
- Orphan requirements may indicate incomplete design (blocking issue!)
- Traceability matrix should be updated throughout project lifecycle
- Use this for:
- Go/no-go release decisions
- Audit trail for compliance
- Impact analysis for change requests
- Test coverage verification
- A requirement is only "done" when it's implemented AND tested
- Missing traceability = missing accountability
- Markdown escaping: When writing less-than or greater-than comparisons, always include a space after
<or>(e.g.,< 3 seconds,> 99.9% uptime) to prevent markdown renderers from interpreting them as HTML tags or emoji