Run lore check from an agent
This guide has a coding agent check its own changes against your rules after every edit.
-
Install the command. Add it as a dev dependency, so every checkout has the same version:
npm install --save-dev @mattstack/lore -
Add one line to
AGENTS.md, or to whatever instructions file your agent reads:After editing files, run `lore check` and fix any rule your change breaks. -
Choose
loreornpx. Plainlore checkneedsloreon thePATH. A dev dependency puts it there inside package scripts, but not in an ordinary shell. If your agent runs commands from a shell, write the line withnpx @mattstack/lore checkinstead, which works anywhere. -
Check the output it reads.
lore checkprints text even when its output is not a terminal, so the agent reads the same rules you would. Run it yourself once after an edit to see what the agent sees. -
Check a whole branch before handing it over. For work spread across commits, tell the agent to run
lore check --base mainat the end. It covers committed and uncommitted work together.
Without the command
An agent with no Lore tooling can still apply Lore, since .lore files are plain text. Paste spec/AGENT.md into its instructions; it explains how to find the rules that apply to a change by reading the files. The For agents page quotes it in full.
Next steps
lore check: checking one commit or a branch.- Hand a reviewer the rules: the reviewer's side of the same rules.
- Lore or a skill: a skill can end by running
lore checkinstead of restating rules.