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

type

yes

authored

Configured tier, such as StRS or SwRS.

id

yes

authored

Stable human-readable identifier. Never renumber an existing ID.

uuid

yes

authored

Globally unique identity. Native requirements receive a generated UUID; imported requirements must provide one.

title

yes

authored

Short human-readable name.

description

yes

authored

The requirement statement. It should describe observable, bounded behavior or intent.

project

yes

authored

Project or product owning the requirement.

scope

yes

authored

Scope used for ownership, allocation, and scan mapping.

tier

yes

authored

Tier label used by the requirements hierarchy.

req_lifecycle

yes

authored

One of draft, proposed, approved, deprecated, or superseded; see Lifecycle states. The field name is lifecycle.field in config.yml (req_lifecycle by default, distinct from the OKF status), and the values are its enum in the base schema.

origin

yes

authored

Source of the requirement, such as native, imported, or a tool name.

derives_from

conditional

authored

IDs of higher-level requirements, with case-sensitive Markdown filename-stem navigation hints. Native SwRS requirements need at least one StRS ID.

depends_on

no

authored

Semantic prerequisite or dependency IDs. This is not generated coverage.

superseded_by

when req_lifecycle: superseded

authored

List of one or more requirement IDs that replace this requirement. Required and non-empty exactly when the lifecycle is superseded; written by okfreq supersede. A single ID written by earlier releases (superseded_by: SwRS-new-001) is still read as a one-item list.

relates_to

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.

verification_method

no

authored

Controlled method used to verify the requirement, for example test, analysis, inspection, or demonstration.

verification_criteria

no

authored

Optional pass criteria that make verification concrete.

user_need

StRS

authored

Stakeholder outcome preserved separately from the normative StRS behavior. okfreq new strs leaves an explicit placeholder when --user-need is omitted.

annotation_exemption

SwRS

authored

Whether implementation and test marker coverage is intentionally exempted. New SwRS documents default to false.

exemption_reason

SwRS

authored

Conditional justification required when annotation_exemption is true. Explain why repository source/test coverage is not applicable and point to external justification or verification documents when available.

external_id

no

authored

Identifier of the corresponding requirement in an external system. It is not a local file reference.

external_url

no

authored

URI of the corresponding requirement in an external system.

owner_email

no

authored

Owner of this requirement when it differs from the configured one. Replaces default_owner_email.

approved_by

when req_lifecycle: approved

authored

Email of the owner who agreed to the current content. Recorded only on the owner’s explicit agreement.

approved_at

when req_lifecycle: approved

authored

ISO 8601 datetime with an explicit UTC offset (2026-10-28T09:00:00+01:00) of that agreement, updated with every agreed change. A bare date is rejected.

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

draft

A requirement proposal, not implemented yet.

Free. okfreq retire can delete it for good. A project whose requirements are delivered with the code they describe should not keep drafts on its default branch: create them with okfreq new --lifecycle proposed in the change that implements them.

proposed

Implemented and in force, but not frozen.

Changes through the project’s usual plan and review, with no explicit owner agreement.

approved

Frozen by its owner.

Any significant change (normative statement, scenarios, verification criteria, deprecation or supersession) needs the owner’s explicit, justified agreement, recorded in approved_by and approved_at. Editorial fixes that keep the meaning are free. Allowed only where approval_lock is true for the tier and scope.

deprecated

No longer in force, without replacement (okfreq archive).

Kept for history; its ID is never reused.

superseded

Replaced by the requirements in superseded_by (okfreq supersede).

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

req_lifecycle

status (section 5.4)

x-okf-status-projection on the lifecycle property

approved_by, approved_at

verified (section 5.2), by a human: actor

built in, when verified is in generated_fields

derives_from, derived_by, depends_on, superseded_by, supersedes, relates_to

Markdown links in the body (section 6.1)

link-projection in each field’s x-okf-link

req_lifecycle

status

Read as

draft

draft

work in progress

proposed, approved

stable

current

deprecated, superseded

deprecated

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

derived_by

generated

Reverse links computed from other requirements’ derives_from fields. Do not author this as the source of truth.

supersedes

generated

Reverse links computed from other requirements’ superseded_by fields: the requirements this one replaces. Written by okfreq update-coverage when supersedes is in generated_fields, only where it has a value (or the field is already present). Do not author it.

implemented_in_files

generated or external tool

SwRS-only project-relative source paths containing implementation markers. It is optional and must never be invented.

tested_in_files

generated or external tool

SwRS-only project-relative test paths containing test markers. It is optional and must never be invented.

default_owner_email

generated

Owner resolved from config.yml for the requirement’s tier and scope. Written by okfreq update-coverage when default_owner_email is in generated_fields, removed when no owner applies. An authored owner_email replaces it.

status

generated

OKF lifecycle mapped from req_lifecycle by x-okf-status-projection; see Native OKF projection. Written by okfreq new, archive, supersede, update-coverage and lint when status is in generated_fields.

verified

generated

OKF trust event {by: human:<approved_by>, at: <approved_at>}, removed when the approval is incomplete. Written when verified is in generated_fields.

Links section

generated

Body section between <!-- okf:links:start --> and <!-- okf:links:end -->, one group per link-projection field.

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.

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.