devguard
devguard is an evidence-first engineering workflow (verified-dev) combined with a curated, version-pinned toolkit of token-saving MCP servers and CLI tools. Install it once and share the exact same engineering discipline and tool wiring across Claude Code, VS Code (Copilot), Google Antigravity, Cursor, OpenCode, Codex CLI, and Gemini CLI.
Installation
Quit running instances of Claude Code, VS Code, and Antigravity first (so they do not overwrite their config files on exit), then run:
curl -fsSL https://raw.githubusercontent.com/Burapa-J/devguard/main/bootstrap.sh | bash
irm https://raw.githubusercontent.com/Burapa-J/devguard/main/bootstrap.ps1 | iex
The bootstrap script performs the following idempotent steps:
- Installs missing prerequisites via Homebrew on macOS,
apt-geton Debian/Ubuntu, orwingeton Windows (git,jq,python3,node,xcbeautifyon macOS,ast-grep,shellcheck). - Clones the repository to
~/.local/share/agent-kit/src(or updates an existing clone). - Runs
./install.sh(via Git Bash on Windows) with the default setup: global rules, theverified-devskill, compaction reminder hook,codegraph,projectmem,rtk, and automatic repository indexing under~/Developer. - Ensures
~/.local/binis on yourPATH(including Windows UserPATHand.cmdshims for PowerShell/CMD).
Custom Install Options
If you already cloned the repository, run ./install.sh directly or pass flags through bootstrap after bash -s --:
./install.sh --dry-run # Preview changes without modifying any files
./install.sh --with=codegraph,projectmem,rtk,context-mode # Enable optional context-mode component
./install.sh --targets=claude,vscode,antigravity # Configure specific agents only
./install.sh --auto-project=~/Developer,~/Work # Customize auto-indexed directories
Quickstart
After installation, open a new terminal and verify your setup:
devguard status # View the agent & tool wiring matrix
devguard doctor # Run all 8 installation health checks
devguard stats # View token savings, AST graph coverage, and verification pass rates
devguard gate init # In a repo: write .devguard/checks and install the commit/push gate
1. Working Mode (verified-dev)
Adapted from ideas in Lauren Tan's pstack, Andrej Karpathy's coding guidelines, and Ponytail, the working mode consists of a 9-line always-on block (rules/core.md) and an on-demand skill (skills/verified-dev/SKILL.md):
- Route by task type: Every request routes to one explicit playbook: Investigation, Bug fix, Feature, Refactor, Perf issue, or Prompt / LLM pipeline.
- Read-only on questions & plan reviews: When you ask a question, discuss tradeoffs, or review a plan, the agent stays strictly read-only until you ask to implement.
- No guessing from
--helpor filenames: Before claiming how a module works or proposing a design, the agent must read the actual implementation source (read/write paths, ID/state lifecycle, ignore/conflict rules) and citefile:line. - Smallest change & sibling-caller checks: Checks every caller of a modified function via
codegraph_exploreand fixes the shared path once. - Runtime evidence required: A successful build is never proof. Every "done" must read
.verify/<name>.logand report a one-line verification receipt (command, exit code, key verdict, and log link), pasting verbatim log lines only on failure. - Source tag on every claim: Each factual claim ends with
(read file:line),(ran: command → exit N),(inferred)or(unchecked); evidence is gathered before answering, and a changed answer names the evidence that changed it. - Pre-mortem before features: A table of what breaks, when, the design that prevents it, and the test that proves it; rows without a test are reported as open risks.
- Prove the test can fail: A new test counts only after it has failed for the right reason (before the fix, or with the guard removed again).
- Done gate: If the repo has
.devguard/checks,devguard checkmust pass before "done", and its git hooks are never bypassed with--no-verify.
2. Components & Companion CLI Tools
All third-party tools are installed directly from upstream at pinned versions. No prompt-modifying local proxies (such as headroom) are used.
| Name | Category | Purpose | Upstream Package | Default |
|---|---|---|---|---|
codegraph |
MCP Component | AST symbol index & caller/callee graph (codegraph_explore) |
npm @colbymchenry/codegraph@1.6.2 |
Enabled |
projectmem |
MCP Component | Per-project & global JSONL/Markdown memory for issues, attempts, fixes & decisions with real-time iCloud Drive CRDT sync | PyPI projectmem==0.3.5 (isolated venv) |
Enabled |
rtk |
Hook / Plugin | Compresses routine shell command output by 38–90% before it enters context | Homebrew rtk (1.2.0+) |
Enabled |
context-mode |
MCP Component | Sandboxed command execution & FTS5 indexed output search (Node ≥ 22.5) | npm context-mode@2.1.7 |
Opt-in |
ast-grep |
Companion CLI | Tree-sitter structural search and multi-line AST refactoring | Homebrew ast-grep |
Installed |
xcbeautify |
Companion CLI | Condenses raw xcodebuild build and test logs into clean summaries |
Homebrew xcbeautify |
Installed |
shellcheck |
Companion CLI | Static analysis for shell scripts; the kit lints itself with it on every commit | Homebrew shellcheck |
Installed |
gitleaks |
Gate check | Scans staged changes for secrets; add it to a repo's .devguard/checks |
Homebrew gitleaks |
Opt-in per repo |
Supported Agents & Config Paths
| Agent | Global Rules File | Skill Path | MCP Configuration |
|---|---|---|---|
| Claude Code | ~/.claude/CLAUDE.md |
~/.claude/skills/verified-dev |
~/.claude.json |
| VS Code (Copilot) | ~/.copilot/copilot-instructions.md |
Shared via ~/.claude/skills |
~/Library/Application Support/Code/User/mcp.json |
| Google Antigravity | ~/.gemini/GEMINI.md |
~/.gemini/config/skills/verified-dev |
~/.gemini/config/mcp_config.json |
| Cursor | ~/.cursor/rules/devguard.mdc |
~/.cursor/skills/verified-dev |
~/.cursor/mcp.json |
| OpenCode | ~/.config/opencode/AGENTS.md |
~/.config/opencode/skills/verified-dev |
~/.config/opencode/opencode.jsonc |
| Codex CLI | ~/.codex/AGENTS.md |
~/.codex/skills/verified-dev |
~/.codex/config.toml |
| Gemini CLI | ~/.gemini/GEMINI.md |
~/.gemini/skills/verified-dev |
~/.gemini/settings.json |
CLI Command Reference
| Command | Description |
|---|---|
devguard |
Launch the interactive terminal menu |
devguard status |
Display the overview matrix of agents, rules, skills, components, and companion tools |
devguard doctor [--fix] |
Audit 8 installation failure modes; pass --fix to repair issues automatically (it re-checks and says when a repair failed) |
devguard stats [options] |
Show token savings, AST index coverage, and verification pass rates (-p current repo, -d daily, --dashboard, --reset) |
devguard sync [--quiet] |
Run cross-machine CRDT sync of projectmem project and global memory over iCloud Drive |
devguard sync --check |
Read-only: per project, do all Macs hold the same events? (in-sync, diverged, single, incomplete) |
devguard check [commit|push] |
Run this repo's .devguard/checks (the done gate); exit 1 on failure |
devguard gate init|install|uninstall |
Write a checks template and/or add or remove the pre-commit and pre-push hooks |
devguard review [--with claude|agy|gemini] [--base REF] |
Have another vendor's model review the change, read-only; report in .verify/review-*.md |
devguard eval run|compare |
Measure correctness, source tags and pushback flips on a case set; compare two runs |
devguard select |
Interactively choose which agents and tool components to enable or disable |
devguard update |
Pull the latest repository commits, upgrade tools, and re-apply all configurations |
devguard init [--all] |
Initialize .gitignore, codegraph, and projectmem in the current repo (or all repos under auto-setup roots) |
devguard skip |
Create a .agent-kit-skip marker so the current repo is excluded from automatic setup |
devguard uninstall [--purge] |
Remove all rules, links, hooks, and MCP wiring (--purge also uninstalls CLIs installed by devguard) |
Capturing Verification Evidence (agent-verify)
Because shell compressors like rtk condense stdout, verification commands are run through agent-verify, which writes the complete unfiltered output and exit code to .verify/<name>.log and extracts failing line numbers (errors_at=L...):
agent-verify unit-tests -- swift test
# Output: agent-verify[unit-tests] exit=0 lines=42 log=.verify/unit-tests.log
agent-verify build-check -- xcodebuild test -scheme MyApp -destination 'platform=macOS'
# Output: agent-verify[build-check] exit=65 lines=184 errors_at=L92,L141 log=.verify/build-check.log
Done Gate (.devguard/checks)
Rules ask an agent to verify; the gate checks for it, whatever model wrote the code. Each repo lists its real checks in a committed .devguard/checks, one per line:
commit build: swift build # every commit: keep it fast
push test: swift test # before push: full suites
commit secrets: gitleaks git --staged --redact --no-banner . # optional: block committed secrets
devguard gate init writes a commented template and installs pre-commit / pre-push hooks; devguard check runs everything by hand. Each check runs through agent-verify, so a failure prints one line and leaves the full log in .verify/gate-<name>.log.
- Never overwrites a hook it did not write (you get the line to add instead); follows linked worktrees and
core.hooksPath. - Lets the commit through with a warning if the kit has moved, so a moved kit cannot block every repo.
- Flags a commit that edits
.devguard/checks; a malformed line fails closed with its line number. - Runs checks with default
SIGPIPEand isolated Python, so they behave as in a terminal. - Known limits: checks see the whole working tree, not only the staged part, and
git commit --no-verifystill skips them (the core rule forbids it).
Cross-model Review (devguard review)
Models catch different things. devguard review sends the change (uncommitted work including new files, the last commit, or --base REF for a range) to a model from another vendor, read-only, with a fixed rubric: correctness bugs, failure modes, tests that would pass without the change, and claims the code does not back. It prints one line (verdict, finding count, report path) and saves the report to .verify/review-<time>-<reviewer>-<pid>.md.
devguard review --with agy # Claude wrote it: let Gemini (via Antigravity) review
devguard review --with claude # Gemini wrote it: let Claude review
devguard review --base main # review a whole branch
Pick the vendor that did not write the code. Gemini CLI refuses individual accounts, so reach Gemini through agy. Each reviewer CLI must be signed in once in a terminal; a signed-out reviewer gets a clear hint. Treat findings as leads and check each against the code.
Measuring Agents (devguard eval)
A rule change is a claim until it is measured. Cases are JSON lines with a prompt, an expect regex, an optional reject regex and an optional pushback follow-up asked in the same conversation:
devguard eval run .devguard/evals/kit.jsonl --with agy --reps 3 --label before
# ...change a rule...
devguard eval run .devguard/evals/kit.jsonl --with agy --reps 3 --label after
devguard eval compare .verify/eval-before-*.json .verify/eval-after-*.json
Per case it reports first-answer correctness, source tags per answer, and how often the answer flipped under pushback.
Evidence: Does Cross-model Review Help?
Seven commits of this kit were rebuilt as isolated repos and reviewed blind by Claude and Gemini. Against 11 bugs known to be in them, each reviewer found 8/11 and the two together found 10/11; each caught bugs the other missed. A commit assumed clean drew a finding from both that turned out to be a real bug. A diff-based "should I review?" heuristic flagged every code commit, so it was not built. Decision: agents run devguard check on every task and invoke devguard review only when explicitly requested by the user (suggesting it after high-risk changes to persisted data, sync, concurrency, or security). One run per commit and reviewer, 11 bugs from one author: a trend, not a precise rate. Details: docs/experiments/2026-10-30-cross-model-review.md.
Measuring ROI & Workflow Quality (devguard stats)
Run devguard stats to view three real-data telemetry tables across your machine:
╭─ 1. RTK Shell Compression Savings ─────────────────────────────────────────────╮
Total commands: 2446 Tokens saved: 194.2K (38.6%)
Efficiency meter: █████████░░░░░░░░░░░░░░░ 38.6%
╰────────────────────────────────────────────────────────────────────────────────╯
╭─ 2. Repositories (CodeGraph & ProjectMem) ─────────────────────────────────────╮
│ Repository Files Symbols Edges Fixes Tokens Saved │
├────────────────────────────────────────────────────────────────────────────────┤
│ TOTAL (8 repos) 655 16207 46092 51 134000 │
╰────────────────────────────────────────────────────────────────────────────────╯
╭─ 3. Verification & Workflow Quality (.verify/*.log) ───────────────────────────╮
│ Repository Verifies Passed Failed Pass Rate Lines Saved │
├────────────────────────────────────────────────────────────────────────────────┤
│ TOTAL (5 repos) 135 127 8 94% 22497 │
╰────────────────────────────────────────────────────────────────────────────────╯
Self-Healing Health Checks (devguard doctor)
devguard doctor audits 8 common configuration problems and repairs them automatically when invoked with --fix:
- Legacy
toklessresidue (leftover binaries,ANTHROPIC_BASE_URLproxy env in~/.claude/settings.json, and.zshrcblocks). - Broken or stale symlinks in
~/.local/bin. - Conflicting brevity/workflow plugins (
caveman,ponytail,cavecrew). - MCP server configuration drift across canonical agent files.
- RTK global plugin & hook registration for Google Antigravity.
- Synchronization of
<!-- agent-kit:begin -->blocks againstrules/core.md. - Version drift of pinned components and presence of companion tools (
ast-grep,xcbeautify,shellcheck). - Cross-machine memory sync: the
.pthhook loads this kit, the iCloud hub exists, and no projectmem MCP server is still running old sync code (restart your agents;--fixnever kills them).
Automatic Repository Setup & Multi-Mac Sync
Every Git repository under ~/Developer (1–2 levels deep) is automatically configured once: .verify/ is appended to .gitignore, codegraph init builds the AST index, and pjm init initializes per-repo memory (verifying config.toml, .git/hooks/post-commit, and registration in ~/.projectmem/projects.json). Setup is triggered via:
- Claude Code SessionStart hook when opening a project in Claude Code.
- zsh
chpwdhook when youcdinto a repository in any terminal. - macOS
launchdbackground scan every 30 minutes (covering GUI-cloned repositories in VS Code and Antigravity).
Cross-Machine Memory Sync (iCloud Drive CRDT): When iCloud Drive is signed in, projectmem automatically syncs per-project and global memories across all your Macs via ~/Library/Mobile Documents/com~apple~CloudDocs/devguard-sync/:
- Per-device node files: Each Mac writes only to its own
nodes/<device_id>.jsonl,docs/<device_id>-PROJECT_MAP.md,docs/<device_id>-plan.md, andglobal/nodes/<device_id>.json, preventing iCloud file conflicts (* 2.jsonl). - Git root commit matching (
root-<sha12>): Repositories are matched by their initial Git commit hash so folder names can differ across machines. - Offline
issue_idcollision resolution: Concurrent offline issues with the same number are deterministically renumbered withparent_issue_keylinkage and.projectmem/.current_issuemarker updates. - Zero-touch real-time hook: A
.pthruntime hook insideprojectmem-venvsyncs automatically on every MCP read/write, complemented bycd,launchd, anddevguard sync. Writes toevents.jsonltake a shared lock, so an event appended while a sync runs is never lost. - Is it synced?
devguard sync --checkcompares every Mac's node file per project and names any Mac that is missing events;devguard statusshows the totals. A repo with no commit and no remote is not synced until its first commit, so two unrelated repos with the same folder name never merge.
Uninstalling
Every modified file is backed up to ~/.agent-kit-backup/<timestamp>/ (automatically retaining the 10 newest snapshots) before editing, and uninstalling restores your original files byte-for-byte:
devguard uninstall --dry-run # Preview what will be removed
devguard uninstall # Remove rules, skills, hooks, and MCP wiring (keep tool CLIs)
devguard uninstall --purge # Also uninstall tool CLIs that devguard installed