Skip to main content

Flags risky changes to AI agent configs (prompts, tool permissions, model choice) in a diff.

Project description

agent-diff-guard

Catches risky changes to an AI agent's config — system prompt, tool permissions, model choice — before they merge. A narrow, single-purpose CI check, not a full observability platform: point it at a repo and it scans every changed file against your base branch automatically.

Get a Pro license → — full per-file detail, model cost-tier detection, SARIF output for GitHub code scanning.

What it catches

  • Safety instructions removed — a phrase like "must never" / "do not" / "refuse" present before a change and missing after it.
  • Dangerous tool permissions addedshell_exec, sudo, rm -rf, exec(, eval(, admin_override appearing for the first time.
  • Model swapped to a pricier tier (Pro) — e.g. haiku → opus, gpt-4o-mini → gpt-4o.

Install

pip install agent-diff-guard

Usage

check — scans changed files against a git ref (recommended)

agent-diff-guard check                          # all files changed vs. HEAD, in the current repo
agent-diff-guard check --against origin/main     # all files changed vs. another ref
agent-diff-guard check path/to/agent_config.yaml # restrict to one file
agent-diff-guard check --repo /path/to/repo      # run against a repo other than cwd
agent-diff-guard check --license-key "$LICENSE"  # unlock Pro (or set AGENT_DIFF_GUARD_LICENSE)

Exit code is 1 if any file has a HIGH severity finding, 0 otherwise — safe to use as a CI gate. The exit code always reflects every scanned file, on the free tier too.

Free tier shows full detail (path + findings) for the first 3 files with findings; beyond that it collapses into a one-line summary — the CI gate still fails correctly either way, Pro just gives the full per-file breakdown.

agent-diff-guard check --format sarif --license-key "$LICENSE"   # Pro: SARIF output

A Pro license key is verified live against Gumroad on every run. If it's invalid or unreachable, the tool falls back to the free tier rather than erroring out, so a network hiccup never breaks your CI.

diff — compare two file versions directly

For comparing arbitrary snapshots outside a git checkout:

agent-diff-guard diff path/to/before.txt path/to/after.txt
agent-diff-guard diff path/to/before.txt path/to/after.txt --license-key "$LICENSE"

GitHub Action

- uses: jwa-wa/agent-diff-guard@v1
  with:
    license-key: ${{ secrets.AGENT_DIFF_GUARD_LICENSE }}   # optional, omit for free tier

That's the whole setup for a pull_request workflow — it reads the PR's base branch automatically and works against a standard (shallow) checkout, no extra config needed.

For a push-triggered workflow (no PR context), it compares against the previous commit instead; your checkout step needs fetch-depth: 2 (or 0) for that:

- uses: actions/checkout@v4
  with:
    fetch-depth: 2
- uses: jwa-wa/agent-diff-guard@v1

Store your license key as a repo/org secret — the Action passes it through as an environment variable, never a command-line argument, so it doesn't end up in job logs.

Input Default Purpose
base-ref PR base branch Branch to diff against. Empty = compare against previous commit.
paths (all changed files) Space-separated list to restrict the scan to specific files.
license-key (none, free tier) Pro license key, verified live against Gumroad.

Pricing

Free — the CI-gate result (pass/fail) always covers every scanned file. Full per-file detail for the first 3 files with findings each run.

Proget a license:

  • Full per-file detail for every file, not just the first 3.
  • Model cost-tier change detection.
  • SARIF output — findings show up natively in GitHub's Security tab.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_diff_guard-0.1.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_diff_guard-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file agent_diff_guard-0.1.0.tar.gz.

File metadata

  • Download URL: agent_diff_guard-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for agent_diff_guard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58d171f1b6ce40e7faf8389f5024dc932f822204f8bcecf3f9f6dc65fe10a89b
MD5 3786852b030274bea5f0b3e95da1ff71
BLAKE2b-256 7815acc77e4a40e8293be92001c3a860fa47c4767f762cc3355616fd504da3e9

See more details on using hashes here.

File details

Details for the file agent_diff_guard-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_diff_guard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da881f598543aa08c3f0b906673753bc1116897c4787ddeefcc3b6c669ed6efa
MD5 5dd33d80077ddb7a2849d0583fc92d75
BLAKE2b-256 f1b1f77d2f99a89b1d94052a1d7442572a0d71658cda660ce7596607a1d3472d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page