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.
Install
Section titled “Install”New Warlock.js apps include Grimoire. In an existing app:
npx warlock add grimoirenpx warlock grimoire buildwarlock 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”.
Who writes what
Section titled “Who writes what”| Written by | |
|---|---|
grimoire/book/, index.json, bookmap.json, *.bookmap.json | Warlock. Not in git. Never edit |
| Features, flows, apps, tasks, changelogs, release briefs | The agent |
The collected list in grimoire/releases/<release>.md | warlock 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.
The folder
Section titled “The folder”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.Commands
Section titled “Commands”npx warlock grimoire build # build or refresh the booknpx warlock grimoire check # report broken names, untested criteria, files with no ownernpx 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 sentencenpx warlock grimoire guard T-12 # check a change against its tasknpx warlock grimoire approve <id|feature/flow|api> # the owner approves a changeGuides
Section titled “Guides”- Written files: the fixed structure of every file agents write.
- The book: layout, entries, freshness.
- Features and book maps: ownership, borrowing, indexes.
- Check:
warlock grimoire checkand every finding code. - Commands:
warlock grimoire,warlock scry, MCP tools. - Tasks and releases
- Apps: sites, pages, blocks, mobile screens.
- Test results:
@provesand the Vitest reporter. - Devtools: the tab and the static export.
- The product map: the plain-language view, screenshots, share links.
- Drift controls:
warlock grimoire guard, locked tests, protected areas, code rules. - 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.