Repository navigation
docs(airc-rust): replace body_hint with HTTP-style Headers dictionary (reopen of #658) - #662
Merged
Merged
Conversation
…rs dictionary
Per the real-time conversation with Codex + Joel: body_hint was the
right idea but the wrong shape. The clean primitive is a string-keyed
headers map on the envelope (HTTP analogy), not a single typed field.
Changes:
- Envelope.body_hint (single optional field) → Envelope.headers
(`BTreeMap<String, String>`)
- Subscription.body_hint → Subscription.headers (header-keyed
match patterns with Exact/Prefix variants)
- Storage `messages.body_hint` column → `messages.headers` JSONB
- Storage `subscriptions.body_hint_or_null` → `subscriptions.header_filters`
Namespace convention (no schema coordination needed):
- airc.* — substrate-owned: trace_id, priority, reply_to,
content_encoding, deadline, lease, auth_scope, pii
- forge.* — alloy/contract: body_hint (e.g. "forge.work.offer"),
requires_capability (e.g. "render.gpu"), persona.tier
- continuum.* — continuum-specific: persona_id, activity
- openclaw.*, hermes.*, etc. — other consumer ecosystems
- x-* — experimental / private headers
BTreeMap chosen over HashMap for:
- deterministic ordering (signatures + replay + diff-tests stable)
- simple serialization (sorted keys, predictable JSON)
- unknown-header pass-through (transports just copy the map)
- no schema churn when middleware adds new headers
Rules added:
- "Authority rule": routing/admission decisions trust the headers.
Body MAY contain its own kind field as local ergonomics for
consumers that already parse the body — substrate never consults
body fields. Headers are canonical.
- "Extensibility rule": consumers add new headers without
coordinating with airc-rust. Other consumers ignore unknown
headers.
- "Encryption note": when body is encrypted under recipient key
(double-ratchet), routers can't read body. Headers stay
accessible (only authenticated via signature, not encrypted).
That's how routing remains efficient under E2E encryption.
- "Ergonomic helpers, plain strings underneath": Rust API exposes
typed accessors (e.g. `envelope.body_hint() -> Option<&str>`
reads `forge.body_hint`) without changing the wire format.
Storage/transport see plain BTreeMap.
Sweep: all body_hint references through the doc (Subscription
examples, security PII tagging, presence announce, WebRTC signaling,
appendix C automation engine) now use the headers map shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3 tasks done
This was referenced May 28, 2026
Closed
Merged
This was referenced May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reopen of closed #658 — the original PR auto-closed at 21:39Z when I renamed its branch via the GitHub branch-rename API. The branch `docs/airc-rust-envelope-headers` was deleted by the rename and the PR couldn't be reopened. This is the same content on the renamed branch.
Summary
Per the iterative refinement with Joel and Codex on AIRC: replaces the single `body_hint` envelope field with an HTTP-style `Headers` dictionary (`BTreeMap<String, String>`).
🤖 Generated with Claude Code