Skip to content

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.

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 git

Warlock’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).

An optional file of front matter only, read once per snapshot. Every key is optional:

---
languages: [en, ar]
screenshots: changed
rules: [logical-css, specific-errors, type-discriminator, no-js-imports]
protected:
- payments src/app/payments/** src/config/payments.ts
---
KeyValue
languagesthe 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.
screenshotschanged (default), all or off. GRIMOIRE_SHOTS overrides it for one run. See Screenshots and approvals.
rulesthe 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.

  • 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 is key: value. Quotes around a value are removed. A list is written inline, apps: [web-client, mobile], or as - item lines under the key. A file whose template has no front matter (a changelog, a layout, a version brief) must not have one.

  • Values.

    ValueFormExample
    id (feature, flow, app, layout)lower-case words joined by -new-arrivals
    feature version<whole>.<decimal>2.1
    dateyyyy-mm-dd, a real day2026-11-10
    task idT-<n>T-14
    flow reference<feature>/<flow>catalog/new-arrivals
    folderrelative 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 Criteria matches ## 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 waits

    Two 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 list
    instead of the global one (AC-2)
  • Code fences. Lines inside a fenced code block (three backticks or ~~~) are never read as headings, steps or Unknown: lines.

---
id: catalog
title: Product catalog
status: shipped
version: 2.1
updated: 2026-11-10
apps: [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)
KeyRequiredValue
idyesan id, equal to the folder name
titleyesfree text
statusyesproposed, building, shipped or retired
versionyesthe feature version
updatedyesthe date the README last changed
appsyesapp ids under grimoire/apps/ (may be empty)
foldersyesthe folders and single files that belong to the feature (may be empty)
originnoinferred (described from the code) or confirmed (the default)
audiencenoa 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.

  • ## Why says why the feature exists, in plain paragraphs. Parsed as why (the paragraphs joined with a blank line), and null when the section is missing or empty.

  • Without audience, readers such as the Product map use the who of the feature’s flows.

  • ## Flows lists each flow as - <flow-id> <what it does>. Each listed flow needs its file flows/<flow-id>.md (GR1026), and each flow file should be listed (GR1027, a warning).

  • ## Affects and affected by is free text. Every <feature>/<flow> written in it is read as a reference.

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 ## Unreleased or ## <release> (<yyyy-mm-dd>). Anything else at ## or below is GR1017. A # title line is allowed and skipped.
  • An entry is - <version> <word> <text>, with spaces between the parts (GR1015). The word is added, changed, fixed or removed (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.

---
id: wishlist
since: 3.0
status: proposed
who: 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.
![The saved product](../../../screenshots/web/wishlist-saved.png)
3. Later, the customer opens their wishlist and sees the product there.
## Steps
1. page /products/:id
2. route POST /api/wishlist
3. notification wishlist-price-drop
4. 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
KeyRequiredValue
idyesan id, equal to the file name without .md
sinceyesthe feature version that introduced the flow
statusyesproposed, building, shipped or retired
whoyeswho walks the flow: customer, guest, admin, system, …
originnoinferred or confirmed
screenshotsnofalse 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 ![alt](path), 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
KindThe name isExample
pagethe 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 ALLPOST /api/orders
mailthe mail’s name in code (a *.mail.ts or *.email.ts file, or a file in mails/ or emails/)order-confirmation
notificationthe notification’s name in codeorder-shipped
jobthe job’s name in code: a defineJob() name, a scheduled task’s name, or a *.job.ts filesend-receipt
eventthe event’s name in codeorder.placed
outside servicefree text naming the servicepayment gateway
affectsanother 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).

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.

---
id: web-client
type: site
root: 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
KeyRequiredValue
idyesan id, equal to the folder name
typeyessite or mobile
rootyesthe folder of the site or mobile app, relative to the project root
originnoinferred (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.

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.

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/:id
layout: 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
KeyRequiredValue
routeyes for a pagethe page’s route path, starting with /
screenfor a screen, route or screenthe screen’s name, when the mobile app defines navigation in code
layoutnoa layout id of this app
originnoinferred 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.

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 sideways

flow 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-014
type: feature
feature: catalog
flow: wishlist
apps: [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?
KeyRequiredValue
idyesT-<n>, equal to the start of the file name
typeyesbug, feature, decision or chore
statusyesopen, waiting for approval, approved, in progress, blocked, done or dropped
featurenoa feature id
flownoa flow id of feature, or <feature>/<flow>
appsnoapp ids
shippedin 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/<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.0
date: 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 -->
KeyRequiredValue
releaseyesthe release number, equal to the file name without .md
dateyesthe 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..

Every code links to its entry on the check page, with what to do.

CodeSeverityReported when
GR1001errora file whose template has front matter does not start with ---
GR1002errora front matter line is not key: value, a key is written twice, or the block is never closed
GR1003errora required key is missing
GR1004errora value has the wrong form: not an id, version, date or listed word, or a folder outside the project
GR1005warninga key is not in the template, or a file whose template has no front matter has one
GR1006errorthe # title or a required ## heading is missing
GR1007warninga ## heading is not in the template, or is written twice
GR1008errora step is not <n>. <kind> <name>, or its route or affects name has the wrong form
GR1009errora step’s kind is not one of the eight kinds
GR1010errorsteps are not numbered 1, 2, 3 in order
GR1011errora case is not - <question> <answer>
GR1012warningone of the eight questions is answered neither under Cases nor under Not handled
GR1013errora criterion is not - AC-<n>[ [app]] <text>
GR1014errora criterion number is used twice in one flow
GR1015errora changelog line, or a line of a release’s collected list, is not an entry
GR1016erroran entry’s word is not added, changed, fixed or removed
GR1017errora changelog heading is not ## Unreleased or ## <release> (<yyyy-mm-dd>), or is written twice
GR1018errora Blocks section has no table, a wrong header or separator, or a bad row
GR1019erroran id (or release) differs from its folder or file name
GR1020warninga file is where the layout has no place for it
GR1021errora feature, app, page or screen folder has no README.md
GR1022errortwo tasks, or two apps, use the same id
GR1023errora 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)
GR1024errora release file’s markers are not one start/end pair
GR1025errora file cannot be read, or is not UTF-8
GR1026errorthe README lists a flow with no file
GR1027warninga flow file is not listed in the README
GR1028erroranother list line (Flows, Conditions, Differs by app, Not handled, Also reached from, block details) is not - name text
GR1029warningan image line points outside grimoire/screenshots/
GR1030warninga flow has no summary under its title

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.