User Guide
Overview
The Antora Requirements Traceability Extension adds role-based traceability to your Antora documentation. Define items with a single [item] block macro, reference them through user-defined relation types, and generate traceability matrices and coverage reports — all driven by your domain model.
Key capabilities:
-
One macro for everything —
[item, role=…]replaces role-specific macros -
User-defined roles and relations — configure your own traceability domain (requirements engineering, agile, medical, or custom)
-
Built-in presets — start with
requirements-engineering,agile,medical-iec62304, orminimal -
Matrix generation — HTML and CSV matrices per your configuration
-
Coverage reports — visual per-role coverage with status badges
-
Neo4j export — CSV and Cypher for graph queries
-
CLI — standalone processing outside Antora
-
Validation — catches invalid relations at processing time
Getting Started
Already have an Antora site? Skip to step 2.
-
Install the extension
npm install antora-tracer --save-dev -
Add it to your Antora playbook (
antora.yml)antora: extensions: - require: antora-tracer/antora-extension config: preset: requirements-engineering -
Write items in your AsciiDoc files
[#REQ-001, item, role=requirement] ==== User Authentication The system shall require authentication for all protected endpoints. ==== [#IMP-001, item, role=implementation] ==== Auth Service JWT-based authentication with token refresh. satisfies:REQ-001[] ==== [#TEST-001, item, role=test] ==== Authentication Tests Unit and integration tests for the auth service. verifies:REQ-001[] tests:IMP-001[] ==== -
Build your site
npx antora antora-playbook.yml -
Open the output
Open
<site-output>/traceability/index.html— you’ll find matrices and a coverage report.
The Traceability Model
Before you write items, understand the three concepts that define your traceability domain.
Roles
A role is a category of traceable item. Think of it as a type label: "requirement", "design", "test", "user_story", "risk_control". Roles are purely user-defined — the extension has no built-in roles. You define them in your traceability configuration, and every [item] gets a role attribute.
[#REQ-001, item, role=requirement]
[#STORY-001, item, role=user_story]
[#TEST-001, item, role=test]
Relations
A relation connects two items of specific roles. Relations are directional (source → target) and typed (satisfies, verifies, implements, etc.). Which relation types are allowed between which roles is defined in your configuration.
[#IMP-001, item, role=implementation]
====
satisfies:REQ-001[] (1)
implements:DES-001[] (2)
====
| 1 | Implementation satisfies Requirement |
| 2 | Implementation implements Design |
Matrices
A matrix cross-references items of one role (rows) against items of other roles (columns), counting how many of each relation type exist. Matrices are configurable — you decide which roles go on rows, which on columns, and which relation types count as "coverage."
Requirement |
Design |
Implementation |
Test |
REQ-001 |
DES-001 |
IMP-001 |
TEST-001 |
REQ-002 |
— |
— |
TEST-002 |
Configuration
The extension is configured through your Antora playbook.
Using a Preset
The simplest path. Pick a preset that matches your domain:
antora:
extensions:
- require: antora-tracer/antora-extension
config:
preset: requirements-engineering
Four built-in presets are available:
| Preset | Best For |
|---|---|
|
Systems & software engineering |
|
Agile/Scrum teams with user stories |
|
Medical device software (IEC 62304) |
|
Getting started, simple projects |
See Presets Reference for the full breakdown of each preset.
Custom Configuration
For full control, point to a traceability YAML file:
antora:
extensions:
- require: antora-tracer/antora-extension
config:
configPath: ./config/traceability.yml
The configuration file defines your roles, the allowed relations between them, and the matrices to generate:
traceability:
roles:
- requirement
- design
- implementation
- test
relations:
requirement:
design: [addresses, satisfied_by]
implementation: [implemented_by]
test: [verified_by]
design:
requirement: [implements]
implementation: [realized_by]
test: [validated_by]
implementation:
requirement: [satisfies]
design: [implements]
test: [tested_by]
test:
requirement: [covers, verifies]
implementation: [tests]
matrices:
- name: requirements-traceability
description: "Requirements to design, implementation, and test"
rows: requirement
columns: [design, implementation, test]
coverageRelations:
design: [addresses, satisfied_by, implements]
implementation: [implemented_by, satisfies, implements]
test: [verified_by, covers, verifies, tests]
Understanding the Config
- Roles
-
A flat list of strings. Every
[item]must have arolethat appears in this list. Roles are case-insensitive. - Relations
-
A nested map:
source_role → target_role → [allowed_types]. Each entry says "items with role X can use relation types [A, B, C] to point at items with role Y." If you write a relation that isn’t in this map, the extension reports an error with the allowed types. - Matrices
-
An array of matrix definitions. Each matrix has:
-
name— used in the output filename (matrix-<name>.html) -
rows— the role that becomes the row index -
columns— roles that become columns -
coverageRelations— which relation types count as "coverage" for each column role
-
Relation Validation
When the extension processes your items, it validates every inline relationship against your configuration. If you write:
[#DES-001, item, role=design]
====
verifies:REQ-001[] (1)
====
| 1 | verifies from design to requirement — is that allowed? |
The extension checks: does relations.design.requirement include verifies? If not, you get:
Error: Relation 'verifies' not allowed from 'design' to 'requirement'. Allowed: [addresses, satisfied_by, implements]
This catches misconfigurations early and prevents invalid traceability graphs.
Playbook Options
All playbook-level configuration options:
| Option | Type | Default | Description |
|---|---|---|---|
|
boolean |
|
Set to |
|
string |
|
Built-in preset name; overridden by |
|
string |
— |
Path to a custom traceability YAML file; takes precedence over |
|
string |
|
Output directory relative to the site output root |
|
boolean |
|
Generate traceability matrices; set to |
|
string[] |
|
Output formats; valid values: |
|
boolean |
|
Add traceability pages to the Antora site navigation |
Writing Items
The [item] Block Macro
[#TYPE-XXX, item, role=<role>, title="TYPE-XXX — Title", status="draft"]
====
Item content. Can span multiple paragraphs.
Inline relationships go anywhere inside the block:
<relation-type>:TARGET-ID[]
<relation-type>:TARGET-ID[]
====
Attributes
| Attribute | Required | Description |
|---|---|---|
|
Yes |
Unique identifier. Recommended format: |
|
Yes |
Must match a role in your configuration. Case-insensitive |
|
No |
Display title. Defaults to the |
|
No |
Free-form status: |
|
No |
Free-form priority: |
Inline Relationships
A relationship is expressed as <relation-type>:<TARGET-ID>[] anywhere inside the item block. The TARGET-ID must match the id of another item.
[#IMP-001, item, role=implementation]
====
Auth Service
satisfies:REQ-001[]
implements:DES-001[]
depends_on:IMP-002[]
====
Relationship syntax:
-
Multiple targets per type:
satisfies:REQ-001,REQ-002,REQ-003[] -
Multiple types per item: write each on its own line
-
The extension validates that each relation is allowed by your config
Inline Macros Are Data Markers
|
Inline relationship macros ( This keeps your source clean — type the relationship once, let the macros handle display. |
The traceability:outgoing[] Macro
Place traceability:outgoing[] inside an item block to render all outgoing relationships as a formatted list:
[#ARC-001, item, role=architecture, title="ARC-001 — Project Scope"]
====
Project description...
addresses:REQ-001[]
addresses:REQ-006[]
addresses:REQ-009[]
traceability:outgoing[]
====
The macro queries the traceability graph at build time and generates AsciiDoc output — lists, tables, or inline xrefs — showing each relationship with the target’s full title.
The traceability:incoming[] Macro
Place traceability:incoming[] inside an item block to render all incoming relationships — items that reference this item from elsewhere:
[#REQ-001, item, role=requirement, title="REQ-001 — System shall..."]
====
Requirement description...
traceability:incoming[]
====
The macro displays relationships pointing TO this item, with inverse relation type labels (e.g., addresses becomes Addressed by). This is useful for seeing which architecture components, designs, or tests reference a given requirement.
Opt-in per page via document attributes:
= Architecture
:traceability-links: true
:traceability-style: list
:traceability-order: target-id
| Attribute | Effect |
|---|---|
|
|
|
|
|
|
PDF compatibility: The macro generates standard AsciiDoc constructs (xrefs, lists, tables) — compatible with both HTML and PDF backends identically.
Role-Based Validation
The extension validates:
-
Role exists — if
role=widgetandwidgetisn’t in your config, you get a warning:Unknown role "widget". Known roles: requirement, design, test. -
Relation allowed — if you write
` from a `documentbut your config only allowsdocument → requirement: [contains], you get an error listing the allowed types. -
Target exists — if
TARGET-IDdoesn’t exist, you get:Target item not found: MISSING-001.
Warnings don’t block processing; errors do. Unknown roles generate warnings (graceful degradation). Invalid relations generate errors.
ID Conventions
While any unique string works, a consistent convention helps readability:
| Pattern | Example | Convention |
|---|---|---|
Role prefix |
|
Two-to-four uppercase letters, hyphen, number |
Hierarchical |
|
Dotted namespace |
Domain prefix |
|
Project prefix |
Sharing Items Across Files
Items can live in any .adoc file in your Antora component. The extension aggregates all items across all files into a single traceability graph. A requirement in modules/ROOT/pages/requirements.adoc can be referenced by an implementation in modules/impl/pages/services.adoc — as long as the IDs match.
Generated Output
After a build, generated artifacts appear in <site-output>/traceability/ (or wherever you set outputDir).
Traceability Index
traceability/index.html — a landing page with links to all matrices and the coverage report.
Matrices
One HTML and one CSV file per configured matrix:
| File | Description |
|---|---|
|
HTML table with color-coded status badges |
|
CSV with header row and summary statistics |
Each matrix row shows one item (from the rows role) and its related items per column role. Cells show IDs of related items, or — if none exist. All item IDs are clickable links — clicking navigates to the item’s definition in the rendered HTML documentation.
Status badges in the HTML output:
| Badge | Meaning |
|---|---|
✓ Complete |
At least one relationship in every column |
◐ Partial |
Relationships in some columns but not all |
✗ Missing |
No relationships at all |
Matrix filenames use the matrix name from your config. With the requirements-engineering preset, you’ll see files like matrix-requirements-traceability.html and matrix-design-verification.html.
Coverage Report
traceability/coverage.html — a visual breakdown:
-
Total items per role
-
Items with at least one relationship per configured coverage relation
-
Overall coverage percentage
-
Color-coded progress bars: green (≥80%), orange (50-79%), red (<50%)
Neo4j Export
traceability/neo4j/nodes.csv and traceability/neo4j/relationships.csv — see Neo4j Export for details.
CLI Reference
The extension provides a CLI for use outside Antora:
# Display help
npx antora-tracer --help
process
Process AsciiDoc files to populate the traceability graph.
npx antora-tracer process -i docs/ --preset requirements-engineering
npx antora-tracer process -i requirements.adoc --config ./traceability.yml
Options:
- -i, --input <path> — input file or directory (required)
- -o, --output <path> — output directory (default: ./output)
- -f, --format <format> — output format: html, csv, json (default: html)
- --preset <name> — built-in preset
- --config <path> — custom traceability YAML
matrix
Generate traceability matrices from processed items.
npx antora-tracer matrix -i docs/ -t requirements-traceability -f html
npx antora-tracer matrix -t requirements-traceability -f csv -o matrix.csv
Options:
- -i, --input <path> — input file to process first (optional)
- -t, --type <type> — matrix name from your config
- -f, --format <format> — csv, html, or json (default: csv)
- -o, --output <path> — output file (defaults to stdout)
validate
Validate the traceability graph for orphaned items, missing targets, and invalid relations.
npx antora-tracer validate -i docs/ --preset requirements-engineering
Options:
- -i, --input <path> — input file or directory to validate
- --preset <name> — built-in preset
- --config <path> — custom traceability YAML
The command exits with a non-zero code if errors are found.
export neo4j
Export the graph to Neo4j-compatible formats.
npx antora-tracer export neo4j -i docs/ --format csv -o ./neo4j-export/
npx antora-tracer export neo4j -i docs/ --format cypher -o ./neo4j-export/
Options:
- -i, --input <path> — input file or directory to process first
- --format <format> — csv (nodes + relationships) or cypher (single script)
- -o, --output <path> — output directory
stats
Display role statistics for the current graph.
npx antora-tracer stats -i docs/ --preset requirements-engineering
Output shows item counts per role and relationship counts.
preset
Manage built-in presets.
npx antora-tracer preset list (1)
npx antora-tracer preset show requirements-engineering (2)
npx antora-tracer preset init -n medical-iec62304 -o ./config/ (3)
| 1 | List all available presets with descriptions |
| 2 | Show a preset’s configuration details |
| 3 | Write a preset’s traceability YAML to a file for customization |
Options (init):
- -n, --name <name> — preset name (required)
- -o, --output <path> — output directory (default: current directory)
Presets Reference
requirements-engineering
Systems and software engineering. Five roles with comprehensive relation coverage.
Roles |
|
Matrices |
|
Key relations: design → requirement [addresses, satisfies], implementation → requirement [satisfies], implementation → design [implements], test → requirement [covers, verifies], test → implementation [tests]. The requirement role defines only requirement-to-requirement relations (refines, depends_on, conflicts_with); downstream roles declare their own relations back to requirements.
agile
Agile/Scrum teams. Eight roles mapping the Scrum backlog.
Roles |
|
Matrices |
|
Key relations: epic → feature [contains], user_story → task [broken_down_into], task → user_story [implements], test → user_story [verified_by], task → bug [fixes].
medical-iec62304
Medical device software compliant with IEC 62304. Five roles with safety classification support.
Roles |
|
Matrices |
|
Key relations: system_requirement → software_requirement [allocated_to], system_requirement → risk [mitigated_by], software_requirement → software_requirement [refines, depends_on], mitigation → risk [mitigates].
minimal
Two roles — the simplest possible setup. Good for learning and prototypes.
Roles |
|
Matrices |
|
Key relations: test → requirement [covers], test → requirement [verified_by], requirement → requirement [depends_on].
Initializing a Custom Preset
Start from a built-in preset, then customize:
npx antora-tracer preset init -n requirements-engineering -o ./config/
This writes the preset’s YAML to ./config/traceability.yml. Edit it to add roles, change relations, or add matrices, then point your playbook at it with configPath.
Neo4j Export
CSV Export
Generates two files:
-
nodes.csv— all items with id, role, title, content, and attributes -
relationships.csv— all relationships with source, target, and type
Import into Neo4j:
LOAD CSV WITH HEADERS FROM 'file:///nodes.csv' AS row
CREATE (n:Item {id: row.id, role: row.role, title: row.title});
LOAD CSV WITH HEADERS FROM 'file:///relationships.csv' AS row
MATCH (a:Item {id: row.fromId}), (b:Item {id: row.targetId})
CREATE (a)-[r:RELATES {type: row.type}]->(b);
Cypher Export
Generates a single import.cypher file with CREATE statements for all nodes and relationships. Can be executed directly in Neo4j Browser or via cypher-shell.
Example Queries
Once imported into Neo4j, ask questions like:
// Requirements without any implementation or test coverage
MATCH (r:Item {role: 'requirement'})
WHERE NOT EXISTS {
MATCH (r)<-[:RELATES]-(:Item)
}
RETURN r.id, r.title ORDER BY r.id
// Full traceability chain: requirement → design → implementation → test
MATCH path = (r:Item {role: 'requirement'})<-[:RELATES]-(d:Item {role: 'design'})
-[:RELATES]->(i:Item {role: 'implementation'})<-[:RELATES]-(t:Item {role: 'test'})
RETURN r.id, d.id, i.id, t.id
// Impact analysis: what depends on REQ-001?
MATCH (r:Item {id: 'REQ-001'})
OPTIONAL MATCH (r)<-[:RELATES]-(d:Item {role: 'design'})
OPTIONAL MATCH (d)-[:RELATES]->(i:Item {role: 'implementation'})
RETURN r.id, collect(d.id) as designs, collect(i.id) as implementations
Each preset also ships with example Cypher queries in its documentation. View them with:
npx antora-tracer preset show requirements-engineering
Recipes & Patterns
Common Setups
- Requirements-driven development:
-
Use
requirements-engineeringpreset. Define requirements first, then implementations, then tests. Each implementationsatisfiesa requirement; each testverifiesa requirement. - Agile backlog traceability:
-
Use
agilepreset. Epics contain features, features break down into user stories, user stories break down into tasks. Tests verify stories; tasks fix bugs. - Regulatory compliance:
-
Use
medical-iec62304preset. System requirements drive software requirements, which are implemented by software items and verified by tests. Risk controls trace to software requirements. - Just getting started:
-
Use
minimalpreset. Requirements and tests only. Add more roles as your traceability needs grow.
Multi-Component Projects
If your Antora site has multiple components, each with its own .adoc files, items are aggregated across all components automatically. Use consistent ID conventions across components to ensure relationships resolve correctly.
Incremental Adoption
-
Start with
minimal— two roles, one matrix -
Add roles as you identify new traceability needs
-
Graduate to
requirements-engineeringoragilewhen your model stabilizes -
Customize via
preset initwhen you need domain-specific adjustments
Troubleshooting
- Items not appearing in matrices
-
Check that the item’s
rolematches a row or column in your configured matrices. Items with roles not referenced in any matrix still exist in the graph but won’t appear in matrix output. - Relationships not showing up
-
Verify the relation type is listed in
coverageRelationsfor the relevant column. Only relations matching those types count as coverage. - "Relation not allowed" errors
-
Your configuration doesn’t permit that relation type between those roles. Check
traceability.ymlrelationssection. Add the missing type or use an allowed type. - "Unknown role" warnings
-
The item’s
roleattribute doesn’t match any role in your configuration. Either add the role totraceability.ymlor correct theroleattribute on the item. - Build completes but no traceability output
-
Verify
enabled: truein your playbook config. Check that your.adocfiles are in the Antora content catalog (have page family). Enable verbose Antora logging for more detail.