okfreq frontmatter reference¶
Every native or imported requirement is an OKF-compatible Markdown file. YAML frontmatter identifies the requirement and records authored relationships. The Markdown body remains useful for rationale, examples, constraints, and review notes. Unknown properties are allowed and must be preserved.
Common fields¶
Field |
Required |
Ownership |
Meaning |
|---|---|---|---|
|
yes |
authored |
Configured tier, such as |
|
yes |
authored |
Stable human-readable identifier. Never renumber an existing ID. |
|
yes |
authored |
Globally unique identity. Native requirements receive a generated UUID; imported requirements must provide one. |
|
yes |
authored |
Short human-readable name. |
|
yes |
authored |
The requirement statement. It should describe observable, bounded behavior or intent. |
|
yes |
authored |
Project or product owning the requirement. |
|
yes |
authored |
Scope used for ownership, allocation, and scan mapping. |
|
yes |
authored |
Tier label used by the requirements hierarchy. |
|
yes |
authored |
One of |
|
yes |
authored |
Source of the requirement, such as |
|
conditional |
authored |
IDs of higher-level requirements, with case-sensitive Markdown filename-stem navigation hints. Native |
|
no |
authored |
Semantic prerequisite or dependency IDs. This is not generated coverage. |
|
when |
authored |
List of one or more requirement IDs that replace this requirement. Required and non-empty exactly when the lifecycle is |
|
no |
authored |
List of requirement IDs related to this one laterally, at any level or scope, for example a sibling feature or a requirement from another release. It has no derivation, supersession or coverage meaning and no generated inverse. |
|
no |
authored |
Controlled method used to verify the requirement, for example |
|
no |
authored |
Optional pass criteria that make verification concrete. |
|
StRS |
authored |
Stakeholder outcome preserved separately from the normative StRS behavior. |
|
SwRS |
authored |
Whether implementation and test marker coverage is intentionally exempted. New SwRS documents default to |
|
SwRS |
authored |
Conditional justification required when |
|
no |
authored |
Identifier of the corresponding requirement in an external system. It is not a local file reference. |
|
no |
authored |
URI of the corresponding requirement in an external system. |
|
no |
authored |
Owner of this requirement when it differs from the configured one. Replaces |
|
when |
authored |
Email of the owner who agreed to the current content. Recorded only on the owner’s explicit agreement. |
|
when |
authored |
ISO 8601 datetime with an explicit UTC offset ( |
Lifecycle states¶
The lifecycle says how freely a requirement may change. Only people change it, through the commands below or an explicit edit; okfreq never infers it.
State |
Meaning |
Change rule |
|---|---|---|
|
A requirement proposal, not implemented yet. |
Free. |
|
Implemented and in force, but not frozen. |
Changes through the project’s usual plan and review, with no explicit owner agreement. |
|
Frozen by its owner. |
Any significant change (normative statement, scenarios, verification criteria, deprecation or supersession) needs the owner’s explicit, justified agreement, recorded in |
|
No longer in force, without replacement ( |
Kept for history; its ID is never reused. |
|
Replaced by the requirements in |
Kept for history. |
Which requirements can be frozen, and by whom, is set per tier and per scope in
config.yml (Ownership and approval):
by default StRS can be approved and SwRS cannot. okfreq validate fails on an
approved requirement whose tier and scope are not lockable, or that lacks
approved_by or approved_at.
A coding agent never approves a requirement, and never changes an approved one, on
its own decision. The owner’s agreement is usually given during planning, where
the agent cannot see it. So when its task changes an approved requirement, the
agent proceeds as if the owner agreed: it records the owner’s email in
approved_by and the current date and time with its offset in approved_at, names
the requirement in the pull or merge request, and requests the owner’s review of the
file. A review rule such as CODEOWNERS then blocks the merge until the owner
approves. okfreq update-coverage then writes the generated status and
verified fields that plain OKF consumers read:
req_lifecycle: approved
status: stable # generated from req_lifecycle
default_owner_email: product-owner@example.org # generated from config.yml
approved_by: product-owner@example.org
approved_at: 2026-10-28T09:00:00+01:00
verified: # generated from the approval
by: human:product-owner@example.org
at: 2026-10-28T09:00:00+01:00
Native OKF projection¶
The tiers/ folder is a plain OKF v0.2 bundle. okfreq keeps its own vocabulary
and generates, as the schemas declare, the fields a consumer that knows only OKF
reads:
okfreq field |
OKF field |
Declared by |
|---|---|---|
|
|
|
|
|
built in, when |
|
Markdown links in the body (section 6.1) |
|
|
|
Read as |
|---|---|---|
|
|
work in progress |
|
|
current |
|
|
retired |
The relations become one generated section at the end of the body, one group per annotated field in schema order, one relative link per value with the target title. A value that does not resolve stays as code, so no broken link is written:
<!-- okf:links:start -->
### Links
<!-- Generated from the frontmatter relations; edit them instead. -->
- Derives from:
- [StRS-demo-001](../../strs/core/StRS-demo-001.md): Export portable reports
<!-- okf:links:end -->
Removing a link-projection label removes its group from every section on the
next okfreq lint or update-coverage; renaming it renames the group. Links that
leave the bundle (project-relative, such as implemented_in_files) cannot be
projected: okfreq validate rejects such a label, a status mapping to a value
outside draft | stable | deprecated or missing a lifecycle value, and a status
that disagrees with the lifecycle. okfreq lint --check and
okfreq update-coverage --check fail on a stale section, status or verified.
Tier-specific Markdown bodies¶
okfreq new deliberately emits different authoring scaffolds for the two
default tiers. Angle-bracket text is an unfinished gap and should remain
visible until it is replaced with evidence-based content. The first Markdown
heading repeats the frontmatter title; update both together when renaming
a requirement. EARS describes the statement format, not the document title.
An StRS preserves stakeholder intent without prescribing software design:
## Export portable reports
### Normative behavior
<stakeholder-observable SHALL statement>
### Preserved stakeholder intent
## User Need
<stakeholder need in the stakeholder's language>
### Rationale and constraints
- <known constraint, exclusion, or rationale>
An SwRS describes software behavior that implementation and tests can observe:
## Write CSV output
### Normative behavior
<observable, bounded software SHALL response>
### Scenario: <nominal behavior>
- GIVEN <precondition and relevant inputs>
- WHEN <trigger or action>
- THEN <single observable, verifiable outcome>
### Scenario: <boundary or failure behavior>
- GIVEN <boundary precondition or failure>
- WHEN <trigger or action>
- THEN <observable recovery, rejection, or boundary outcome>
### Verification notes
- Method: <test, inspection, analysis, or demonstration>
- Criteria: <objective pass condition>
StRS documents do not receive SwRS scenarios or verification notes. SwRS
documents do not receive User Need or stakeholder rationale/constraints.
Annotation exemptions¶
annotation_exemption is a boolean policy decision for a SwRS requirement;
it is not evidence that the requirement has been implemented or tested. Keep it
false unless repository-level source and test markers genuinely cannot apply.
When it is true, exemption_reason must be a non-empty, authored
justification. State what makes normal coverage impossible or inappropriate,
what evidence is used instead, and include a path or URL to an external
justification, verification report, safety case, certification record, or other
reviewable document when one exists.
annotation_exemption: true
exemption_reason: >-
Hardware-in-the-loop evidence is maintained outside this repository. See
https://requirements.example.test/verification/REQ-4821 and report HIL-2026-04.
The schema requires exemption_reason whenever annotation_exemption is
true, and okfreq validate/okfreq lint reject an exemption without that
justification. The reason does not make test execution available to the report;
it records why repository marker coverage is intentionally excluded. See the
Generated and externally maintained fields section above for the distinction
between authored exemption metadata and generated coverage.
Generated and externally maintained fields¶
Field |
Ownership |
Meaning |
|---|---|---|
|
generated |
Reverse links computed from other requirements’ |
|
generated |
Reverse links computed from other requirements’ |
|
generated or external tool |
SwRS-only project-relative source paths containing implementation markers. It is optional and must never be invented. |
|
generated or external tool |
SwRS-only project-relative test paths containing test markers. It is optional and must never be invented. |
|
generated |
Owner resolved from |
|
generated |
OKF lifecycle mapped from |
|
generated |
OKF trust event |
Links section |
generated |
Body section between |
The schema is selected from the type value. Common fields are defined in
tiers/_schema/base.schema.yaml; type: StRS is validated by
tiers/_schema/strs.schema.yaml, and type: SwRS by
tiers/_schema/swrs.schema.yaml. StRS intentionally has no implementation or
test coverage fields, because source and test markers apply only to leaf SwRS
requirements.
okfreq update-coverage may update only the coverage fields it owns. It writes
atomically and supports preview modes. Reports, indexes, and scope indexes are
also generated artifacts and should be regenerated rather than manually edited.
File-link annotations¶
These fields apply the generic okf-schema contract; okfreq does not own a
separate file-link type or resolution engine. New requirement scaffolds contain
the annotations below. Existing requirement schemas and documents are not
migrated or rewritten.
Requirement values are strings, so a consumer needs schema metadata to know
which values it can open as files. For example, this SwRS frontmatter records
the implementation file, its test, its parent requirement, and an external
tracker ID without changing any of their YAML types:
---
type: SwRS
id: SwRS-demo-001
derives_from:
- StRS-demo-001
implemented_in_files:
- src/report/export.py
tested_in_files:
- tests/test_export.py
external_id: DOORS-4821
---
The generated schema tells the consumer how to interpret each value:
implemented_in_files:
type: array
items:
type: string
x-okf-link:
resolution: project-relative
syntax: plain
basename_marker: '@implements_req'
id_marker: id
show_line_number: true
tested_in_files:
type: array
items:
type: string
x-okf-link:
resolution: project-relative
syntax: plain
basename_marker: '@tests_req'
id_marker: id
show_line_number: true
derives_from:
type: array
items:
type: string
x-okf-link:
resolution: filename-stem
syntax: plain
id_marker: id
tooltip_shows_fields: [description]
preview_shows_fields: [description]
superseded_by, supersedes and relates_to use the same array-of-strings
definition as derives_from, each with the filename-stem annotation shown
above. The scaffold written by okfreq init contains them. An existing project’s
tiers/_schema/base.schema.yaml is never rewritten: copy the three property
blocks from a freshly initialized bundle when you want editor navigation for
them, after converting any scalar superseded_by to a list (the array schema
rejects a scalar).
With a project containing src/report/export.py, tests/test_export.py, and
a requirement file named StRS-demo-001.md, the first two values resolve to
exact project-relative files and StRS-demo-001 navigates by Markdown
filename stem. DOORS-4821 remains an external identifier. The file-link
annotations guide navigation; they do not replace the existing requirement-ID
validation or prove that a source file implements the requirement. For source
and test evidence, basename_marker names the marker prefix to search in the
resolved file, while id_marker: id tells a consumer to use the requirement’s
id value. The consumer can therefore find @implements_req <id> or
@tests_req <id> and open directly at that line. A basename is a filename
without its extension; these hints are advisory x-okf-link metadata and are
not checked by okfreq --check-links. tooltip_shows_fields and
preview_shows_fields tell a consumer which linked frontmatter fields are useful
in a hover or preview, while show_line_number requests line-aware source/test
navigation. The CLI validates targets but does not render those UI elements.
Link checking is opt-in:
okfreq validate . --check-links --project-root .
okfreq lint . --check-links --project-root .
The okf-schema repository applies these annotations to its own requirements/
bundle. For example, SwRS-OKFSCHEMA-CORE-007 derives from
StRS-OKFSCHEMA-CORE-003; its generated implementation evidence points to
src/okf_schema/file_links.py, and its test evidence points to
tests/test_file_links.py. From the repository root, check those targets with:
okfreq validate requirements --check-links --project-root . --prose
The StRS states why consumers need recognizable file references without changing value types. The SwRS specifies the shared API, resolution modes, diagnostics, and opt-in behavior; KB and requirements SwRS describe their applied conventions. This is an explicitly maintained repository bundle, not an automatic migration of other existing bundles.
If no project root is supplied, okfreq uses the containing Git root for
project-relative paths. It never infers an editor workspace or uses the current
working directory as a fallback. Missing exact targets and ambiguous filename
stems are E10 errors. An unavailable root or inaccessible matching candidate is
reported as W15 and skipped, because the CLI cannot infer which workspace the
author intended. --check-links does not check heading or block fragments in
wikilinks; it checks only the target file.
StRS documents do not have source coverage. The generated report gives StRS its
own stakeholder-test coverage record, computed from linked SwRS and the
configured strs_test_coverage_mode. A direct @tests_req StRS-ID marker in a
test file counts as a defined validation test when the
linked-swrs-and-validation-test mode is selected.
Marker fields¶
The default marker keywords are:
# In source code:
@implements_req REQUIREMENT-ID
# In tests code:
@tests_req REQUIREMENT-ID
For example:
# @implements_req SwRS-default-001
# @tests_req SwRS-default-001
The keywords and accepted ID pattern are configured in config.yml. trace
reports implementation references, test references, direct StRS validation-test
references, unknown IDs, non-leaf references, and
scan warnings. Projects may configure other tiers; implementation markers on
non-leaf tiers do not count as leaf coverage.
Markers are file-level references
okfreq parses markers at the file level. It does not provide language-specific
parsers, AST analysis, or special support for Python, Rust, TypeScript, C/C++,
or another programming language. A marker is therefore evidence that a file
references a requirement, not proof that a particular function, class, or test
case implements or verifies it. Use normal language tooling, code review, and
the test runner for those stronger checks.
Test results are not parsed
The current traceability report parses @tests_req markers, but it does not
read test-runner output or determine whether a referenced test passed, failed,
was skipped, or ran at all. Its SwRS test-link coverage and configured StRS
coverage are therefore linkage metrics only. In theory, true requirement
coverage requires successful validation tests, connected to the requirement and
executed in the relevant validation run. Until test-result ingestion is
implemented, treat the report’s execution evidence as not_collected.
Read What okfreq coverage really means
for the rationale, limitations, and evidence model behind this behavior.
Extending the model¶
Project-specific properties such as safety_goal, owner, review_board,
risk_class, or a producer’s external reference can be added directly to the
frontmatter. The bundled schema uses additionalProperties: true, so these
properties remain interoperable and are preserved by round-trip editing.
For a new tier, add an entry under tiers in config.yml with its folder,
ID prefix, and allowed parent tiers. Keep the same directional convention:
derives_from is authored and derived_by is computed. For new lifecycle
values or transition policies, update the configuration and validation policy
explicitly; do not silently reinterpret existing lifecycle states.
See the requirements traceability tutorial for examples and the build requirement base guide for the setup workflow.