Written files
Agents write the files under grimoire/features/, grimoire/apps/, grimoire/tasks/ and grimoire/releases/.
Each kind of file has a fixed template. Warlock reads these files and never edits them, with two exceptions: the
collected list of a release file, between its two markers, which warlock grimoire release writes, and
warlock grimoire release --stamp, which moves the ## Unreleased entries of the feature changelogs under the
release’s section and writes a missing release file, only when you pass --stamp.
A file that does not follow its template gives a structure finding (GR1001 to GR1028) with the file and line.
Warlock still reads everything else in the file, so the other checks keep working. The full list of codes is at the
end of this page.
The layout
Section titled “The layout”grimoire/ features/ <feature>/ README.md the feature as it is now CHANGELOG.md one entry per feature version flows/<flow>.md one path through the feature versions/v<n>.md the brief written before a whole-number version apps/ <app>/ README.md one site or mobile app and its conditions layouts/<layout>.md blocks every page of a layout shares pages/<page>/README.md a page of a site pages/<page>/blocks/<block>.md screens/<screen>/README.md a screen of a mobile app screens/<screen>/blocks/<block>.md tasks/ open/T-<n>-<slug>.md done/<yyyy-mm>/T-<n>-<slug>.md releases/<release>.md settings.md optional: languages, screenshot mode, code rules, protected areas approved/ what the owner approved (baseline.json, api.json), in git screenshots/<any folders>/<image> images the written files show (.png .jpg .jpeg .webp .gif) screenshots/approved/<feature>/<flow>/<AC-n>.<language>.png approved images of `@shows` scenes, in git screenshots/captured/<feature>/<flow>/<AC-n>.<language>.png the last capture of each scene, not in gitWarlock’s own files are skipped: everything under grimoire/book/, grimoire/approved/ and grimoire/screenshots/, features/index.json, tasks/index.json, any
.json file in a feature folder and flows/*.bookmap.json. Files whose name starts with a dot (.gitkeep) are
skipped too. Any other file in these folders is reported as not part of the layout (GR1020, a warning).
settings.md
Section titled “settings.md”An optional file of front matter only, read once per snapshot. Every key is optional:
---languages: [en, ar]screenshots: changedrules: [logical-css, specific-errors, type-discriminator, no-js-imports]protected: - payments src/app/payments/** src/config/payments.ts---| Key | Value |
|---|---|
languages | the app’s languages, in order. Without it the adapter’s languages() is used (the Warlock adapter reads app.localeCodes without booting the app), and without that there is one unnamed language. |
screenshots | changed (default), all or off. GRIMOIRE_SHOTS overrides it for one run. See Screenshots and approvals. |
rules | the code rules to run: logical-css, specific-errors, type-discriminator, no-js-imports. Absent: check runs none and guard runs all four on added lines. []: none anywhere. |
protected | - <name> <glob> [<glob>…] lines. A built-in area name replaces its globs; a new name adds an area. |
A key that is not in this table is GR1005; a wrong value is GR1004.
Rules for every file
Section titled “Rules for every file”-
Text. Files are UTF-8. Line endings may be LF or CRLF. Trailing spaces and extra blank lines are ignored.
-
Front matter. Files that have one start with a
---line and end it with another. Each line iskey: value. Quotes around a value are removed. A list is written inline,apps: [web-client, mobile], or as- itemlines under the key. A file whose template has no front matter (a changelog, a layout, a version brief) must not have one. -
Values.
Value Form Example id (feature, flow, app, layout) lower-case words joined by -new-arrivalsfeature version <whole>.<decimal>2.1date yyyy-mm-dd, a real day2026-11-10task id T-<n>T-14flow reference <feature>/<flow>catalog/new-arrivalsfolder relative to the project root; \is read as/,./and a trailing/are droppedsrc/app/catalog -
Headings. The
#title and the##headings are compared without case and extra spaces, so## Acceptance Criteriamatches## Acceptance criteria. A##heading the template does not have is a warning (GR1007). Deeper headings and text between the lines of a section are free. -
List lines. A list line is a
-or*bullet, a name, spaces (or a tab), then the text:- outside service down the payment gateway is down → the order waitsTwo or more spaces line the texts up and always end the name. One space is read too, because a Markdown formatter collapses the spaces: the name is then one of the eight case questions when the line starts with one, and otherwise the first word. A name of several words of your own (a case question the owner described) needs two or more spaces after it. Steps, criteria and changelog entries follow the same rule.
A longer text goes on indented lines right below; they are joined with one space:
- 2.1 fixed new-arrivals: a customer with no country saw an empty listinstead of the global one (AC-2) -
Code fences. Lines inside a fenced code block (three backticks or
~~~) are never read as headings, steps orUnknown:lines.
Features
Section titled “Features”features/<feature>/README.md
Section titled “features/<feature>/README.md”---id: catalogtitle: Product catalogstatus: shippedversion: 2.1updated: 2026-11-10apps: [web-client, mobile]folders: [src/app/catalog, src/web/$sites/client/products]audience: [shoppers, store staff]---
# Product catalog
Customers browse products, see what is new in their country, and will save products for later.
## Why
Shoppers decide what to buy from the catalog, so it has to be quick to browse and clear about what is new.
## Flows
- browse-products list products and open one- new-arrivals the newest products sold in the customer's country- wishlist save a product for later
## Affects and affected by
- affected by orders/place-order (lowers stock)| Key | Required | Value |
|---|---|---|
id | yes | an id, equal to the folder name |
title | yes | free text |
status | yes | proposed, building, shipped or retired |
version | yes | the feature version |
updated | yes | the date the README last changed |
apps | yes | app ids under grimoire/apps/ (may be empty) |
folders | yes | the folders and single files that belong to the feature (may be empty) |
origin | no | inferred (described from the code) or confirmed (the default) |
audience | no | a list of who the feature is for, in plain words ([shoppers, store staff]) |
Headings: the # title is required. ## Why, ## Flows and ## Affects and affected by are optional.
-
## Whysays why the feature exists, in plain paragraphs. Parsed aswhy(the paragraphs joined with a blank line), andnullwhen the section is missing or empty. -
Without
audience, readers such as the Product map use thewhoof the feature’s flows. -
## Flowslists each flow as- <flow-id> <what it does>. Each listed flow needs its fileflows/<flow-id>.md(GR1026), and each flow file should be listed (GR1027, a warning). -
## Affects and affected byis free text. Every<feature>/<flow>written in it is read as a reference.
features/<feature>/CHANGELOG.md
Section titled “features/<feature>/CHANGELOG.md”No front matter. Sections, newest first:
## Unreleased
- 2.1 fixed new-arrivals: a customer with no country saw an empty list instead of the global one (AC-2)
## 1.0.0 (2026-10-01)
- 2.0 added new-arrivals: customers see the newest products sold in their country- 1.0 added browse-products: customers list products and open one- A section heading is
## Unreleasedor## <release> (<yyyy-mm-dd>). Anything else at##or below isGR1017. A#title line is allowed and skipped. - An entry is
- <version> <word> <text>, with spaces between the parts (GR1015). The word isadded,changed,fixedorremoved(GR1016). - The text may start with the flow id and a colon (
new-arrivals: …) and end with the criteria it concerns in parentheses ((AC-2),(AC-1, AC-3)). - Every other line must be blank or a continuation of an entry.
Releasing. New entries go under ## Unreleased, with no date and no release number. At release time the agent
writes the release file, moves the entries the release ships into a new section ## <release> (<yyyy-mm-dd>) with
the release file’s date, then runs warlock grimoire release <release>. The command collects only the entries
under that section; entries still under ## Unreleased are left out and named in a note. Warlock edits the
changelog only when you ask for it with warlock grimoire release <release> --stamp, which makes that move for every
feature and then collects. The check reports a listed entry with no matching release and date, and a release section with no release
file or a different date.
features/<feature>/flows/<flow>.md
Section titled “features/<feature>/flows/<flow>.md”---id: wishlistsince: 3.0status: proposedwho: customer---
# Save a product to the wishlist
A customer saves a product they like and finds it again later on their wishlist.
## Story
1. The customer opens a product and taps "Save for later".2. The product shows a filled heart. 3. Later, the customer opens their wishlist and sees the product there.
## Steps
1. page /products/:id2. route POST /api/wishlist3. notification wishlist-price-drop4. page /wishlist
## Differs by app
- mobile the save button is also on the product card in lists
## Cases
- invalid input the product does not exist → 404- not allowed guest → sent to sign in, then back to the product- not found a removed product disappears from the list- duplicate already saved → stays saved, no error (AC-2)- limits at most 200 products- expiry does not apply: saved products do not expire- double submit two taps save once (AC-2)- outside service down does not apply: no outside service- server unreachable the save button says the server cannot be reached (AC-5)- server error a failed save says what failed (AC-5)
## Acceptance criteria
- AC-1 a saved product appears on /wishlist- AC-2 saving twice keeps one entry- AC-3 a guest is sent to sign in and returns to the product- AC-4 [mobile] the product card has a save button- AC-5 a failed save says what failed and what to do next| Key | Required | Value |
|---|---|---|
id | yes | an id, equal to the file name without .md |
since | yes | the feature version that introduced the flow |
status | yes | proposed, building, shipped or retired |
who | yes | who walks the flow: customer, guest, admin, system, … |
origin | no | inferred or confirmed |
screenshots | no | false opts the flow out of @shows captures (default: captured) |
Headings: the # title, ## Steps, ## Cases and ## Acceptance criteria are required. ## Story,
## Differs by app and ## Not handled are optional.
Summary. The paragraph under the # title says what the flow does in one or two plain sentences. It is read as
the flow’s summary. A flow without one gets GR1030 (a warning).
Story. ## Story tells the flow in the user’s words, for readers who do not read code. Each step is
<n>. <sentence>, numbered from 1 in order (a wrong number is GR1010, and the message says “story step”). Indented
lines continue the sentence. An image line (see below) under a step attaches a screenshot to it. A line that is
none of these is GR1008.
Screenshots. An image line is Markdown , outside a code fence. Keep the files in
grimoire/screenshots/, in any subfolders, as .png, .jpg, .jpeg, .webp or .gif. The path is relative to the
Markdown file, so it also shows on a git host (../../../screenshots/web/product.png from a flow file), or starts
with /grimoire/screenshots/. A path that points outside the folder is GR1029 (a warning) and a file that does not
exist, or is not an image type, is GR2014 (a warning). Image lines are read in a flow’s story, in page and screen
READMEs and in block files.
A flow is named <feature>/<flow> everywhere else: in blocks, tasks, affects steps and @proves lines.
Steps are numbered 1., 2., 3. in order (GR1010). Each is <n>. <kind> <name>, with spaces after the
kind (GR1008), and an optional note after — or --:
3. route GET /api/products/:id — the page loads it through its setup file| Kind | The name is | Example |
|---|---|---|
page | the route path of a page or screen, and optionally its app in brackets | /products/:id |
route | <METHOD> /path; the method is one of GET POST PUT PATCH DELETE HEAD OPTIONS ALL | POST /api/orders |
mail | the mail’s name in code (a *.mail.ts or *.email.ts file, or a file in mails/ or emails/) | order-confirmation |
notification | the notification’s name in code | order-shipped |
job | the job’s name in code: a defineJob() name, a scheduled task’s name, or a *.job.ts file | send-receipt |
event | the event’s name in code | order.placed |
outside service | free text naming the service | payment gateway |
affects | another feature, or <feature>/<flow> | catalog/browse-products |
Any other kind is GR1009.
A page on several apps. When two sites (or a site and the mobile app) have a page with the same path, write the app after the path in brackets, the way a criterion names its app. The step then looks in that app only, for a site page or for a screen of a mobile app:
2. page /support [web-admin]Without the brackets, a page step looks in the apps its feature lists. A bracket that names an app with no folder in
grimoire/apps is GR2008; one that names an app the feature does not list is GR2009; a path the app has no page
for is GR2002.
A route or page name matches the code with params written either way (:id or [id]) and a trailing /
ignored; a route’s method matches whatever its case, and ALL matches any method.
Cases are - <question> <answer> lines (GR1011). Every flow answers these eight questions, under
## Cases or under ## Not handled (GR1012, a warning):
invalid input, not allowed, not found, duplicate, limits, expiry, double submit,
outside service down.
A flow with a page step also answers two more questions, because a screen can fail in ways an API cannot hide:
server unreachable (what the user sees when the request never arrives) and server error (when the server answers
with a failure). They are required, with the same GR1012, only in flows that have a page step, and optional
everywhere else.
A flow with no writes (every step is a page, or a GET, HEAD or OPTIONS route) may leave out duplicate and
double submit; the other six stay required. Answering the two anyway is fine. A flow with no steps, or with any
other kind of step (a write route, mail, notification, job, event, outside service, affects), counts as a flow that writes.
An answer that starts with does not apply marks the question as not relevant; say why after it. A case with
another question is read as the owner’s own case.
End a case line with (AC-<n>), or (AC-<n>, AC-<m>), to say which criterion proves it. The part in brackets is
read as the case’s criteria and left out of its answer. A number the flow does not have is GR2013 (an error).
Not handled lists the questions the code does not handle yet, in the same - <question> <reason> form.
Unknown lines. A line that starts with Unknown: anywhere in the flow records an open question:
Unknown: why does a vip skip the stock check?Acceptance criteria are - AC-<n> <text>, or - AC-<n> [<app-id>] <text> for a criterion that holds in
one app only (GR1013). Number them from AC-1 and never renumber; a number used twice in one flow is GR1014.
Differs by app lines are - <app-id> <what differs> (GR1028).
features/<feature>/versions/v<n>.md
Section titled “features/<feature>/versions/v<n>.md”The brief written before a whole-number version (v3.md before 3.0): no front matter, a # title, then free
text (why, what changes, what is out of scope). A file in versions/ with another name is not part of the layout.
apps/<app>/README.md
Section titled “apps/<app>/README.md”---id: web-clienttype: siteroot: src/web/$sites/client---
# The shop website
## Conditions
- guest not signed in- customer signed in- vip customer with the vip membership- pref:personalised the customer left personalised content on| Key | Required | Value |
|---|---|---|
id | yes | an id, equal to the folder name |
type | yes | site or mobile |
root | yes | the folder of the site or mobile app, relative to the project root |
origin | no | inferred (described from the code) or confirmed |
Headings: ## Conditions is required. Each condition is - <name> <meaning>. Pages and blocks of this app use
only these names.
The blocks table
Section titled “The blocks table”Layouts, pages and screens describe their parts in a ## Blocks table:
## Blocks
| Block | Flow | Who sees it | Changes with || ----------------- | ----------------------- | ----------- | -------------------------------------------- || Featured products | catalog/browse-products | everyone | vip: member prices; pref:personalised: picks || New arrivals | catalog/new-arrivals | everyone | the customer's country || Recent orders | orders/place-order | customer | — |- The header row is exactly
Block | Flow | Who sees it | Changes with(any case), then a separator row. Outer pipes are optional. Text before the table is allowed; the table ends at the first line without a|. - Block: the name of the part. Required.
- Flow:
<feature>/<flow>, or—(or-, or empty) when the part shows no flow. - Who sees it:
everyone, or condition names separated by,. Each name is checked against the app’s conditions (GR5002). - Changes with: items separated by
;. An item may start with a condition name (vip: member prices) to say what that condition changes; that name is checked against the app’s conditions (GR5002). A name written in backticks anywhere in an item (`vip`) is checked too, as a warning (GR5010). Plain text is free and is never reported.—means nothing changes. - A
|inside a cell is written\|.
Any other shape is GR1018.
apps/<app>/layouts/<layout>.md
Section titled “apps/<app>/layouts/<layout>.md”Front matter is optional and holds only origin (inferred or confirmed). A # title and a required
## Blocks table with the parts every page of the layout shares.
apps/<app>/pages/<page>/README.md and apps/<app>/screens/<screen>/README.md
Section titled “apps/<app>/pages/<page>/README.md and apps/<app>/screens/<screen>/README.md”---route: /products/:idlayout: site---
# Product
One product with its price, stock and the order button.
## Blocks
| Block | Flow | Who sees it | Changes with || ------------ | ----------------------- | ----------- | ----------------- || Details | catalog/browse-products | everyone | vip: member price || Order button | orders/place-order | customer | — |
## Also reached from
- mail order-confirmation| Key | Required | Value |
|---|---|---|
route | yes for a page | the page’s route path, starting with / |
screen | for a screen, route or screen | the screen’s name, when the mobile app defines navigation in code |
layout | no | a layout id of this app |
origin | no | inferred or confirmed, as on a feature |
Headings: the # title is required, and the paragraph under it is the page’s purpose. ## Blocks and
## Also reached from are optional. Image lines in the README, anywhere outside code fences, show what the page
looks like (see Screenshots under a flow). Entry points are - <kind> <name> (mail, notification, page,
screen, outside service).
A mobile app with file-based routing gives each screen a route. A mobile app that defines its navigation in code
gives each screen its screen name.
apps/<app>/pages/<page>/blocks/<block>.md
Section titled “apps/<app>/pages/<page>/blocks/<block>.md”Only when a block has something to say about this page in particular:
---flow: catalog/new-arrivals---
# New arrivals on the home page
- position second row, under Featured products- shows a grid of up to 20 products- phones one row that scrolls sidewaysflow is required. Detail lines are - <name> <text>; other text is free. An image line shows what the block
looks like.
tasks/open/T-<n>-<slug>.md while open, tasks/done/<yyyy-mm>/T-<n>-<slug>.md once done. A task file elsewhere,
or with another name, is GR1023. Two files with one id are GR1022.
---id: T-014type: featurefeature: catalogflow: wishlistapps: [web-client, mobile]status: waiting for approval---
# Let customers save products to a wishlist
- Asked by: the owner, 2026-11-16- Why: customers ask to keep products for later- Brief: features/catalog/versions/v3.md- Decision needed: one wishlist per customer, or several named lists?| Key | Required | Value |
|---|---|---|
id | yes | T-<n>, equal to the start of the file name |
type | yes | bug, feature, decision or chore |
status | yes | open, waiting for approval, approved, in progress, blocked, done or dropped |
feature | no | a feature id |
flow | no | a flow id of feature, or <feature>/<flow> |
apps | no | app ids |
shipped | in done/ | <feature> <version>, like catalog 2.1 |
The body is free text. Lines - <Key>: <value> are read as fields; Brief: paths are relative to grimoire/, and a
Decision needed: field puts the task on the list of tasks waiting for the owner.
Releases
Section titled “Releases”releases/<release>.md. The agent writes the front matter, the title and a short brief, and moves the shipped
changelog entries under ## <release> (<date>) in each feature’s changelog. Then warlock grimoire release <release>
writes the collected list below the brief, between two markers, and rewrites only that part when run again.
---release: 1.0.0date: 2026-10-01---
# Release 1.0.0
The first release: customers browse products, see new arrivals, sign up and place orders.
<!-- grimoire:collected:start -->
## Changes
### catalog
- 2.0 added new-arrivals: customers see the newest products sold in their country- 1.0 added browse-products: customers list products and open one
<!-- grimoire:collected:end -->| Key | Required | Value |
|---|---|---|
release | yes | the release number, equal to the file name without .md |
date | yes | the release date |
The # title is required. Everything between the title and the start marker is the brief. The markers come in one
pair, start first (GR1024). Between them: ## Changes, a ### <feature> heading per feature, entry lines in the
changelog grammar, or No feature changes..
Structure codes
Section titled “Structure codes”Every code links to its entry on the check page, with what to do.
| Code | Severity | Reported when |
|---|---|---|
GR1001 | error | a file whose template has front matter does not start with --- |
GR1002 | error | a front matter line is not key: value, a key is written twice, or the block is never closed |
GR1003 | error | a required key is missing |
GR1004 | error | a value has the wrong form: not an id, version, date or listed word, or a folder outside the project |
GR1005 | warning | a key is not in the template, or a file whose template has no front matter has one |
GR1006 | error | the # title or a required ## heading is missing |
GR1007 | warning | a ## heading is not in the template, or is written twice |
GR1008 | error | a step is not <n>. <kind> <name>, or its route or affects name has the wrong form |
GR1009 | error | a step’s kind is not one of the eight kinds |
GR1010 | error | steps are not numbered 1, 2, 3 in order |
GR1011 | error | a case is not - <question> <answer> |
GR1012 | warning | one of the eight questions is answered neither under Cases nor under Not handled |
GR1013 | error | a criterion is not - AC-<n>[ [app]] <text> |
GR1014 | error | a criterion number is used twice in one flow |
GR1015 | error | a changelog line, or a line of a release’s collected list, is not an entry |
GR1016 | error | an entry’s word is not added, changed, fixed or removed |
GR1017 | error | a changelog heading is not ## Unreleased or ## <release> (<yyyy-mm-dd>), or is written twice |
GR1018 | error | a Blocks section has no table, a wrong header or separator, or a bad row |
GR1019 | error | an id (or release) differs from its folder or file name |
GR1020 | warning | a file is where the layout has no place for it |
GR1021 | error | a feature, app, page or screen folder has no README.md |
GR1022 | error | two tasks, or two apps, use the same id |
GR1023 | error | a task file is not named T-<n>-<slug>.md, or is not in tasks/open/ or tasks/done/<yyyy-mm>/ (it is then not read) |
GR1024 | error | a release file’s markers are not one start/end pair |
GR1025 | error | a file cannot be read, or is not UTF-8 |
GR1026 | error | the README lists a flow with no file |
GR1027 | warning | a flow file is not listed in the README |
GR1028 | error | another list line (Flows, Conditions, Differs by app, Not handled, Also reached from, block details) is not - name text |
GR1029 | warning | an image line points outside grimoire/screenshots/ |
GR1030 | warning | a flow has no summary under its title |
Reading the files from code
Section titled “Reading the files from code”parseGrimoire(root) from @warlock.js/grimoire reads every written file of a project and returns the parsed
files with the structure findings. It never throws on a malformed file, and every value keeps the file and line it
was read from.
import { parseGrimoire } from "@warlock.js/grimoire";
const { written, findings } = await parseGrimoire(process.cwd());
for (const finding of findings) { console.log(`${finding.at?.file}:${finding.at?.line} ${finding.code} ${finding.message}`);}
const wishlist = written.features .find((feature) => feature.id === "catalog") ?.flows.find((flow) => flow.ref === "catalog/wishlist");A project without a grimoire/ folder gives written.exists === false and no findings.