A StRS is a use case: something a writer, reviewer or maintainer can do and see in VS Code. A SwRS is one observable behaviour of the extension, written with its scenarios (given, when, then, or a table); a rule many behaviours share is written once and cited by the others. They say what Studio does today, never what we would like it to do.
Why we keep them
The documented behaviour stays equal to the code, a behaviour that looks wrong is written down as a known issue, we know which test checks which behaviour, and a change is reviewed against the requirement, the code and the test together.
How it works
A use case is refined into behaviours, and each behaviour is anchored by a one-line comment holding its identifier: @implements_req where the code produces it, @tests_req in the test that checks it.
A real example
This requirement is read from the report and the repository as they stand: its statement, a scenario, then the two comments that tie it to the code and to the test.
When a writer clicks a checkbox in reading or edit mode, the extension SHALL edit only the character between its brackets, without opening a block editor, and revert the checkbox and show the reason next to it for a few seconds (and as its tooltip) when the host refuses the toggle; the host SHALL accept a previewCheckboxToggle message only with a safe non-negative integer column, a boolean checked state and a single line.
Scenario: Toggle in reading mode
GIVEN a trusted preview with '- [ ] a'
WHEN the checkbox is clicked
THEN the source becomes '- [x] a' and no block editor opens
In the code, the marker next to the implementation: src/core/edits/sourceEdits.ts:54
// @implements_req SwRS-MDOKFSTUDIO-GFM-021
/**
* Gives the task-list marker at 1-based `line`, zero-based `column` (its opening bracket) the
* state `checked`: a one-character edit between the brackets.
*/
export function planCheckboxToggle(text: string, line: number, column: number, checked: boolean): CheckboxTogglePlan {
const lines = sourceLines(text);
In the test, the marker above the test that checks it: test/core/edits/sourceEdits.test.ts:34
// @tests_req SwRS-MDOKFSTUDIO-GFM-021
test("a checkbox toggle changes the one character between the brackets", () => {
const text = "# Tasks\r\n\r\n- [ ] one\r\n- [x] two\r\n";
const toggle = planCheckboxToggle(text, 3, 2, true);
assert.deepEqual(toggle, { edit: { start: 14, end: 15, text: "x" } });
assert.equal(applied(text, toggle), "# Tasks\r\n\r\n- [x] one\r\n- [x] two\r\n");
assert.equal(applied(text, planCheckboxToggle(text, 4, 2, false)), "# Tasks\r\n\r\n- [ ] one\r\n- [ ] two\r\n");
What keeps it in sync
CI runs okfreq validate on the files and links, okfreq lint --check on the navigation and okfreq update-coverage --check on the markers, so a change that moves marked code or tests moves the markers in the same commit.
The figures
Counts come from the okfreq generate-report JSON and cover active requirements only (15 approved, 518 proposed); retired ones are counted below. Report generated 2026-11-24T08:38:44.949563+00:00.