agent-receipts

v0.6.0
io.github.webaesbyamin/agent-receipts Checked 1 day ago Published 1 month ago

Ed25519-signed receipts for every AI agent action.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

create_receipt

Create an Ed25519-signed receipt with pre-computed SHA-256 hashes. Use when you have already hashed the input/output data externally or need full control over receipt fields. For automatic hashing, use track_action instead. Returns the signed receipt object with receipt_id. The receipt is stored locally in SQLite and can be completed later with complete_receipt.

ParameterTypeDescription
action *stringAction name being recorded (e.g., "generate_code", "analyze_data")
input_hash *stringPre-computed SHA-256 hash of the input data in format "sha256:hexstring"
chain_idstringChain ID (auto-generated if not provided)
confidenceConfidence score 0-1
constraintsarrayArray of constraint definitions to evaluate (types: max_latency_ms, max_cost_usd, min_confidence, required_fields, status_must_be, output_schema)
cost_usdCost in USD
expires_atstringISO datetime when this receipt expires
latency_msLatency in milliseconds
metadataobjectArbitrary metadata
modelstring | nullAI model used
output_hashstring | nullPre-computed SHA-256 hash of the output data in format "sha256:hexstring"
output_summarystring | nullHuman-readable summary of the output
parent_receipt_idstring | nullParent receipt ID for chains
receipt_typestringReceipt type: "action" (default), "verification", "judgment", or "arbitration"
statusstringInitial status: "pending" (default, complete later) or "completed"
tagsTags for categorization
tokens_inInput tokens
tokens_outOutput tokens
tool_callsTools called during the action
ttl_msnumberTime-to-live in milliseconds from now

complete_receipt

Finalize a pending receipt by recording execution results, costs, and output data. Updates the receipt status to completed, failed, or timeout and re-signs with Ed25519. Use after create_receipt when you need to record results separately from creation (two-phase tracking). Cannot complete an already-completed receipt. Returns the updated signed receipt.

ParameterTypeDescription
receipt_id *stringThe receipt ID to complete — must be a pending receipt (status: "pending")
status *stringFinal status: "completed" (success), "failed" (error occurred), or "timeout" (timed out)
callback_verifiedboolean | nullWhether an external callback verified the result
confidenceConfidence score for output quality, 0.0 to 1.0
cost_usdTotal cost in USD
errorError details if status is "failed" (e.g., {"code": "TIMEOUT", "message": "..."})
latency_msTotal execution time in milliseconds
modelstring | nullAI model used during execution
output_hashstring | nullPre-computed SHA-256 hash of the output in format "sha256:hexstring"
output_summarystring | nullHuman-readable summary of the execution result
tokens_inInput tokens consumed
tokens_outOutput tokens generated
tool_callsNames of tools called during execution

track_action

Create a completed Ed25519-signed receipt for an AI agent action with automatic SHA-256 hashing of input and output data. Records model usage, costs, latency, and constraint evaluations. Returns the signed receipt with receipt_id for future reference. Use this as the primary tool for recording agent actions — prefer over create_receipt + complete_receipt for single-step actions.

ParameterTypeDescription
action *stringAction name being recorded (e.g., "generate_code", "summarize_text", "classify_intent")
chain_idstringChain identifier for grouping related receipts — auto-generated if not provided
confidencenumberConfidence score for the output quality, 0.0 to 1.0
constraintsarrayConstraint definitions to evaluate against this receipt (e.g., max_latency_ms, max_cost_usd, min_confidence)
cost_usdnumberExecution cost in USD (e.g., 0.0045)
expires_atstringISO 8601 datetime when this receipt expires (e.g., "2026-12-31T23:59:59Z")
inputInput data passed to the agent — automatically hashed with SHA-256, raw data is never stored
latency_msintegerTotal execution time in milliseconds
metadataobjectArbitrary key-value metadata attached to the receipt
modelstringAI model used (e.g., "claude-sonnet-4-20250514", "gpt-4o", "gemini-2.0-flash")
outputOutput produced by the agent — automatically hashed with SHA-256, raw data is never stored
output_summarystringHuman-readable summary of the output for audit purposes (max 500 chars recommended)
parent_receipt_idstringParent receipt ID for chaining — links this receipt to a previous step
tagsarrayArbitrary tags for filtering and categorization (e.g., ["production", "critical"])
tokens_inintegerInput tokens consumed by the model
tokens_outintegerOutput tokens generated by the model
tool_callsarrayNames of tools called during this action (e.g., ["web_search", "code_exec"])
ttl_msnumberTime-to-live in milliseconds from now — alternative to expires_at

verify_receipt

Cryptographically verify the Ed25519 signature on a stored receipt to confirm it has not been changed since signing. Receipt format v2 signs every field (summary, cost, model, metadata, files and the chain link); legacy v1 receipts sign 12 core fields only. Returns verified, sig_version and covers_all_fields. To check a whole chain for edited, removed or forked receipts, use the CLI: agent-receipts verify-chain <chain_id>. Use to audit receipts before using them as evidence or before completing payments based on agent work.

ParameterTypeDescription
receipt_id *stringThe receipt ID to verify — must exist in local storage

get_receipt

Retrieve a single receipt by its ID from local SQLite storage. Returns the full receipt object including all 27 fields: identity, timestamps, action data, performance metrics, constraints, cryptographic proof, and metadata. Returns an error message if the receipt ID does not exist. Use to inspect a specific receipt or retrieve it before verification.

ParameterTypeDescription
receipt_id *stringThe receipt ID to retrieve (format: "rcpt_" followed by 12 alphanumeric characters)

list_receipts

Query and paginate receipts from local SQLite storage with optional filtering by agent, action, status, environment, type, chain, or tag. Supports sorting by timestamp, cost, or latency. Returns paginated results with total count, page info, and has_next/has_prev flags. Default: 50 receipts per page, sorted by timestamp descending. Use to audit agent activity, generate reports, or find specific receipts.

ParameterTypeDescription
actionstringFilter by action name (exact match)
agent_idstringFilter by agent ID (exact match)
chain_idstringFilter to receipts in a specific chain
environmentstringFilter by environment: "development", "production", "staging", or "test"
limitintegerResults per page, 1 to 100 (default: 50)
pageintegerPage number, starting at 1 (default: 1)
receipt_typestringFilter by type: "action", "verification", "judgment", or "arbitration"
sortstringSort field and direction in format "field:asc" or "field:desc" (e.g., "timestamp:desc", "cost_usd:asc")
statusstringFilter by status: "pending", "completed", "failed", or "timeout"
tagstringFilter to receipts containing this tag

get_chain

Retrieve all receipts belonging to a chain, ordered by timestamp ascending to show the sequence of operations. A chain groups related receipts from a multi-step agent workflow. Returns the complete receipt objects for every step. Use to audit a complete workflow, calculate total chain cost and duration, or identify which step in a pipeline failed.

ParameterTypeDescription
chain_id *stringThe chain ID to retrieve (format: "chain_" followed by 8 alphanumeric characters)

get_public_key

Export the Ed25519 public key used to sign all receipts on this instance. Returns the key as a 64-character hex string. Share this key with clients or third parties so they can independently verify receipt signatures without accessing your private key. The private key never leaves your machine — only the public key is needed for verification.

judge_receipt

Start an AI judgment evaluation for a receipt by creating a pending judgment receipt and returning a structured evaluation prompt. The host model (you) evaluates the receipt's output against the provided rubric criteria and then calls complete_judgment with the results. Use to assess output quality beyond simple pass/fail constraints — supports weighted criteria, partial verdicts, and confidence scores. Judgment receipts are themselves Ed25519-signed for auditability.

ParameterTypeDescription
receipt_id *stringThe receipt ID to evaluate — the original action receipt
rubric *objectEvaluation rubric with criteria array. Each criterion needs: name (string), description (string), weight (0.0-1.0), and optional passing_threshold (0.0-1.0, default 0.7). Also set: passing_threshold (…
output_summary_for_reviewstringThe actual output content to evaluate — provide if output_summary on the receipt is insufficient for evaluation

complete_judgment

Submit evaluation results to finalize a pending judgment receipt created by judge_receipt. Records the verdict, overall score, per-criterion scores and reasoning, and confidence. The judgment receipt is re-signed with Ed25519 and linked to the original receipt via parent_receipt_id. Returns the judgment receipt ID, verdict, score, and chain ID. Use immediately after evaluating the prompt returned by judge_receipt.

ParameterTypeDescription
confidence *numberYour confidence in this evaluation, 0.0 to 1.0
criteria_results *arrayArray of per-criterion results. Each item needs: criterion (name string), score (0.0-1.0), reasoning (explanation string)
judgment_receipt_id *stringThe pending judgment receipt ID returned by judge_receipt
overall_reasoning *stringOverall explanation of the evaluation verdict
score *numberOverall quality score from 0.0 to 1.0
verdict *stringOverall evaluation result: "pass" (meets threshold), "fail" (below threshold), or "partial" (mixed results)

get_judgments

Retrieve all judgment receipts associated with a given receipt ID. Judgment receipts are linked via parent_receipt_id. Returns an array of judgment receipt objects ordered by timestamp, including verdict, score, criteria results, and confidence. Use to review the evaluation history of a receipt, compare multiple judgments, or audit AI quality assessments. Returns empty array if no judgments exist.

ParameterTypeDescription
receipt_id *stringThe original receipt ID to get judgments for (not the judgment receipt ID)

cleanup

Delete receipts that have passed their expiration time based on the expires_at field in metadata. Expired receipts are receipts where metadata.expires_at is set and is earlier than the current time. Supports dry_run mode to preview deletions without committing. Returns count of deleted receipts and remaining total. Use periodically to manage storage and enforce TTL policies set during receipt creation. Set cleanup_memory to also soft-delete expired memory observations.

ParameterTypeDescription
cleanup_memorybooleanAlso clean up expired memory observations (soft-delete). Defaults to false.
dry_runbooleanIf true, returns what would be deleted without actually deleting. Defaults to false.

generate_invoice

Generate a client invoice from cryptographically signed receipts within a date range. Aggregates receipt data by agent, action, or day and calculates total costs, token usage, and receipt counts. Supports JSON, CSV, and Markdown output formats. Each line item references a signed receipt for verifiable billing. Use to bill clients for AI agent work with cryptographic proof of every billed action.

ParameterTypeDescription
from *stringInvoice period start date in ISO 8601 format (e.g., "2026-01-01" or "2026-01-01T00:00:00Z")
to *stringInvoice period end date in ISO 8601 format (e.g., "2026-01-31" or "2026-01-31T23:59:59Z")
actionsarrayFilter to specific action names only
agent_idsarrayFilter to specific agent IDs only
client_emailstringClient email address
client_namestringClient or bill-to name for the invoice header
constraints_passed_onlybooleanIf true, only include receipts where all constraints passed
formatstringOutput format: "json" (structured data), "csv" (spreadsheet), or "md" (markdown table)
group_bystringHow to group line items: "action" (by action name), "agent" (by agent ID), "day" (by date), or "none" (single total)
include_receiptsbooleanIf true, includes full receipt objects in JSON output for full auditability
notesstringAdditional notes to include in the invoice
payment_termsstringPayment terms text (e.g., "Net 30", "Due on receipt")
provider_emailstringYour email address
provider_namestringYour company or provider name

get_started

Display a getting-started guide with usage examples for all Agent Receipts tools. Shows how to record agent actions, verify receipts, use receipt chains, evaluate with constraints, and generate invoices. Call this tool first when setting up Agent Receipts or when you need a reference for available tools and their typical usage patterns.

memory_observe

Store a memory observation about a person, project, preference, or any entity. Automatically creates the entity if it doesn't exist. Every observation is cryptographically signed and linked to a receipt.

ParameterTypeDescription
content *stringThe observation/fact to remember
entity_name *stringName of the entity (person, project, tool, etc.)
entity_type *stringType of entity
confidencestringHow confident you are in this observation (default: medium)
contextstringWhat conversation or task produced this observation
scopestringWho can see this memory (default: agent)
tagsarrayTags for categorization
ttl_secondsnumberTime-to-live in seconds. After this duration, the observation expires and is excluded from recall but retained for audit.

memory_recall

Search and retrieve stored memories. Use text search to find relevant observations across all entities, or filter by entity type, specific entity, or scope. Every recall is logged as a receipt.

ParameterTypeDescription
auditedbooleanCreate a signed receipt for this read operation (default: false)
entity_idstringGet memories for a specific entity
entity_typestringFilter by entity type
include_forgottenbooleanInclude soft-deleted memories (default: false)
limitnumberMax results to return (default: 20, max: 100)
querystringText to search for across all observations
scopestringFilter by memory scope

memory_forget

Forget a specific observation or an entire entity. This is a soft delete — the memory is marked as forgotten but retained for audit purposes. The forget operation itself is recorded as a signed receipt.

ParameterTypeDescription
entity_idstringEntity to forget entirely (all its observations)
observation_idstringSpecific observation to forget
reasonstringWhy this memory is being forgotten

memory_entities

List known entities (people, projects, organizations, etc.) with optional filtering. Returns entities with their observation counts.

ParameterTypeDescription
entity_typestring
include_forgottenbooleanInclude forgotten entities (default: false)
limitnumberMax results (default: 20)
querystringSearch entity names and aliases
scopestring

memory_relate

Create a relationship between two entities (e.g., "Amin" builds "ModQuote"). Relationships are bidirectional for querying but stored with a direction.

ParameterTypeDescription
from_entity_id *stringSource entity ID
relationship_type *stringType of relationship (e.g., "builds", "uses", "works_at", "prefers")
to_entity_id *stringTarget entity ID
contextstringWhat established this relationship
strengthstring

memory_provenance

Get the full provenance chain for a memory observation. Shows when it was created, which conversation produced it, which agent made the observation, and every subsequent modification.

ParameterTypeDescription
observation_id *stringThe observation to trace

memory_audit

Generate an audit report of memory operations. Shows what was remembered, forgotten, merged, and by which agents over a time period.

ParameterTypeDescription
agent_idstringFilter by agent
entity_idstringFilter by entity
fromstringStart date (ISO 8601)
tostringEnd date (ISO 8601)

memory_context

Get a complete context dump of all stored memories — top entities, recent observations, active relationships, and preferences. Call this at the start of a conversation to understand what is already known about the user, their projects, and their preferences. Every context pull is logged as a signed receipt.

ParameterTypeDescription
auditedbooleanCreate a signed receipt for this read operation (default: false)
max_entitiesnumberMaximum entities to return, ordered by activity (default: 10, max: 50)
max_observationsnumberMaximum recent observations to return (default: 20, max: 100)
scopestringFilter memories by scope (default: returns all accessible scopes)

memory_export_bundle

Export memories as a portable, verifiable bundle. Includes entities, observations, relationships, source receipts, and the public key needed to verify them. Share with other agents or import into another Agent Receipts instance.

ParameterTypeDescription
descriptionstringDescription of what this bundle contains
entity_idsarrayExport specific entities (default: all)
include_forgottenbooleanInclude forgotten/deleted memories (default: false)
include_receiptsbooleanInclude source receipts for verification (default: true)

memory_import_bundle

Import a memory bundle from another Agent Receipts instance. Verifies checksums before importing. Skips memories that already exist locally. The import operation itself is recorded as a signed receipt.

ParameterTypeDescription
bundle *objectThe memory bundle JSON object to import
skip_existingbooleanSkip entities/observations that already exist (default: true)