devguard v1.1.0 · MIT License
GitHub ↗
Platform: macOS · Linux · Windows Shell: Bash 3.2+ · Zsh · PowerShell Agents: Claude Code · Copilot · Antigravity · Cursor · OpenCode · Codex · Gemini

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.

Design Philosophy Two layers that never interfere with each other: (1) Working mode enforces task-specific playbooks, read-only investigation on questions, and mandatory runtime proof before claiming "done". (2) Token-saving tools compress routine shell output and index your codebase's AST call graph while keeping verification logs completely intact. On top sit quality gates that do not depend on the model: a per-repo done gate enforced by git hooks, a cross-vendor review, and an eval harness to measure whether a rule change helps.

Installation

Quit running instances of Claude Code, VS Code, and Antigravity first (so they do not overwrite their config files on exit), then run:

sh — One-command bootstrap (macOS / Linux)
curl -fsSL https://raw.githubusercontent.com/Burapa-J/devguard/main/bootstrap.sh | bash
PowerShell — One-command bootstrap (Windows)
irm https://raw.githubusercontent.com/Burapa-J/devguard/main/bootstrap.ps1 | iex

The bootstrap script performs the following idempotent steps:

  1. Installs missing prerequisites via Homebrew on macOS, apt-get on Debian/Ubuntu, or winget on Windows (git, jq, python3, node, xcbeautify on macOS, ast-grep, shellcheck).
  2. Clones the repository to ~/.local/share/agent-kit/src (or updates an existing clone).
  3. Runs ./install.sh (via Git Bash on Windows) with the default setup: global rules, the verified-dev skill, compaction reminder hook, codegraph, projectmem, rtk, and automatic repository indexing under ~/Developer.
  4. Ensures ~/.local/bin is on your PATH (including Windows User PATH and .cmd shims for PowerShell/CMD).

Custom Install Options

If you already cloned the repository, run ./install.sh directly or pass flags through bootstrap after bash -s --:

sh
./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:

sh
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):

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...):

sh
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:

.devguard/checks
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.

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.

sh
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:

sh
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:

Terminal Output — devguard stats
╭─ 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:

  1. Legacy tokless residue (leftover binaries, ANTHROPIC_BASE_URL proxy env in ~/.claude/settings.json, and .zshrc blocks).
  2. Broken or stale symlinks in ~/.local/bin.
  3. Conflicting brevity/workflow plugins (caveman, ponytail, cavecrew).
  4. MCP server configuration drift across canonical agent files.
  5. RTK global plugin & hook registration for Google Antigravity.
  6. Synchronization of <!-- agent-kit:begin --> blocks against rules/core.md.
  7. Version drift of pinned components and presence of companion tools (ast-grep, xcbeautify, shellcheck).
  8. Cross-machine memory sync: the .pth hook loads this kit, the iCloud hub exists, and no projectmem MCP server is still running old sync code (restart your agents; --fix never 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:

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/:

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:

sh
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