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 |
|---|---|
|
An index of the documentation with one line per page, following the llms.txt convention. Start here. |
|
The documentation in a single file, in reading order. It is small enough for the context window of current long-context models. |
|
Each page as Markdown, for example |
|
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
[
{
"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.pathis the entity the diagnostic is about (nullfor a syntax error),messagesays what is wrong,spansays where, andsnippetis the text found there. Lines and columns are counted from zero (line 17 is the 18th line of the file) andindexis the byte offset.codeidentifies the kind of issue and never changes,kindis what the issue is about (syntax,path,reference,typingorconnection). Every code is explained in Diagnostics, with an example and the fix: read it before guessing a fix.severityis one oflight,moderate,severeandcritical.A syntax error is in the same list, with the kind
syntaxand the severitycritical. 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
onin 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
refinesorderivesunless it is markedtop, and children unless it is markedbottom. 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,selectnorif: writeall … for … end,any … for … end,choose,argmaxorargmin, andwhen. A range of values isx 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]]`.