Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 916 Bytes

File metadata and controls

41 lines (29 loc) · 916 Bytes

Claude Code

Claude Code can call AgentGuard before risky tool use.

Minimal runtime hook

To write the template automatically in the current project:

agentguard init --agent claude-code

This 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:

  • Bashshell
  • Readfile_read
  • Write, Edit, MultiEditfile_write
  • WebFetch, WebSearchnetwork

Decisions

  • allow and warn exit 0
  • require_approval and block exit 2

Connected Cloud approvals print the approval id when creation succeeds.