Claude Code can call AgentGuard before risky tool use.
To write the template automatically in the current project:
agentguard init --agent claude-codeThis creates .claude/hooks/agentguard-protect.sh and .claude/settings.local.json.
Configure a PreToolUse hook that pipes Claude Code hook JSON to agentguard protect:
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "AGENTGUARD_AGENT_HOST=claude-code AGENTGUARD_ACTION_TYPE=shell AGENTGUARD_TOOL_NAME=Bash agentguard protect"
}
]
}Recommended matchers:
Bash→shellRead→file_readWrite,Edit,MultiEdit→file_writeWebFetch,WebSearch→network
allowandwarnexit0require_approvalandblockexit2
Connected Cloud approvals print the approval id when creation succeeds.