Commands
Grimoire adds two commands to the Warlock CLI, warlock grimoire and warlock scry, and the same questions as MCP
tools for coding agents.
Register the commands
Section titled “Register the commands”Add one line to warlock.config.ts:
import { defineConfig } from "@warlock.js/core";import { registerGrimoireCommands } from "@warlock.js/grimoire/warlock";
export default defineConfig({ cli: { commands: [registerGrimoireCommands()], },});registerGrimoireCommands() returns two commands (grimoire and scry). An entry of cli.commands may be an
array, so the call sits next to your other commands as one entry. The same line brings the MCP tools and lets
warlock explain describe GR codes.
The module is light: it loads the book builder, the check and @warlock.js/core/tooling only when a command or tool
runs, so warlock.config.ts stays fast to load.
Options
Section titled “Options”registerGrimoireCommands(options) and createWarlockAdapter(options) take:
| Option | Default | Meaning |
|---|---|---|
mobile | every top-level folder with app.json or app.config.* | Mobile apps in the repository: { root, id?, routing? }. An app is file-routed when its package.json lists expo-router (screens come from its files), and code-navigated otherwise (you declare its screens in grimoire/apps/<app>/screens/). |
inspect | the warlock inspect boot pass | How the facts that need the app booted (routes, events, jobs) are read. |
When the app boots
Section titled “When the app boots”warlock grimoire build and warlock grimoire check first make sure the book exists and is fresh. Only changed files
are read again; an unchanged project reads nothing and writes nothing. warlock scry and the MCP read tools only read
the stored book (see warlock scry).
Route facts (routes, events and jobs) need the app booted, the way warlock inspect boots it: connectors boot, none
starts, no database connection opens and no port is bound. They are cached in the book and read again only when a
routes file, a file it imports, a config file, a mail, job, event or notification file, warlock.config.ts or
package.json changed.
warlock grimoire buildandwarlock grimoire checkboot the app only when the route facts are stale or missing. When the app does not boot, they go on with the cached route facts and print aGR8002warning. This holds when the app’s config or bootstrap fails while the command starts, not only when its routes cannot be read.warlock scryand the MCP tools never boot the app. They use the cached route facts and add a note when they are stale. A route question of a project with no route facts stops withGR9002(a page or screen URL is still found); runwarlock grimoire buildfirst.- An app with several sites (
src/web/$sites/<site>) loads onlysrc/config/web.tsfor file questions, because the sites’ base paths shape the page routes.
warlock grimoire build
Section titled “warlock grimoire build”npx warlock grimoire build # bring the book up to datenpx warlock grimoire build --force # rebuild every entry and read the routes againnpx warlock grimoire build --site # also write the static site to grimoire/book/sitenpx warlock grimoire build --site --out public/grimoirenpx warlock grimoire build --site --product # the business export: the Product map onlynpx warlock grimoire build --jsonbook 35 files (46 written, 0 removed), routes freshfeatures 3 (bookmaps written: 9) tasks 1 open, 1 waiting, 1 donetime 0.4sThe summary is always the last lines, after any output the app prints while it boots. A run with nothing to do prints book up to date. A task waiting for the owner is counted under waiting
only, not under open. --site writes the same view as the devtools tab as one
static index.html (see Devtools); --out takes a folder inside the
project; a folder outside it, or the project folder itself, stops the command with GR9006. --json prints { rebuilt, changed, written, removed, routes, site, siteUpToDate, siteMode, problems }.
--site --product writes the business export: the Product map as a read-only page, opening on the map, with no
file paths, test names, export names, check findings or per-file answers (the same detail a share link hides). It is
much smaller than the full export, because it carries no per-file answers and no code search; the screenshots the
written files use are copied next to it. Hand this one to people who do not read code. The full export stays the
developer view.
A site export carries a stamp of the book it was built from (the code and test files, the written folders, the test
results). When the folder already holds a page with the same stamp and mode, build --site does not write it again
and prints (up to date, not rebuilt); --force writes it anyway.
warlock grimoire check
Section titled “warlock grimoire check”npx warlock grimoire checknpx warlock grimoire check --all # list every findingnpx warlock grimoire check --jsongrimoire/features/catalog/flows/browse-products.md:26 GR4001 warning catalog/browse-products AC-1 has no test… … GR4001: 12 findings in all, 7 not showngrimoire/features/catalog/flows/wishlist.md:12 GR2001 error route step "POST /api/wishlist" matches no route (expected)7 findings not listed; run with --all to list every finding.0 errors, 8 warnings, 8 expected (routes: fresh)book up to datetime 0.3sErrors always print in full. When a code has more than five warnings, the text shows the first five, then how many
are left. --all prints every finding; --json is always complete. The last two lines (the book state and the
time) come after the app’s own boot output.
The command exits 1 only when the report holds an error that is not expected. Findings on proposed features and flows are expected and never fail it. The check lists every code.
warlock grimoire release <release>
Section titled “warlock grimoire release <release>”npx warlock grimoire release 1.1.0grimoire/releases/1.1.0.md: 1 entry collected (catalog 2.1 fixed)note: 1 entry is still unreleased: orders 3.0. To ship them in 1.1.0, move them under "## 1.1.0 (2026-11-20)" in each feature's CHANGELOG.md and run this command again.It writes the list of the changelog entries stamped with that release between the markers of
grimoire/releases/<release>.md, and changes nothing else. Write the release file (front matter release and
date, and the brief) first: without it the command stops with GR9005. Broken markers stop it with GR1024. See
Tasks and releases.
Stamp and collect: --stamp
Section titled “Stamp and collect: --stamp”npx warlock grimoire release --stampnpx warlock grimoire release 1.4.0 --stamp --date 2026-11-24stamped catalog, orders → 1.4.0 (2026-11-24)wrote grimoire/releases/1.4.0.mdgrimoire/releases/1.4.0.md: 2 entries collectedWith --stamp the command does the agent’s release steps first, then collects as above:
- The version is the argument, or the
versionof the app’spackage.json. The date is--date, else the date of the release file when it exists, else today. - In each feature
CHANGELOG.mdthat has entries under## Unreleased, the entries move under a new## <version> (<date>)heading and an empty## Unreleasedstays above it. No other byte of the file changes. - When
grimoire/releases/<version>.mdis missing, it is written with its front matter, a# Release <version>heading and a one-line brief that names the changed features. Rewrite the brief in your own words; a release file that exists is never touched, and neither is its brief. - It stops with
GR9006and changes nothing when the version is missing (no argument and noversioninpackage.json), when the date is notyyyy-mm-dd, or when a section for the version exists with another date or the release file has another date than--date. --jsonprints{ stamped, created, collect }: the features stamped, the release file written (ornull) and the collect result.
The stamp is the only edit Warlock makes to written files, and only when you ask for it with --stamp. Without
--stamp the command writes the collected list and nothing else.
warlock grimoire guard [task]
Section titled “warlock grimoire guard [task]”Checks the change (the git diff against a base) against its task: files outside the task’s features, removed flows, criteria and cases, deleted proving tests, edited locked tests, protected areas and the code rules on the lines the change adds. See Drift controls for what each finding means.
warlock grimoire guard # the one task in progresswarlock grimoire guard T-12 # T-12, 12 and T-012 name the same taskwarlock grimoire guard T-12 --base origin/mainwarlock grimoire guard --base origin/main --commits origin/main..HEADwarlock grimoire guard --hook # for an agent's Stop hookwarlock grimoire guard --json| Option | What |
|---|---|
[task] | The task id. Without it the guard uses the tasks named in the commits of --commits, then the one task whose status is in progress, else GR9008. |
--base <ref> | The ref the change is compared with. Default: the point where HEAD left the default branch (origin/HEAD, then main, then master), else HEAD. |
--commits <range> | A commit range (origin/main..HEAD). Every commit must name a task id (T-12) that has a file (GR7012); the tasks the commits name are guarded. |
--hook | Agent-hook mode: everything goes to stderr, exit code 2 on an error, 0 otherwise, also when no task or no git repository is found and when the hook input says the agent already went on once (stop_hook_active). |
--json | Print the report as JSON. |
The change is every file that differs between the base and the working tree: committed, staged, unstaged and untracked (not ignored). The guard never boots the app and reads the route facts of the last build.
Text output is one line per finding, as warlock grimoire check prints them (<file>:<line> <code> <severity> <message>
and a fix: line under each error), then not approved: <n> changes with one line per change since the approved
baseline that nobody approved (these never fail the guard), then guard: ok or guard: <n> errors.
Exit codes: 0 no error, 1 at least one error, 2 an error in --hook mode. GR9009 (git could not answer) and
GR9008 (no task) exit 1, and 0 in --hook mode.
--json prints:
{ "schemaVersion": 1, "task": "T-20", "base": "9f1c2e…", "changed": [ { "file": "src/app/orders/utils/extra.ts", "status": "added", "from": null, "addedLines": [1] } ], "findings": [ { "code": "GR7006", "severity": "error", "message": "…", "at": { "file": "…", "line": 1, "column": null }, "expected": false, "subject": { "feature": null, "flow": null, "app": null, "task": "T-20", "file": "…" }, "hint": "…" } ], "notApproved": [], "counts": { "errors": 1, "warnings": 0, "expected": 0 }, "ok": false}base is the commit the change was compared with; task is null when none was found, and joins several ids with a
comma when the commits name several.
warlock grimoire approve api
Section titled “warlock grimoire approve api”Writes the routes the book knows to grimoire/approved/api.json, the approved public API. It reads the route facts of
the last warlock grimoire build and never boots the app. warlock grimoire check warns (GR7013) when the routes
differ, and the guard reports GR7011 for a change that does not name public-api in Touches:.
warlock grimoire approve <target> and reject <target>
Section titled “warlock grimoire approve <target> and reject <target>”The owner accepts or refuses a change since the approved baseline: a new or changed capture, a removed image, a new or removed flow, criterion or case, a criterion that lost its proving test.
npx warlock grimoire approve shot-changed:contact/send-message:AC-2:ar # one change, by its idnpx warlock grimoire approve contact/send-message --lang ar # every change of a flow, one language's imagesnpx warlock grimoire approve --all # everything; creates the baseline the first timenpx warlock grimoire reject contact/send-message --note "the button is too small"The target is a change id (the ids are in the check messages and the Bird view), a <feature>/<flow>, or --all.
--lang keeps only the images of one language. A target nothing matches is GR9010. Text output prints one line per
change and then approved <n> (or rejected <n>); --json prints { "done": [...] }. approve --all with no
baseline creates it from the current state. Approving copies the capture to grimoire/screenshots/approved/ and
updates grimoire/approved/baseline.json. See
Screenshots and approvals.
warlock scry
Section titled “warlock scry”One question at a time. Text by default, --json for the result object. Paths may use either separator and may be
absolute.
scry only reads. It answers from the book the last warlock grimoire build left in grimoire/book/ and never
rebuilds it, never boots the app and never writes a file, so a call on a large app takes a fraction of a second. Run
warlock grimoire build after you finish editing. While the code, test or written files differ from the book, every
answer ends with a note (in --json, the notes list), and the answer is the stored one:
note book is stale (12 files changed); run warlock grimoire buildA project whose book was never built (or was built by another version) stops with GR9007.
A file
Section titled “A file”npx warlock scry src/app/catalog/services/new-arrivals.service.tssrc/app/catalog/services/new-arrivals.service.ts service 10 linesabout Lists the newest products sold in the customer's country.feature catalogflows catalog/new-arrivalsexports listNewArrivals Returns up to 20 products, newest first.imports src/app/catalog/repositories/products.repository.tsused by src/app/catalog/controllers/new-arrivals.controller.ts src/app/catalog/tests/new-arrivals.test.ts src/web/$sites/client/home.setup.tsentry grimoire/book/app/catalog/services/new-arrivals.service.jsonfeature shows (borrowed by: orders) when other features import the file. routes, pages and screens lines
appear when the file registers or handles a route, or is a page, setup, layout or screen file.
What a change reaches: --impact
Section titled “What a change reaches: --impact”npx warlock scry --impact src/app/catalog/models/product.model.tsimpact of src/app/catalog/models/product.model.tsimporters 1 direct, 14 in allroutes (4) GET /api/products GET /api/products/new-arrivals GET /api/products/:id POST /api/orderspages (2) web-client / web-client /products/:idflows (4) catalog/browse-products catalog/new-arrivals catalog/wishlist orders/place-orderfeatures (2) catalog (owner) orders (borrower)tests (3) e2e/checkout.e2e.ts src/app/catalog/tests/new-arrivals.test.ts src/app/orders/tests/place-order.test.tsEach heading carries the count of its list. A list longer than 20 stops there and ends with … and N more; add
--all to print every line. --json always holds the full lists.
routes lists API routes whose handler file (or routes file, when the handler file is unknown) reaches the file
through imports; pages and screens are listed under pages. features lists the owner of the file and every
feature whose files import it, directly or through other files (borrowers; spec files do not count). tests lists the test files among the importers and the tests that prove
the flows above.
A route: --route
Section titled “A route: --route”npx warlock scry --route "POST /api/orders"POST /api/orders orders.placehandler PlaceOrderController.store src/app/orders/controllers/place-order.controller.tsregistered src/app/orders/routes.tsmiddleware authMiddlewareauth required (customer)files src/app/catalog/models/product.model.ts src/app/catalog/repositories/products.repository.ts src/app/orders/controllers/place-order.controller.ts src/app/orders/events/order-placed.event.ts src/app/orders/jobs/send-receipt.job.ts src/app/orders/mails/order-confirmation.mail.ts src/app/orders/services/place-order.service.tssteps orders/place-order step 2files is the handler file and everything it imports. Route params match written either way (:id or [id]), a
trailing / is ignored and the method may be in any case. warlock grimoire check matches flow route steps the same
way.
--route also takes a page URL. In a web app every page sits behind one catch-all route, so for GET and HEAD with
no API route on the path, scry looks the path up in the pages and mobile screens (params written either way, as above):
npx warlock scry --route "GET /chat"npx warlock scry --route "GET /login" --site admin # only the page of one site or appGET /chat (page)pages web /chat src/app/chat/pages/chat.page.tsxsetup src/app/chat/pages/chat.setup.tslayouts src/app/shell/layouts/app.layout.tsxfiles src/app/chat/pages/chat.page.tsx src/app/chat/pages/chat.setup.ts src/app/shell/layouts/app.layout.tsxfiles holds the page file, its setup file and its layouts with everything they import. A path several sites serve
(/, /login) lists every one of them; --site <id> keeps one site or mobile app. In --json, route is null and
pages holds one entry per site (app, site, route, file, type, setupFile, layouts, files). Other methods
on a page URL stop with GR9002, and its message lists the pages on that path. The grimoire_route MCP tool takes the
same page URLs and an optional site.
Errors under --json
Section titled “Errors under --json”With --json, a failed scry prints the error as JSON on stdout and exits 1, so a caller that parses stdout always
gets an object:
{ "type": "error", "code": "GR9002", "message": "No route matches DELETE /api/orders. …", "fix": "…"}fix is the code’s fix text (an empty string when it has none). Without --json the error is text on stderr, as for
every command. The ScryError type describes the object; the scry MCP tools return the same object as their error
text (see MCP tools).
A feature: --feature
Section titled “A feature: --feature”npx warlock scry --feature catalogcatalog Product catalog shipped 2.1 updated 2026-11-10 apps web-client, mobileflows browse-products shipped since 1.0 new-arrivals shipped since 2.0 wishlist proposed since 3.0own 8 files (unreached: none)borrows src/app/shared/utils/money.tsroutes GET /api/products GET /api/products/new-arrivals GET /api/products/:idpages web-client /products/:idchanges 2.1 fixed new-arrivals: a customer with no country saw an empty list … (unreleased) 2.0 added new-arrivals: customers see the newest products sold in … (1.0.0, 2026-10-01) 1.0 added browse-products: customers list products and open one (1.0.0, 2026-10-01)tasks T-014 waiting for approval Let customers save products to a wishlistcheck 0 errors, 4 warnings, 8 expectedA flow: --flow
Section titled “A flow: --flow”npx warlock scry --flow catalog/new-arrivalscatalog/new-arrivals New arrivals shipped since 2.0 who everyoneThe newest products sold in the shopper's country, newest first.1. page / src/web/$sites/client/home.page.tsx (+5 reachable)2. route GET /api/products/new-arrivals src/app/catalog/controllers/new-arrivals.controller.ts (+4 reachable)differs mobile: uses the device's country when the customer has noneAC-1 not run the newest products come first src/app/catalog/tests/new-arrivals.test.ts:12AC-2 not run a customer with no country sees … src/app/catalog/tests/new-arrivals.test.ts:17AC-3 [mobile] no test the device's country is used when …shown on mobile home: New arrivals web-client home: New arrivalshistory 2.1 fixed (unreleased) 2.0 added (1.0.0, 2026-10-01)check 0 errors, 1 warning, 0 expectedThe line under the title is the flow’s summary. Each step shows the file it starts from and how many more files
run behind it (+5 reachable). Imports that only carry types are not followed, because they are erased before the
code runs; when a step reaches files only through them, they are counted apart (2 type-only). A page step takes every page and
screen of the feature’s apps that matches the route, so the count includes the mobile screen here. A step that names
nothing shows not found. Each criterion shows its status from the last test run: pass, fail, stale (the test
changed since it ran), not run or no test (see Test results).
Search: --search
Section titled “Search: --search”npx warlock scry --search "the change history screen needs a better ui"npx warlock scry --search "new arrivals"npx warlock scry --search "order" --limit 5 --app mobile 21.4 flow catalog/new-arrivals New arrivals 12.9 block mobile/home/new-arrivals catalog/new-arrivals 11.3 route GET /api/products/new-arrivals catalog.new-arrivals 9.8 file src/app/catalog/services/new-arrivals.service.ts Lists the newest products sold in the customer's country.changes with the top hits: src/app/catalog/repositories/products.repository.ts imported by new-arrivals.service.ts src/app/catalog/tests/new-arrivals.test.ts testnext: warlock scry --impact src/app/catalog/services/new-arrivals.service.tsSearch first: the answer already carries the top file’s impact list. Run --impact only for the full lists. Pass the whole sentence (a commit title, a bug report) rather than two keywords: a hit needs only some of the words,
and more words give the right file more to match. Case does not matter, words are matched whole (ui does not find
build), a plural or -ing/-ed form matches its base word, and small words such as the, of and for are left
out (a text of small words only finds nothing). An id such as AC-5 or WL9003 stays one word.
Search reads any language. One tokeniser serves the text and the index: accents and Arabic vowel marks are dropped
(café and cafe match, so do أحمد and احمد), the tatweel is dropped, ى is read as ي and ة as ه, words
split at every character that is not a letter or digit, camel case splits in any script, and an Arabic word of five or
more letters loses a leading article (ال, وال, بال, لل), so شحنة finds الشحنة. A few Arabic small words
(في, من, على) are left out like the English ones. Stemming of plurals and -ing/-ed is for Latin words only.
A text with no letters or digits in any script stops with GR9006.
Hits are ranked in two tiers and printed in score order, best first, with the score in front of each line:
- Names first. A feature, flow, block, page, route, file or export whose name or title is the whole text ranks highest, then one that starts with the text, then one that holds every word as a whole word. A feature or flow adds two ranks to such a match.
- Everything else by BM25F score. Candidates that share only some of the words are scored over four fields:
the words of the id or path (weight 3), export names (2), the header sentence or title (1) and written text (1:
a flow’s summary, story, cases and criteria). Rare words count more than common ones. A block is found through
its
<app>/<page>and its text, never through the slug of its whole text.
Name matches always rank above scored matches. On an equal score features and flows come first, then a page or screen
file before its helper files. A flow found by its written text shows the part that matched, like
[AC-5: A receipt is emailed]. Page, screen, block and file hits carry the app they belong to; --app <id> keeps
only the hits of that app (features, flows, routes and tasks belong to none and are left out). When the limit cuts the
list, a last line counts the matches per type (showing 20 of 41 (2 flow, 39 file); raise --limit for more), and
--json carries the same counts. The index is built once for each opened book, so repeated searches in the MCP
server stay fast. --limit defaults to 20.
What changes with the top hits
Section titled “What changes with the top hits”After the hits, the answer lists the files that usually change with the top ones, so you open the right files
without a second question. They come from the top three hits that map to files (a file, an export, a page or screen, a
mail or job, a route’s handler, or the files a flow’s steps start from). For each, the list holds the files it imports
and the files that import it when they belong to the same feature (the same module when the file has no owner), no
specs, plus the spec files that import it and the tests that prove a hit flow’s criteria. Files are ranked by how many
of the top hits share them, then step files, importers, imports and tests, and the list stops at 10 files whatever the
--limit. A file that is already a hit is left out.
Below the block, the answer folds in the impact of the top hit’s file, so one search answers “what changes with it”
without --impact: the importers (transitively) that are not already listed above, at most 8 with a +n more count,
then the API routes (METHOD path), flows and tests that reach it, at most 5 each:
impact of src/app/catalog/services/new-arrivals.service.ts: files src/app/orders/controllers/orders.controller.ts, src/app/catalog/controllers/home.controller.ts routes GET /api/products/new-arrivalsWhen that block is printed it replaces the next: line; when the impact adds nothing beyond the list above, the
next: line stays. Each line of the first block says why the file is there: imports <hit file> (it imports the hit’s file), imported by <hit file> (the
hit’s file imports it), test, or step of <flow>. When there is no impact block, the last line,
next: warlock scry --impact <file>, names the impact question for the first file. In --json the answer carries
alsoChanges ({ file, reason, via }, via being the ids of the top hits that brought the file in), impact
({ file, files, more, routes, flows, tests }), weak and next.
When the best hit is not a name match and holds fewer than half of the words of the text, the answer is marked weak
("weak": true) and ends with weak match: no hit holds most of the request's words; use grep for literal text.
Use grep for literal text and when the answer says this.
Spec files, locale files and type files have their BM25F score multiplied by 0.6, so code wins a near tie and they are still found when nothing else matches.
Errors
Section titled “Errors”Every error prints its code, what failed and what to do, and the command exits 1:
GR9003 No feature has the id "billing". Features: auth, catalog, orders. fix: Use an id from `grimoire/features/`.| Code | When |
|---|---|
GR9001 | The file is not in the book (not a code file under the source roots, or new since the last build). |
GR9002 | No route matches, or there are no route facts yet. |
GR9003 | No feature has that id. |
GR9004 | No flow has that id. |
GR9006 | The question is missing, asks two things at once, or has the wrong form. |
GR9007 | The book was never built, or was built by another version: run warlock grimoire build. |
MCP tools
Section titled “MCP tools”warlock mcp and warlock dev --mcp serve these tools next to the built-in ones. They answer with the same objects
--json prints. The read tools never boot the app; they use the cached route facts, and a grimoire_route question
on a project with no route facts stops with GR9002 (pages and screens are still found by their URL).
| Tool | Input | Answer | Writes |
|---|---|---|---|
grimoire_file | { file } | the file answer | no |
grimoire_impact | { file } | the impact answer | no |
grimoire_route | { method, path, site? } | the route answer | no |
grimoire_feature | { feature } | the feature answer | no |
grimoire_flow | { flow, files?, step?, offset? } | the compact flow answer, or one page of a step’s files | no |
grimoire_search | { text, limit?, app? } | the search answer | no |
grimoire_check | {} | the check report (note when the book is behind) | no |
grimoire_build | { force? } | { rebuilt, written, removed, routes, note? } | no |
grimoire_release | { release } | the release file, its list and whether it changed | yes |
grimoire_explain | { code } | the code’s title, fix, skill and docs link | no |
When a question fails, the scry tools (grimoire_file, grimoire_impact, grimoire_route, grimoire_feature,
grimoire_flow, grimoire_search) return a tool error whose text is the same ScryError JSON that warlock scry --json
prints, so a client can parse the code and the fix:
{ "type": "error", "code": "GR9004", "message": "No flow catalog/returns. …", "fix": "…" }The other tools’ errors read GR9006: <message> Fix: <fix>.
grimoire_flow answers with counts instead of file lists: each step has counts (direct, feature, reachable,
typeOnly) and its first 50 direct imports, so the answer stays small on a large app. To see the files behind one
step, call it again with files (reachable or type-only) and step (the step number); a page holds 200 files
sorted by module, and offset moves to the next page. warlock scry --flow --json and the scry() function keep the
full lists.
The MCP server keeps the opened book in memory between calls. Each read tool checks that nothing changed with a stamp
of stat results (the size and modified time of the code and test files, the folders that hold them, every written
file, the manifest and the test results file; no file is read) and answers from the kept book when the stamp is the
same. A change to a code file, a written file or the manifest opens the book again on the next call, so answers never
go stale. On a large app this turns a call that reopened the book (seconds) into a stat pass over the files (a fraction of a
second). The read tools open the stored book the way warlock scry does: they never rebuild it, and say in notes when it is behind the files. warlock scry as a one-off command opens the stored book once per process; the kept book helps long-running processes.
The read tools write nothing. grimoire_build refreshes the book, which is a git-ignored cache, so it does not count as
a write. grimoire_build reads the routes again when they changed (under warlock mcp this boots the app once, the
warlock inspect way). grimoire_release writes a project file, so the server refuses it unless it runs with
--allow-writes.
warlock explain GR2001
Section titled “warlock explain GR2001”npx warlock explain GR2001npx warlock explain GR2001 --jsonGR2001 A route step names a route that does not exist
Area: links Fix: Fix the method and path in the flow, or add the route in code. Skill: record-a-change Docs: https://warlock.js.org/v/latest/grimoire/guides/04-check/#gr2001warlock explain reads only warlock.config.ts for a GR code and never boots the app. The answer comes from the
Grimoire commands registered in cli.commands.
From code
Section titled “From code”import { createWarlockAdapter, collectMobileFacts } from "@warlock.js/grimoire/warlock";import { openGrimoire, scry, formatScryResult } from "@warlock.js/grimoire";
const root = process.cwd();const snapshot = await openGrimoire(root, createWarlockAdapter(), { routes: "cached" });
console.log( formatScryResult(scry(snapshot, { type: "flow", feature: "catalog", flow: "new-arrivals" })).join( "\n", ),);console.log(await collectMobileFacts(root));openStoredGrimoire(root, adapter) opens the book the last build left without building it, the way warlock scry
does (GR9007 when it was never built). SCRY_STOP_WORDS is the set of small words search leaves out; add a word to
it before the first search of a process to leave that word out too:
import { SCRY_STOP_WORDS } from "@warlock.js/grimoire";
SCRY_STOP_WORDS.add("please");createWarlockAdapter(options) turns the inspect report into the book’s facts: files from collectFiles() of
@warlock.js/core/tooling (over src and each mobile app’s source folders, leaving out android/, ios/ and
build output), routes, events and jobs from inspectApp()
after the boot pass, pages from the web page graph, and mobile apps from their folders (collectMobileFacts()).
reachedFrom of a page is null (unknown) for now. Mails are files named *.mail.ts or *.email.ts and files in a mails/ or emails/ folder; notifications are
files named *.notification.ts. Jobs are the names of the queue’s registry (defineJob()) and of the scheduler’s
scheduled tasks, plus any *.job.ts file the registries do not list.