Skip to main content

Module tool_receipts

Module tool_receipts 

Expand description

HMAC-SHA256 tool execution receipts for hallucination detection.

Structs§

ReceiptGenerator
Generates and verifies HMAC-SHA256 receipts for tool executions. Each session gets an ephemeral key — never exposed to the LLM.
ReceiptScope
Per-turn receipt forwarding scope, used to thread the generator and the per-turn collector through delegate sub-loops without changing the Tool trait signature. Mirrors the pattern used by TOOL_LOOP_COST_TRACKING_CONTEXT.

Constants§

SYSTEM_PROMPT_ADDENDUM
Canonical system-prompt addendum that instructs the model to carry the [receipt: ...] field verbatim. Shared by every turn entrypoint so the instruction text never drifts between the channel orchestrator and the ACP/WS/CLI agent paths.

Statics§

TOOL_LOOP_RECEIPT_CONTEXT
Set by the orchestrator when [agent.tool_receipts] enabled = true. DelegateTool reads this to forward receipts into sub-agent tool loops so subagent tool calls land in the same per-turn collector.

Functions§

render_receipts_block
Render the trailing Tool receipts: block from a per-turn collector, or None when the collector is empty. Shared seam so the channel orchestrator and the agent turn paths emit byte-identical blocks.
scope_receipts
Scope TOOL_LOOP_RECEIPT_CONTEXT around fut for the lifetime of one turn so delegate sub-loops forward receipts into the same per-turn collector. One seam shared by every entrypoint; a None scope is inert.