Skip to content

Grimoire

@warlock.js/grimoire is a map of your project for AI agents and developers. It answers the questions an agent asks before changing code: where things are, what a feature is meant to do, and what a change will touch.

  • Warlock writes the book: one entry per source file (what it is for, its exports, what it imports and what imports it), the routes, the pages of each site and the screens of a mobile app.
  • Agents write the rest: what the product does (features and their flows, with cases and acceptance criteria), where users meet it (sites, mobile apps, pages and blocks), and the work (tasks and releases).
  • A read-only check ties them together: every name a written file uses (a route, a page, a mail, a flow) is looked up in the book, and every name that no longer exists is reported.

Warlock never edits a file an agent wrote.

New Warlock.js apps include Grimoire. In an existing app:

Terminal window
npx warlock add grimoire
npx warlock grimoire build

warlock add grimoire installs @warlock.js/grimoire, registers registerGrimoireCommands() in cli.commands of warlock.config.ts (it creates the cli block when there is none), adds the generated files to .gitignore, adds the Grimoire tab to src/config/devtools.ts when @warlock.js/devtools is a dependency of the app (otherwise run warlock add devtools first, then this command again), and adds grimoireReporter() to vite.config.ts when the app runs Vitest. Running it twice changes nothing. Vitest reads reporters from the root test object, so Warlock edits it only when the exported config is a literal (defineConfig({ test: { ... } })). When a setting comes from a variable (cli: cliSettings), a function or a projects factory, it leaves the file as it is and prints the line to add yourself, for example “add grimoireReporter() to test.reporters of the root config”.

Written by
grimoire/book/, index.json, bookmap.json, *.bookmap.jsonWarlock. Not in git. Never edit
Features, flows, apps, tasks, changelogs, release briefsThe agent
The collected list in grimoire/releases/<release>.mdwarlock grimoire release, between two markers

The agent writes the release number and date into each feature changelog and writes the release brief first. warlock grimoire release then writes only the collected list.

grimoire/
book/ Warlock. Not in git; rebuilt when sources change.
features/
index.json Warlock. Not in git.
<feature>/
README.md What the feature is, as it is now.
CHANGELOG.md One entry per feature version.
flows/<flow>.md Who, steps, cases, acceptance criteria.
flows/<flow>.bookmap.json Warlock. Files behind each step, tests per criterion.
versions/v<n>.md The brief written before a whole-number version.
bookmap.json Warlock. Owned and borrowed files, routes, pages.
apps/
<app>/README.md One site or mobile app and its conditions.
<app>/layouts/<layout>.md Blocks every page of a layout shares.
<app>/pages/<page>/README.md
<app>/screens/<screen>/README.md
tasks/
open/T-<n>-<slug>.md
done/<yyyy-mm>/T-<n>-<slug>.md
index.json Warlock. Not in git.
releases/<release>.md The agent's brief and the collected changes.
settings.md Optional: languages, screenshot mode, code rules, protected areas.
approved/ What the owner approved: baseline.json, api.json. In git.
screenshots/
approved/ Approved images of `@shows` scenes. In git.
captured/ Warlock. The last capture of each scene. Not in git.
Terminal window
npx warlock grimoire build # build or refresh the book
npx warlock grimoire check # report broken names, untested criteria, files with no owner
npx warlock scry <file> # what is this file?
npx warlock scry --impact <file>
npx warlock scry --search "new arrivals are empty for customers with no country" # pass the whole sentence
npx warlock grimoire guard T-12 # check a change against its task
npx warlock grimoire approve <id|feature/flow|api> # the owner approves a change
  1. Written files: the fixed structure of every file agents write.
  2. The book: layout, entries, freshness.
  3. Features and book maps: ownership, borrowing, indexes.
  4. Check: warlock grimoire check and every finding code.
  5. Commands: warlock grimoire, warlock scry, MCP tools.
  6. Tasks and releases
  7. Apps: sites, pages, blocks, mobile screens.
  8. Test results: @proves and the Vitest reporter.
  9. Devtools: the tab and the static export.
  10. The product map: the plain-language view, screenshots, share links.
  11. Drift controls: warlock grimoire guard, locked tests, protected areas, code rules.
  12. Screenshots and approvals: @shows, one capture per language, the approved baseline.

Agents learn the workflow from the package’s skills: use-the-grimoire, write-a-feature, record-a-change, guard-a-change, review-a-change, describe-an-app, document-a-file and backfill-a-grimoire.