occ-anthropic
v0.2.0
Published
OCC cryptographic proof signing for Anthropic Node SDK tool calls
Downloads
25
Readme
occ-anthropic
Cryptographic proof signing for Anthropic Node SDK tool calls. Every tool call gets an Ed25519-signed proof written to proof.jsonl.
Install
npm install occ-anthropic @anthropic-ai/sdkUsage
Wrap the client
import Anthropic from "@anthropic-ai/sdk";
import { wrapAnthropic } from "occ-anthropic";
const client = wrapAnthropic(new Anthropic(), {
proofFile: "proof.jsonl", // default
agentId: "my-agent",
});
// Use as normal — tool calls are automatically signed
const response = await client.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 1024,
messages: [{ role: "user", content: "What's the weather?" }],
tools: [{
name: "get_weather",
description: "Get the weather for a city",
input_schema: {
type: "object" as const,
properties: { city: { type: "string" } },
required: ["city"],
},
}],
});Sign tool execution results
When you execute tool calls in your own loop, sign the results too:
import { signToolResult } from "occ-anthropic";
// After executing the tool
const result = await getWeather({ city: "Buffalo" });
// Sign the result
await signToolResult("get_weather", { city: "Buffalo" }, result);Configuration
interface WrapAnthropicOptions {
proofFile?: string; // Default: "proof.jsonl"
statePath?: string; // Default: ".occ/signer-state.json"
measurement?: string; // Default: "occ-anthropic:stub"
agentId?: string; // Default: "anthropic-agent"
}How it works
wrapAnthropic()returns a Proxy around your Anthropic client- When
messages.create()returnstool_usecontent blocks, each one is signed - Pre-execution proof: Ed25519 signature over SHA-256 of tool name + arguments
- Post-execution proof (via
signToolResult): signature over tool name + args + result - Both proofs are chained via
prevB64for tamper-evident ordering - All proofs written to
proof.jsonlas append-only log
Verify
npx occ-mcp-proxy verify proof.jsonl