Skip to content

EBNF Grammar

Formal grammar for AXL Protocol packets, specified in Extended Backus-Naur Form.

Complete Grammar

packet        = [ rosetta ] [ payment ] [ timestamp ] [ nonce ] header fields flags ;

rosetta       = "@" url "|" ;
payment       = "π:" tx_id ":" signature ":" gas "|" ;
timestamp     = "T:" integer "|" ;
nonce         = "N:" integer "|" ;

header        = "S:" domain "." tier ;

fields        = { "|" field_value } ;
field_value   = key_value | plain_value ;
key_value     = identifier "=" value ;
plain_value   = value ;

flags         = { "|" "!" flag_name } ;
flag_name     = UPPER_WORD ;

domain        = UPPER_WORD ;
tier          = DIGIT ;

url           = URI_CHARS ;
tx_id         = HEX_STRING ;
signature     = ALPHANUMERIC_STRING ;
gas           = integer ;
integer       = DIGIT { DIGIT } ;
identifier    = ALPHA_CHAR { ALPHANUMERIC_CHAR | "_" } ;
value         = { VALUE_CHAR } ;

Terminal Definitions

DIGIT                = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
ALPHA_CHAR           = "A"-"Z" | "a"-"z" ;
ALPHANUMERIC_CHAR    = ALPHA_CHAR | DIGIT ;
UPPER_WORD           = UPPER_CHAR { UPPER_CHAR | DIGIT | "_" } ;
UPPER_CHAR           = "A"-"Z" ;
HEX_STRING           = "0x" { HEX_DIGIT } ;
HEX_DIGIT            = DIGIT | "a"-"f" | "A"-"F" ;
ALPHANUMERIC_STRING  = { ALPHANUMERIC_CHAR | "_" } ;
URI_CHARS            = { ALPHA_CHAR | DIGIT | ":" | "/" | "." | "-" | "_" | "%" | "?" | "=" | "&" } ;
VALUE_CHAR           = ? any character except "|" ? ;

Production Rules Expanded

packet

A packet is a single-line string composed of optional preamble segments followed by a mandatory header, zero or more data fields, and zero or more signal flags.

[ @rosetta_uri | ] [ π:tx:sig:gas | ] [ T:timestamp | ] [ N:nonce | ] S:DOMAIN.TIER | field1 | field2 | !FLAG1 | !FLAG2

All segments are delimited by |. The header (S:DOMAIN.TIER) is the only required segment.

rosetta

Links to an external Rosetta definition file that defines the encoding context for this packet. The Rosetta file maps domain-specific semantics so that unfamiliar agents can decode the packet.

@ipfs://QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/rosetta.axl
  • Must appear first if present.
  • The @ prefix distinguishes it from other preamble segments.
  • URI schemes: ipfs://, https://, ar:// (Arweave).

payment

On-chain payment proof attesting that the sender has committed economic value to this message. Prevents spam and enables economic interactions.

π:0xabc123def456:sig_789xyz:21000
Component Description
π: Payment proof prefix (U+03C0)
tx_id Transaction hash (hex-encoded)
signature Cryptographic signature of the payload
gas Gas cost in smallest unit (wei)

timestamp

Unix epoch timestamp in seconds. Used for ordering and replay protection.

T:1711234567
  • Integer only, no fractional seconds.
  • Agents SHOULD reject packets with timestamps more than 300 seconds in the future.

nonce

Monotonically increasing integer per-sender. Combined with timestamp, provides replay attack resistance.

N:42
  • Each sender maintains its own nonce counter.
  • Receivers MUST reject packets with a nonce less than or equal to the last seen nonce from that sender.

The mandatory header identifies the domain and priority tier.

S:OPS.3
Component Description
S: Header prefix (Signal)
domain One of the registered domain codes
. Separator
tier Priority level, 1 (critical) to 5 (debug)

Registered domains:

Code Domain
OPS Operations
ERR Error
FAIL Failure
LOG Logging
SIG Security Signal
PAY Payment
ACK Acknowledgment
CMD Command
QRY Query
RSP Response

fields

Zero or more data fields, each prefixed by |. Fields carry the semantic payload of the packet.

|cpu_high|node-7|threshold=90

Two forms:

  • Plain value: cpu_high -- a semantic token or free-form value.
  • Key-value: threshold=90 -- structured data with an identifier key and arbitrary value.

Fields are ordered. Position MAY carry semantic meaning depending on the domain's Rosetta definition.

flags

Zero or more signal flags, each prefixed by |!. Flags control routing, alerting, and processing behavior.

|!ALERT|!ROUTE|!ACK

Standard flags:

Flag Meaning
ALERT Trigger alert pipeline
ROUTE Route to responsible handler
ACK Acknowledgment required/provided
LOG Write to persistent log
ESCALATE Escalate to higher authority
RETRY Retry the failed operation
FREEZE Freeze associated resources
BATCH Part of a batch operation

Minimal Valid Packet

The smallest valid AXL packet contains only a header:

S:OPS.5

This is a valid operations packet at debug priority with no fields or flags.

Maximal Packet Example

@ipfs://Qm.../rosetta.axl|π:0xabc:sig_def:21000|T:1711234567|N:42|S:SIG.1|breach|zone=4|severity=critical|vector=phishing|!ALERT|!ESCALATE|!FREEZE|!LOG