Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.xandrlabs.ai/llms.txt

Use this file to discover all available pages before exploring further.

ALX Protocol v1 defines the shared contract for solve request and response flows, session inspection, run events, protocol negotiation, and response envelopes. The specification is structured around two layers: the wire contract (what messages look like) and the semantic invariants (what must remain true over time). This page summarizes the most important rules for clients and implementers. The normative type source is packages/protocol/src/index.ts, and the full document is docs/protocol/PROTOCOL-SPEC.md. The current shared protocol version constant is exported from @alx/protocol:
import { ALX_PROTOCOL_VERSION } from "@alx/protocol";
The protocol envelope reports the same version string (format: "1.1").

Wire-level guarantees

All compatible implementations must satisfy the following wire-level rules.
RuleRequirement
WG-01Shared protocol-owned wire shapes must live in @alx/protocol.
WG-02Major protocol surfaces must expose stable envelope metadata: ok, correlationId, and protocol.
WG-03Session timeline events must use the closed SessionTimelineEventType vocabulary.
WG-04Run events must use the closed RunEventType vocabulary.
WG-05error.code must be machine-readable and stable across compatible releases.
WG-06Canonical wire fields must remain semantically stable across minor releases.
WG-07Implementations must tolerate unknown optional fields and unsupported capabilities.
WG-08A failed request must not report ok: true.
WG-09If run.failed is emitted, it must carry ok: false.
WG-10If run.completed is emitted, it must carry ok: true.

Solve response canonical fields

These fields carry compatibility guarantees and must not be renamed or removed in a minor release.
FieldDescription
oktrue on success, false on failure.
correlationIdOpaque trace identifier. Preserve for operator observability.
protocolNegotiation envelope: protocol_version and capabilities.
successWhether the solve operation succeeded.
executionIdStable identifier for the execution.
artifactThe selected Knowledge Block artifact, if any.
resultThe natural-language result payload.
confidenceNumeric confidence score for the selected artifact.
executionExecution metadata.
stepsOrdered list of execution steps.
learningFeedback and learning metadata.
errorError detail (present when ok: false).

Session response canonical fields

FieldDescription
oktrue on success, false on failure.
correlationIdOpaque trace identifier.
protocolProtocol negotiation envelope.
sessionIdStable session identifier.
userIdIdentifier of the session owner.
intentOriginal user intent string.
statusCurrent session lifecycle status.
progressCompletion progress indicator.
nextStepSuggested next action for the client.
summaryHuman-readable session summary.
timelineOrdered list of session timeline events.
sessionsSession list (for list endpoints).
errorError detail (present when ok: false).

Determinism boundaries

Not every surface is required to be deterministic. Clients must not depend on server behavior outside the deterministic surfaces.
  • Protocol type shapes
  • Field names and their meanings
  • Event vocabulary names (run and session timeline types)
  • Response envelope structure
  • Negotiation field semantics
  • kbHash derivation for identical inputs
  • Settlement and attribution math for identical inputs
  • Artifact selection strategy
  • Retrieval ranking order
  • Natural-language response text
  • Runtime optimization heuristics

Versioning rules

See versioning and compatibility for the complete compatibility policy. The summary:
  • Clients should ignore unknown optional fields.
  • Clients should ignore unknown capabilities.
  • Servers may add optional fields in minor releases.
  • Servers must not change the meaning of an existing canonical field without a major version bump.
  • New union members are allowed in minor releases only when old clients can safely ignore them.
  • Ergonomic alias fields may be added but do not override canonical wire fields.

Canonical vs ergonomic fields

Canonical fields are the compatibility contract. Ergonomic alias fields are convenience additions that may be present alongside canonical fields for SDK or CLI consumers, but are not the authoritative wire representation. Current solve alias fields (not part of the stability contract): improvement, confidenceScore, reason, cached, fallbackUsed, idempotencyKey, selectMeta. Current error alias field: top-level code (the canonical location is error.code).

Knowledge Block identity fields

FieldIncluded in kbHash derivationNotes
top-level kbHashNoRemoved before canonical hashing.
canonical KB contentYesHashed through canonical serialization.
sources / lineage referencesYes (when present in canonical content)Affect derived identity.
kbId (implementation label)NoMust not alter canonical identity.
transport metadataNoDoes not change KB identity.