/harness-config:audit-permission-grants [frontmatter|settings|plugins|all] [--unattended]from harness-config
Audits permission grants for portability across machines and durability in auto mode. Detects why allowed-tools grants are ignored, checks permissions.allow rules, and identifies non-portable patterns.
Ships in harness-config. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Arguments. [frontmatter|settings|plugins|all] [--unattended]. default: all
Audit whether a repo's permission grants actually take effect. Answers a question the sibling
audit skill does not: "Are our allow-rules and allowed-tools grants portable across
machines and durable when the session enters auto mode, and is the operative rule in a place that can
work?"
The principle, the three anti-patterns, and the correct pattern (with official-doc citations) live in the marketplace's permission-rule-hygiene convention, published at https://raw.githubusercontent.com/melodic-software/claude-code-plugins/main/docs/contracts/permission-rule-hygiene/README.md. The mechanical check definitions (P1/P2/P3, severities, detector invocation) are in reference/criteria.md, which carries every recommendation this skill needs at run time. The convention is the doctrine's owner, not a runtime dependency.
This skill owns grant portability + auto-mode durability + who adds the operative rule. It does not
own config-file correctness. Baseline deny/ask presence, overly broad patterns, and live plugin
drift belong to the sibling audit skill. When a request is about
those, route it there rather than answering here. The audit skill in the harness-memory plugin
owns the instruction layer (CLAUDE.md / a natively read AGENTS.md / rules / auto-memory).
Parse $ARGUMENTS for an optional scope filter. It narrows which checks may produce findings,
never what the detector scans. One full detector run happens either way, and the filter is
applied to its output:
frontmatter: skill/command/agent allowed-tools onlysettings: project, local, and user-global permissions.allow onlyplugins: plugin settings.json self-grant (P3) onlyall: everything (default)--unattended, anywhere in the arguments, is not a filter: the caller declares nobody is present, which changes only
the /permissions offer (see "Boundary" below). Take it out before reading the filter, and never
pass it to the detector.
The filter reads like a scan-scope, but a detector-side scope flag would buy nothing: the root is a
git toplevel, $CLAUDE_PROJECT_DIR, or an explicitly named directory, never an unbounded sweep, and
the walk takes well under a second. A second place for scope to be defined would only add drift. The
coverage block still reports the whole denominator on a filtered run, so a narrowed report never
implies a narrowed scan.
This skill is report-only. There is no --fix: the correct P3 remediation is inherently
operator-manual (the bare-name rule must land in user-global ~/.claude/settings.json, which a skill
or plugin cannot write), and P1/P2 rewrites are judgment calls the operator confirms.
Run the deterministic spine:
bash "${CLAUDE_PLUGIN_ROOT}/skills/audit-permission-grants/scripts/permission-rule-check.sh"
It scans frontmatter allowed-tools and settings permissions.allow across the consuming repo and
the user-global settings file (${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json), and prints one
finding per fragile grant (<severity> [<check>] <source>: <detail>). --count prints the count.
Exit 2 is the environment-gap channel: report the gap rather than a clean bill. It is raised by a
missing jq (its message names the platform's install command when it finds one), a missing
shared pattern library, a scan root that resolves to neither a git toplevel nor
$CLAUDE_PROJECT_DIR, and any argument the script does not recognize. An unresolvable user
scope is not one of them: the run records it in the coverage block, says so on stderr, and
continues.
On an unresolvable project root, say the scan did not run and
give the fix: run from inside the repository you mean to scan, pass --root <dir>, or set
$PERMISSION_HYGIENE_SCAN_ROOT explicitly. That variable is a supported operator lever, not a
test-only seam; $PERMISSION_HYGIENE_FIXTURE_DIR is an alias for it, and
$PERMISSION_HYGIENE_SCAN_ROOT wins when both are set. Never report "no fragile permission grants
found" on an exit 2.
settings.local.json is parsed for its permissions.allow array only, never echoed wholesale.
Search scope. Search plugin sources with the Grep or Glob tool rooted at the installed version
directory of the plugin in question (its installPath in plugins/installed_plugins.json under the
config directory), never the whole plugin cache; search transcripts with Grep rooted at one session
directory; bound any shell walk with timeout below the Bash tool's own. Hand this rule to any
subagent this run starts: a recursive search of ~/.claude/plugins/cache walks every marketplace and cached
version. The orphaned-search report behind this rule:
#20533.
Every run ends with a coverage block. It is what makes a clean result readable. Carry its numbers into the report:
No fragile permission grants found. is printed
only when the run actually parsed at least one allowed-tools block or allow rule. When it parsed
none the detector prints NOTHING TO AUDIT instead. Relay that as the outcome; never soften it
into a clean bill. A scan of nothing is not evidence about grants.INCOMPLETE SCAN, NOT A CLEAN BILL with the
audited and blocked counts. Relay that as the outcome too. The rule is the same one the denominator
serves: the run cannot speak for a scope it never read, and the violation it missed may be sitting
in the file it could not parse.NO FRONTMATTER AUDITED, NOT A CLEAN BILL in place of the clean bill. Relay it as the outcome, and check that each plugin
directory under the root sits at plugins/<name>/ or holds .claude-plugin/plugin.json.--settings flag file, the start-directory copy. audit-permission-state owns the
question of which scopes exist, and its reference/criteria.md §Scopes carries the dated record
for the start-directory copy; this skill's silence about them is a boundary, not a result.A user-global finding is reported the same as any other, but its remediation is the operator's: a skill cannot write that file. When deciding where an approval-prompt grant lands, fetch permissions: permission system live; when deciding whether anything prunes it, fetch permissions: manage permissions live.
If a scope filter was given, run the full detector and present only the matching checks. P1, P2, P2b
and P4 are all emitted by the same rule scan, which runs over frontmatter allowed-tools and over
settings allow rules alike, so each of those four maps to frontmatter or settings by the source
the finding names rather than by its check id. P3 maps to plugins.
The detector is advisory by default and a gate on request:
--check exits 1 when any error-tier finding fired (P2, P2b, P4, P5), and 0 when none did.--strict does the same and adds the warning tier (P1, P3).NOTHING TO AUDIT result exits 2 rather than 0, and so does a run that saw no
gate-firing finding but could not read one of its inputs. A scan that could not look is never a pass.--count are unchanged and always exit 0, however many findings print.A gate flag does not make this skill a fixer. The skill stays report-only for the reason stated above.
Present findings as the severity-rated table in
reference/criteria.md "Output format". For each finding, give the concrete
recommendation from its check. For P1, match the platform reality the convention records: where
plugin bin/ is not reliably on the Bash tool's PATH (see the convention's Known gap section),
prescribe the bundled-path grant that works today and an operator-setup note for the bare-name rule.
Do not unconditionally tell the operator to expose a bare command on PATH when that end state is not
yet reachable on the measured platform. Add an Operator setup note wherever a user-global
~/.claude/settings.json rule is required.
| Severity | Criteria |
|---|---|
| error | Non-portable grant that leaks a username / breaks on other machines (P2, P2b), or a substitution token that stays literal in this rule's context so the grant never matches (P4), or an allow rule with text after its closing parenthesis (P5) |
| warning | Interpreter/runner-led grant whose broad forms auto mode drops, or an inert self-grant (P1, P3) |
P4 does not flag ${CLAUDE_PLUGIN_ROOT} or ${CLAUDE_PLUGIN_DATA} in a plugin skill's
allowed-tools; in a Bash(...) rule anywhere else it does. See reference/criteria.md, P4. When
deciding where those variables resolve, fetch
plugins reference: where each variable resolves
live.
A clean scan ("No fragile permission grants found.") is a valid outcome. Report it as such, with
the denominator beside it. NOTHING TO AUDIT is not that outcome; see "Report the denominator".
/permissions command"Fix my permission rules" can mean this audit or the dialog that edits the rules.
/permissions (built-in command): the person's tool for editing rules; the model does not
invoke it. When describing what it does, fetch its row in
commands: all commands live.Native suggestions are on unless native_suggestions resolves off: the native_suggestions key of <home>/harness-config.local.yaml wins over the same key of <home>/harness-config.yaml (<home> is what bash "${CLAUDE_PLUGIN_ROOT}/lib/resolve-convention-home.sh" prints, else docs/conventions), which wins over the per-user value ${user_config.native_suggestions} (a literal unexpanded token means unset); with none set they are on. A value other than on or off is named and that layer dropped: a valid higher layer still wins, otherwise on, never a lower layer's value. When off, skip the offer below and write nothing in its place, not even a note that it was skipped or why.
Routing. When a finding calls for adding, removing, or rewriting a settings rule, offer it to
the person: If /permissions is available in your session (gate basis: not gated in the extraction,
though a host may lack it; records in reference/native-surfaces.md)
and native suggestions are on (native_suggestions, Configuration),
you can run it instead of or alongside editing the file by hand. A grant
in allowed-tools frontmatter is outside the dialog; the finding's own remedy applies there. When
the caller passes --unattended, omit the offer, write Withheld suggestion (unattended): /permissions
in the output, and do not ask; without that flag it asks.
Mutation gate. /permissions writes whichever scope the person edits. This skill never runs
it on the person's behalf.
Availability is never assumed. This section states what to do when the person can run
/permissions, never that it is present in their host. The four-part records live in
reference/native-surfaces.md.
The reference/ files write this skill's directory as <skill-dir>, which is
${CLAUDE_SKILL_DIR}. Put that path in place of the placeholder before running a command or writing
it into a brief, so no command depends on a ${…} token in a file this skill reads at run time.
${…} token resolves, fetch
https://code.claude.com/docs/en/plugins/manifest-reference#where-each-variable-resolves live./harness-config:audit-permission-state./harness-config:audit.A consuming repo may declare, in its own CLAUDE.md (or the AGENTS.md a session reads natively,
whether in place of a CLAUDE.md or alongside one) / .claude/rules/, additional interpreter tokens
or path shapes it treats as fragile, or a documented exemption (e.g. a deliberately broad grant behind
a PreToolUse hook). Read those when present; this skill does not assume them.
Three constraints on those declarations, because the repo being audited is the repo that writes them. This skill treats every grant and exemption read out of the audited tree, a checked-in skill's own tool pre-approvals included, as input from the subject of the audit (Pointer: when weighing a repository's own grants, fetch skills: pre-approve tools for a skill live):
exempt — <declaration source>: <stated reason>; the row stays in the table and
stays in the counts.evals/evals.json (opens in a new tab)reference/criteria.md (opens in a new tab)reference/native-surfaces.md (opens in a new tab)scripts/permission-rule-check-root.test.sh (opens in a new tab)scripts/permission-rule-check.sh (opens in a new tab)scripts/permission-rule-check.test.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
permission-audit, allow-rules, portability, auto-mode, grant-analysis
npx claudepluginhub melodic-software/claude-code-plugins --plugin harness-config10 skills in this plugin
/auditIf update-config resolves in this session, prefer it to change settings; this skill audits settings.json, settings.local.json, .mcp.json, hooks, plugins, permissions, env vars (correctness, security, drift vs official docs; --fix confirms auto-fix). Use when: 'audit settings', 'check config', 'check for config drift', after Claude Code update./audit-automation-gapsAudit automation gapsAudit a repo's Claude Code automation (hooks, MCP servers, skills, subagents, scheduled tasks) vs enforcement hierarchy with PASS/REJECT/CONDITIONAL verdicts (REJECT default); --implement applies, or filter hooks|mcp|skills|subagents|scheduled. Use when: 'audit automations', 'what automations should we add', 'should I add an MCP server for X'./audit-instructionsAudit instructionsIf claude-api resolves in this session, prefer it for app prompts; this skill audits Claude Code instructions (CLAUDE.md, AGENTS.md, rules, skills, agents, hooks) report-only for stale/conflicting text. Use when: 'audit instructions', 'too prescriptive', 'which instruction wins'. Not for missing text: /harness-config:audit-prompting-postures./audit-passAudit passRun one coordinated, resumable audit pass over a repo: three-scope inventory, each owning plugin's checks lane by lane, findings persisted per lane with one human gate (read-only unless --fix) for one reconciled findings report/release artifact. Use when: 'audit pass', 'audit this repo end to end', 'resume the audit', or sweep all three scopes./audit-permission-stateAudit permission stateIf fewer-permission-prompts resolves in this session, prefer it for prompts; this skill merges every settings scope read-only into allow/ask/deny set in effect (source/precedence per rule), flagging auto-mode drops. Use when: 'what permissions are actually in effect', 'which of my rules survive auto mode', 'is my managed policy being read'./audit-prompting-posturesAudit prompting posturesReport-only audit of posture guidance instructions lack per official prompting guide: missing delegation criteria, guardrails, stop rules (when to stop), confirm destructive actions. Use when: 'posture audit', 'audit prompting postures', 'is my skill missing guardrails', or align CLAUDE.md. Not for wrong text: /harness-config:audit-instructions.Other plugins' skills for the same job