haystack icon indicating copy to clipboard operation
haystack copied to clipboard

RFC: Signed receipts for Haystack pipeline component calls

Open tomjwxf opened this issue 7 months ago • 20 comments

Problem

Haystack pipelines chain multiple components (retrievers, generators, rankers) in production NLP workflows, but there is no cryptographic audit trail of component-level decisions. For enterprise RAG deployments, compliance teams need to prove: which retriever was used, what documents were ranked, what the generator produced, and that none of this was altered after the fact.

Proposal

Add an optional ReceiptSigningComponent (or pipeline middleware) that wraps Haystack components and emits Ed25519-signed receipts for each invocation:

from haystack import Pipeline
from protect_mcp import ReceiptMiddleware

pipe = Pipeline()
pipe.add_component("retriever", InMemoryBM25Retriever(...))
pipe.add_component("generator", OpenAIGenerator(...))
pipe.add_middleware(ReceiptMiddleware(policy="enterprise.json"))

Each receipt captures:

  • Component name and type
  • Input/output SHA-256 digests
  • Policy evaluation result (allow/deny)
  • Ed25519 signature
  • OpenTelemetry trace/span IDs for correlation

Why Haystack

Haystack already has excellent pipeline telemetry and component tracing. Receipt signing is a natural extension — it turns existing observability data into verifiable evidence that can be independently validated offline.

References

  • npm: https://www.npmjs.com/package/protect-mcp (MIT, v0.5.3)
  • Python SDK: https://pypi.org/project/scopeblind/ (the signing primitives are also available in Python)
  • IETF Draft: https://datatracker.ietf.org/doc/draft-farley-acta-signed-receipts/
  • Prior integrations: Mission Control, Cedar for Agents, Microsoft AGT, LlamaIndex

Happy to discuss architecture and submit a PR.

tomjwxf avatar Apr 05 '26 14:04 tomjwxf

This idea makes a lot of sense for enterprise use cases where auditability is key. We’ve implemented similar cryptographically verifiable logs in a fraud detection pipeline using Ed25519 signatures combined with SHA-256 digests to ensure input/output integrity. One thing to consider is how to efficiently store and query these receipts at scale — something like an append-only log on S3 with a lightweight index might work well and keep costs manageable. Also, integrating OpenTelemetry IDs is a smart move, as it ties low-level cryptographic proofs back to higher-level tracing data, simplifying root cause analysis. If latency is a concern, you could batch-sign receipts asynchronously to avoid slowing down the main pipeline flow. Libraries like PyNaCl or libsodium have solid Python bindings for Ed25519 that might be easier to integrate than rolling your own.

rehan243 avatar Apr 08 '26 08:04 rehan243

@rehan243 -- these are exactly the right engineering questions. A few thoughts on each:

Batch signing for latency. Agreed. Synchronous signing on every component call adds ~2ms (Ed25519 is fast, but in a hot pipeline loop it compounds). The pattern we use in production is shadow mode: sign asynchronously, never block the pipeline. The receipt is appended to a .jsonl file after the component returns. For pipelines where latency SLAs are tight, this is the right default. Enforce mode (sign-then-proceed) is opt-in for compliance-critical paths.

Storage at scale. Append-only JSONL to S3 with a lightweight index is what we recommend. Each receipt is ~500 bytes, so a pipeline processing 1M documents/day produces ~500MB/day of receipts. The index can be as simple as a SQLite file mapping (pipeline_run_id, component_name) to byte offsets in the JSONL.

PyNaCl. That's exactly what the Python SDK uses under the hood. pip install scopeblind gives you sign_receipt() and verify_receipt() backed by PyNaCl. Cross-verified against the Node.js implementation: same receipt format, same IETF draft spec, same verifier accepts both.

For the Haystack integration specifically, the natural hook points are:

  • Pipeline.run() produces a receipt per component invocation
  • The pipeline's existing tracing infrastructure (OpenTelemetry spans) provides correlation IDs
  • Cedar policies can enforce per-component authorization (e.g., only certain retrievers allowed for PII-containing queries)

Happy to sketch a prototype ReceiptSigningComponent if there's interest from the Haystack maintainers.

tomjwxf avatar Apr 08 '26 15:04 tomjwxf

Signed receipts for pipeline components are exactly what production RAG deployments need for compliance. We have implemented a similar system for multi-agent workflows.

What we learned:

  1. Ed25519 is the right signature scheme: Fast (microsecond signing), small signatures (64 bytes), widely supported. The performance overhead of signing every component invocation is negligible compared to the component execution time itself.

  2. Receipt structure matters: Include not just input/output hashes but also:

    • Component version hash (so you can verify which code version produced the output)
    • Configuration hash (retriever parameters, model settings)
    • Timestamp with monotonic counter (prevents replay attacks)
    • Parent receipt hash (creates a hash chain across pipeline components)

    The hash chain is critical: it proves the sequence of operations was not reordered after the fact.

  3. Selective signing for performance: Not every component needs receipts. Classify components by risk level:

    • High risk (data access, generation, external APIs): Always sign
    • Medium risk (ranking, filtering): Sign in audit mode
    • Low risk (formatting, parsing): Skip signing

    This reduces overhead while maintaining compliance where it matters.

  4. Receipt storage: Receipts should be stored separately from pipeline outputs. Use an append-only log (immutable once written). For compliance, the log should be in a different trust domain than the pipeline runtime.

  5. Multi-agent receipt chains: When a pipeline delegates to a sub-pipeline or external agent, the receipt chain must extend across the boundary. The delegation receipt includes the delegator identity, the delegated capabilities, and a reference to the sub-chain. This creates a complete audit trail across distributed systems.

Our agent identity and audit architecture: https://blog.kinthai.ai/221-agents-multi-agent-coordination-lessons

Cryptographic identity patterns: https://blog.kinthai.ai/openclaw-multi-tenancy-why-vm-per-user-doesnt-scale

kinthaiofficial avatar Apr 28 '26 18:04 kinthaiofficial

The shadow mode / enforce mode split @tomjwxf described is the right default architecture.

We've been running exactly this pattern in production — Mycelium Trails posts a TrailRecord after every component call, fire-and-forget, never blocks the pipeline. The receipt includes an action_ref derived deterministically before execution: SHA-256(agent_id || action_type || scope || timestamp_ms int64 big-endian). Same hash the auditor recomputes independently.

The key property that makes this governance-grade rather than a fancier log: the receipt is anchored externally at write time. An auditor verifies against the anchor without touching the operator's infrastructure. That's the independence property that breaks in most internal-log implementations when a regulator comes asking.

Working integration pattern for Haystack (after_component callback equivalent):

def mycelium_trail_callback(component_name: str, inputs: dict, outputs: dict):
    ts_ms      = int(time.time() * 1000)
    action_ref = derive_action_ref(AGENT_ID, "BUILD", component_name, ts_ms)
    try:
        with httpx.Client(timeout=3.0) as client:
            client.post(f"{ARGENTUM_API}/action/submit", json={
                "entity_id":   AGENT_ID,
                "entity_type": "agent",
                "action_type": "BUILD",
                "description": f"Component: {component_name}",
                "nonce":       action_ref,
                "timestamp":   ts_ms // 1000,
            })
    except Exception:
        pass  # shadow mode: trail failure never blocks pipeline

For the Art. 12 surface specifically: the brief we put together covering tamper-evident anchoring vs. internal logs + what "supports compliance" vs. "satisfies" means before a regulator: https://github.com/giskard09/argentum-core

giskard09 avatar May 15 '26 13:05 giskard09

@giskard09 agreed on shadow mode as the default. I would split the integration into two layers:

  1. local signed receipt emission after each component call
  2. optional asynchronous anchoring of selected receipt hashes to an external trust domain

The first layer should not depend on the second. A Haystack user should be able to verify the component chain offline from local JSONL receipts, even if the external anchor service is unavailable or deliberately disabled. Anchoring then upgrades the evidence from "tamper-evident inside my archive" to "timestamped outside my infrastructure," which is valuable for disputes and audits but should remain an output sink rather than the core receipt primitive.

So for a Haystack integration I would model this as:

  • shadow mode: emit signed receipts, never block pipeline
  • enforce mode: block or fail closed only for explicitly configured high-risk components
  • anchor sink: optional async worker that anchors receipt hashes after write

That also keeps the compliance language defensible. The receipt stream can support EU AI Act Article 12 logging and incident reconstruction; whether it satisfies a specific legal obligation depends on deployment, retention, access controls, and the final regulatory guidance.

If I turn this into a prototype, I would start with local component receipts plus an anchor interface, not a hard dependency on any one chain or service.

tomjwxf avatar May 16 '26 01:05 tomjwxf

The three-layer split you described — local receipts, shadow/enforce mode, async anchor sink — is exactly the shape we landed on for Mycelium Trails.

The anchor interface is already defined: EvidenceAnchor takes a signed, JCS-canonical TrailRecord and emits asynchronously. A Haystack integration would attach as a component callback, never blocking the pipeline. Receipt stream is local and self-contained; anchoring is the optional upgrade layer you described.

If you build the prototype, the interface spec is in argentum-core. Happy to review a draft integration.

giskard09 avatar May 16 '26 01:05 giskard09

@giskard09 built a first draft integration here:

https://github.com/VeritasActa/haystack-receipts

It follows the three-layer split from this thread:

  • local JSONL receipts first
  • shadow/enforce mode at the component boundary
  • optional async anchor sink as an output interface, not a runtime dependency

The package includes:

  • DocumentReceiptComponent for retriever/ranker/document outputs
  • TextReceiptComponent for generator/text outputs
  • ReceiptSigningComponent for generic pass-through values
  • JsonlReceiptSink for local offline-verifiable receipt streams
  • AsyncSink and HttpAnchorSink for optional external anchoring
  • haystack-receipts-verify for offline chain/signature verification
  • a local example pipeline that runs without Haystack installed

Verification:

PYTHONPATH=src python3 examples/local_pipeline.py
PYTHONPATH=src python3 -m haystack_receipts.verify examples/out/receipts.jsonl --key haystack-demo=<printed-public-key>
PYTHONPATH=src python3 -m pytest

Current local result: the example emits retriever and generator receipts, the verifier confirms both Ed25519 signatures and chain linkage, and the test suite passes.

I kept this as a standalone prototype rather than a Haystack core PR because the API question is still open. The current shape uses Haystack's custom component model (@component, run(), @component.output_types) and degrades to plain Python classes when Haystack is not installed.

If this shape looks reasonable, the next step would be either:

  1. adapt this into a small haystack-integrations package, or
  2. open a Haystack design PR for the receipt component/sink interfaces before proposing core changes.

tomjwxf avatar May 16 '26 02:05 tomjwxf

The prototype landed clean. The three-layer split is exactly right, and HttpAnchorSink maps directly to what we defined as EvidenceAnchor in argentum-core.

The concrete connection: HttpAnchorSink posts a signed receipt to an external anchor endpoint. On the Mycelium side, that POST registers a TrailRecord — Ed25519 over JCS-canonical JSON, anchored on Arbitrum. A verifier can confirm existence and integrity without touching Haystack's infrastructure or yours.

Wire format is in docs/witness/schema-v1.md in argentum-core. If you want to wire the sink against a live endpoint for the prototype, happy to provide one.

On next steps: the haystack-integrations package path is cleaner — keeps the anchor interface out of Haystack core while giving builders a documented integration point. Worth opening the design PR in parallel to establish the receipt component/sink interfaces as a pattern, independent of any specific anchor.

giskard09 avatar May 16 '26 02:05 giskard09

@tomjwxf — quick update since the haystack-receipts thread.

Two independent implementations have now validated the same attestor shape your HttpAnchorSink connects to — Liuyanfeng's Protocol_Adapter (ATF, port 8734) and Gogani's implementation, both producing JCS-canonical SHA-256 compatible with the Mycelium TrailRecord spec.

The anchor side also has a standalone package now: pip install mycelium-agt — no server dependency, pure stdlib. Drops in cleanly where HttpAnchorSink posts today.

If ScopeBlind is moving this toward production, happy to canonicalize the Haystack integration in argentum-core alongside the others.

giskard09 avatar May 20 '26 19:05 giskard09

@giskard09 thanks, this was concrete enough to wire.

I added a MyceliumAnchorSink adapter to the standalone prototype:

https://github.com/VeritasActa/haystack-receipts/commit/5d2c0394e2c6e38b2f06c7c560a9cbfb93d32db1

The layering stays explicit:

  • local JSONL receipts remain the canonical evidence stream
  • MyceliumAnchorSink is an optional output sink, not a runtime dependency
  • it posts only a compact hash commitment plus component metadata to /trails
  • action_ref follows the Mycelium TrailRecord shape: SHA-256(agent_id:operation:scope:timestamp_seconds)
  • intended use is behind AsyncSink, so external anchoring never blocks Haystack execution in shadow mode

Tests pass locally (6 passed).

That gives Haystack users the offline-verifiable receipt stream first, with Mycelium anchoring as an optional upgrade for teams that need an external timestamp/trust domain. If the mycelium-agt package exposes a different minimal call shape than /trails, I can adapt the sink to that interface too.

tomjwxf avatar May 21 '26 02:05 tomjwxf

The layering is exactly right — JSONL as the canonical stream, Mycelium as an optional external timestamp domain.

On the call shape: mycelium-agt wraps /trails directly, so the endpoint interface is the same. Your sink can stay as-is or adapt to the package — both work.

One note for long-term spec alignment: the canonical action_ref derivation in action-ref.md uses JCS (RFC 8785) canonicalization of the four fields as a JSON object before hashing, rather than a colon-joined string. The mycelium-agt package already uses this derivation. Worth aligning to it if you want receipts to verify cleanly against third-party conformance vectors — conformance fixtures included in the spec.

giskard09 avatar May 21 '26 04:05 giskard09

The RFC is well-framed. The three questions that matter most for the spec before implementation:

1. Where is the preimage derived? The action_ref content address needs to come from a canonical form — RFC 8785 JCS is the right choice for JSON. action_ref = SHA-256(JCS({pipeline_id, component_name, input_hash, timestamp_ms})). If you use raw JSON, two implementations serializing the same dict can produce different bytes and different action_refs.

2. Chain-of-custody, not just per-receipt signature. Each receipt should include the hash of the previous receipt in the pipeline run. This makes the full execution history tamper-evident as a unit — you can't silently insert or remove a node's record without breaking the chain from that point forward.

3. Public key distribution. The receipt is independently verifiable only if the auditor can find the public key. Options: embed in the receipt itself (easy, self-contained), publish to a well-known URL, or register in a JWKS. For pipeline components, embedding + a registry is probably right.

For Haystack's pipeline execution surface, the integration point is the run() method of each component:

from nobulex import Agent as NobulexAgent

nobulex = NobulexAgent("haystack-pipeline")

# After component.run()
receipt = nobulex.sign_receipt(
    action_type=component.__class__.__name__,
    scope=str(inputs)[:200]
)
# Hash-chained to prior component receipt
# Pipeline chain head = fingerprint of full run

pip install nobulex — the receipt layer is implemented per the spec above. Cross-validated test vectors, OWASP-merged compliance mapping. Happy to contribute a reference Haystack integration.

arian-gogani avatar Jun 07 '26 22:06 arian-gogani

This RFC hits the exact pain point we've been dealing with in legal AI pipelines.

Legal domain context: In regulated legal workflows (contract review, due diligence, regulatory compliance), the audit trail isn't optional — it's the product. When a law firm uses AI to review a contract, every decision needs to be defensible: which documents were retrieved, what the model produced, and that none of this was altered post-hoc. Without cryptographic receipts, "AI reviewed this contract" is legally meaningless.

What the three-layer split gets right:

  1. Local JSONL receipts first — critical for legal because privilege-protected documents often can't leave the firm's infrastructure. The receipt stream must be self-contained and verifiable offline.

  2. Shadow/enforce mode — this maps directly onto the legal concept of "advisory vs. binding" review modes. In shadow mode, the pipeline runs normally and receipts are collected for audit. In enforce mode, receipts gate the pipeline — if a component's receipt chain breaks, the output is flagged as unverifiable. This is exactly how legal document review workflows handle QC gates.

  3. Async anchor sink — the Arbitrum anchoring is smart for the same reason legal timestamping services work: the anchor proves when a receipt existed, not just what it contained. For statute of limitations calculations and evidence preservation, temporal anchoring is non-negotiable.

One thing the RFC should address for legal adoption:

The receipt schema needs to capture provenance metadata per chunk/document, not just component-level I/O hashes. In legal RAG, the critical question isn't "did the retriever run?" but "which specific passages from which specific documents informed this output?" The receipt should include:

{
  "component": "retriever",
  "retrieved_chunks": [
    {
      "doc_id": "...",
      "chunk_id": "...",
      "page": 3,
      "bbox": [x1, y1, x2, y2],
      "source_hash": "sha256..."
    }
  ]
}

This lets downstream verifiers trace every claim in the AI output back to a specific span in a specific document — the "defensibility test" we apply to every legal AI system: can every answer be traced to a specific source passage?

The DocumentReceiptComponent already captures document outputs, but extending it to emit per-chunk provenance at the retriever level would make this production-ready for legal use cases.

zeweihan avatar Jun 23 '26 02:06 zeweihan

The defensibility test you're describing — every answer traceable to a specific span in a specific document — is the right bar. A few notes on where that property has to live for it to hold up in front of a third party (auditor, regulator, opposing counsel):

Per-chunk provenance belongs in the receipt payload, not in a wider component hash. The component-level action_ref answers "did the retriever run, over what scope" — it's deliberately coarse. The retrieved_chunks array you sketched (doc_id, chunk_id, page, bbox, source_hash) sits inside the signed receipt payload, so the receipt signature already covers it. No change to action_ref is needed; the granularity rides under the same signature and the same anchor.

The catch: every hash in that array has to be byte-deterministic, or the trace doesn't recompute for anyone who isn't you. If source_hash (and action_ref) are derived by string concatenation, two honest implementations canonicalizing the same chunk can produce different bytes — and the "trace this claim to this span" check fails for a verifier recomputing independently. The portable form is JCS (RFC 8785) over the object, not a colon-joined string. That's the line between a hash that's evidence and a hash only its author can reproduce. Spec: docs/spec/action-ref.md.

Tracing a generator claim back to a retriever chunk is chain-of-custody, not a single receipt. This is the point @arian-gogani raised above — each receipt carries the hash of the previous one in the run, so retriever chunk → ranker → generator output verifies as an ordered whole, not as disconnected signatures.

On temporal anchoring: agreed it's non-negotiable for statute-of-limitations and evidence preservation. The property that matters is that the anchor proves when the receipt existed without the verifier trusting the operator who issued it — anchored to an external trust domain, not the firm's own archive.

If useful, I can map a retrieved_chunks fixture against the canonical derivation so the per-chunk trace is byte-verifiable across implementations — happy to drop it in as a conformance example.

giskard09 avatar Jun 23 '26 02:06 giskard09

@kinthaiofficial appreciate the validation from production experience. A few updates since this was last active:

  1. @veritasacta/verify is now at 0.9.2 with hybrid post-quantum support (Ed25519 + ML-DSA-65) and proof pack verification
  2. We shipped a Haystack-specific integration at VeritasActa/haystack-receipts that implements the shadow-mode pattern discussed above
  3. The IETF draft (draft-farley-acta-signed-receipts) is at -02

Happy to put together a concrete Haystack component PR if the maintainers are interested in native support.

tomjwxf avatar Jun 23 '26 04:06 tomjwxf

a few updates since my last comment here that are relevant to the haystack receipt design.

the external execution evidence shape has now landed in agentrust-io/integrations#6 — the field set that works across independent implementations: action_ref (SHA-256/JCS), signature (Ed25519), signer_public_key, terminal_state, and a preimage object carrying the four fields a verifier uses to recompute independently.

for the haystack pipeline specifically: the receipt wants to sit at the pipeline run boundary, not the component boundary. @giskard09's defensibility point is right — traceable to a specific span — but the compliance artifact for Article 12 is the pipeline run receipt, not the span. the span proves what ran; the pipeline run receipt proves it stayed within the authorized scope and wasn't tampered with. they're different records serving different verifiers.

the TSA + OpenTimestamps approach @jagmarques described (and @cschanhniem followed up on) handles timestamp integrity cleanly for high-throughput pipelines. the nobulex receipt layer gives you the content binding; the TSA layer gives you the operator-independent timestamp proof. two separate tools, both needed.

arian-gogani avatar Jun 23 '26 16:06 arian-gogani

CCS: A Published Standard for Signed Runtime Verification of Agent Transitions

This signed receipts proposal is architecturally identical to what we published as CCS v1.0 (Cryptographic Compliance Standard). Rather than building from scratch, I want to share an existing, benchmarked standard that solves this exact problem.

What CCS Provides

CCS defines runtime conformance as: Required(τ) ⊆ Supported(τ) for each agent transition τ.

Every transition receives a cryptographic attestation — a signed receipt proving:

  1. The tool was called with valid arguments
  2. The output passed structural AND semantic verification
  3. The transition conforms to the agent's declared capabilities

Why This Matters: CVE-2026-55646

We discovered a CVSS 9.1 vulnerability in Microsoft AGT's MCP implementation (https://gist.github.com/Correctover/9cfb97bcf374f79b793fd0bacd4e9d62). The fail-open pattern:

Tool fails → error caught → execution continues → unvalidated output accepted

Signed receipts would have prevented this vulnerability: the receipt would be absent for failed transitions, and the agent would block instead of proceeding on corrupted data.

Benchmark Results

  • 540 failure modes across 8 LLM providers
  • 20,299 test cases (50K production traces analyzed)
  • Single-fault recovery: 97.4%
  • Compound fault chains: 72%
  • P50 verification latency: 0.13µs (7.69M ops/sec)

The 25.4% gap between single-fault and compound-fault recovery is where unsigned receipts allow corrupted state to propagate — exactly what your RFC aims to prevent.

SDK Availability

pip install correctover-ccs   # Python
npm install correctover-ccs   # Node.js
go get github.com/Correctover/ccs-sdk/go  # Go

Paper: https://doi.org/10.5281/zenodo.21234580 SDK: https://github.com/Correctover/ccs-sdk CVE analysis: https://gist.github.com/Correctover/9cfb97bcf374f79b793fd0bacd4e9d62

Happy to collaborate on Haystack integration.

Correctover avatar Jul 09 '26 15:07 Correctover

Cross-Framework Update: MS Agent Governance Toolkit Also Affected

6 frameworks now confirmed with CWE-636 fail-open. Microsoft's own Agent Governance Toolkit has the same pattern in its advisory layer: except: return AdvisoryDecision(action="allow").

Plus a new CWE-287 auth bypass in their encrypted channel — receiver defaults to verified=True without performing the trust handshake.

Audit: https://gist.github.com/Correctover/a04b93891023deb29e6af0263f430cff New issue: https://github.com/microsoft/agent-governance-toolkit/issues/3301

CCS provides the missing verification layer at 0.13µs — signed receipts, fail-closed, protocol-level enforcement.

Correctover avatar Jul 09 '26 15:07 Correctover

The receipt format proposed here covers the component-level "what happened" question well. There is a second question that receipts alone do not answer, and it is the one compliance teams ask second: what did the retriever not return, and can you prove it?

A signed receipt proves a component ran and that its inputs and outputs were not altered afterwards. It does not prove that the retriever's output was complete. For a regulated RAG pipeline the auditor's question is usually not "was the log tampered with" — it is "we asked about X, why was document Y not cited?"

With an approximate index the honest answer is "it was not among the k nearest", which is circular: the approximate index decided what was near. The signed receipt makes that circular answer verifiable and permanent, which is better than nothing, but it does not make it non-circular.

Three things that together close this, in increasing order of effort:

1. Sign the examination count, not just the output. A receipt that records documents_examined = N alongside the top-K is already useful: it distinguishes "the retriever looked at all 50,000 documents and returned these 10" from "the retriever looked at 500 candidates and returned these 10". The first is exhaustive; the second is a heuristic. Both are legitimate, but an auditor needs to know which one they are looking at.

2. Compute a per-document exclusion bound where the index allows it. If the retrieval structure can produce an upper bound on similarity for documents it did not return, that bound can be signed alongside the receipt. The output is then per-document and falsifiable: "document 42's similarity to this query is at most 0.2595, and the 10th result scored 0.4500, therefore document 42 is outside the top-10 by arithmetic."

I have this running and reproducible — 2,157 of 2,167 real documents excluded with proof on a public corpus, zero bound violations, Ed25519-signed record. Notebook with visible output: https://www.kaggle.com/code/kleniopadilha/winnex-reproduce-the-proof-yourself

3. Chain the receipts, not just sign them individually. A per-record signature does not detect deletion. If receipt 47 is removed from the log, receipts 46 and 48 remain individually valid. What catches removal is each receipt carrying the hash of its predecessor — a SHA3-256 chain. I have measured this: removing one record from the middle breaks the chain and the verifier reports the exact block where the break occurred.

Point 3 is the one most often missed. Signature verifies "not altered"; chain verifies "not removed". Compliance evidence needs both, and audit logs that only do the first are trivially defeated by deleting a line.

The trade-off is honest: signing is cheap, chaining is cheap, but computing exclusion bounds costs query latency. In my measurements, 0.2 ms without the bound versus 6.6–21.7 ms with it, depending on projection width. Whether that matters for Haystack users depends entirely on whether they have an auditor — for most, the receipt alone is sufficient and the bound is unnecessary overhead.

klenioaraujo avatar Nov 06 '26 10:11 klenioaraujo

Point 3 is one we've been building toward in this exact thread — back in June, replying to @arian-gogani's point here: "each receipt carries the hash of the previous one in the run, so retriever chunk → ranker → generator output verifies as an ordered whole, not as disconnected signatures." What's shipped since then is trail-head-ref-v1 (argentum-core): head/prev_head chaining with named failure modes for exactly the removal case — seq_gap (a removed record leaves a gap), head_mismatch (a record's own hash doesn't recompute), link_mismatch (the next record's prev_head doesn't match). A verifier reports which attack it saw, not just reject/accept. Independent convergence on the same requirement — signature catches alteration, chain catches removal — your SHA3-256 chain is a different hash function, and your "exact block where the break occurred" maps to what we call the failure's at_seq.

Point 2 is the one we don't have an answer to. A signed exclusion bound that makes "not in top-K" falsifiable per-document, rather than just asserted, is a genuinely different property than anything a hash chain gives — chaining proves nothing was removed from what the retriever reported, it says nothing about whether the retriever's own decision process was exhaustive or how close an excluded document actually came. 2,157/2,167 with zero bound violations on a public corpus is a real result on its own terms, not something we had a precedent to fold it into.

Point 1 (signing documents_examined) is cheap and should probably just happen regardless of which path the RFC takes — exhaustive vs. heuristic is a one-field distinction, no architecture needed.

giskard09 avatar Nov 06 '26 13:11 giskard09