Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>crag — Governance for AI Coding AgentsNew to Visual Studio Code? Get it now.
crag — Governance for AI Coding Agents

crag — Governance for AI Coding Agents

WhitehatD

|
3 installs
| (0) | Free
One governance.md → 13 AI tool configs. Auto-recompile, drift detection, inline diagnostics.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

crag — Governance for AI Coding Agents

One governance.md → 13 AI tool configs. Auto-recompile, drift detection, inline diagnostics.

CI npm License


Demo

Analyze + compile in one shot

crag demo — analyze and compile

Auto-recompile on save

crag auto-recompile

Drift detection

crag audit — drift detection


Where is crag in VS Code?

Once installed, crag appears in 4 places:

1. Activity Bar (sidebar)

A crag icon appears in the Activity Bar (left sidebar). Click it to see the Compile Targets tree view — all 13 output formats with sync/stale status. Click any target to compile it.

2. Status Bar

The bottom status bar shows crag: 13/13 synced (or the current drift count). Click it to run an audit.

3. Command Palette

Ctrl+Shift+P → type crag to see all 10 palette commands: Analyze, Compile, Audit, Diff, Doctor, and more. (An 11th command, Compile This Target, is available only from the sidebar tree-view context menu.)

4. CodeLens (inline in governance.md)

Open .claude/governance.md and you'll see inline Compile | Audit | Diff actions above sections — one click to act.


Features

Feature How it works
Auto-recompile Save governance.md → all 13 targets recompiled (debounced 500ms)
Drift detection Status bar shows live drift count. Problems panel shows issues with line numbers
Sidebar Tree view of all 13 compile targets with sync/stale icons
CodeLens Inline Compile / Audit / Diff actions directly in governance.md
Startup audit Background audit on workspace open — know your drift state immediately
11 commands 10 in the command palette + 1 sidebar-only (Compile This Target)

Commands

Ctrl+Shift+P → type crag:

Command What it does
Analyze Project Generate governance.md from your codebase
Compile All Targets Compile governance to all 13 formats
Compile Target... Pick a specific target
Audit Drift Check for stale configs, phantom gates, CI drift
Audit + Auto-Fix Audit and auto-recompile stale targets
Diff Compare governance vs codebase reality
Doctor Deep diagnostic of governance integrity
Install Pre-Commit Hook Install the crag pre-commit hook
Open governance.md Jump to the governance file
Refresh Re-scan targets and refresh sidebar

13 Compile Targets

One governance.md → deterministic output:

Target Output Consumer
agents-md AGENTS.md Codex, Aider, Factory
claude CLAUDE.md Claude Code
cursor .cursor/rules/governance.mdc Cursor
gemini GEMINI.md Gemini CLI
copilot .github/copilot-instructions.md GitHub Copilot
cline .clinerules Cline
continue .continuerules Continue.dev
windsurf .windsurf/rules/governance.md Windsurf
zed .rules Zed
amazonq .amazonq/rules/governance.md Amazon Q
github .github/workflows/gates.yml GitHub Actions
husky .husky/pre-commit Husky
pre-commit .pre-commit-config.yaml pre-commit.com

Settings

Setting Default Description
crag.autoCompileOnSave true Recompile when governance.md is saved
crag.showStatusBar true Show drift count in status bar
crag.auditOnStartup true Background audit on workspace open
crag.cliPath "" Custom crag binary path
crag.diagnostics.enabled true Show drift in Problems panel
crag.compileTargets [] Restrict to specific targets

Requirements

  • crag CLI — npm install -g @whitehatd/crag
  • Node.js 18+

The extension auto-detects crag via npx if not installed globally.


Works with 6 editors

VS Code · Cursor · Windsurf · Cline · Continue · Google Antigravity

One 20 KB extension. All are VS Code forks — zero porting.


25+ Language Stacks

Node · Python · Rust · Go · Java · Kotlin · Ruby · PHP · .NET · Swift · Elixir · Haskell · OCaml · Zig · C/C++ · Dart · Crystal · Nim · Julia · Erlang · Lua · Terraform · Helm · Docker


crag.sh · Docs · GitHub · npm · Dashboard · Status

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft