View as Markdown

LLMs and agents#

A typed, checked specification grounds a coding agent far better than prose in a markdown file: every term an agent uses is declared, every reference is resolved, and a checker tells it exactly what is wrong. This page lists what is published for language models and how to wire reqtool into an agent loop.

Machine-readable documentation#

Everything is plain text and public. No HTML scraping is needed.

Address

Content

/llms.txt

An index of the documentation with one line per page, following the llms.txt convention. Start here.

/llms-full.txt

The documentation in a single file, in reading order. It is small enough for the context window of current long-context models.

/md/<page>.md

Each page as Markdown, for example /md/reference/entity.md. Every page of this site links to its Markdown version at the top, and declares it with <link rel="alternate" type="text/markdown">.

/sitemap.xml

Every page of the site.

The reference is the specification of the language. When writing req, prefer it, and req by example, over knowledge from training data: the language is young and changes between versions.

Close the loop with the checker#

reqtool check turns a specification into feedback an agent can act on. With --json it prints a machine-readable report:

reqtool check --json spec.req
Report for a formal expression of the wrong type#
[
  {
    "code": "E03010",
    "path": "System::Deceleration_bound",
    "span": {
      "start": { "line": 17, "column": 4, "index": 328 },
      "end":   { "line": 17, "column": 40, "index": 364 }
    },
    "message": "expected type Number got Boolean",
    "severity": "critical",
    "kind": "typing",
    "snippet": "Wheel::deceleration_duration < false"
  }
]
  • The report is a list with one object per diagnostic. An empty list, [], means the specification is clean.

  • path is the entity the diagnostic is about (null for a syntax error), message says what is wrong, span says where, and snippet is the text found there. Lines and columns are counted from zero (line 17 is the 18th line of the file) and index is the byte offset.

  • code identifies the kind of issue and never changes, kind is what the issue is about (syntax, path, reference, typing or connection). Every code is explained in Diagnostics, with an example and the fix: read it before guessing a fix.

  • severity is one of light, moderate, severe and critical.

  • A syntax error is in the same list, with the kind syntax and the severity critical. It means the parser could not read the source: fix these first, the other diagnostics around them may be consequences.

Warning

reqtool check currently exits with status 0 even when it reports issues. An agent or a CI job must read the report (an empty list when the specification is clean), not the exit status.

What the checker enforces today#

An agent writing req should know these rules. They are how reqtool behaves today, and each one corresponds to a diagnostic.

  • Every part and attribute must be used (referenced by a requirement) and restricted (named after on in a requirement).

  • A requirement uses the entity it is on: an identifier in its expression when it is formal, a [[...]] reference in its text when it is informal.

  • A requirement needs a parent through refines or derives unless it is marked top, and children unless it is marked bottom. A requirement marked with both stands alone.

  • The root of the specification is a package. Requirements are written in packages, attributes in parts.

  • Identifiers are made of letters, digits and _, and do not start with a digit.

  • A refining requirement must restrict an entity inside what the refined requirement restricts.

  • References are written [[Path::To::Entity]] inside informal text between @@ markers. They are resolved against the enclosing scopes, or as a full path.

  • Units go between backslashes and are free-form: let speed in real \ m/s \.

  • There is no forall, exists, select nor if: write all … for … end, any … for … end, choose, argmax or argmin, and when. A range of values is x in 3000 tol 50.

A complete specification that follows all of them:

package Sensor_node
  part Radio
    let report_period in real \ min \
    let payload_size in integer \ B \
  part

  requirement Regular_reporting top
    on Radio
  is
    @@
      The [[Radio]] shall report often enough to detect a sensor
      failure within 30 minutes, using small payloads.
    @@
  requirement

  requirement Report_period bottom
    on Radio::report_period
    refines Regular_reporting
  is
    Radio::report_period <= 10
  requirement

  requirement Payload_size bottom
    on Radio::payload_size
    refines Regular_reporting
  is
    Radio::payload_size <= 51
  requirement
package

A snippet for your agent instructions#

Put this in AGENTS.md, CLAUDE.md or the equivalent file of your repository:

## Specifications (req)

- Requirements are written in the req language, in `.req` files.
- Language documentation for agents: https://req-lang.org/llms.txt
  (the whole documentation in one file: https://req-lang.org/llms-full.txt).
- Do not invent syntax. If a construct is not in the documentation, ask.
- After every edit to a `.req` file, run `reqtool check --json <file>` and fix every issue
  until the report is the empty list `[]`. The exit status is 0 even when issues are reported.
- Each issue has a `code`. The Diagnostics page of the documentation explains each code, with an example and the fix.
- Keep informal text in `@@ ... @@` and reference entities with `[[Path::To::Entity]]`.