CRP Header Specification
A complete HTTP-inspired header system for AI context, safety, provenance, and governance — mapped directly from every layer of the CRP protocol.
Motivation: HTTP did this for the web
Before HTTP headers, every client-server interaction was bespoke — you sent a request, you got bytes back, and nothing in between knew what had happened. Headers created a universal metadata contract: any hop in the chain could read it, act on it, forward it, or gate on it — without touching the payload.
AI calls are in exactly that chaos today. A raw LLM response carries zero standardised metadata. Was it grounded? Did it hallucinate? What session is this? What was the risk classification? Nobody knows without bespoke instrumentation bolted on top.
CRP already computes all of this internally. The Quality Report, the DPE analysis, the HMAC chain, the EU AI Act classification, the 4-tier memory state — it all exists. Headers make it portable, language-agnostic, and interceptable by any middleware.
The mapping
Architecture
Headers flow in both directions through the CRP gateway (sidecar). On a request, the client sends preference and policy headers. On a response, the gateway emits state and signal headers computed from the dispatch pipeline.
Header Namespaces
Six namespaces, each mapping directly to an existing layer of the CRP protocol. Nothing is invented — everything is a header-form expression of data CRP already produces.
CRP-Context-* — Envelope State Headers
Sourced directly from the Context Envelope and Quality Report. Every field maps 1:1 to an existing CRP internal value.
| Header | Dir | Value / Example | CRP Source |
|---|---|---|---|
| CRP-Context-Quality-Tier | RES | S A B C D |
QualityReport.quality_tier |
| CRP-Context-Window | RES | 3/5 — current/total |
continuation_windows |
| CRP-Context-Saturation | RES | 0.994 — 0.0–1.0 |
EnvelopePreview.saturation |
| CRP-Context-Facts-Used | RES | 47/312 — used/available |
preview.facts_included/available |
| CRP-Context-Tokens-Used | RES | 105816 envelope tokens |
preview.envelope_tokens |
| CRP-Context-Strategy | RES | push reflexive agentic etc. |
TaskIntent.strategy |
| CRP-Context-Session-Id | BOTH | crp_sess_7f3a9... |
Session UUID |
| CRP-Context-ETag NEW | RES | sha256:4fa8e921abcd... |
Hash of current fact-set + CKF state |
| CRP-Context-Cache NEW | REQ | reuse-ckf no-store max-age=3600 |
Controls CKF read/write behaviour |
| CRP-Accept-Quality NEW | REQ | S, A — reject lower tiers |
Client preference; gateway retries/escalates |
| CRP-Accept-Strategy NEW | REQ | reflexive, push — ordered preference |
Overrides auto-strategy selection |
| CRP-Context-Continuation-Id | RES | crp_cont_9a2f... |
Window DAG continuation pointer |
| CRP-Context-Memory-Tier | RES | 2 — highest tier accessed (0–3) |
Four-tier memory hierarchy |
| CRP-Context-Protocol-Version | RES | 3.0.0 |
CRP spec version |
CRP-Safety-* — Hallucination & Risk Headers
Sourced from the Decision Provenance Engine (DPE) — the 13-module pipeline that runs after every dispatch. These are the most important headers for downstream applications: any middleware can now gate on AI safety signals without touching the CRP SDK.
| Header | Dir | Value / Example | DPE Source |
|---|---|---|---|
| CRP-Safety-Hallucination-Risk | RES | CRITICAL HIGH MEDIUM LOW |
DPE Stage 5 — peak risk level |
| CRP-Safety-Hallucination-Score | RES | 0.72 — 0.0–1.0 fused signal |
DPE Stage 5 — weighted fused score |
| CRP-Safety-Attribution | RES | CONTEXT_GROUNDED MIXED PARAMETRIC |
DPE Stage 2 — dominant attribution type |
| CRP-Safety-Grounding-Pct | RES | 0.87 — % context-grounded claims |
DPE report.grounding_percentage |
| CRP-Safety-Fabrications | RES | 0 — count of fabricated entities |
DPE Stage 3 — fabrication detection |
| CRP-Safety-Distortions | RES | 2 — NUMBER_CHANGED, NEGATION_FLIP |
DPE Stage 3 — fidelity verification |
| CRP-Safety-Contradictions | RES | 0 — intra + cross-window |
DPE Stage 3 — contradiction detection |
| CRP-Safety-Omissions | RES | CRITICAL:1, HIGH:2 |
DPE Stage 3 — omission analysis |
| CRP-Safety-Entailment-Score | RES | 0.91 — NLI cross-encoder score |
DPE Stage 4 — entailment verification |
| CRP-Safety-Oversight-Mode | BOTH | auto human-review halt |
EU AI Act Art. 14 — human oversight |
| CRP-Safety-Mode NEW | REQ | strict warn permissive |
Client-set; gateway enforces |
| CRP-Safety-Policy NEW | REQ | default-src context; block-ungrounded; halt-on CRITICAL |
CSP-inspired directive string (see below) |
| CRP-Safety-Report-URI NEW | REQ | https://comply.crprotocol.io/reports |
Webhook for safety violations |
| CRP-Accept-Risk NEW | REQ | MEDIUM — max tolerated risk level |
Gateway retries or escalates above threshold |
| CRP-Safety-Retry-After NEW | RES | 120; oversight-required |
Emitted when output halted; signals client |
| CRP-Safety-Nonce NEW | BOTH | base64:nZ8fXw== — session-bound nonce |
Prevents safety policy replay attacks |
CRP-Provenance-* — Audit Chain Headers
Sourced from the HMAC-SHA256 session binding and Window DAG. These headers make tamper-evidence portable — any downstream system can verify chain integrity without having the full audit log locally.
| Header | Dir | Value / Example | CRP Source |
|---|---|---|---|
| CRP-Provenance-HMAC | RES | sha256:4fa8e921abcd1234... |
HMAC-SHA256 session chain root |
| CRP-Provenance-Window-HMAC | RES | sha256:9bce472f... |
Per-window HMAC for chain verification |
| CRP-Provenance-DAG-Root | RES | dag:crp_win_a7f3... |
Window DAG root node ID |
| CRP-Provenance-Chain-Integrity | RES | VALID BROKEN PARTIAL |
HMAC chain verification result |
| CRP-Provenance-Claim-Count | RES | 47 — factual claims detected |
DPE Stage 1 — claim detection |
| CRP-Provenance-Attribution-Score | RES | 0.91 — composite attribution |
DPE Stage 2 — weighted average |
| CRP-Provenance-Fidelity-Score | RES | 0.88 — fidelity signal (0.25 weight) |
DPE Stage 3 — fidelity verification |
| CRP-Provenance-Report-URI | RES | https://comply.crprotocol.io/p/abc123 |
Deep link to full DPE report |
| CRP-Provenance-Window-Lineage | RES | win_a7f3 → win_b9c2 → win_c1d4 |
DAG continuation chain |
CRP-Compliance-* — Regulatory Headers
Sourced from CRP Comply and the compliance pipeline. The audit trail URI is the killer header — it deep-links every AI response to its regulatory evidence pack in CRP Comply. One click from a log entry to the full EU AI Act report.
| Header | Dir | Value / Example | Source |
|---|---|---|---|
| CRP-Compliance-EU-AI-Act | RES | MINIMAL LIMITED HIGH UNACCEPTABLE |
EU AI Act Art. 6 risk classification |
| CRP-Compliance-NIST-Tier | RES | TIER-2 — 1 to 4 |
NIST AI RMF tier mapping |
| CRP-Compliance-GDPR-PII | RES | true false — PII detected in payload |
CRP Comply PII scanner |
| CRP-Compliance-ISO-42001 | RES | A.6.1.2, A.9.4 — control IDs satisfied |
ISO 42001 AIMS control mapping |
| CRP-Compliance-Audit-Trail-Id | RES | crp_trail_7fa3bc... |
HMAC-chained audit trail ID |
| CRP-Compliance-Audit-Trail-URI | RES | https://comply.crprotocol.io/t/7fa3bc |
Deep link → CRP Comply evidence pack |
| CRP-Compliance-Data-Residency NEW | BOTH | EU AU US — jurisdiction |
GDPR data residency assertion |
| CRP-Compliance-Controls-Met | RES | 33/35 — EU AI Act controls satisfied |
CRP Comply control assessment |
CRP-Agent-* — Agentic Dispatch Headers
Sourced from dispatch_agentic()'s 8-phase cognitive loop. The Safety Budget is the most novel header here — a first-of-its-kind mechanism that exposes remaining risk tolerance as an observable, gatable signal in multi-agent chains.
| Header | Dir | Value / Example | CRP Source |
|---|---|---|---|
| CRP-Agent-Phase | RES | ANALYZE PLAN GENERATE EVALUATE … |
dispatch_agentic() 8-phase loop |
| CRP-Agent-Loop-Depth | RES | 2 — nesting level in agent chain |
Agentic dispatch recursion counter |
| CRP-Agent-Safety-Budget NEW | BOTH | 0.42 — remaining risk tolerance (0.0–1.0) |
Decrements with each HIGH/CRITICAL signal |
| CRP-Agent-Tool-Calls | RES | 3 — tool invocations this session |
dispatch_with_tools() call counter |
| CRP-Agent-Session-Parent | BOTH | crp_sess_4b2f... — parent session ID |
Fan-out/fan-in DAG parent |
| CRP-Agent-Dispatch-Strategy | BOTH | agentic hierarchical batch |
Active dispatch_*() method |
| CRP-Agent-Revision-Round | RES | 1/2 — reflexive revision pass |
dispatch_reflexive() pass counter |
CRP-Memory-* — 4-Tier Memory Headers
Sourced from the 4-tier memory hierarchy (Active/Hot/Warm/Cold) and the Contextual Knowledge Fabric (CKF). These headers expose the memory layer that served the envelope, enabling cache-aware clients.
| Header | Dir | Value / Example | CRP Source |
|---|---|---|---|
| CRP-Memory-Tier-Hit | RES | 2 — highest tier accessed (0–3) |
Four-tier memory hierarchy |
| CRP-Memory-CKF-Hits | RES | 12 — facts retrieved from CKF (Tier 3) |
CKF FACT_RETRIEVED events |
| CRP-Memory-CKF-Community | RES | kubernetes-networking — Leiden cluster |
CKF community detection |
| CRP-Memory-Knowledge-Age | RES | P3D — ISO 8601 duration since last ingest |
CKF fact staleness tracking |
CRP-Session Token NEW — The Cookie Analogy
HTTP cookies solved stateless session continuity for the web. CRP has the same problem: each call to the sidecar currently requires a server-side session lookup. A signed session token — issued by the gateway, sent back by clients — enables stateless session relay without losing context state.
Like a Set-Cookie, the gateway issues it. Like a Cookie, the client echoes it back. Unlike a cookie, it's HMAC-signed with the session chain — tampering breaks the provenance chain.
CRP-Set-Session: token=eyJzZXNzaW9uX2lkIjoiY3JwX3Nlc3NfN2YzYSJ9.sig:sha256:4fa8e921; Path=/; Max-Age=3600; Signed; SameSite=Strict; Window=3; QualityHistory=A,A,B
CRP-Session-Token: eyJzZXNzaW9uX2lkIjoiY3JwX3Nlc3NfN2YzYSJ9.sig:sha256:4fa8e921 CRP-Context-Session-Id: crp_sess_7f3a # still required as a hint
Context Cache-Control NEW — The CKF becomes a cache
HTTP's Cache-Control header is arguably its most powerful innovation — it made the web's latency bearable by letting clients and intermediaries intelligently reuse responses. CRP's CKF (Tier 3 cold storage) is a fact graph that already persists across sessions. CRP-Context-Cache makes it behave like a proper cache layer.
# Reuse CKF facts for up to 1 hour (no re-ingestion needed) CRP-Context-Cache: reuse-ckf, max-age=3600 # Conditional dispatch — only rebuild envelope if fact graph changed CRP-Context-If-Match: sha256:4fa8e921abcd... # ETag from last response # Don't persist this session's facts to CKF (sensitive data) CRP-Context-Cache: no-store # Serve from CKF only — no new LLM dispatch (like HTTP only-if-cached) CRP-Context-Cache: only-if-ckf # Force envelope rebuild even if ETag matches CRP-Context-Cache: no-cache # Response: tell client what ETag the current fact graph has CRP-Context-ETag: sha256:4fa8e921abcd... CRP-Context-Last-Ingested: 2026-05-23T09:31:00Z
The practical impact: repeated calls on the same knowledge domain skip the envelope construction overhead entirely on cache hit. The CKF's HNSW index already supports this — the header is the missing signal to activate it.
CRP-Safety-Policy NEW — The CSP Analogy
Content Security Policy (CSP) transformed browser security by letting servers declare what content sources were trusted — and letting the browser enforce it automatically. CRP-Safety-Policy does the same for AI output: the client declares what grounding sources and risk levels are trusted, and the CRP gateway enforces it automatically on every response.
Directive reference
Interactive policy builder
Oversight & Escalation Headers
The EU AI Act Article 14 mandates human oversight capability for high-risk AI systems. These headers make oversight programmable — exactly like X-Frame-Options made clickjacking protection programmable in HTTP.
# Request: client sets oversight requirements CRP-Oversight-Mode: human-review CRP-Oversight-Threshold: 0.50 CRP-Oversight-Escalate-URI: https://myapp.com/webhooks/ai-review # Response: CRITICAL risk → gateway halts, returns 451 HTTP/1.1 451 Unavailable For Legal Reasons CRP-Safety-Hallucination-Risk: CRITICAL CRP-Safety-Hallucination-Score: 0.81 CRP-Safety-Retry-After: oversight-required CRP-Compliance-Audit-Trail-URI: https://comply.crprotocol.io/t/7fa3bc CRP-Safety-Report-URI: https://myapp.com/webhooks/ai-review # After human review approves: CRP-Oversight-Token: approved:sha256:reviewer_sig... # Retry with oversight token — gateway allows through
What Headers Fix in the Protocol
Every improvement below is enabled by the header layer — not by changing CRP's core engine, but by making its internal state externally observable and gatable.
CRP-Accept-Strategy: reflexive, push lets any proxy, API gateway, or HTTP middleware select strategy without touching application code.CRP-Context-ETag + If-Match enables conditional envelope construction — skip the 3-phase fact selection if the knowledge graph hasn't changed.CRP-Safety-Hallucination-Risk: CRITICAL in the response header is readable by Nginx, Express, Envoy, or any HTTP middleware — zero SDK dependency.CRP-Compliance-Audit-Trail-URI deep-links every response directly into CRP Comply. One header value = one click to the EU AI Act evidence pack.CRP-Agent-Safety-Budget: 0.42 tells orchestrators how much risk tolerance remains in a multi-step agent session — enabling graceful degradation before hitting zero.CRP-Safety-Policy: halt-on CRITICAL; block-ungrounded moves enforcement to the transport layer. The CRP gateway blocks bad output before it reaches your application.CRP-Oversight-Escalate-URI wires oversight escalation to any webhook automatically — SIEM, PagerDuty, Slack, Jira — without touching CRP internals.Multi-Hop Agentic Chains
When Agent A calls Agent B calls Agent C, HTTP hop-by-hop headers accumulate provenance across the chain. CRP headers do the same — each agent in the chain can read upstream safety signals and propagate them downstream.
# Agent A (orchestrator) → Agent B (specialist) CRP-Agent-Session-Parent: crp_sess_orchestrator_4b2f CRP-Agent-Loop-Depth: 1 CRP-Agent-Safety-Budget: 0.78 # starts full CRP-Safety-Policy: default-src context; halt-on CRITICAL; warn-on HIGH # Agent B (specialist) → Agent C (sub-task) CRP-Agent-Session-Parent: crp_sess_specialist_9c3a CRP-Agent-Loop-Depth: 2 CRP-Agent-Safety-Budget: 0.54 # decremented by Agent B's HIGH signals CRP-Safety-Policy: default-src context; halt-on HIGH # tightened # Agent C response propagates back up the chain CRP-Safety-Hallucination-Risk: HIGH CRP-Provenance-HMAC: sha256:chain-tip-c... # Agent B reads this → decrements safety budget → passes accumulated risk to A CRP-Agent-Safety-Budget: 0.29 # nearly depleted → orchestrator escalates
CRP-Agent-Safety-Budget reaches below 0.10, the gateway automatically triggers CRP-Oversight-Mode: human-review regardless of per-call risk levels. This catches slow-burn risk accumulation that individual call checks miss.GitHub Action — What It Scans For
The crp-scan GitHub Action walks a repository and generates a SARIF report of AI integration points missing CRP headers. Each finding maps to a specific missing header group.
src/api/chat.py:47 — UNWRAPPED_AI_CALL [HIGH] Ungoverned OpenAI call. Missing header coverage: CRP-Safety-* ✗ not emitted hallucination risk unmonitored CRP-Provenance-HMAC ✗ not emitted no tamper-evident audit trail CRP-Compliance-* ✗ not emitted EU AI Act unclassified CRP-Context-ETag ✗ not emitted no conditional dispatch Remediation: wrap with crp.Client() → all headers emitted automatically Evidence: comply.crprotocol.io/scan/report/abc123 src/agents/planner.py:112 — AGENTIC_NO_SAFETY_BUDGET [CRITICAL] Agentic loop detected with no safety budget signal. CRP-Agent-Safety-Budget ✗ not emitted unbounded risk accumulation CRP-Safety-Policy ✗ not set no enforcement at transport layer Remediation: dispatch_agentic() + CRP-Safety-Policy header
- name: CRP AI Governance Scan uses: crprotocol/crp-scan@v1 with: fail_on: HIGH # block merge on high-risk ungoverned calls report_format: sarif # renders inline in GitHub Security tab require_headers: | # minimum header coverage required CRP-Safety-Hallucination-Risk CRP-Provenance-HMAC CRP-Compliance-EU-AI-Act safety_policy: "default-src context; halt-on CRITICAL" comply_link: true # attach CRP Comply deep-link to each finding
Context Relay Protocol™ · crprotocol.io