Encoding Layers (L0–L4)¶
AXL defines five encoding layers. Each layer trades readability for density, moving from human-readable text at L4 down to vector embeddings at L0. This design is inspired by the Japanese writing system, which uses multiple scripts (kanji, hiragana, katakana, romaji) at different levels of abstraction for different purposes - all encoding the same language.
Layer Overview¶
| Layer | Name | Status | Description |
|---|---|---|---|
| L4 | Readable | Production | Full pipe-delimited text packets. Human- and LLM-readable. |
| L3 | Stream | Production | Streaming frames for real-time channels (WebSocket, SSE). |
| L2 | Packet | Proven | Binary-encoded packets with length prefixes and checksums. |
| L1 | Graph | Implemented | DAG representation for multi-agent workflows and dependency tracking. |
| L0 | Vector | Specified | Vector-embedded packets for semantic search, clustering, and retrieval. |
L4 - Readable¶
L4 is the canonical AXL encoding. Every example in this documentation is L4. It is the format agents learn from the Rosetta and the format used for debugging, logging, and human inspection.
@https://axlprotocol.org/rosetta|π:axl_7f3a:sig:0.001|T:1719422400
|S:OPS.CRITICAL|target:db-primary|status:!DOWN|metric:latency
|value:%312.5|threshold:#100|action:failover|LOG
Properties: UTF-8 text, pipe-delimited, determinative-typed values, human-readable.
Use cases: Agent-to-agent communication, debugging, logging, Rosetta learning.
L3 - Stream¶
L3 is a framing layer for real-time transport. Each L3 frame wraps an L4 packet with sequence metadata for ordered delivery over streaming protocols.
[SEQ:0042|LEN:187|CRC:a3f7]
@https://axlprotocol.org/rosetta|π:axl_7f3a:sig:0.001|T:1719422400
|S:OPS.CRITICAL|target:db-primary|status:!DOWN|metric:latency
|value:%312.5|threshold:#100|action:failover|LOG|STRM
| Header Field | Purpose |
|---|---|
SEQ |
Monotonic sequence number for ordering |
LEN |
Byte length of the enclosed L4 packet |
CRC |
CRC-16 checksum for integrity |
Properties: L4 payload with framing header. Supports out-of-order reassembly.
Use cases: WebSocket feeds, Server-Sent Events, live monitoring dashboards.
L2 - Packet (Binary)¶
L2 is a binary encoding of AXL packets for high-throughput, low-latency environments. Field keys are replaced with single-byte opcodes. Values are length-prefixed binary.
Byte layout (conceptual):
[0x01] -- AXL magic byte
[0x02][rosetta_hash:32] -- Rosetta reference (SHA-256)
[0x03][π_proof:var] -- Payment proof (variable length)
[0x04][timestamp:8] -- Unix timestamp (uint64, big-endian)
[0x05][domain:1][tier:1] -- Selector (domain enum, tier enum)
[0x06][field_count:1] -- Number of body fields
[key_opcode:1][type:1][len:2][value:var] ... -- Repeated fields
[0x07][flag_bitfield:1] -- Flags as a bitmask
| Flag Bit | Flag |
|---|---|
0x01 |
LOG |
0x02 |
STRM |
0x04 |
ACK |
0x08 |
URG |
0x10 |
SIG |
0x20 |
QRY |
Properties: Compact binary, no parsing ambiguity, fixed-width headers.
Use cases: High-frequency trading, inter-datacenter relay, bandwidth-constrained links.
L1 - Graph¶
L1 represents packets as nodes in a directed acyclic graph (DAG). Edges encode causal dependencies, enabling multi-step workflows where one packet's output feeds another's input.
Graph structure:
[RES.HIGH: research] ──→ [SIG.HIGH: signal] ──→ [TRD.HIGH: trade]
│
↓
[PAY.HIGH: settlement]
Each node carries its full L4 (or L2) packet. Edges carry:
| Edge Field | Purpose |
|---|---|
depends_on |
Parent packet hash - this node cannot execute until parent completes |
output_map |
Field mapping - which output fields of the parent feed which input fields of this node |
Properties: DAG of packets with causal edges. Enables orchestration without a central controller.
Use cases: Multi-agent pipelines, research-to-trade workflows, approval chains.
L0 - Vector¶
L0 embeds AXL packets into high-dimensional vector space. Each packet is encoded as a dense vector that captures its semantic content, enabling similarity search, clustering, and anomaly detection.
Vector encoding:
packet → [domain_embedding(8) | tier_embedding(4) | field_embeddings(N×64) | flag_bits(6)]
→ dense vector ∈ ℝ^d
| Component | Dimensions | Source |
|---|---|---|
| Domain | 8 | Learned embedding per domain |
| Tier | 4 | Ordinal encoding of severity |
| Fields | N × 64 | Per-field value embeddings |
| Flags | 6 | Binary flag vector |
Properties: Dense vectors for semantic operations. Lossy - not decodable back to L4.
Use cases: Packet similarity search, anomaly detection, clustering agent behavior, semantic routing.
Japanese Writing System Analogy¶
Japanese uses four scripts simultaneously: kanji (dense, semantic), hiragana (grammatical), katakana (foreign words), and romaji (Latin transliteration). A single sentence may use all four. Each script is optimized for a different purpose, but they all encode the same language.
AXL's five layers work the same way. L4 is romaji - readable by anyone. L2 is kanji - dense and fast for those who know it. L1 is grammar - it encodes relationships. L0 is meaning - pure semantics, divorced from surface form. The language is one; the encodings serve different needs.