Module tool_receipts
Expand description
HMAC-SHA256 tool execution receipts for hallucination detection.
Structs§
- Receipt
Generator - Generates and verifies HMAC-SHA256 receipts for tool executions. Each session gets an ephemeral key — never exposed to the LLM.
- Receipt
Scope - Per-turn receipt forwarding scope, used to thread the generator and
the per-turn collector through delegate sub-loops without changing the
Tooltrait signature. Mirrors the pattern used byTOOL_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.DelegateToolreads 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, orNonewhen 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_CONTEXTaroundfutfor the lifetime of one turn so delegate sub-loops forward receipts into the same per-turn collector. One seam shared by every entrypoint; aNonescope is inert.