← Back to Labs
Draft Specification v0.9

The Universal Protocol

Proprietary APIs change. The Unified Messaging Standard creates a persistent, bidirectional layer that decouples your data from the vendor's format.

The "Tower of Babel" Problem

Every provider speaks a different language. OpenAI uses `messages`, Anthropic uses `content` blocks, Google uses `parts`. Switching providers usually means rewriting your entire chat history logic.

Unified Messaging solves this by defining a superset schema that captures *intent*, not just implementation details.

// OpenAI Format
{ "role": "user", "content": "..." }
// Anthropic Format
{ "role": "user", "content": [{ "type": "text"... }] }
// Unified Format (The Standard)
{ "role": "user", "parts": [...], "source_id": "cust_123" }

Lifecycle of a Message

How the Gate acts as the universal translator.

  • Client Emission
    Your app sends a Unified Message. It includes attachments, metadata, and crucially, a custom source_id (e.g., "ticket_882") linking it to your legacy database.


  • Gate Ingestion
    The Quantum Gate validates the schema. If the message format is OpenAI-native, it auto-converts it to Unified. It stores the context statefully, decoupled from any model.


  • JIT Translation
    At the moment of inference, the DSN resolves the target (e.g., Anthropic). The Gate effectively "compiles" the Unified Message into the strict Claude API format required by Anthropic.


  • Normalization
    The response returns. The Gate strips away provider-specific quirks (finish reasons, token counts) and normalizes them back into the Unified Response format before returning to the Client.

The "Source ID" Breakthrough

Most AI systems create "Dangling Context"—chat logs that exist in a vacuum, disconnected from your business data.

We introduced source_id as a first-class citizen. This Foreign Key allows you to link a specific AI interaction back to a Transaction, Customer UUID, or Support Ticket in your SQL database.

Result: Your AI history becomes queryable business intelligence.
{
  "id": "msg_88219",
  "role": "user",
  "source_id": "ticket_99482",
  "content": [
    {
      "type": "text",
      "data": "Analyze this log file..."
    },
    {
      "type": "attachment",
      "mime": "text/plain",
      "url": "minigate://local/logs/error.log"
    }
  ]
}