The Claude Agent SDK adapter (@deedglass/sdk/claude-agent-sdk)
Tested with @anthropic-ai/claude-agent-sdk 0.3.289 (2026-10-04) by calling the hook callbacks with
the SDK’s own input types, and with createSdkMcpServer holding a governed tool; no model call. The
peer range is >=0.3 <0.4.
import { query } from '@anthropic-ai/claude-agent-sdk';import { Deedglass } from '@deedglass/sdk';import { deedglassHooks, deedglassMcpServer } from '@deedglass/sdk/claude-agent-sdk';
const dg = new Deedglass();for await (const m of query({ prompt, options: { hooks: deedglassHooks({ client: dg }), mcpServers: { deedglass: deedglassMcpServer(dg) } } })) { … }deedglassHooks({ client, matcher, connector = 'claude', onPending = 'deny', approvalTimeoutMs, failureMeans })PreToolUserecords a proxy actionclaude.<tool_name>(claude.Bash,claude.Write,claude.mcp__github__create_issue) withtool_inputas its arguments. Denied →permissionDecision: 'deny'with the policy sentence. Pending →denywith the pending sentence, or withonPending: 'wait'a long poll inside the hook (the matcher’stimeoutbecomesapprovalTimeoutMs / 1000 + 30). Authorized →{}, which defers to the host’s own permission rules: Deedglass allowing a call never skips your prompts.PostToolUsereportssucceededwithtool_response(256 KiB, else its digest);PostToolUseFailurereportsunknown(orfailedwithfailureMeans: 'not_applied').Stopreportsunknown(no_result_observed) for authorized calls that never produced a Post event.- It fails closed: when Deedglass can’t be reached the hook denies with “Deedglass couldn’t be reached, so this tool call was not run.” It never throws, and there is no fail-open option.
governSdkTool(def, options)wraps an SDK MCP tool’s handler; a denial is{ content: [{ type: 'text', text }], isError: true }.deedglassMcpServer(client, { connector })returns{ type: 'http', url: '<server>/mcp/native', headers: { Authorization } }for Deedglass’s gateway tools (S15).- Policy:
examples/policies/claude-agent-local.yaml(15 cases) lets reads run, never runsrm -rf /, curl into a shell, force pushes or.envwrites, and sends writes outside/workspace/and every MCP tool to a person. - What it doesn’t see: tools the Agent SDK doesn’t route through hooks.