Akashik Protocol
Types

Message Envelope

The wrapper structure for every Akashik Protocol message.

Message Envelope

Every protocol message MUST use the envelope structure defined here. The envelope identifies the protocol, version, operation, and sender, providing a consistent frame for parsing and routing across all transports.

Schema

{
  "protocol": "akashik",
  "version": "0.1.0",
  "id": "<string>",
  "operation": "<OperationType>",
  "agent_id": "<string>",
  "session_id": "<string | null>",
  "epoch": "<number>",
  "payload": {}
}

Field Reference

FieldTypeRequiredDescription
protocolstringMUST be "akashik". Any other value MUST be rejected.
versionstringProtocol version. MUST be "0.1.0" for this specification.
idstringUnique message identifier. Used for idempotency and tracing.
operationstringThe operation type. MUST be one of the defined operation types.
agent_idstringThe agent sending this message. MUST be a registered agent (except for REGISTER itself).
session_idstring or nullThe active session context, or null if no session is active.
epochintegerLogical clock value. Level 0 implementations MAY use 0.
payloadobjectOperation-specific data. Structure is defined per-operation.

Valid Operation Types

OperationType = "REGISTER" | "DEREGISTER"
              | "RECORD" | "ATTUNE"
              | "DETECT" | "MERGE"
              | "SUBSCRIBE" | "REPLAY" | "COMPACT"
              | "COORDINATE" | "HANDOFF" | "SESSION"

Behavioral Requirements

CORE The Field MUST reject any message where protocol !== "akashik" with an appropriate transport-level error.

CORE The Field MUST reject any message where version is not supported by the Field implementation.

CORE epoch MUST be a non-negative integer. Level 0 implementations MAY always send 0.

Level 1+ When receiving a message, the Field MUST update its logical clock to max(local_epoch, message.epoch) + 1.

Example

{
  "protocol": "akashik",
  "version": "0.1.0",
  "id": "msg-001",
  "operation": "RECORD",
  "agent_id": "researcher-01",
  "session_id": null,
  "epoch": 5,
  "payload": {
    "mode": "committed",
    "type": "finding",
    "content": "...",
    "intent": { "purpose": "..." }
  }
}

JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://akashikprotocol.com/schema/0.1.0/envelope.json",
  "type": "object",
  "required": ["protocol", "version", "id", "operation", "agent_id", "session_id", "epoch", "payload"],
  "properties": {
    "protocol": { "type": "string", "const": "akashik" },
    "version": { "type": "string", "const": "0.1.0" },
    "id": { "type": "string", "minLength": 1 },
    "operation": {
      "type": "string",
      "enum": ["REGISTER", "DEREGISTER", "RECORD", "ATTUNE", "DETECT", "MERGE", "SUBSCRIBE", "REPLAY", "COMPACT", "COORDINATE", "HANDOFF", "SESSION"]
    },
    "agent_id": { "type": "string", "minLength": 1 },
    "session_id": { "type": ["string", "null"] },
    "epoch": { "type": "integer", "minimum": 0 },
    "payload": { "type": "object" }
  },
  "additionalProperties": false
}