Getting started
crag is a CLI. You edit one governance file, AGENTS.md. crag keeps your CI gates, git hooks, and per-agent config files in sync with it. The package is @whitehatd/crag (v1.0.0-alpha.1). It has no runtime dependencies and needs Node 18 or newer. Installing it adds two binaries: crag and crag-mcp.
Install
npm install -g @whitehatd/crag # or run it once, no install: npx @whitehatd/crag
First run
Run crag with no arguments inside a repo. It runs analyze then compile in one pass.
cd your-project crag
What lands on disk:
| Step | What it does | Files written |
|---|---|---|
analyze | Reads package.json, CI workflows, Makefiles, and 25+ other signals; infers your test/lint/build gates. | Updates the managed gates fence inside AGENTS.md. Scaffolds a minimal AGENTS.md if none exists. |
compile | Detects which AI tools and CI systems are actually present, then derives the config each one needs from AGENTS.md. | AGENTS.md plus only the deltas (for example CLAUDE.md, Cursor rules, a CI gates workflow). Never all 23 files. |
Check for drift
crag audit compares the committed governance against the repo as it exists now: stale compiled files, gates that reference a tool you no longer have, CI commands missing from AGENTS.md.
crag audit # human-readable report crag audit --fix # recompile stale targets crag audit --ci # exit non-zero on drift (for pipelines)
Zero runtime dependencies. The published
package.json lists no dependencies. crag runs on Node built-ins alone. Nothing is fetched at install beyond the package itself.