Prose analysis
MarkSpec performs quality analysis on the body prose of authored entries — the
paragraphs and list items that describe what a requirement means, not just its
identity. Prose analysis runs after parsing and validation, in markspec lint
and in a project-wide markspec check. Its diagnostics are warnings and
information only, so they never make markspec check exit with code 1.
Scope
Only authored entries of Specification-family types are analysed. The scope predicate is:
shape = Authored AND core type ∈ { Requirement, Test, Contract, Record, Risk }
or a profile subtype of any of the above
Reference-shape entries are excluded — they point to external documents whose
prose MarkSpec does not own. Core types outside the Specification family (e.g.
SoftwareComponent, Definition, Annotation) are also excluded; structural
descriptions and glossary entries follow different writing conventions.
A profile subtype counts whether the entry names it in Type: or matches its
display-ID pattern. markspec lint and a project-wide (bare) markspec check
apply the same scope. markspec check <file> runs no prose lint.
Suppression-hygiene rules (MSL-Q9xx) run on all authored entries
regardless of type.
All active rules
The Stage-2 prose-analysis build (ADR-021) ships the rules below. Severity and
score contribution drive the project-level roll-up surfaced by
markspec lint --format json (band counts + mean; no trend artifact in core, by
design — see
ADR-021).
| Code | Slug | Surface | Severity | Score |
|---|---|---|---|---|
| MSL-Q100 | ears-no-pattern | EARS | info | 1 |
| MSL-Q101 | ears-missing-actor | EARS | warning | 3 |
| MSL-Q102 | ears-negative-response | EARS | info | 1 |
| MSL-Q103 | ears-stacked-preconditions | EARS | warning | 3 |
| MSL-Q104 | ears-malformed-attempt | EARS | info | 1 |
| MSL-Q200 | modal-multiple | Modal sentence | warning | 3 |
| MSL-Q201 | modal-soft-in-normative | Modal sentence | info | 1 |
| MSL-Q300 | incose-r2-active-voice | Passive voice | warning | 3 |
| MSL-Q301 | incose-r3-subject-verb | Passive voice | info | 1 |
| MSL-Q302 | incose-r7-vague-term | INCOSE lexicon | warning | 3 |
| MSL-Q303 | incose-r8-escape-clause | INCOSE lexicon | warning | 3 |
| MSL-Q304 | incose-r9-open-ended | INCOSE lexicon | info | 1 |
| MSL-Q305 | incose-r10-superfluous-infinitive | INCOSE lexicon | info | 1 |
| MSL-Q310 | incose-r26-absolute | INCOSE lexicon | info | 1 |
| MSL-Q313 | incose-r16-not | INCOSE lexicon | info | 1 |
| MSL-Q400 | struct-title-length | Structural | info | 1 |
| MSL-Q401 | struct-body-length | Structural | info | 1 |
| MSL-Q500 | xref-glossary-undefined | Flagship cross-ref | warning | 3 |
| MSL-Q900 | disable-without-rationale | Suppression hygiene | warning | — |
| MSL-Q901 | disable-unknown-rule | Suppression hygiene | warning | — |
| MSL-Q902 | disable-unused | Suppression hygiene | info | — |
The EARS (MSL-Q100–MSL-Q104), modal sentence (MSL-Q200–MSL-Q201),
passive voice (MSL-Q300–MSL-Q301) and INCOSE sentence
(MSL-Q306–MSL-Q309, MSL-Q311, MSL-Q312, MSL-Q402) rules do not read
text in inline code, link destinations, titles and labels, autolinks, images,
link reference definitions, footnote labels and raw HTML. A modal keyword or a
passive phrase in those places does not count. An inline link and a full
reference link keep their visible text as prose, and the rules read it. In a
shortcut or collapsed reference that has a definition ([shall], [shall][]),
the text is the label, so the rules skip it.
MSL-Q201 reports a soft modal (should, may, with or without not) in an
entry whose core type is Requirement. With a profile, the entry is classified
with it, so a profile type that extends Requirement counts, whether the entry
names it in Type: or matches its display-ID pattern. This is the same check
that MSL-M061 and MSL-M062 use. Without a profile, only types that core
resolves on its own count, such as Type: Requirement or the built-in REQ
display-ID prefix.
The flagship rule MSL-Q500 xref-glossary-undefined flags capitalized
proper-noun usage in normative prose that has no corresponding Definition
entry in the glossary. It ships with a glossary-only subset resolver
($Identifier / RIDL rules degrade-to-silent until ADR-016 marker pass lands).
The default severity is warning, and core ships an English-baseline allowlist
of universally-true capitalized words (calendar / geography / languages) at
packages/markspec/core/lexicons/capitalized-allow.txt — list-additive across
profile tiers, capped, and explicitly excludes domain vocabulary and
standards-body acronyms. Text in inline code, link destinations, titles and
labels, autolinks, images, link reference definitions, footnote labels and raw
HTML is not read as a term. The rule skips modal and EARS keywords in any
casing, so it never reports SHALL or WHEN. A glossary term that contains a
keyword, such as May Day Protocol, is not split at the keyword when the
keyword is in Title case or all caps and the term starts where the capitalized
phrase starts, including at the start of a sentence. The rule tries the leading
parts of the phrase, longest first. A term that starts later in the phrase is
still split: with day-when-protocol defined, the Pump Day When Protocol is
split at When.
Modal keyword analysis
Modal keywords signal the obligation level of a requirement. MarkSpec enforces
the RFC 2119 / EARS convention that modals appear in lowercase under the
default casing. Under modal-keywords.casing: rfc8174, shall and must are
written in uppercase instead, and under preserve the source casing is kept:
| Keyword | Obligation |
|---|---|
shall | Mandatory |
shall not | Prohibited |
should | Recommended |
should not | Not recommended |
may | Optional |
must | External constraint (use shall for internal) |
must not | Prohibited (external constraint) |
MSL-M060 — modal-keyword-uppercase (warning)
Fires when any of the above keywords appears in uppercase (SHALL, MUST, …)
inside body prose, under the default casing (also selected by rfc2119 and
iso). It is not emitted under modal-keywords.casing: preserve or rfc8174.
Under the default casing, the formatter (markspec fmt) rewrites uppercase
modals in prose to lowercase automatically. It keeps the case of a keyword in
inline code, link destinations, titles and labels, autolinks, images, link
reference definitions, footnote labels and raw HTML, and this diagnostic does
not report a keyword in those places either, so a formatted file does not show
it.
warning[MSL-M060]: requirements.md:12 modal keyword 'SHALL' in body prose is
uppercase (spec §3.4.1 canonical form is lowercase; 'markspec fmt' will
rewrite it)
Verbatim blocks (fenced code, math, feature snippets) are excluded — modal keywords inside code examples are not checked.
MSL-M061 — missing-modal-keyword (info)
Fires on an entry whose type resolves to Requirement when its body contains no
modal keyword at all. The type resolves to Requirement for an explicit
Type: Requirement, a profile type that extends Requirement (set by an
explicit Type: or by the profile display-ID pattern), the built-in REQ
display-ID prefix, or a .feature Feature or Rule entry. A keyword in inline
code, link destinations, titles and labels, autolinks, images, link reference
definitions, footnote labels and raw HTML does not count. This is a style hint:
a requirement without an obligation word is often a description masquerading as
a requirement.
info[MSL-M061]: requirements.md:7 Requirement entry contains no modal keyword
(shall / should / may / must) — consider declaring one to make the obligation
explicit
MSL-M062 — modal-keyword-lowercase-rfc8174 (info)
Fires only under the profile convention modal-keywords.casing: rfc8174, on
each lowercase modal keyword in an entry whose type resolves to Requirement:
the core type, a profile type that extends it (set by an explicit Type: or by
the profile display-ID pattern), the built-in REQ display-ID prefix, or a
.feature Feature or Rule entry. Under that convention only uppercase keywords
are normative, and MSL-M060 is not emitted. Like MSL-M060, it does not
report a keyword in inline code, link destinations, titles and labels,
autolinks, images, link reference definitions, footnote labels and raw HTML,
which the formatter keeps as written.
The diagnostic covers every lowercase modal keyword: shall, must, may,
should, will, and should not (as well as shall not and must not).
markspec fmt uppercases only shall and must, so MSL-M062 on may,
should or will stays until the author uppercases the word, if it is
normative, or leaves it as plain English.
info[MSL-M062]: requirements.md:12 modal keyword 'shall' is lowercase; under
RFC 8174 only uppercase keywords are normative
EARS pattern recognition
EARS (Easy Approach to Requirements Syntax) defines five body forms for
requirement entries. MarkSpec recognises the leading keyword of each form and
uses it internally for normalization — under the default casing, capitalisation
is preserved at sentence start and lowercased mid-sentence (rfc8174 and
preserve keep the source casing of EARS keywords).
| Form | Leading keyword | Template |
|---|---|---|
| Ubiquitous | (none) | The system shall … |
| State-driven | While | While state, system shall … |
| Event-driven | When | When event, system shall … |
| Unwanted | If | If condition, system shall … |
| Optional | Where | Where feature, system shall … |
The EARS form is currently used for normalization only; no lint rule fires on an
EARS keyword choice. Future rule group ears is reserved for form-specific
checks (e.g. ensuring state-driven requirements name a concrete state).
GWT pattern
GWT (Given / When / Then) is the standard body form for Test entries. MarkSpec
accepts GWT prose without enforcing structural rules in the current phase; the
three clauses are plain prose paragraphs.
Recommended form:
- [SWT_BRK_0030] Debounce rejects short pulses
Given the debounce threshold is 10 ms, When a pulse of 5 ms arrives, Then the
output shall remain unchanged.
Id: 01HGW3R9QNP4ABCDEFGHJKMNPQ
Type: test
Verifies: 01HGW2Q8MNP3RSTVWXYZABCDEF
GWT-specific lint rules (detecting missing clauses, mixed-form bodies) are planned for a future phase.
INCOSE lexicon rules
These rules flag vocabulary patterns that the INCOSE Guide to Writing Requirements (GtWR) identifies as common sources of ambiguity. All rules apply to prose-bearing blocks (paragraphs, notes, list items); tables, code, and math blocks are excluded.
| Code | Name | Severity | Examples of flagged text |
|---|---|---|---|
| MSL-Q302 | incose-r7-vague-term | warning | some, several, many, adequate, sufficient, reasonable, as needed |
| MSL-Q303 | incose-r8-escape-clause | warning | as appropriate, where possible, if practicable, to the extent possible |
| MSL-Q304 | incose-r9-open-ended | info | including but not limited to, etc., and/or |
| MSL-Q305 | incose-r10-superfluous-infinitive | info | be able to, be designed to, in order to |
| MSL-Q310 | incose-r26-absolute | info | 100%, always, never, complete, entirely |
| MSL-Q313 | incose-r16-not | info | not (whole-word; excludes note, notation) |
Rules MSL-Q302 and MSL-Q303 are warning severity — they flag text that
routinely causes requirement verification ambiguity. The remaining rules are
info — informational hints that the author should consider but that do not
necessarily indicate a defect.
Example
warning[MSL-Q302]: src/braking/requirements.md:14 vague term 'sufficient' in
body prose — specify a measurable threshold instead (INCOSE GtWR R7)
warning[MSL-Q303]: src/braking/requirements.md:19 escape clause 'as appropriate'
weakens verifiability (INCOSE GtWR R8)
Structural quality rules
Two rules check the shape of entries rather than their vocabulary.
MSL-Q400 — struct-title-length (info)
The entry title should be between 3 and 120 characters. A 1–2 character title is almost certainly incomplete; a title longer than 120 characters is usually a sentence that belongs in the body.
MSL-Q401 — struct-body-length (info)
The entry body should contain between 5 and 500 words. An entry with fewer than 5 words has no meaningful description; one exceeding 500 words is likely describing multiple concerns that should be split.
Both thresholds are hard-coded defaults in the current phase. Profile-level
configuration (e.g. prose.struct.title.maxLength) is planned but not yet
implemented.
Suppression
A rule can be silenced for a specific entry by adding two trailer attributes:
- [SRS_BRK_0108] Legacy inherited requirement
The system shall operate as appropriate for the ambient conditions.
Id: 01HGW2Q8MNP3RSTVWXYZABCDEF
Markspec-disable: MSL-Q303
Rationale: Verbatim from customer SRS version 1.2; cannot be rephrased
without an approved change request.
Both Markspec-disable and Rationale must be present; a suppression without a
rationale fires MSL-Q900 (disable-without-rationale). Citing an unknown rule
code fires MSL-Q901 (disable-unknown-rule). A disable that did not match any
diagnostic during a run fires MSL-Q902 (disable-unused) — one diagnostic per
unused code at the entry’s location — so stale escape hatches get pruned. These
three hygiene rules run on all authored entries regardless of type and cannot
themselves be suppressed.
Running prose analysis
markspec lint <paths...> # info, warning, error output to stderr
markspec lint --format json <paths...> # structured JSON to stdout
markspec lint --strict <paths...> # promote warnings to errors (exit 1)
The lint subcommand is separate from check; the pre-commit hook (see the
git hooks recipe) does not run lint —
lint is a review-time quality gate, not a commit blocker.