req, in one page

Requirements that live next to your code, with a tool that knows when a rewording changed what you promised. For people who decide, plan or explain; the engineering view is docs/how-it-works.md.

The problem. A requirement is a sentence. Someone edits the sentence in a pull request, and everyone reads the diff as wording. Whether the edit kept the promise, loosened it or broke it is decided by whoever happens to notice. req makes that question something the tool answers, and leaves the decision to a person.

Before and after, on one real edit

Without a tool that reads meaning

  1. The requirement says “respond within 200 ms”.
  2. A pull request changes it to “within 500 ms”, among other edits.
  3. Reviewers see changed words. The loosening is one number in a larger diff.
  4. It merges if nobody spots it. Nothing in the process failed.

With req

  1. The requirement is a file with a short list of pins: the numbers that matter.
  2. The same edit is made.
  3. The tool states the direction of the change and fails the check on the stale pin.
  4. A person decides, and the decision is recorded.

What that looks like (real output)

Every block below was produced by running req in a scratch corpus when this page was built; none of it is typed in. The requirement is The API shall respond to a health check within 200 ms.

1. The tool reads the sentence and checks what you pinned

$ req canon
REQ-0001  structured   SHALL     API          op LE   value 0.2    unit s     lints -
  pin operator LE: agrees
  pin value 0.2: agrees
  pin unit s: agrees

The line starting REQ-0001 is what the tool understood from the sentence; each pin line is a number a person said must stay true, and the tool agrees.

2. A reword that keeps the promise is not noise

$ req compare claims/REQ-0001.yml reworded.yml
REQ-0001 -> REQ-0001: identical
  cbece4455e74 -> cbece4455e74

“200 ms” and “0.2 s” are the same promise. Same fingerprint, nothing to review.

3. An edit that loosens it is named

$ req compare claims/REQ-0001.yml loosened.yml
REQ-0001 -> REQ-0001: numeric_loosening
  this change permits strictly more than before
  cbece4455e74 -> 7d235640e413

The tool classifies the direction. It does not approve it: ratification is a human act.

4. An edit that forgets the pin fails the check

$ req gate
# Release gate: 1 applying claim(s), 0 undecided (an undecided claim is never treated as absent)

[FAIL] pins_hold
  every pin of every applying claim must agree with the derived parse (3 pin(s), 2 held, 1 flagged)
  - REQ-0001: pin value 0.2 contradicts the parse (0.5)

The release gate fails, naming the claim and the pin. Exit code 1 stops the merge in CI.

Who it is for

What it does not do