@agent-custody/receipts 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,7 @@ Anyone holding the public keys can verify a receipt offline. The agent is not tr
14
14
  - [The interceptor SDK](docs/sdk.md): Claude Code hooks, the Claude Agent SDK, adapters for the OpenAI Agents SDK, Vercel AI SDK and LangChain, and wrapping tool functions in anything else
15
15
  - [Writing policies](docs/policies.md): how a tool call becomes a Cedar request, with tested examples
16
16
  - [Verifying a receipt](docs/verification.md): what each check means and what a verified receipt does and does not prove
17
+ - [What the evidence satisfies](docs/compliance.md): the receipts, packs, and certificates mapped to SOC 2, ISO 27001, the EU AI Act, and UK GDPR, with what none of them claims
17
18
 
18
19
  ## Getting started
19
20
 
@@ -58,7 +59,7 @@ flowchart LR
58
59
  R[("receipt bundles<br/>receipts/*.json")]
59
60
  L[("Merkle log<br/>local file, or a remote log<br/>run by someone else")]
60
61
  V["Verifier<br/>auditor, counterparty, CI job"]
61
- O["Observability<br/>OTel, LangSmith, Arize"]
62
+ O["Observability<br/>OTel, Splunk, LangSmith, Arize"]
62
63
 
63
64
  P -- "signed delegation grant" --> G
64
65
  A -- "MCP tools/call" --> G
@@ -105,7 +106,7 @@ Every receipt names its issuer, and the verifier prints what that issuer kind is
105
106
  | Vercel AI SDK | SDK | `wrapTools` | | a real `generateText` loop over the SDK's mock model |
106
107
  | LangChain / LangGraph (JS) | SDK | `tool(issuer.wrap(fn))` | `ReceiptCallbackHandler` | real `StructuredTool` invocations |
107
108
  | anything else | SDK | `issuer.wrap(name, fn)` | `issuer.record` | plain functions |
108
- | Python: LangChain, OpenAI Agents SDK, Claude Agent SDK | sidecar + [Python package](../python/README.md) | `wrap_tools`, `claude_hook` PreToolUse deny, `client.wrap` | `ReceiptCallbackHandler` | the real Python packages, receipts checked by this verifier |
109
+ | Python: LangChain, OpenAI Agents SDK, CrewAI, Claude Agent SDK | sidecar + [Python package](../python/README.md) | `wrap_tools` (OpenAI Agents, CrewAI), `claude_hook` PreToolUse deny, `client.wrap` | `ReceiptCallbackHandler` | the real Python packages, receipts checked by this verifier |
109
110
  | Go, Java, Rust, any language with HTTP | sidecar | decide then record | record | [examples/languages](examples/languages), each run against a live sidecar |
110
111
  | any MCP host in any language: Claude Agent SDK Python, OpenAI Agents Python | gateway | yes | | the gateway is an MCP server; [usage.md](docs/usage.md#python-hosts) |
111
112
  | any REST API, as tools the agent reaches through the gateway | gateway, `rest` upstream | yes | | a stand-in HTTP API; [usage.md](docs/usage.md#setup-step-by-step) |
@@ -241,6 +242,7 @@ src/sdk/claude.ts Claude Code command hook and Claude Agent SDK in-process hook
241
242
  src/sdk/openai-agents.ts, vercel-ai.ts, langchain.ts framework adapters, tested against the real packages
242
243
  src/sidecar.ts the SDK issuer behind a local HTTP API, for agents in other languages
243
244
  src/otel.ts OpenTelemetry export: one OTLP/HTTP span per receipt, after the receipt, no SDK dependency
245
+ src/splunk.ts Splunk export: one HTTP Event Collector event per receipt, token from the environment, beside or instead of otel
244
246
  src/rest.ts the REST connector: an HTTP API described as tools, standing where an MCP upstream stands
245
247
  src/upstream.ts attested execution: an upstream signs its result for the receipt; the verifier checks it with the upstream key
246
248
  vectors/ conformance vectors: receipts, keys, logs, proofs, and expected verdicts; `bun run vectors` regenerates them
@@ -268,7 +270,7 @@ The design is two producers feeding one verifier. The SDK is the top of the funn
268
270
  - Claude Code command hook for PreToolUse, PostToolUse, and PostToolUseFailure, with blocking on deny.
269
271
  - Claude Agent SDK in-process hooks over the same handler.
270
272
  - Provider-native deliveries: an upstream wrapping Stripe or GitHub attaches the signed webhook or delivery for the call; a verifier with the shared secret checks the HMAC, the timestamp, and the binding to the result, and reports the execution as attested by shared secret.
271
- - Logarithmic appends: the Merkle log caches complete subtrees, so issuing a receipt costs the same at the millionth leaf as at the first; measured at 0.15 ms per receipt and about half a millisecond per gateway call including policy, a fact lookup, and the upstream signature.
273
+ - Logarithmic appends: the Merkle log caches complete subtrees, so issuing a receipt costs the same at the millionth leaf as at the first; measured at 0.15 ms per receipt and about half a millisecond per gateway call including policy, a fact lookup, and the upstream signature. A remote log adds one network round trip plus about five milliseconds of server work per call, two for a pre-committed call; the [deployment guide](https://agent-custody.dev/guide/deployment) has the measurements against the live log.
272
274
  - Retention on the log: `prune` replaces leaves older than a cutoff with their hashes and removes their bundles, so proofs still verify and the content is gone.
273
275
  - Several upstreams under one gateway and one grant, each tool owned by exactly one, with the receipt naming which served the call; consumed facts flow across them.
274
276
  - Attested execution: an upstream that holds a key signs its result for the receipt, the gateway embeds it, and a verifier given the upstream key reports the execution as attested rather than observed. The memory server and the demo upstream sign.
@@ -288,6 +290,7 @@ The design is two producers feeding one verifier. The SDK is the top of the funn
288
290
  - The log over Postgres: `log --db-env`, leaves as hashes in one table keyed by tenant, one writer per tenant by advisory lock, tenants and hashed tokens in tables managed by `log-admin`, rate limits and a body cap, retries in the sink, and `import` for an existing file log. Phase 2 of [issue #6](https://github.com/ch4r10t33r/agent-custody/issues/6).
289
291
  - A log for someone else: `hashOnly` sends leaf hashes so the log never holds a receipt; the reference server runs several tenant logs at `/t/<tenant>/` with their own tokens and ids; tree heads name their log and the verifier checks it with `--log-id`. Phase 1 of the hosted log, [issue #6](https://github.com/ch4r10t33r/agent-custody/issues/6).
290
292
  - OpenTelemetry export: with `otel` in either config, every receipt is also one span at the collector the team already runs, trace id equal to the receipt id, attributes for tool, agent, principal, status, decision, and log position; after the receipt, best effort, never on the evidence path.
293
+ - Splunk export: with `splunk` in either config, every receipt is also one event at the HTTP Event Collector, with the receipt id, tool, agent, principal, status, decision, and log position as searchable fields and the token from the environment; the same best-effort rule.
291
294
  - The REST connector: a plain HTTP API described as tools in the gateway config, credentials from the environment, so an agent's direct API calls become receipted, policy-checked tool calls through the gateway.
292
295
  - Pre-commit authorization for consequential tools: named in `precommit`, a call is signed and logged before it is forwarded, withheld if the log will not take it, and its receipt carries the committed authorization with proof that it precedes the execution.
293
296
 
package/dist/config.d.ts CHANGED
@@ -181,6 +181,14 @@ export declare const GatewayConfigSchema: z.ZodObject<{
181
181
  headersEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
182
182
  serviceName: z.ZodOptional<z.ZodString>;
183
183
  }, z.core.$strip>>;
184
+ splunk: z.ZodOptional<z.ZodObject<{
185
+ url: z.ZodString;
186
+ tokenEnv: z.ZodString;
187
+ index: z.ZodOptional<z.ZodString>;
188
+ source: z.ZodOptional<z.ZodString>;
189
+ sourcetype: z.ZodOptional<z.ZodString>;
190
+ host: z.ZodOptional<z.ZodString>;
191
+ }, z.core.$strip>>;
184
192
  }, z.core.$strip>;
185
193
  export type GatewayConfig = z.infer<typeof GatewayConfigSchema>;
186
194
  export type FactConfig = z.infer<typeof FactSchema>;
@@ -205,6 +213,14 @@ export declare const SdkConfigSchema: z.ZodObject<{
205
213
  headersEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
206
214
  serviceName: z.ZodOptional<z.ZodString>;
207
215
  }, z.core.$strip>>;
216
+ splunk: z.ZodOptional<z.ZodObject<{
217
+ url: z.ZodString;
218
+ tokenEnv: z.ZodString;
219
+ index: z.ZodOptional<z.ZodString>;
220
+ source: z.ZodOptional<z.ZodString>;
221
+ sourcetype: z.ZodOptional<z.ZodString>;
222
+ host: z.ZodOptional<z.ZodString>;
223
+ }, z.core.$strip>>;
208
224
  framework: z.ZodOptional<z.ZodString>;
209
225
  }, z.core.$strip>;
210
226
  export type SdkConfig = z.infer<typeof SdkConfigSchema>;
package/dist/config.js CHANGED
@@ -6,6 +6,7 @@ const LogSchema = z.object({ url: z.string().url(), tokenEnv: z.string().min(1).
6
6
  const oneLog = { message: "exactly one of logFile or log is required" };
7
7
  /** Optional OpenTelemetry export: every receipt also becomes a span at this OTLP/HTTP collector, after it is issued. Never on the evidence path. */
8
8
  const OtelSchema = z.object({ url: z.string().url(), headersEnv: z.record(z.string(), z.string().min(1)).optional(), serviceName: z.string().min(1).optional() });
9
+ const SplunkSchema = z.object({ url: z.string().url(), tokenEnv: z.string().min(1), index: z.string().min(1).optional(), source: z.string().min(1).optional(), sourcetype: z.string().min(1).optional(), host: z.string().min(1).optional() });
9
10
  const hasOneLog = (c) => (c.logFile ? 1 : 0) + (c.log ? 1 : 0) === 1;
10
11
  /** One REST endpoint offered to the agent as a tool. `{name}` segments in the path come from the call's arguments; the rest go to the query on GET and DELETE, or to a JSON body otherwise. */
11
12
  const RestToolSchema = z.object({
@@ -65,6 +66,7 @@ export const GatewayConfigSchema = z.object({
65
66
  logFile: z.string().optional(),
66
67
  log: LogSchema.optional(),
67
68
  otel: OtelSchema.optional(),
69
+ splunk: SplunkSchema.optional(),
68
70
  }).refine(hasOneLog, oneLog).refine((c) => (c.upstream ? 1 : 0) + (c.upstreams ? 1 : 0) === 1, { message: "exactly one of upstream or upstreams is required" });
69
71
  /** Loads a config file and resolves every path relative to the file's directory. */
70
72
  export function loadConfig(path) {
@@ -92,6 +94,7 @@ export const SdkConfigSchema = z.object({
92
94
  logFile: z.string().optional(),
93
95
  log: LogSchema.optional(),
94
96
  otel: OtelSchema.optional(),
97
+ splunk: SplunkSchema.optional(),
95
98
  /** free-text label of the host framework, e.g. "claude-code", "openai-agents" */
96
99
  framework: z.string().optional(),
97
100
  }).refine(hasOneLog, oneLog);
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export type { AuthorizationBundle, AuthorizationPredicate, AuthorizationStatemen
3
3
  export type { GatewayOptions } from "./gateway.ts";
4
4
  export { buildRequest, restUpstream } from "./rest.ts";
5
5
  export { openExporter, otlpExporter, spanFor } from "./otel.ts";
6
+ export { hecEvent, splunkExporter } from "./splunk.ts";
6
7
  export { fileBackend, importLogFile, PostgresLog, PostgresTenancy, RateLimiter } from "./log-store.ts";
7
8
  export { connectSigner, fetchLogKeys, localSigner, serveSigner, signerHandler } from "./signer.ts";
8
9
  export type { KeyDocument, RemoteSignerOptions, RetiredKey, RunningSigner, Signer, SignerServerOptions } from "./signer.ts";
@@ -17,6 +18,7 @@ export type { AdminOptions } from "./log-admin.ts";
17
18
  export type { Checkpoint, CheckpointStore } from "./checkpoints.ts";
18
19
  export type { AppendResult, LogBackend, PostgresLike, PostgresLogOptions, RateLimitOptions, Tenant, TokenRecord } from "./log-store.ts";
19
20
  export type { OtelConfig, OtlpOptions, ReceiptExporter } from "./otel.ts";
21
+ export type { SplunkConfig, SplunkOptions } from "./splunk.ts";
20
22
  export type { IssuerOptions } from "./issue.ts";
21
23
  export type { RestOptions, UpstreamClient } from "./rest.ts";
22
24
  export * from "./config.ts";
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  export { AUTHORIZATION_PREDICATE_TYPE, buildAuthorizationStatement } from "./receipt.js";
3
3
  export { buildRequest, restUpstream } from "./rest.js";
4
4
  export { openExporter, otlpExporter, spanFor } from "./otel.js";
5
+ export { hecEvent, splunkExporter } from "./splunk.js";
5
6
  export { fileBackend, importLogFile, PostgresLog, PostgresTenancy, RateLimiter } from "./log-store.js";
6
7
  export { connectSigner, fetchLogKeys, localSigner, serveSigner, signerHandler } from "./signer.js";
7
8
  export { bothCheckpoints, dirCheckpoints, postgresCheckpoints } from "./checkpoints.js";
package/dist/otel.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ReceiptBundle, ReceiptPredicate } from "./receipt.ts";
2
+ import { type SplunkConfig } from "./splunk.ts";
2
3
  export interface OtelConfig {
3
4
  /** the collector's OTLP/HTTP base, e.g. http://localhost:4318; spans go to <url>/v1/traces */
4
5
  url: string;
@@ -22,7 +23,8 @@ export interface OtlpOptions {
22
23
  }
23
24
  /** An exporter that posts each receipt's span to an OTLP/HTTP collector. Failures are reported, never thrown. */
24
25
  export declare function otlpExporter(cfg: OtelConfig, opts?: OtlpOptions): ReceiptExporter;
25
- /** The exporter a config asks for, or undefined. */
26
+ /** The exporters a config asks for, as one; undefined when it asks for none. Each is told independently, so one failing never silences another. */
26
27
  export declare function openExporter(cfg: {
27
28
  otel?: OtelConfig | undefined;
29
+ splunk?: SplunkConfig | undefined;
28
30
  }): ReceiptExporter | undefined;
package/dist/otel.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { splunkExporter } from "./splunk.js";
1
2
  const str = (key, v) => (v === null || v === undefined ? [] : [{ key, value: { stringValue: v } }]);
2
3
  const int = (key, v) => [{ key, value: { intValue: String(v) } }];
3
4
  /** The span for one receipt, as the OTLP JSON a collector accepts on /v1/traces. Exported so a test or another transport can reuse it. */
@@ -81,7 +82,21 @@ export function otlpExporter(cfg, opts = {}) {
81
82
  },
82
83
  };
83
84
  }
84
- /** The exporter a config asks for, or undefined. */
85
+ /** The exporters a config asks for, as one; undefined when it asks for none. Each is told independently, so one failing never silences another. */
85
86
  export function openExporter(cfg) {
86
- return cfg.otel ? otlpExporter(cfg.otel) : undefined;
87
+ const all = [];
88
+ if (cfg.otel)
89
+ all.push(otlpExporter(cfg.otel));
90
+ if (cfg.splunk)
91
+ all.push(splunkExporter(cfg.splunk));
92
+ if (all.length === 0)
93
+ return undefined;
94
+ if (all.length === 1)
95
+ return all[0];
96
+ return {
97
+ where: all.map((e) => e.where).join(", "),
98
+ async exported(p, bundle) {
99
+ await Promise.all(all.map((e) => e.exported(p, bundle)));
100
+ },
101
+ };
87
102
  }
@@ -0,0 +1,26 @@
1
+ import type { ReceiptBundle, ReceiptPredicate } from "./receipt.ts";
2
+ import type { ReceiptExporter } from "./otel.ts";
3
+ export interface SplunkConfig {
4
+ /** the collector's base, e.g. https://splunk.example.com:8088; events go to <url>/services/collector/event */
5
+ url: string;
6
+ /** environment variable holding the HEC token; a missing variable fails at startup */
7
+ tokenEnv: string;
8
+ /** index to write to; omitted, the token's default index */
9
+ index?: string | undefined;
10
+ /** the event's source field; default agent-custody */
11
+ source?: string | undefined;
12
+ /** the event's sourcetype; default agent-custody:receipt */
13
+ sourcetype?: string | undefined;
14
+ /** the event's host field; omitted, the collector fills it in */
15
+ host?: string | undefined;
16
+ }
17
+ /** The HEC event for one receipt: flat fields Splunk can search without a props stanza. Exported for tests and other transports. */
18
+ export declare function hecEvent(p: ReceiptPredicate, bundle: ReceiptBundle, cfg: SplunkConfig): Record<string, unknown>;
19
+ export interface SplunkOptions {
20
+ fetch?: typeof fetch;
21
+ env?: Record<string, string | undefined>;
22
+ /** where export failures are reported; default stderr */
23
+ warn?: (message: string) => void;
24
+ }
25
+ /** An exporter that posts each receipt as one event to a Splunk HTTP Event Collector. Failures are reported, never thrown. */
26
+ export declare function splunkExporter(cfg: SplunkConfig, opts?: SplunkOptions): ReceiptExporter;
package/dist/splunk.js ADDED
@@ -0,0 +1,59 @@
1
+ /** The HEC event for one receipt: flat fields Splunk can search without a props stanza. Exported for tests and other transports. */
2
+ export function hecEvent(p, bundle, cfg) {
3
+ const auth = p.authorization;
4
+ const exec = p.execution;
5
+ return {
6
+ time: Date.parse(p.timestamp) / 1000,
7
+ source: cfg.source ?? "agent-custody",
8
+ sourcetype: cfg.sourcetype ?? "agent-custody:receipt",
9
+ ...(cfg.index ? { index: cfg.index } : {}),
10
+ ...(cfg.host ? { host: cfg.host } : {}),
11
+ event: {
12
+ receipt_id: p.receiptId,
13
+ issuer_kind: p.issuer.kind,
14
+ issuer_keyid: p.issuer.keyid,
15
+ tool: p.tool.name,
16
+ upstream: p.tool.upstream ?? null,
17
+ agent: p.agent.id,
18
+ agent_provenance: p.agent.provenance,
19
+ principal: p.principal.id,
20
+ status: exec.status,
21
+ reason: exec.reason ?? exec.error ?? null,
22
+ policy_decision: p.policy?.decision ?? null,
23
+ policy_digest: p.policy?.policyDigest ?? null,
24
+ policy_reasons: p.policy?.reasons ?? [],
25
+ args_digest: p.request.argsDigest,
26
+ log_leaf_index: bundle.inclusion.leafIndex,
27
+ log_tree_size: bundle.inclusion.treeSize,
28
+ authorization_leaf_index: auth ? auth.inclusion.leafIndex : null,
29
+ consumed_count: p.consumed?.factIds.length ?? 0,
30
+ model: p.model.id,
31
+ session: p.session.id,
32
+ },
33
+ };
34
+ }
35
+ /** An exporter that posts each receipt as one event to a Splunk HTTP Event Collector. Failures are reported, never thrown. */
36
+ export function splunkExporter(cfg, opts = {}) {
37
+ const f = opts.fetch ?? fetch;
38
+ const env = opts.env ?? process.env;
39
+ const warn = opts.warn ?? ((m) => console.error(m));
40
+ const token = env[cfg.tokenEnv];
41
+ if (!token)
42
+ throw new Error(`splunk: environment variable ${cfg.tokenEnv} is not set`);
43
+ const headers = { "content-type": "application/json", authorization: `Splunk ${token}` };
44
+ const base = cfg.url.endsWith("/") ? cfg.url : `${cfg.url}/`;
45
+ const url = new URL("services/collector/event", base);
46
+ return {
47
+ where: cfg.url,
48
+ async exported(p, bundle) {
49
+ try {
50
+ const res = await f(url, { method: "POST", headers, body: JSON.stringify(hecEvent(p, bundle, cfg)), signal: AbortSignal.timeout(5000) });
51
+ if (!res.ok)
52
+ warn(`agent-custody: splunk export of receipt ${p.receiptId} refused by ${cfg.url}: ${res.status}`);
53
+ }
54
+ catch (e) {
55
+ warn(`agent-custody: splunk export of receipt ${p.receiptId} failed: ${e instanceof Error ? e.message : String(e)}`);
56
+ }
57
+ },
58
+ };
59
+ }
@@ -0,0 +1,64 @@
1
+ # What the evidence satisfies
2
+
3
+ Auditors ask for controls by their names. This page maps the requirements they cite most to the artefacts agent-custody produces, so a security questionnaire can be answered with a file rather than a paragraph. It is a map, not a certificate: the artefacts are evidence that a control operated, and the control itself, the policy, the grant, the retention window, the person who reviews an alarm, is yours.
4
+
5
+ Two rules keep the answers honest. First, say which producer made the receipt: a gateway receipt was enforced outside the agent's process, an SDK receipt is the agent's own report, and the receipt's `issuer.kind` says which. Second, say where the log runs: with the default local log the operator can rewrite history, with a log run by someone else they cannot, and with a witness neither operator can. The [proof table](../README.md#what-a-receipt-proves-and-what-it-does-not) has the full list of claims and against whom each holds.
6
+
7
+ ## The artefacts
8
+
9
+ | artefact | what it is | how to produce it |
10
+ | --- | --- | --- |
11
+ | receipt | one signed record per tool call: who authorized it, what the agent saw, what it did, the policy decision, its position in the log | issued by the gateway or the SDK; `receipts/<id>.json` |
12
+ | authorization | the same, committed to the log before a consequential call was forwarded | `precommit` in the gateway config |
13
+ | verification report | the check list a third party gets from the receipt and public keys alone | `agent-custody verify` |
14
+ | audit | proof that the log at a later size extends its earlier state | `agent-custody audit` between any two tree heads or checkpoints |
15
+ | checkpoint | a signed tree head published on a schedule, countersigned by a witness where one runs | the log's checkpoints host, the witness's host |
16
+ | action pack | one receipt explained and packed with every downstream receipt, signed | `agent-custody-memory explain --out --sign` |
17
+ | custody pack | one fact's history, receipts, blast radius, holds, and forget certificate, signed | `agent-custody-memory pack` |
18
+ | forget certificate | the receipt of the call that erased a value from the ledger and the stores, with each store's answer | `memory.forget` through the gateway |
19
+ | eval report | scores for stale reads, contradictions, and blast radius after retraction, signed | `agent-custody-memory eval --sign` |
20
+ | usage | appends per tenant per month on the hosted log | `/admin/usage.csv` |
21
+
22
+ ## SOC 2, Trust Services Criteria
23
+
24
+ | criterion | what it asks | what answers it |
25
+ | --- | --- | --- |
26
+ | CC6.1, logical access | access to systems is restricted to authorized users | the delegation grant: a human-signed statement of which agent may call which tools, for how long, embedded in every gateway receipt and re-checked by the verifier |
27
+ | CC6.3, authorization changes | access is granted, modified, and removed by authorized parties | grants have validity windows and are signed by a principal key the gateway is configured to trust; a new grant is a new signed file, a revoked one expires |
28
+ | CC7.2, monitoring for anomalies | the entity monitors system components for anomalies | every call has a receipt, allowed or denied, and `explain` answers who, why, and what depended on it; the OpenTelemetry and Splunk exports carry each receipt into the existing SIEM |
29
+ | CC7.3, evaluation of security events | events are evaluated to determine whether they are incidents | the action pack: one receipt with every downstream receipt, verifiable by the evaluator without access to the system |
30
+ | CC7.4, incident response | incidents are contained and remediated | blast radius names every action and belief that depended on a wrong fact; retract and forget are receipted calls, so the remediation has its own evidence |
31
+ | CC8.1, change management | changes are authorized and tracked | the policy digest in every receipt identifies the exact policy that decided the call, so a policy change is visible in the receipts on either side of it |
32
+
33
+ ## ISO/IEC 27001:2022, Annex A
34
+
35
+ | control | what it asks | what answers it |
36
+ | --- | --- | --- |
37
+ | A.5.15, access control | rules for access based on business requirements | the grant and the Cedar policy, with the policy decision on facts the gateway fetched itself |
38
+ | A.5.28, collection of evidence | evidence is collected in a form that stands up | receipts are signed, hashed into a Merkle log, and verifiable offline; the audit proves nothing was rewritten between two points; the packs are single signed artefacts for a case file |
39
+ | A.8.10, information deletion | information is deleted when no longer required | forget erases a value from the ledger and the adapted stores and the receipt is the certificate, with each store's own answer; retention sweeps run as receipted calls; a legal hold refuses both |
40
+ | A.8.15, logging | logs are produced, stored, protected, and analysed | the transparency log, append-only and hashed, with a log run by someone else where the operator must not be trusted |
41
+ | A.8.16, monitoring activities | networks, systems, and applications are monitored | `log-check` from a machine that is not the log's, and the per-receipt spans in the SIEM |
42
+ | A.8.32, change management | changes are subject to change management | the policy digest, the grant's window, and the receipts either side of a change |
43
+
44
+ ## EU AI Act, obligations on high-risk systems and their deployers
45
+
46
+ | article | what it asks | what answers it |
47
+ | --- | --- | --- |
48
+ | Article 12, record-keeping | automatic recording of events over the system's lifetime, enabling traceability | one receipt per tool call, in a tamper-evident log, with the facts the agent was shown and the beliefs it wrote; `explain` traces any action to its causes and consequences |
49
+ | Article 14, human oversight | humans can understand, oversee, and intervene | the grant is a human's signature over what the agent may do; the policy decides on facts the agent did not supply; retract and forget are the intervention, receipted |
50
+ | Article 19, retention of logs | logs are kept for a period appropriate to the purpose | retention windows per space in the memory server; `prune` on the receipt log keeps every proof valid while the content is gone; a legal hold overrides both |
51
+ | Article 26, deployer obligations | deployers keep logs and monitor operation | the same receipts and the same monitor; a tenant on the hosted log has its own log id and checkpoints an auditor can fetch |
52
+
53
+ ## UK GDPR
54
+
55
+ | provision | what it asks | what answers it |
56
+ | --- | --- | --- |
57
+ | Article 5(2), accountability | the controller demonstrates compliance | signed receipts and packs demonstrate what was done and why, to a party who has no access to the controller's systems |
58
+ | Article 17, right to erasure | personal data is erased on request | the forget certificate, including `stillIndexed` when a store has not caught up, which is what an honest response to a data subject says |
59
+ | Article 30, records of processing | records of processing activities are kept | the receipts, and the memory ledger's history of every fact with its source receipt |
60
+ | Article 32, security of processing | appropriate technical measures | the hosted log holds hashes only, and receipts stay with the controller |
61
+
62
+ ## What no artefact here claims
63
+
64
+ That the agent's arguments were correct, that the model named in a receipt produced the call, that the upstream executed the action unless it signed the result or a provider delivery is embedded, or that an SDK receipt was enforced outside the agent. The [proof table](../README.md#what-a-receipt-proves-and-what-it-does-not) says so, and a questionnaire answer that repeats it will survive the reviewer who checks.
package/docs/sdk.md CHANGED
@@ -30,7 +30,7 @@ Use the SDK for reach. Use the gateway for anything that moves money, touches pr
30
30
 
31
31
  `policyFile` and `principalId` are optional. Without a policy the SDK records and never denies. Paths resolve relative to the config file. Instead of `logFile`, `"log": { "url": "https://log.example.com/", "tokenEnv": "AGENT_CUSTODY_LOG_TOKEN" }` sends every leaf to a log run by someone else, whose key then signs the tree heads; see [usage.md](usage.md) for what that changes and [verification.md](verification.md) for what it proves. Generate the key with `node src/cli.ts keygen --dir keys --name app`.
32
32
 
33
- `"otel": { "url": "http://localhost:4318" }` additionally exports every receipt as one span to that OTLP/HTTP collector, after the receipt is written, with the receipt id as the trace id; see the [usage guide](usage.md#setup-step-by-step) for the fields. Export never blocks or fails a receipt.
33
+ `"otel": { "url": "http://localhost:4318" }` additionally exports every receipt as one span to that OTLP/HTTP collector, after the receipt is written, with the receipt id as the trace id; see the [usage guide](usage.md#setup-step-by-step) for the fields. Export never blocks or fails a receipt. `"splunk": { "url": ..., "tokenEnv": "HEC_TOKEN" }` does the same to a Splunk HTTP Event Collector, one event per receipt with the receipt id and log position as fields; both blocks may be set together.
34
34
 
35
35
  Policies see `context.args` and an empty `context.facts`. A policy that reads `context.facts` or `context.grant` errors, which is a deny. That is intended: an SDK policy cannot pretend it checked something outside the agent's process.
36
36
 
package/docs/tutorials.md CHANGED
@@ -28,6 +28,7 @@ Suggested reading order is the numbering. Output lands in `examples-out/`, which
28
28
  | 16 | consequential tools, committed first | [16-precommit.ts](../examples/16-precommit.ts) | a refund named in `precommit`: the authorization leaf before the receipt leaf, the five authorization checks in the report, and the same call withheld when the log refuses | `src/gateway.ts`, `src/issue.ts`, `src/verify.ts` |
29
29
  | 17 | a REST API as an upstream | [17-rest-upstream.ts](../examples/17-rest-upstream.ts) | a stand-in payments API described as two tools, the token from the environment, a refund allowed on the gateway's own lookup and one denied before reaching the API, the receipt verified | `src/rest.ts`, `src/gateway.ts` |
30
30
  | 18 | OpenTelemetry export | [18-opentelemetry.ts](../examples/18-opentelemetry.ts) | a stand-in OTLP collector, `otel` in the config, one span per receipt with the receipt id as trace id, the collector going away and the next receipt still issued | `src/otel.ts`, `src/issue.ts` |
31
+ | 19 | Splunk export | [19-splunk.ts](../examples/19-splunk.ts) | a stand-in HTTP Event Collector, `splunk` in the config with the token from the environment, one event per receipt with the receipt id and log position as fields, the collector going away and the next receipt still issued | `src/splunk.ts`, `src/otel.ts` |
31
32
 
32
33
  ## How policies are defined, in one paragraph
33
34
 
package/docs/usage.md CHANGED
@@ -109,6 +109,8 @@ Exactly one of the two. The bearer token comes from the named environment variab
109
109
 
110
110
  `otel`, optional in both the gateway and SDK configs, sends every receipt to the collector you already run as one span over OTLP/HTTP, after the receipt is issued: `"otel": { "url": "http://localhost:4318", "headersEnv": { "x-api-key": "OTEL_KEY" }, "serviceName": "support-agents" }`. The span's trace id is the receipt id, its attributes carry the tool, agent, principal, execution status, policy decision, and log position, and its status is an error only when the upstream failed or errored, since a denial is the policy working. Export is best effort: a collector that is down or refuses costs a line on stderr, never a receipt. Tutorial 18 shows it against a stand-in collector.
111
111
 
112
+ `splunk`, optional in both configs and usable beside `otel`, sends every receipt to a Splunk HTTP Event Collector as one event: `"splunk": { "url": "https://splunk.example.com:8088", "tokenEnv": "HEC_TOKEN", "index": "agents" }`, with optional `source` (default `agent-custody`), `sourcetype` (default `agent-custody:receipt`), and `host`. The token is read from the named environment variable at startup and never appears in the config. Each event carries `receipt_id`, `tool`, `agent`, `principal`, `status`, `reason`, `policy_decision`, `policy_digest`, `args_digest`, `log_leaf_index`, `log_tree_size`, and `authorization_leaf_index` as plain fields, so a search like `sourcetype="agent-custody:receipt" status=denied` needs no field extraction and every alert leads to the receipt by id. The same rule holds: the event is a copy, the receipt is the evidence, and a collector outage costs a warning. Tutorial 19 shows it.
113
+
112
114
  `facts` tells the gateway which upstream tool to call before evaluating policy for a given tool. `$args.<key>` copies a value from the intercepted call. The result appears in Cedar as `context.facts.<name>` and in the receipt with its own digest, labelled `observed`. If a fact lookup fails, the call is denied and the receipt says why. A lookup with `"optional": true` is skipped when a `$args.<key>` it needs is absent from the call, and the fact is then simply not present, which a policy tests with `context.facts has <name>`; this is how a policy sees the fact a `memory.write` is about to supersede without denying every write that supersedes nothing.
113
115
 
114
116
  `precommit` names the consequential tools, or `["*"]` for all of them. For every other tool the gateway forwards the call and then records it, so if the log is unreachable at that moment the side effect exists before its evidence does. For a tool in `precommit` the gateway first signs an authorization statement, everything the receipt will say except the outcome, and appends it to the log. Only if the log took it does the call go upstream. The receipt then embeds that authorization with its own inclusion proof, and a verifier checks that it names this call and sits in the log before the receipt does. If the log will not take it, the call is not forwarded, the agent is told `Not executed`, and the receipt records `execution.status: "withheld"` with the policy's `allow` beside it. The authorization is also written on its own as `receipts/<receiptId>.authorization.json`, which is the evidence that survives if the gateway dies between forwarding and the receipt. Use it for money, for anything irreversible, and for anything a counterparty could later dispute; the cost is one extra log append per call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-custody/receipts",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Chain of custody for AI agents: signed, independently verifiable receipts for tool calls. MCP gateway + Cedar policy + Merkle transparency log",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {