AI coding agents can edit files, run shell commands, and touch infrastructure. One bad rm -rf, force-push, or docker compose down -v can wipe hours of work or production data.
# ~/.bashrc or ~/.zshrc
agcheck() {
agent-guard check "$@"
}
#!/usr/bin/env bash
# ag-run — evaluate then execute
set -euo pipefail
exec agent-guard run -- "$@"
Usage:
chmod +x ag-run
./ag-run git status
./ag-run npm test
In CI, prefer agent-guard check (analysis only). Do not enable interactive WARN prompts.
agent-guard check --json "$CMD"
case $? in
0) echo ALLOW ;;
10) echo WARN; exit 1 ;;
20) echo BLOCK; exit 1 ;;
*) exit 30 ;;
esac
agent-guard check "Remove-Item -Recurse -Force .\src"
agent-guard run -- python -c "print('ok')"
Always prefer agent-guard run -- prog arg1 arg2 so argv is not re-parsed by an outer shell when avoidable.