Summary
gh aw audit should surface integrity filtering and guard policy events from the MCP Gateway, giving workflow authors visibility into when and why tool calls are blocked or scoped by guard policies.
This is not covered by #22757 — that issue focuses on MCP tool call stats, session metrics, token usage, and safe-output compliance. Guard policy enforcement (integrity filtering, repo scoping) is a separate dimension of observability.
What are guard policies?
Guard policies are defined in workflow frontmatter under tools: github: and control which tool calls the MCP Gateway allows:
tools:
github:
mode: remote
toolsets: [default]
repos: "public" # or "all", ["owner/repo", "owner/*"]
min-integrity: reader # one of: none, reader, writer, merged
repos — Scopes which repositories a tool can access (exact match, owner wildcard, prefix wildcard)
min-integrity — Minimum DIFC integrity level required for a tool call to proceed
- Both fields are required together (validated in
pkg/workflow/tools_validation.go:61-200)
See full spec: scratchpad/guard-policies-specification.md
What events are produced?
When a guard policy blocks or filters a tool call, the MCP Gateway logs these decisions. Currently:
gateway.jsonl records tool calls with type: "tool_call", status, duration, and errors — but does NOT explicitly tag integrity-filtered events
filtered_integrity parameter in pkg/cli/mcp_tools_privileged.go can filter log runs to those containing integrity-filtered events
- Daily analysis workflow (
.github/workflows/daily-integrity-analysis.md) does Python-based bucketing of integrity-filtered events
The gap: gh aw audit does not parse or surface any of this.
Proposed metrics for gh aw audit
Guard Policy Summary
- Total tool calls subject to guard policies
- Tool calls blocked by
min-integrity (with integrity level distribution)
- Tool calls blocked by
repos scope (with repo pattern details)
- Tool calls allowed through guard policies
Per-Server Breakdown
- Which MCP servers had guard policies applied
- Block rate per server
- Most frequently blocked tools
Integrity Level Distribution
- Count of tool calls at each integrity level (none, reader, writer, merged)
- Which levels triggered filtering
Debugging Support
- When a tool call fails, show whether it was blocked by a guard policy vs. a runtime error
- Surface the specific guard policy rule that caused the block
- This directly helps debug "why did my agent fail to call this tool?" scenarios
Key files
| File |
Purpose |
pkg/workflow/tools_types.go:265-302 |
GitHubIntegrityLevel, GitHubReposScope, GitHubToolConfig with guard policy fields |
pkg/workflow/tools_validation.go:61-200 |
validateGitHubGuardPolicy() — repos + min-integrity validation |
pkg/workflow/tools_parser.go |
Extracts repos and min-integrity from frontmatter |
pkg/cli/gateway_logs.go |
parseGatewayLogs(), GatewayMetrics — current parsing (no guard policy events) |
pkg/cli/mcp_tools_privileged.go |
filtered_integrity parameter for log filtering |
scratchpad/guard-policies-specification.md |
Full guard policies design spec |
Tasks
Relationship to other issues
🤖 Generated with Claude Code
Summary
gh aw auditshould surface integrity filtering and guard policy events from the MCP Gateway, giving workflow authors visibility into when and why tool calls are blocked or scoped by guard policies.This is not covered by #22757 — that issue focuses on MCP tool call stats, session metrics, token usage, and safe-output compliance. Guard policy enforcement (integrity filtering, repo scoping) is a separate dimension of observability.
What are guard policies?
Guard policies are defined in workflow frontmatter under
tools: github:and control which tool calls the MCP Gateway allows:repos— Scopes which repositories a tool can access (exact match, owner wildcard, prefix wildcard)min-integrity— Minimum DIFC integrity level required for a tool call to proceedpkg/workflow/tools_validation.go:61-200)See full spec:
scratchpad/guard-policies-specification.mdWhat events are produced?
When a guard policy blocks or filters a tool call, the MCP Gateway logs these decisions. Currently:
gateway.jsonlrecords tool calls withtype: "tool_call", status, duration, and errors — but does NOT explicitly tag integrity-filtered eventsfiltered_integrityparameter inpkg/cli/mcp_tools_privileged.gocan filter log runs to those containing integrity-filtered events.github/workflows/daily-integrity-analysis.md) does Python-based bucketing of integrity-filtered eventsThe gap:
gh aw auditdoes not parse or surface any of this.Proposed metrics for
gh aw auditGuard Policy Summary
min-integrity(with integrity level distribution)reposscope (with repo pattern details)Per-Server Breakdown
Integrity Level Distribution
Debugging Support
Key files
pkg/workflow/tools_types.go:265-302GitHubIntegrityLevel,GitHubReposScope,GitHubToolConfigwith guard policy fieldspkg/workflow/tools_validation.go:61-200validateGitHubGuardPolicy()— repos + min-integrity validationpkg/workflow/tools_parser.goreposandmin-integrityfrom frontmatterpkg/cli/gateway_logs.goparseGatewayLogs(),GatewayMetrics— current parsing (no guard policy events)pkg/cli/mcp_tools_privileged.gofiltered_integrityparameter for log filteringscratchpad/guard-policies-specification.mdTasks
gateway.jsonl(e.g.,type: "guard_policy",action: "blocked"/"allowed",reason: "min_integrity"/"repo_scope")GatewayLogEntryandGatewayMetricsingateway_logs.goto parse guard policy eventsgh aw auditoutput (blocked/allowed counts, integrity level distribution)LOGGING.mdwith guard policy event documentationRelationship to other issues
gh aw audit🤖 Generated with Claude Code