Agent Guard Check
v1.7.0Shows what each AI agent configured in a repository can do and flags authority it does not need.
Agent permissions now live in files that change in ordinary pull requests: a permission list, an MCP server, a hook, a CI trigger, a plugin marketplace. One line can turn a harmless agent into one that reads private data, takes in untrusted text and can send data out. A reviewer sees a JSON diff, not that consequence. Agent Guard Check reads those files and shows what each agent in a repository can do. It flags authority the agent does not need and, on a pull request, reports only what the change made worse.
Summary extracted from the README.
@shieldaai/agent-guard-check
Agent permissions now live in files that change in ordinary pull requests: a permission list, an MCP server, a hook, a CI trigger, a plugin marketplace. One line can turn a harmless agent into one that reads private data, takes in untrusted text and can send data out. A reviewer sees a JSON diff, not that consequence.
Agent Guard Check reads those files and shows what each agent in a repository can do. It
flags authority the agent does not need and, on a pull request, reports only what the change
made worse. By default it reads files only: it never runs repository code, never starts an MCP
server and makes no network calls. From 1.6.0 the GitHub Action also asks GitHub, read-only, whether
the branch requires code-owner review (input github-rules).
It works on its own. With Agent Guard it also reads the guard's own records (tool labels, live task grants, host manifests), and with a running Agent Map it compares the repository with what is deployed.
npx @shieldaai/agent-guard-check
Node.js 22 or later. Two runtime dependencies (yaml, smol-toml), both pinned.
What it shows
agent-guard-check 1.7.0: 1 agent(s), 1 critical, 1 medium
Evidence: repository files
Claude Code (project) (.claude/settings.json)
reads private data yes, no approval via mcp__postgres
reads untrusted input yes, no approval via WebFetch, WebSearch
writes yes, with approval via Bash, Edit
runs code yes, with approval via Bash
sends data out yes, no approval via WebFetch, Bash
runtime check: none
Findings:
CRITICAL AGC-TRI-001 .claude/settings.json:1
Claude Code (project) reads private data (mcp__postgres), reads untrusted input (WebFetch) and can send data out without approval (WebFetch).
Fix: Require approval for "WebFetch", or remove one of the three legs.
MEDIUM AGC-COV-001 .claude/settings.json:1
Claude Code (project) can send data out without approval (WebFetch), and nothing checks those calls at runtime.
Fix: Add a runtime check that sees these calls: a PreToolUse hook whose matcher names these tools, or route them through Agent Guard or an MCP gateway.
That is the whole result for this .claude/settings.json and .mcp.json:
{ "permissions": { "allow": ["mcp__postgres", "WebFetch"] } }
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres@0.6.2", "postgresql://localhost/app"]
}
}
}
For each agent it works out seven capabilities: reads private data, reads untrusted input,
writes, runs code, sends data out, spends money, changes itself. Each one is no,
unknown, yes, with approval or yes, no approval, and names the file and line that
grants it. An unknown capability is never treated as safe.
Levels of evidence
| Evidence | When it runs | What it adds |
|---|---|---|
| Repository files | Always | Agents, their capabilities and 37 rules on configuration |
| Agent Guard records | When guard.describe() output, an executor inventory snapshot or a host manifest is in an agent-guard*.json file, named in agent_guard.files, or passed with --agent-guard |
8 rules (AGC-AGX-*) on the guard itself: tasks exposed to the dangerous three, unapproved or unlabeled tools, wildcard grants, long budgets, unowned agents, access declared outside the guard, MCP servers reachable around the guard |
| Live Agent Map | Only with --live or --agent-map-url and a read-only token |
4 rules (AGC-DRF-*): activity no declared agent accounts for, unclaimed cloud identities, agents Agent Map flags as exposed in production, stale inventory |
| GitHub branch rules | With --github-repo (on by default in the GitHub Action from 1.6.0) |
1 rule (AGC-GOV-004): CODEOWNERS names an owner for agent configuration, but the branch does not require the owner's approval, or lets someone bypass it |
Files named agent-guard*.json are read automatically, and what each one is (describe() output,
inventory snapshot or manifest) is recognised from its content. Name any other path in
agent_guard.files, or pass --agent-guard. Write a description at build time:
import { writeFileSync } from 'node:fs';
writeFileSync('agent-guard-description.json', JSON.stringify(guard.describe(), null, 2));
The dangerous-three verdicts follow Agent Map's own rules, so the scanner and the map agree:
private data from a sensitive task or a confidential or restricted binding, outside content
from an untrusted task or a tool that reads untrusted content, and a sender that declares
sendsExternal: true and stays on untrustedContext: 'allow'. The core refuses external
sends from sensitive tasks and tasks without recipients, and so does the scanner.
Live evidence is three read-only queries (get_inventory_health, list_unclaimed_identities,
list_agents). The token comes from AGENT_MAP_TOKEN, or the variable named in
agent_map.token_env, which must end in AGENT_MAP_TOKEN (for example PROD_AGENT_MAP_TOKEN),
so the repository cannot choose another secret to send. It is never accepted in a file or a
URL. The URL must use https (plain http only for localhost).
What it reads
| Agent | Files |
|---|---|
| Claude Code | .claude/settings.json, .claude/settings.local.json, .mcp.json, .claude/agents/*.md (including permissionMode, disallowedTools, inline mcpServers, model), .claude/commands/*.md and skills (including their allowed-tools, which run without asking while one is active), hook scripts, CLAUDE.md, AGENTS.md, up to 32 folders deep, so monorepo packages are separate agents. On macOS and Windows letter case is ignored: a path that is configuration only when case is ignored (.CLAUDE/settings.json, a root claude.md), and two paths that differ only in case, are reported |
| Claude Code plugins | extraKnownMarketplaces in settings, .claude-plugin/marketplace.json; a plugin folder (.claude-plugin/plugin.json) is its own agent with its .mcp.json servers, mcpServers and hooks (inline, a file in the plugin, or a list of them) and hooks/hooks.json; a file it names that cannot be read counts as unknown reach. A .mcp.json there still counts for Claude Code in that folder too |
| Agent Plugins | plugin.json beside mcp.json or a skills/ folder; SKILL.md files anywhere under skills/ |
| OpenAI Codex | .codex/config.toml: approval policy, sandbox mode, network access, web search, MCP servers, profiles |
| Gemini CLI | .gemini/settings.json (nested and flat layouts): approval mode, allowed, core and excluded tools, trusted MCP servers, mcp.allowed, GEMINI.md |
| GitHub workflows | Steps that use anthropics/claude-code-action (with its settings: inline JSON, a mapping or a file), openai/codex-action (with its sandbox and permission-profile), or run claude -p (with --settings), codex exec, copilot -p or gemini -p |
| GitHub Agentic Workflows | .github/workflows/*.md with on: in the frontmatter: triggers, engine (and its env), tools (bash, edit, web-fetch, web-search, playwright, github with read-only and github-token), safe-outputs (with threat-detection and jobs), permissions, env and github-token secrets, mcp-servers (including container), network, and imports (front matter, {{#import}} and @include) from the repository, three levels deep, each relative to the file that names it. The .lock.yml it compiles to is judged from this source, except steps that use claude-code-action, codex-action or run-gemini-cli, which gh-aw never generates and which are judged in the lock; a lock with no gh-aw source beside it is read as a workflow and is also unknown reach. With --base, a lock that changed while its source did not is reported (AGC-CFG-002, high); without --base, a lock edited by hand in other ways is not detected. Frontmatter jobs, steps and post-steps that start an agent are unknown reach (high); sandbox: { agent: false } opens the network; a secrets mapping is private data |
| VS Code and Cursor | .vscode/mcp.json, .cursor/mcp.json (comments and trailing commas allowed), Cursor rules (.cursor/rules/*.mdc, .cursorrules) |
| Cursor CLI | .cursor/cli.json: Shell, Read, Write, WebFetch and Mcp allow and deny tokens, with the servers in .cursor/mcp.json |
| OpenCode | opencode.json or opencode.jsonc (also in .opencode/): V1 permission objects, bash patterns and <server>_* keys, V2 permissions rules, disabled tools, mcp servers, model; agent overrides in agent.<name> and .opencode/agent/*.md |
| GitHub Copilot | Custom agents in .github/agents/*.md (tools with GitHub's and VS Code's tool names, mcp-servers, target, model); .github/copilot-instructions.md, .github/instructions/*.instructions.md and .github/prompts/*.prompt.md for the text rules |
| Kiro | .kiro/settings/mcp.json (autoApprove, disabled); .kiro/steering/*.md for the text rules |
| Windsurf | .windsurfrules and .windsurf/rules/*.md, for the text rules (its MCP and permission settings live outside the repository) |
| Agent Guard | agent-guard*.json records, or files named in .agc.yaml or on the command line |
| Repository | CODEOWNERS, package.json files (names and dependencies), the root package-lock.json or npm-shrinkwrap.json (installed versions, for AGC-SUP-001/006) and package-source files (.npmrc, .yarnrc, .yarnrc.yml, bunfig.toml, uv.toml, pip.conf, pyproject.toml) for identification, .agc.yaml |
| Your own settings | Only with --include-user: ~/.claude/settings.json, user and local-scope servers in ~/.claude.json, ~/.codex/config.toml, ~/.gemini/settings.json and Claude Code managed settings |
node_modules, .git and virtual environments are skipped. Build output and vendored code
(dist, build, out, vendor, target, ...) are skipped too, but only outside configuration
folders: a skill called build is read. Agent configuration found inside a skipped folder
(vendor/.claude/settings.json) is reported as AGC-CFG-002 (high for settings). Links are resolved the way the operating
system resolves them (a .. after a linked folder included), and followed only when they stay
inside the repository: a linked file is read through its target, and a linked folder is walked
at the link's own path, so .claude -> tools/agentcfg is read as .claude. In a git tree, a link
whose target passes through another link, or has .. after a folder name, is not followed. A
link that is not followed is never read. A configuration file the scan could not read is
reported as AGC-CFG-002: one over 1 MiB, a link (to a file or a folder where configuration lives)
that leaves the repository or cannot be resolved, a file that cannot be parsed (invalid JSON,
YAML or TOML, or more YAML aliases than allowed; Claude Code subagents are first read the
lenient way Claude Code reads them), or a walk that stopped (more than 200,000 entries, folders
more than 32 levels deep, or one folder reached through links more than 4 times). Folders and
files where configuration lives are walked first, so filler cannot use up the walk before
.github or .claude; a walk that stopped is still high. For settings and agent definitions (including subagents, Copilot, OpenCode and gh-aw
agents written in Markdown) it is high and fails the default gate, so padding or linking one
cannot hide what it grants; for instruction files it is medium. An agent whose definition could
not be read, or a file a configuration names (a gh-aw import, a plugin's server or hook file, a
workflow's settings file) that could not be read, counts as unknown reach. A workflow settings
file or a gh-aw import that is not in the repository (or is at a moving ref of another
repository) is reported at high, so moving the risky part out of view fails the gate; a gh-aw
import pinned to a commit of another repository is a note. Folders named ~ or <managed> in
the repository are never read.
Amp and Goose keep their permissions outside the repository, so they are not read. Configuration
of agents the scanner does not model (Kiro hooks and agents, Gemini CLI commands, extensions and
.env, OpenCode plugins, Roo Code, Continue, Junie, Amazon Q, Crush, Qwen Code, Cursor's
background agent) is reported as AGC-CFG-001: high when it can run code (servers, hooks, plugins),
medium otherwise. Unknown gh-aw front matter keys are reported too (high for ones that run code,
such as safe-inputs). Cursor's hooks.json is judged like Claude Code's hooks. VS Code's
chat.tools.autoApprove, Zed's always_allow_tool_actions and Aider's yes-always are read as
bypasses (AGC-PERM-001), in .vscode/settings.json, *.code-workspace and
.devcontainer/devcontainer.json; VS Code terminal and URL auto-approve patterns beyond fixed
project commands, Zed context servers and Aider test and lint commands are high. .env is never
read, since it holds secrets: Aider settings there are not seen. A setting
the scanner does not model, such as a permission mode or Copilot tool name it does not know, a
gh-aw engine key or tool it does not know, or the domains Claude Code's Bash sandbox allows, is
reported as AGC-CFG-001 with what the scan assumed instead, and the reach it could give is
counted as unknown. An allow rule for a tool the scanner does not know is unknown reach, reported
at medium.
Hooks run without asking, on every matching event, so each one is judged like a command:
hooks in settings, plugin hooks.json and skill, command and subagent front matter, and the
commands Claude Code runs on its own (apiKeyHelper, otelHeadersHelper, awsAuthRefresh,
awsCredentialExport, statusLine, fileSuggestion). A hook's command is split into commands
and each is sorted as a Bash rule is (see shell commands below); a script from the repository or
the plugin ("$CLAUDE_PROJECT_DIR"/.claude/hooks/x.sh, python3 scripts/x.py) is project code,
read for the scripts it runs, unless it pipes a download into a shell. A hook that can reach the
network or run arbitrary code, an HTTP hook, or one that runs a program outside the repository
is AGC-PERM-003. A PreToolUse or PermissionRequest hook (or a Cursor beforeShellExecution /
beforeMCPExecution hook) that answers "allow" approves calls instead of a person: the tools it
matches run without asking, it is AGC-PERM-001 (critical), and it is not a runtime check. The
decision is read from the hook's command, the scripts it runs, the files it prints and the local
modules a script imports. A hook may approve (high, and not a runtime check either) when it
builds a decision the scan cannot read ("permissionDecision": "al" + "low", D=allow), when
a decision key's value is anything but a literal deny or ask, when its output is decoded or
reversed (base64, rev, character codes), or when its text cannot be read (a
script that is missing or outside the repository, an HTTP or prompt hook). Settings env
values that run code or change where packages come from are high: shell startup and prefix
variables (BASH_ENV, CLAUDE_CODE_SHELL_PREFIX, PATH), loaders (LD_PRELOAD, NODE_OPTIONS,
PYTHONPATH, JAVA_TOOL_OPTIONS, DOTNET_STARTUP_HOOKS), git hooks into commands
(GIT_CONFIG_*, GIT_ASKPASS, GIT_SSH_COMMAND, and GIT_DIR, HOME or XDG_CONFIG_HOME,
which choose the git config), build wrappers (RUSTC_WRAPPER, GOFLAGS)
and package sources (npm_config_*, PIP_INDEX_URL, ...).
Your own settings
What an agent can do on your machine also depends on settings outside the repository. With
--include-user the scan merges them in Claude Code's order: managed settings first (their
deny rules always apply, and disableBypassPermissionsMode turns bypass off), then the
project's own settings, then yours. Allow and deny rules from every level add up. Servers in
~/.claude.json count for every project, and its projects entry for this folder for this one
only. Your Codex and Gemini CLI settings are listed as their own agents, Codex (~) and
Gemini CLI (~). Findings point at ~/... paths.
It is for local runs only: in CI these files belong to the runner, so the flag is refused when
CI is set. It cannot be combined with --fix, which edits repository files only, or with
--write-baseline, which would record your own settings as accepted repository findings. A file
it cannot read (over 1 MiB, or not a regular file) is named on stderr. Managed MCP servers
(managed-mcp.json) count for every project.
On every Claude Code session: --hook
--include-user sees the files no pull request shows only when someone runs it. As a Claude Code
hook it runs on its own. Add the package to the project's dev dependencies
(npm install --save-dev @shieldaai/agent-guard-check) and the hook to the shared
.claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"matcher": "startup|resume",
"hooks": [{ "type": "command", "command": "npx --no-install @shieldaai/agent-guard-check --hook" }]
}
]
}
}
The hook scans the folder on disk with the settings Claude Code adds to it (the gitignored
.claude/settings.local.json, ~/.claude/settings.json, ~/.claude.json and managed settings;
CLAUDE_CONFIG_DIR is honoured) and compares it with the files git tracks, as staged: what a pull
request will show and CI judge. When the difference adds a finding at or above fail_on
(--fail-on overrides it), it names the finding and the file it comes from and exits 2;
otherwise it prints nothing. An unstaged edit to a tracked file counts, including one hidden with
git update-index --skip-worktree; once staged, it is the pull request's to show.
| Event | What exit 2 does |
|---|---|
SessionStart |
Shows the findings to the developer; the session goes on. Nothing is added to Claude's context. |
UserPromptSubmit |
Holds every prompt until the local settings are fixed. Use the same command under "UserPromptSubmit". |
- Only what the local layers add is reported. A finding the tracked files already have (a passed review date, a finding CI accepted) is CI's, and does not interrupt a session.
.agc.yamlis read as staged, so an unstaged or untracked edit cannot lower the bar.- Submodules count as tracked, and a clone or worktree inside the folder is another checkout, not
this session's settings (the project's own
.claude/,.mcp.jsonandCLAUDE.mdalways count). A tracked link, or a file under a git filter (LFS, git-crypt), is compared as it is on disk, so an unstaged edit to one is not seen. Outside git, or in a folder its parent repository does not track, everything but.claude/settings.local.jsonandCLAUDE.local.mdcounts as shared. - Not read: agents, skills and commands under
~/.claude, user plugins,managed-settings.d, and managed settings delivered by an MDM profile or the Windows registry. A personal settings file that exists but cannot be read is named in the report. - Codex and Gemini settings are left out: the hook speaks for the Claude Code session. In CI
(
CIset) no personal settings are read. - A mistake in the hook command, or a failure of the scan itself, exits 1, which Claude Code shows without blocking: a broken check never holds a prompt.
- The command above (or
npx --no-install agent-guard-check --hook) is the form the scanner itself does not report as a hook that can reach the network:--no-installruns the project's installed copy and never downloads.npx -y @shieldaai/agent-guard-check@…downloads the package on each machine, and a bareagent-guard-checkcould be any program onPATH; both are reported like any other hook that can reach the network. - A hook warns or holds; it does not enforce. Claude Code runs project hooks only after the
folder's workspace-trust prompt is accepted, and a developer can turn them off with
disableAllHooksin their own settings. To enforce, use managed settings:allowManagedPermissionRulesOnlymakes Claude Code ignore allow rules from user, project and local files, andallowManagedHooksOnlykeeps a managed copy of this hook from being turned off.
Pull requests: report only what got worse
npx @shieldaai/agent-guard-check --base origin/main --format markdown
With --base, the files at that commit are read with git (nothing is checked out) and
compared with the working tree. The report lists capabilities that grew (from no to yes,
or from "with approval" to "no approval") and findings that are new. A finding whose severity
rose counts as new, and so does a new finding that the same change silences with an inline
agc-ignore comment. The exit code depends on new findings only, so existing debt does not
block unrelated changes.
The change under review does not set its own gate: .agc.yaml, and a --baseline file inside
the repository, are read from the base commit. An edit to either takes effect once it is merged,
and the scanner notes on stderr that the file differs.
GitHub Action
name: Agent config
on: [pull_request, merge_group]
permissions:
contents: read
pull-requests: write # for comment: true
security-events: write # for sarif: true
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ShieldaAI/agent-guard/packages/check/action@<commit>
with:
comment: true
sarif: true
On pull requests the action compares with the base commit by itself, writes the Markdown
report to the job summary, optionally uploads SARIF to code scanning and keeps one pull-request
comment up to date. It runs an exact package version (input version, default 1.7.0),
from a folder outside the checkout and with the public npm registry, so a node_modules or
.npmrc committed in the pull request cannot replace the scanner.
Inputs: path, fail-on, base, baseline, agent-guard-files, sarif, comment,
github-rules, version.
merge_group runs the check again in a merge queue, on the commit that will land, compared with
the queue's base commit. It catches two pull requests that are fine alone but not together, such
as one that adds a database MCP server and another, checked before the first merged, that adds
WebFetch. If the check is required and the repository uses a merge queue, the queue waits for
it, so the trigger is needed there. The pull-request comment is skipped in the queue. Without a
merge queue, merge_group never fires; "Require branches to be up to date" in branch protection
covers the same case.
Code-owner review
A CODEOWNERS entry only requests the owner's review. The approval becomes required when a ruleset
or branch protection rule for the branch turns on "Require review from Code Owners". Without it, a
pull request that widens .claude/settings.json merges with any approval, or with none on a branch
that requires no reviews. The two settings live in different places, so a review of one rarely
shows the other.
With --github-repo, the scanner asks GitHub which rules apply to the branch and reports
AGC-GOV-004 when CODEOWNERS gives an owner to a file that defines an agent and nothing requires
that owner's approval. CODEOWNERS is read as GitHub reads it: the last matching line decides. On a pull request it is reported only when the change widens what an agent can
do, adds an agent or edits a review record: the change the owner should have had to approve. The
action does this by default with the workflow's own token (github-rules: false turns it off).
- Active rulesets, from the repository or the organization, can be read by anyone who can read the repository. Rulesets in "evaluate" mode enforce nothing and do not count.
- Classic branch protection settings need admin access to read, and the Actions token cannot have it. A branch with classic protection and no ruleset requiring code owners is reported at info: the scanner cannot tell. A ruleset reads the same for everyone.
- Who may bypass a rule counts too: anyone on that list can merge without the owners. The bypass list of a ruleset, and whether classic protection applies to admins, are readable with admin access only. Every rule that requires code owners applies at once, so only an actor on every list gets through. When the token can read the lists and one actor is on all of them, AGC-GOV-004 reports who (low). When it cannot read them, or the lists share no actor but a person could be on each through a team or role, nothing is reported for the bypass.
- If more rules apply than the scanner reads (ten pages), or GitHub does not say how a protected branch is protected, the answer is "cannot tell" (info), never "not required".
- If GitHub cannot be reached, or refuses the token, the scan warns on stderr and goes on without this rule.
pre-commit
repos:
- repo: https://github.com/ShieldaAI/agent-guard
rev: <release tag or commit>
hooks:
- id: agent-guard-check
The hook runs with --base HEAD when agent configuration is staged.
Container
docker build -f packages/check/Dockerfile -t agent-guard-check .
docker run --rm --network none -v "$PWD:/repo:ro" agent-guard-check
The image runs as an unprivileged user and needs no network.
Fixing
npx @shieldaai/agent-guard-check --fix-dry-run # print the fixes as a diff
npx @shieldaai/agent-guard-check --fix # apply them, then report what is left
Fixes only remove authority or add limits: they set defaultMode back to default, move
risky allow rules (network commands, interpreters, self-edits, destructive commands, the
outbound leg of a trifecta) to ask, drop bypass flags from workflow steps, and add
timeout-minutes and --max-turns to agent steps. Each edit is kept only if scanning again
shows its finding gone and nothing as severe added. JSON files with comments and YAML block
scalars are left for a person.
Policy as code
A policy section in .agc.yaml encodes a team's own decisions, so reviews do not
re-derive them for each change:
policy:
allowed_mcp_servers: [github, postgres, mcp/fetch] # catalog ID, package or image (never the config name)
allowed_mcp_hosts: [mcp.example.com, githubcopilot.com]
forbid:
- name: untrusted input with unasked network access
when: { untrustedInput: auto, egress: auto } # auto: without approval; any: at all
severity: critical
Review records: an owner and a review date
Agents outlive the people who set them up. .agc-reviews.yaml at the repository root gives
each agent the repository ships an owner, the capabilities its last review approved, and a date
by which someone looks again:
reviews:
- agent: .claude/settings.json # agent ID, agent name, or the file that defines it
owner: '@acme/platform'
review_by: 2027-05-01 # YYYY-MM-DD, UTC; a timestamp with a time is not accepted
capabilities: [write, selfModify] # what it may do without asking; [] for none
- agent: .github/workflows/triage.yml
owner: '@acme/support-tools'
review_by: 2027-02-15
capabilities: [untrustedInput, write]
agent matches an agent's ID, its name, or the file that defines it; --format json lists
the ID and name of every agent the scan found. A name counts only while one agent has it: a
name can be written in an agent's file, so a copy elsewhere could otherwise borrow another
agent's review. Agents of one file that share a name the scanner built (two agent steps in one
workflow job) are covered together. The file is the safest choice. capabilities lists what the agent may do
without a person approving each use, using the
seven capability names (privateData, untrustedInput, write, exec, egress, spend,
selfModify). Something behind a per-call prompt is checked at every call, so it is left out.
A date on its own turns into a snooze button, so the check holds the record to it:
- The date passing fails the check (AGC-REV-001, high). No commit makes a date pass, so in
a pull request the finding counts as new whether or not the base had it. Every change fails
until the review is done. Neither a baseline nor an inline
agc-ignorecomment silences it: both are written by the repository, and the date passing is not. For 14 days before the date it is reported as info. - A renewal shows what it approves. With
--base, a change to a record is listed with the date, the owner, the capabilities it approves (and what it approved before) and what the agent can do now without asking. The reviewer approves access, not just a later date. A record removed by the change is listed too. - The record must match the agent, both ways. An agent that can do more without asking than
its record approves is a finding (AGC-REV-003). So a change that widens access also has to
change the record, where the reviewer sees it. A record that approves something the agent can
no longer do is reported too (AGC-REV-008, low): otherwise a later change could restore that
access without touching the record. Approvals are per capability, not per command: once a
review approves
exec, another command that runs code does not change the record. The permission rules (AGC-PERM-*) judge those commands. - The date cannot be pushed out of sight.
review_bymay be at mostpolicy.max_review_daysahead (default 365; AGC-REV-004). - Every agent needs a record, once
policy.require_reviews: trueis set (AGC-REV-002). A record that names no agent (AGC-REV-005, high), usually left behind by a rename, and one that cannot be read (AGC-REV-007) are findings too. A record is never guessed at, and neither of those can be silenced with an inline comment. AGC-REV-005 is high because a moved agent is no longer checked against what its review approved, so the change that moves it has to point the record at it. - Turn on
require_reviewsif records are to be a gate, not a habit. Without it, records are opt-in: a change that deletes a record, or moves an agent and leaves another agent at the old path for the record to match, leaves the moved agent with no record and nothing fails. The report still lists a deleted record. Withrequire_reviews, both fail as a missing record (AGC-REV-002). - The owner should be asked about changes. When the repository has CODEOWNERS, an owner it does not name is reported (AGC-REV-006). That also catches an owner who left and was removed from it. Being asked is not the same as having to approve: see Code-owner review (AGC-GOV-004).
# .agc.yaml
policy:
require_reviews: true
max_review_days: 180
With --base, .agc-reviews.yaml is read from the change, like agent configuration, so a
renewal is judged on its new date. .agc.yaml is read from the base, so a change cannot raise its
own max_review_days or turn off require_reviews. The scanner cannot tell whether anyone
actually reviewed the agent before moving the date. That decision belongs to the people who
approve the pull request, ideally the owner through CODEOWNERS. What the scanner does is put the
capabilities in front of them.
Other agents: plugin, MCP server and skill
The Agent Guard Check plugin packages the skill and the MCP server for Claude Code, Codex and Antigravity:
/plugin marketplace add ShieldaAI/agent-guard
/plugin install agent-guard-check@shielda
agent-guard-check-mcp is a read-only MCP server (stdio) so an agent can check its own
configuration before it changes it. It scans one root fixed at start-up and never leaves it.
agent-guard-check --mcp [root] starts the same server through the default bin (with --mcp as
the first argument); MCP registries list it as io.github.ShieldaAI/agent-guard-check. A client
that installs it from a registry runs npx in your project, where the project's .npmrc and
node_modules can change which package runs; the plugin's launcher avoids that, so prefer the
plugin when you check repositories you did not write.
{
"mcpServers": {
"agent-guard-check": {
"command": "npx",
"args": ["-y", "-p", "@shieldaai/agent-guard-check@1.7.0", "agent-guard-check-mcp", "."]
}
}
}
The scanner reports that configuration as AGC-SUP-006 (low), as it does any pinned npx server:
it cannot see from the config that this package pins its only two dependencies exactly and that
neither has dependencies of its own. To have the lockfile fix it anyway, add the package to your
dev dependencies and start it with
"command": "npx", "args": ["--no-install", "-p", "@shieldaai/agent-guard-check", "agent-guard-check-mcp", "."].
Tools: scan_agent_config, check_agent_config_change (compare with a git ref) and
explain_agent_rule. A Claude Code skill that tells the agent when to run the check is in
skill/agent-guard-check/SKILL.md.
Options
| Option | Meaning |
|---|---|
--format text|json|sarif|markdown|inventory |
Output format. JSON includes each agent's computed authority. SARIF 2.1.0 works with GitHub code scanning. Markdown is a PR comment. Inventory is an auditor's export: agents, capabilities, tools and counts, without finding text. |
--output <file> |
Write the report to a file (owner-only permissions). |
--fail-on <severity|none> |
Exit 1 at or above this severity. Default high. |
--min-confidence high|low |
By default, low-confidence findings are reported but never fail the run. |
--base <ref> |
Compare with a commit and report only what the change made worse. |
--baseline <file> / --write-baseline <file> |
Accept current findings once; later runs fail only on new ones. |
--agent-guard <file> |
Read an Agent Guard record from anywhere (repeatable). |
--live, --agent-map-url <url> |
Add live evidence from Agent Map (read-only). |
--github-repo <owner/name>, --github-branch |
Ask GitHub (read-only) whether the branch, by default the default branch, requires code-owner review. The token comes from GITHUB_TOKEN or GH_TOKEN. See Code-owner review. |
--import-sarif <file> |
Merge another tool's SARIF findings into the report, baseline and gate (repeatable). They keep their own tool name in SARIF output. |
--fix, --fix-dry-run |
Apply or print verified safe fixes. |
--include-user |
Also read your own settings outside the repository (local runs only). See Your own settings. |
--hook |
Run as a Claude Code SessionStart or UserPromptSubmit hook. See On every Claude Code session. |
--list-rules |
Print every rule. |
Exit codes: 0 nothing at or above --fail-on, 1 findings, 2 usage, read or live-evidence error.
Configuration and suppressions
.agc.yaml at the repository root:
fail_on: high # critical, high, medium, low, info or none
min_confidence: high # high or low
severity:
AGC-LIM-002: info
ignore:
- rule: AGC-SUP-001
path: tools/ # optional: a file or folder
reason: Served from our internal registry mirror, pinned there.
agent_guard:
files: [build/agent-guard-description.json]
max_deadline_hours: 24 # AGC-AGX-007 ceilings
max_calls: 1000
max_cost: 500
agent_map:
url: https://agent-map.internal.example
token_env: AGENT_MAP_TOKEN
policy: {} # see Policy as code and Review records
mcp_servers: # what servers the catalog does not know can do
mcp.docs.example.com: # a package, image, remote host or catalog ID
capabilities: [untrustedInput]
'@acme/crm-mcp':
capabilities: [privateData, write]
unknown: [egress]
Unknown keys and invalid values are errors, so a typo never silently turns a check off. Every ignore needs a reason.
mcp_servers declares what an MCP server can do: the capabilities it has, and the ones it may
have (unknown). Anything not listed is no, and [] means it can do none of the seven. A
declaration is keyed by what runs: the package (npx, uvx and similar), the container image,
the remote host, or a catalog ID, and it replaces the built-in catalog entry. It never matches a
server's name in the config, because a change chooses names: a server called docs that runs
another package is not the declared one. With --base, declarations are read from the base
commit like the rest of .agc.yaml.
A package or image is identified, for the catalog and for declarations, only when the command
has exactly the expected shape: a runner (npx, uvx, bunx, pipx run, pnpm dlx,
yarn dlx, npm exec) with only harmless flags (-y, --quiet, --offline and similar), then
the package and its own arguments; or docker run / podman run with known flags, then the
image. -p/--package/--from, --call, a registry or any other runner flag, a shell line
with a second command (sh -c "npx pkg; curl ..."), --entrypoint, --env-file, an unknown
docker flag, an environment variable that changes what is loaded (NODE_OPTIONS,
npm_config_*, PYTHONPATH, LD_PRELOAD, ...) or an envFile, a docker mount or working folder
(-v, --mount, -w, which can replace the image's code), or a server with both a command and a
URL all leave it unidentified, so its reach stays unknown. So do a package spec that fetches from
somewhere other than the registry (name@npm:other, name@github:..., name@file:..., a URL,
name @ git+https://...), a package the repository's own package.json depends on (a runner
resolves that from the dependency spec; so is any package named or depended on by a
package.json anywhere in the repository), a runner or docker that is a file in the repository
(./bin/npx) rather than a system command, a server with a cwd, a docker environment
variable that changes the daemon (DOCKER_HOST, ...), and a package from a registry the
repository redirects: an npm-family runner below a .npmrc, .yarnrc(.yml) or bunfig.toml
that sets a registry, or uvx/pipx below a uv.toml, pip.conf or pyproject.toml that sets
an index. Settings that do not redirect (engine-strict, hoisting) change nothing, and a
redirect applies only to its own folder and below; one that is too large or a link out of the
repository is assumed to redirect. The policy rule (AGC-POL-001) matches servers the same way,
also by remote host, and AGC-SUP-001 checks every package a command fetches, reporting a shell
line it cannot read, or a runner or container option it does not know where the next word may be
that option's value or the package (--option=value is always readable). A server that is not identified may read private data, take in untrusted
input, send data out, write and run code: all unknown.
In Markdown, YAML and scripts, a comment on the same line or the line above suppresses one
rule: <!-- agc-ignore AGC-SUP-004: installer pinned by checksum -->. Settings files are
strict JSON, so use .agc.yaml for them. Suppressed findings, with their reasons, are listed
in JSON output.
Rules
Severity is the default; .agc.yaml can change it. The rule catalog shows,
for every rule, a configuration it flags and a look-alike it does not.
| ID | Severity | Finding | OWASP |
|---|---|---|---|
| AGC-PERM-001 | Critical | Agent runs every tool without asking | ASI02, ASI09 |
| AGC-PERM-002 | High (MCP: medium, low) | Wildcard tool allow, or every tool of an MCP server | ASI02 |
| AGC-PERM-003 | High | Allowed command can send data out or run any code | ASI02, ASI05 |
| AGC-PERM-004 | High | Agent can read files outside the project | ASI03 |
| AGC-PERM-005 | Medium | Destructive action allowed without approval | ASI02, ASI09 |
| AGC-PERM-006 | High | Subagent runs with broader permissions than its parent | ASI02, ASI09 |
| AGC-TRI-001 | Critical | Lethal trifecta: private data, untrusted input and an unguarded way out | ASI01, ASI02 |
| AGC-TRI-002 | Medium | Lethal trifecta behind one approval, or one leg unknown | ASI01 |
| AGC-SUP-001 | High | MCP server runs an unpinned package | ASI04 |
| AGC-SUP-002 | High | Remote MCP server over plain HTTP | ASI04 |
| AGC-SUP-003 | High | Remote content loaded into the agent at runtime | ASI04, ASI01 |
| AGC-SUP-004 | Critical | Download piped into a shell | ASI04, ASI05 |
| AGC-SUP-005 | Medium | Plugin or marketplace not pinned | ASI04 |
| AGC-SUP-006 | Low | Pinned MCP server can still change | ASI04 |
| AGC-PER-001 | High | Agent can rewrite its own instructions | ASI06, ASI10 |
| AGC-PER-002 | High | Agent can change its own permissions or hooks | ASI10 |
| AGC-SEC-001 | Critical | Hardcoded credential | ASI03 |
| AGC-SEC-002 | Medium | Secret passed on a command line | ASI03 |
| AGC-TXT-001 | Medium (low confidence) | Hidden characters in agent instructions | ASI01, ASI06 |
| AGC-TXT-002 | Medium (low confidence) | Instruction-override phrasing in shipped prompts | ASI01 |
| AGC-TXT-003 | Low (low confidence) | Long encoded blob in agent instructions | ASI01 |
| AGC-TXT-004 | Medium (low confidence) | Instructions to act without asking | ASI02, ASI09 |
| AGC-TRG-001 | High | Agent triggered by outsiders with write access | ASI01, ASI03 |
| AGC-LIM-001 | Low | No turn limit on an automated agent | ASI08 |
| AGC-LIM-002 | Low | No timeout on an automated agent | ASI08 |
| AGC-IDN-001 | High | Agent runs on a personal access token | ASI03 |
| AGC-TRG-002 | Medium | Unattended agent changes the repository with no reviewer | ASI09, ASI08 |
| AGC-IDN-002 | Medium | Agent gets long-lived cloud keys | ASI03 |
| AGC-GOV-001 | Low | Agent configuration has no code owner | ASI10 |
| AGC-GOV-004 | Low (info if unknown) | Code owners are asked to review, not required to approve | ASI10 |
| AGC-GOV-002 | Low | Subagent has no stated purpose | ASI10 |
| AGC-COV-001 | Medium | Risky actions with no runtime check | ASI02 |
| AGC-GOV-003 | Info | Agent model is a moving alias | ASI04 |
| AGC-CFG-001 | Info (low confidence) | Agent setting the scanner does not model | ASI02 |
| AGC-CFG-002 | High | Agent configuration file too large to read | ASI02, ASI04 |
| AGC-REV-001 | High | Agent review date has passed | ASI10 |
| AGC-REV-002 | High | Agent has no review record | ASI10 |
| AGC-REV-003 | High | Agent can do more than its review approved | ASI02, ASI10 |
| AGC-REV-004 | High | Agent review date is too far away | ASI10 |
| AGC-REV-005 | High | Review record matches no agent | ASI10 |
| AGC-REV-006 | Low | Review owner is not a code owner | ASI10 |
| AGC-REV-007 | High | Review record could not be read | ASI10 |
| AGC-REV-008 | Low | Review approves more than the agent can do | ASI02 |
| AGC-POL-001 | High | MCP server not on the approved list | ASI04 |
| AGC-POL-002 | High | Remote MCP server on a host not on the approved list | ASI04, ASI02 |
| AGC-POL-003 | High | Agent holds a forbidden capability combination | ASI02, ASI01 |
| AGC-AGX-001 | High | Agent reaches a guarded MCP server directly | ASI02 |
| AGC-AGX-002 | High | Declared access outside the guard | ASI02, ASI03 |
| AGC-AGX-003 | Critical | Agent Guard task exposed to the dangerous three | ASI01, ASI02 |
| AGC-AGX-004 | Medium | Agent without an owner, or retired with live work | ASI10 |
| AGC-AGX-005 | Medium | Guarded tool registered but not approved | ASI04 |
| AGC-AGX-006 | Medium | Task grant broader than its tool warrants | ASI02, ASI03 |
| AGC-AGX-007 | Medium | Task budget above the team ceiling | ASI08 |
| AGC-AGX-008 | Medium | Outbound tool labels leave a gap | ASI02 |
| AGC-DRF-001 | High | Guarded activity no declared agent accounts for | ASI10, ASI03 |
| AGC-DRF-002 | Medium | Cloud identities no agent claims | ASI03 |
| AGC-DRF-003 | High | Live agent exposed to the dangerous three | ASI01, ASI02 |
| AGC-DRF-004 | Low | Live inventory is stale | ASI10 |
Some findings change severity with context: AGC-TRG-001 is medium when
claude-code-action only answers people with write access, high when anyone can start the
agent, and critical when anyone can start it with broad tools or when a
pull_request_target job checks out the pull request's own code.
Accuracy
Three measurements, all reproducible with npm run bench:check (and --real for the last two):
-
Labeled cases. 129 configurations, at least one that each of the 48 rules must flag and one look-alike it must not (
bench/cases.mjs). Precision 100%, recall 100%. The test suite fails if a rule loses its cases or any case changes outcome. -
Public repositories. 32 repositories at pinned commits (Anthropic, OpenAI, Google, Microsoft, Sentry, PostHog, Supabase, Vercel and others;
bench/real-repos.json), 191 agents. Every critical, high and medium finding, 178 in all, was reviewed by hand: 177 true positives and 1 false positive (a low-confidence text rule), precision 99.4%. "True" follows the fail-closed reading above:Bash(git *)orBash(rg:*)is reported because an option can run any program, and a local MCP server the scanner cannot identify is reported when its tools run without asking. -
Recall against independent labels. For 8 of those repositories, a reviewer who saw neither the scanner's output nor its source labelled every agent and its seven capabilities from the configuration files (
bench/recall-labels.json). The scanner finds 68 of the 70 agents (97%). Of the 300 capabilities labelled yes it reports 84% (as yes or unknown), and 67% at the labelled approval level or wider:Capability Labelled yes Reported At level untrustedInput 64 92% 81% write 58 93% 71% egress 56 96% 73% exec 48 98% 79% privateData 29 55% 21% selfModify 23 96% 96% spend 22 0% 0% Most of the gap is a difference in definitions, not a missed setting. The labels count money spent by any command that runs unsandboxed and data read outside the project after a prompt; the scanner counts spending only through a tool known to spend, and private data only where the agent reaches it without a person approving that read (otherwise every agent that can fetch a web page would be a lethal trifecta). It also does not see what a prompt tells the agent to fetch, or what a later job does with the agent's output. The two agents it misses are an OpenCode CLI started from a workflow script and an empty desktop plugin.
How it decides
-
Approval. Interactive Claude Code asks before shell commands, edits, fetches and MCP tool calls unless an allow rule or a permission mode says otherwise. Those paths count as "with approval". A headless agent (a workflow step) has nobody to answer a prompt, so only its allowed tools count. A subagent's
permissionModereplaces the session's for its calls. -
Permission modes.
bypassPermissionsruns every tool without asking.autolets a classifier, not a person, approve most calls, so they count as "no approval"; that safety review checks the calls the mode lets through, so it counts as a runtime check for them (AGC-COV-001), in sessions and in workflows (--permission-mode auto) alike. Calls an allow rule already permits do not reach it. Project settings withdefaultMode: autoare reported as AGC-PERM-001 (medium).dontAskdenies whatever would prompt, so only allowed tools remain.acceptEditsalso runsmkdir,touch,mvandcpwithout asking.planandmanualread likedefault. Newer Claude Code ignoresautoandbypassPermissionsin project settings; the scan still reports them, because older versions apply them. -
The trifecta. Critical when the agent reads private data and untrusted input and can send data out without approval. Medium when only the prompt on sending data out stands in the way while untrusted input arrives unasked, or when one leg is unknown. When a person approves both untrusted input and sending out, it is not reported.
-
Shell commands are sorted by what they can reach: the project's own test, lint, build and install commands and package scripts (
npm test,pnpm lint,./scripts/check.sh); read-only commands; commands that bring in remote text (git clone,git pull); commands that change files (cp,mv,tee,git reset); commands that publish to the repository itself (gh pr comment,git push); and everything else, counted as commands that can reach any host or run arbitrary code (AGC-PERM-003). The sort fails closed: a rule is narrower only when every command in it matches a known command shape. An exact rule is split the way a shell would (ls && curl … | shis as wide ascurlandsh), a redirect writes a file, and options that run a program are read (awk 'BEGIN{system(…)}',sed e,find -exec,git -c,rg --pre,sort --compress-program,tar --to-command). Prefix rules forgit fetch,pull,cloneandremotereach the network (--upload-packruns a program), and ones forgit diff,logandshowwrite files (--output). A star with no space before it (git diff*,ls*) matches other programs and subcommands (git difftool,lsof), so it counts as running code; a path glob (tests/*) and a package-script prefix (pnpm test*) do not. Harmless exact commands are not reported: version and help checks (node --version), listings (docker ps,pip list,kubectl get) and workspace scripts (pnpm --filter web test,yarn workspace web test,turbo run test,bundle exec rspec). An unknown program, an absolute path to one, a wrapper that runs another command (sudo,timeout,xargs,env,eval), a wildcard inside the command (c*,*url) and a prefix rule for a command whose options run programs (git:*,find:*,rg:*,sort:*,sed:*,awk:*,git rebase:*,git grep:*) all count as running code; so do prefix rules that choose what to install or run (npm install:*,npm exec:*,uv run:*,bun run:*,mvn:*,tox:*,nx:*,yarn plugin:*,pnpm up:*), and prefix rules for build tools whose options run any program (make:*,go test:*,cargo:*,just:*). A rule for a repository script is read: a script that runs its arguments as a command (exec "$@",eval "$*",sys.argvhanded to a process) allows any command. Variable assignments before a command are dropped unless they load code (BASH_ENV,PATH,GIT_SSH_COMMAND, ...).PowerShellandMonitorrules are judged as Bash rules are;WebFetch(domain:*)sends data out. -
Codex runs commands inside its sandbox without asking unless
approval_policyisuntrusted;workspace-writehas no network unlessnetwork_access = true; leaving the sandbox needs approval unless the policy isnever.neverwithdanger-full-accessis AGC-PERM-001. Gemini CLI asks before built-in tools unless they are intools.allowedor the approval mode isyolo; a trusted MCP server skips confirmation for all its tools. -
MCP servers. A catalog of 44 well-known servers (GitHub, Slack, Postgres, Fetch, Playwright, Exa, Zapier, Kubernetes and others) records what each can do, by package, image or remote host. Any other server is unknown until
mcp_serversin.agc.yamldeclares it. -
Sandbox. With Claude Code's
sandbox.enabled, sandboxed Bash runs and writes without asking unlessautoAllowBashIfSandboxedis false. The sandbox never lowers network reach: a command can leave it (allowUnsandboxedCommands,excludedCommands) through the normal permission flow, where an allowed command still runs without asking, and the sandbox's allowed domains are not modelled. -
Actions. Agent actions are matched by name in any letter case, with any sub-path (
anthropics/claude-code-action/base-action) and under any owner, so a fork counts. A local composite action (uses: ./oruses: ./path) is read step by step, through the local actions it uses, three levels deep; one that starts an agent is an agent of unknown reach, reported at high. Every--mcp-configfile andmcp_configgiven as a path is read, relative to the step'sworking-directoryfor a CLI; one that cannot be read makes the step unknown reach. -
Scripts. A
run:script is split into commands the way a shell would: quotes removed, shell keywords (if,then,do,!), variable assignments,env,time,sudo,timeout,xargs,npxand other wrappers skipped, andbash -c "...",eval "...",$(...)and back quotes read as commands of their own. The scan follows repository scripts the step runs (./ci/agent.sh,bash x.sh,source x.sh), files run by an interpreter (python3 ci/x.py,node x.js,ruby x.rb,uv run python x.py: a process call there that starts an agent CLI, such assubprocess.run(["claude", "-p", ...]), is an agent of unknown reach, and so are local modules they import),npm run/pnpmscripts frompackage.json(with theirpreandpostscripts,npm test/startand install lifecycle scripts),make,justand Taskfile targets, DockerfileRUNlines fordocker build,find -exec, aliases and symlinks to an agent CLI, a customshell:, the agent CLI insidedocker run, and Claude Code started asnode .../cli.jsor by path ("$(which claude)"). Shell variables set in the script or inenvare expanded; an unquoted variable the scan cannot resolve ($FLAGS,"$@","${ARGS[@]}"), a quoted one not named for a prompt ("$MODE"), or a GitHub expression where a flag could be (claude_args: ${{ inputs.args }}, any argument holding text an outsider chose, such as--model ${{ github.event.comment.body }}) makes the step unknown reach. An agent named in text the scan cannot follow (piped into a shell,python -ccode that starts a process, a command taken from the job's matrix, a non-shellshell:, agithub-scriptthat starts a process, decoded text piped into a shell such asbase64 -d | bash, a step in a job container named for an agent) is an agent of unknown reach. So is a remote action or reusable workflow handed agent flags or a model key. Flags of the Claude Code and Codex CLIs the scan does not know (--plugin-dir,--chrome,--add-diroutside the checkout, Codex-c mcp_servers.…) make the step unknown reach; Codex's attached-sdanger-full-accessis read, and aCODEX_HOMEin the repository is read (elsewhere, unknown). A step that writes agent settings or adds servers before the agent runs (> ~/.claude/settings.json,claude mcp add) makes the agent unknown reach, and so do gh-aw front matter steps that do.claude-code-base-actiondoes not check who starts it. OpenCode, Cursor's CLI, Aider, Amp, Goose, Qwen Code and Crush, and actions that run them, are agents of unknown reach too.claude --version,npm i -g @anthropic-ai/claude-code,claude mcp add,command -v claudeor anechothat mentions an agent are not agents. Claude Code's list flags are variadic (--allowedTools Read Bash). Action inputs are matched in any letter case, as GitHub matches them.path_to_claude_code_executable,plugins,plugin_marketplaces,--permission-prompt-tooland inline--agentsthat set a permission mode make the step unknown reach;allowed_bots: "*"lets any bot start it.CLAUDE_CONFIG_DIRorHOMEset for a Claude step moves its settings: the file it points to in the repository is read, and one outside the repository makes the step unknown reach. -
Workflow agents. A Codex step runs commands without asking, inside its sandbox:
read-onlywrites nothing,workspace-writewrites the checkout, and the network is unknown unless the sandbox isdanger-full-access; a permission profile, defined in Codex's own config, leaves writes unknown. A workflow agent with a GitHub token and a shell can read issue and pull-request text whatever started it, so that input is unknown. When flags and inputs set different Codex sandboxes (--sandbox read-only --full-auto), the wider one is judged.claude-code-action'ssettings(inline JSON with comments, a mapping or a file in the repository),--settings, andclaude -p --permission-modeare read; settings that cannot be read make the step unknown reach. Copilot CLI steps (copilot -p) and Gemini CLI steps (gemini,gemini-cliornpx @google/gemini-cliin command position, with-p, a positional prompt or stdin, or thegoogle-github-actions/run-gemini-cliaction) are unknown reach, or run every tool without asking with--allow-all-tools/--yolo. A GitHub Agentic Workflow is unattended; itssafe-outputsare posted by a separate job that checks them, which counts as a runtime check for them unlessthreat-detectionis off. Imported tool lists are joined. An engine gh-aw does not build in, an import that cannot be read (from another repository, missing, too large or nested too deep), a tool the scanner does not model, or custom safe-outputjobsare unknown reach, as are engine settings it does not model (args,command, ...) and container MCP servers with an entrypoint, mounts or arguments. Secrets in the agent'senv, its MCP servers, its tools and its engine's environment (which its shell inherits) are private data, except the model credentials the harness itself reads (see workflow triggers below). Importedjobsandstepsthat start an agent, and enginecommand,stepsorargsthat lift the agent's limits, are unknown reach, reported at high. Withnetwork: { allowed: ["*"] }the firewall is open, so outbound reach is yes. The repository a workflow runs in is not counted as private data. -
gh-aw lock files. The
.lock.ymlthat runs is checked against its source's front matter (and the front matter it imports; prose explains nothing). Untrusted triggers the source does not have (after gh-aw's own expansion ofslash_commandandlabel_command), agent flags it does not ask for inengine.argsorengine.permission-mode(--dangerously-skip-permissions,--permission-mode bypassPermissionsin either form,--allow-all-toolswithoutbash: "*"), Claude allowed tools its tools do not give (every Bash command, web fetches, edits; the list read the way Claude Code reads it), an agent CLI other than the source's engine, or an agent gh-aw does not compile mean the lock was edited by hand: it is unknown reach, reported at high. Afrontmatter_hashthat differs from the source's (gh-aw's own algorithm, recomputed) means the lock is out of date or edited: medium. Other hand edits to compiled steps are not detected; recompiling in CI (gh aw compileand a diff) is the complete check. -
Model endpoints.
ANTHROPIC_BASE_URLand similar variables send model traffic, with everything the agent reads, to another endpoint. That is reported (AGC-CFG-001) but not counted as sending data out, since it is the model's own channel. In the repository's settings, a workflow or a gh-aw engine it is high, except for a model provider's own host (https://api.z.ai/...) or a value set outside the repository (${{ vars.X }}), which are medium; proxies and CA bundles are medium. -
IDE agents. The VS Code and Cursor agents behind
.vscode/mcp.jsonand.cursor/mcp.jsonask before terminal commands and fetches, apply edits without asking, and ask before MCP tools. -
Changing itself. An agent that can edit any file, or run any shell command, can rewrite its own settings and instructions, with the same approval.
-
Workflow triggers.
issues,issue_comment,pull_request_target, discussions andworkflow_runcarry text anyone can write and run with the repository's secrets.pull_requestfrom forks gets no secrets and a read-only token, so it is not treated as outsider input. Commands that post to the repository count only when the job's token can write. A reusable workflow (workflow_call) takes the triggers of its callers in the repository; with no caller here, anyone's event may start it (unknown). Secrets are found in every expression form (secrets.X,secrets['X'],toJSON(secrets)for all of them), in every input but the harness's own credentials (the prompt included), in the script of a CLI step, and through$GITHUB_ENVfrom an earlier step. The harness's own credentials are not counted as data given to the agent: a variable it reads (ANTHROPIC_API_KEY,OPENAI_API_KEY,GEMINI_API_KEY,OTEL_EXPORTER_OTLP_HEADERS, ...), matched by exact name, whose value is a secret named for a model provider (ZAI_API_KEY) or, for telemetry headers, a telemetry service. The same variable carrying another secret (ANTHROPIC_API_KEY: ${{ secrets.PROD_DB_API_KEY }}) is counted. -
The gate and computed reach. An agent that can both run code and send data out without approval, with no runtime check that sees those calls, is AGC-COV-001 at high, whichever setting gave it that reach (a Codex
danger-full-accesssandbox, a Bash rule, a mode). An agent that can edit any file and run a project command without asking can rewrite that command's code, so its network reach is counted as unknown. -
What the scan does not see. It reads files; it does not run anything, so a determined author can still hide reach from it. Known gaps:
- code that builds an agent's name at run time (
os.system("cla" + "ude …")without agent flags on that line); - a container image's own entry point, a program installed outside the repository, and a remote action or reusable workflow that gets neither agent flags nor a model key;
- settings an earlier step writes somewhere other than the agent's settings files or
$GITHUB_ENV/$GITHUB_PATH; - Codex permission profiles, Gemini policy files, Copilot and Windsurf hook files, and the auth headers of a remote MCP server;
Bash(tee:*),Bash(yq:*)and similar prefix rules count as writes, not as reaching the agent's own settings;.envis never read, since it holds secrets.
In a full scan an inline
agc-ignorecomment can silence a finding in the same change; only--basejudges a change against the base commit's suppressions. Recompiling gh-aw workflows in CI is the complete check for lock files. - code that builds an agent's name at run time (
-
Runtime checks. A runtime check counts only for the calls it sees. A hook matcher is a regular expression from the repository, so the scanner never runs it: it reads the matcher's
|alternatives, and credits only exact tool names (Bash), name prefixes (Web.*,mcp__db__.*) and every tool ("",*,.*). For an MCP server an alternative must be a prefix of all its tools (mcp__.*,mcp__<server>__.*): naming one tool does not cover the server. Any other shape, a matcher that is not a valid regular expression on its own, or one longer than 512 characters is not credited, nor is a hook that can approve calls or whose decisions cannot be read (see hooks above), and no hook counts whendisableAllHooksis set (or only managed hooks, under managedallowManagedHooksOnly). Agent Guard or an MCP gateway reached as an MCP server sees only the calls made through that server, not Bash and not servers configured beside it. -
Other agents. Codex runs commands inside its sandbox without asking unless
approval_policyisuntrusted, and an unknownsandbox_modeis judged as no sandbox. OpenCode V1 allows tools itspermissionobject leaves out, V2 asks for calls no rule matches, and a file with neither is reported as unknown. Every OpenCode agent override is judged (V1 and V2 files,permissionandtools), and the OpenCode agent can do what any of its agents can. A Copilot custom agent on the cloud agent runs without anyone approving it; its network is behind the Copilot firewall, so outbound reach is unknown, and it has the read-only GitHub MCP server unlesstoolsleaves it out. Withtarget: vscodeit runs in VS Code, which asks before terminal commands, fetches and MCP tools. Tool-set names (execute/runInTerminal) count as their set. A tool name the scanner does not know, or atoolsvalue that is not a list, counts as unknown reach. Kiro'sautoApproveruns the listed tools without a prompt. A plugin's servers ask before their tools run, as Claude Code does by default.
What it does not do
- It does not detect malicious code inside an MCP server, plugin or skill. Content scanners
such as Cisco MCP Scanner and Snyk Agent Scan cover that;
--import-sarifmerges their findings into one report. - Without Agent Guard records or live evidence it cannot see permissions held outside the
repository: a token's real scopes or cloud IAM. User-level settings in
~/.claude,~/.codexand~/.geminiare read only with--include-user. - It does not block anything at runtime. Agent Guard does that.
- Text rules are heuristics, labelled low confidence.
Inventory format
--format inventory writes every agent, its seven capabilities with how each is reached and
the settings behind it, its tools, runtime checks and finding counts, without finding text.
The format is published as a JSON Schema,
agent-guard-check-inventory-v1.schema.json,
so other tools can read it or write it. A capability that is not listed is no; unknown is
never a promise of no. New agent kinds may be added in a minor release, so readers should
accept kinds they do not know.
Security
The scanner treats every file as hostile input. It never executes repository content or runs a
regular expression taken from it, follows a symbolic link only when the operating system
resolves it to a place inside the repository (and reads named files only through paths with no
link in them), caps file sizes and counts, validates git refs before passing them to
git, writes reports and baselines with owner-only permissions, masks secrets in messages,
escapes untrusted text in Markdown (including line breaks, mentions and links) and keeps it on
one line in text output, so a name in a repository file cannot start a GitHub workflow command. Network access happens only for live evidence you ask for,
with redirects refused and responses capped at 8 MiB. Report problems as described in
SECURITY.md.
API
import { scan, diffScans, fetchLiveEvidence, formatSarif } from '@shieldaai/agent-guard-check';
const head = scan({ root: '/path/to/repo' });
const base = scan({ root: '/path/to/repo', ref: 'origin/main' });
const diff = diffScans(base, head);
console.log(diff.widened.map(change => `${change.agent.name}: ${change.capability}`));
// With live evidence (read-only token):
const live = await fetchLiveEvidence({ url: 'https://agent-map.example', token: process.env.AGENT_MAP_TOKEN! });
const result = scan({ root: '/path/to/repo', live });
MemorySource scans files you already hold, without touching the disk. planFixes,
importSarif, formatInventory, runHook, fetchBranchRules and the rule list (RULES) are
exported too.
Apache-2.0.