Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sigilcore.com/llms.txt

Use this file to discover all available pages before exploring further.

Installation

npm install @sigilcore/agent-hooks

Usage

import { checkAnthropicToolUse } from '@sigilcore/agent-hooks';

const config = {
  apiKey: process.env.SIGIL_API_KEY!,
  agentId: 'my-claude-agent',
};

// In your PreToolUse hook:
const rejection = await checkAnthropicToolUse(toolUseBlock, config);
if (rejection) {
  // Feed rejection back to Claude as a tool_result error
  return rejection;
}
// Otherwise, let the tool execute normally

Tool Name Mapping

checkAnthropicToolUse maps Anthropic tool names to Sigil action types automatically:
Anthropic ToolSigil Action
Bash, bashbash
WebSearch, WebFetchweb_fetch
Write, Editfile_write
computerbash
Any other toollowercased tool name

What Gets Sent to Sigil

For each tool call, the following intent is submitted to /v1/authorize:
{
  action: 'bash',                    // mapped from tool name
  command: block.input['command'],   // bash only
  url: block.input['url'],           // web_fetch only
  path: block.input['path'],         // file_write only
  metadata: block.input,             // full input for custom rules
}

Rejection Response

When Sigil denies or holds an action, checkAnthropicToolUse returns a tool_result error block that Claude understands:
{
  type: 'tool_result',
  tool_use_id: block.id,
  content: JSON.stringify({
    sigil_decision: 'DENIED',
    sigil_error_code: 'SIGIL_POLICY_VIOLATION_BLOCKED_COMMAND',
    sigil_message: 'Command contains blocked string: rm -rf',
    sigil_action_taken: 'halted',
    sigil_next_steps: 'Do not attempt to reframe or retry this action.',
  }),
  is_error: true,
}
Claude will receive this as a tool error and adjust its behavior accordingly.

Configuration

FieldTypeRequiredDefaultDescription
apiKeystringYesSigil API key (sk_sigil_...)
apiUrlstringNohttps://sign.sigilcore.comSigil Sign endpoint
agentIdstringNo'agent'Agent identifier
onDeniedfunctionNoCalled when action is denied
onPendingfunctionNoCalled when action is held
onErrorfunctionNoCalled on network error