Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZPL-S Protocol

status python protocol license

AI agent protocol / machine-to-machine protocol for canonical state frames. ZPL-S lets agents, services and machines exchange compact, deterministic, hashable state instead of copying long chat context.

It is runnable today: Python reference implementation, CLI, semantic hashes, Q-field/Q-matrix logic, S1.1 delta operations, HMAC seals, HTTP Fabric, OpenAPI contract and conformance tests.

Deutsch kurz: ZPL-S ist kein Chatbot-Wrapper. Menschen bekommen Erklaerung, Maschinen bekommen pruefbare Zustandsframes.

Use ZPL-S when AI agents need to exchange compact, replayable, auditable state transitions instead of copying long chat context.

Good for: multi-agent handoffs, risk gates, deterministic replay, signed machine-state envelopes and HTTP gateway exchange.

Not for: human chat, prompt templates, general-purpose private JSON payloads or claims about real quantum computing.

5-Minute Start

Clone and install the public reference implementation:

git clone https://github.com/viistaproducts/zpls-protocol.git
cd zpls-protocol
python3.12 -m venv .venv  # any Python >= 3.11 works
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e .

Validate a machine-state frame:

zpls validate '§S1 a:critic sh:8f3c op:eval t:17 c:.72 r:med Δ{next:revise,risk:+pricing_stale}'

Run the shortest proof that this is more than text formatting:

zpls conformance
zpls fabric-demo
python examples/killer_demo.py

Package-only install also works:

pip install "git+https://github.com/viistaproducts/zpls-protocol.git@v0.3.1"

Build your first HTTP node:

zpls serve --node-id worker.local --endpoint http://127.0.0.1:8787/.well-known/zpls.json --key mesh-secret

In another terminal:

curl -s http://127.0.0.1:8787/.well-known/zpls.json | python -m json.tool
curl -s -X POST http://127.0.0.1:8787/frame/validate \
  --data '§S1 a:planner sh:8f3c op:plan t:17 c:.91 r:low Δ{next:worker}' \
  | python -m json.tool

Or run the full local HTTP pack/receive flow:

python examples/http_client_demo.py

Implementation docs:

Die Grundidee:

Ein Agent sendet nicht "ich denke vielleicht X, Y oder Z",
sondern einen kanonischen Zustandsvektor.

Ein normaler Frame sieht so aus:

§S1 a:critic sh:8f3c op:eval t:17 c:.72 r:med Δ{next:revise,risk:+pricing_stale}

Use Cases

  • Planner -> coder -> critic handoff.
  • Safety/risk gate before shipping or triggering tools.
  • Compact state updates between agents, robots, jobs or services.
  • Audit log for why a route changed.
  • Signed HTTP Fabric envelope between external nodes.
  • Deterministic replay of an agent decision.

Chat JSON is verbose, ambiguous, hard to hash and hard to replay. ZPL-S is compact, canonical, hashable, signable and replayable.

{"message":"Pricing looks stale. Do not ship yet. Revise pricing...","history":["..."]}
§S1 a:critic sh:8f3c op:eval t:17 c:.72 r:med Δ{next:revise_pricing,risk:+pricing_stale}

Was Neu Daran Ist

ZPL-S soll nicht nur ein kleineres JSON sein. Es modelliert Maschinenzustand als Matrix:

  • mehrere moegliche Zustaende gleichzeitig,
  • verschraenkte Referenzen zwischen Agenten,
  • Interferenz zwischen konkurrierenden Pfaden,
  • explizite Layer-Superpositionen wie parallele Arbeitswelten,
  • Tensorfelder aus Zustand x Layer,
  • deterministischer Kollaps erst bei Beobachtung,
  • kompakte Frames statt langer Kontextkopien.

Das ist quantenlogisch inspiriert, aber keine Behauptung ueber echte Quantenphysik. Es ist ein technisches Protokollmodell: replaybar, testbar und implementierbar.

Q-Matrix In Einem Bild

Ein unbeobachteter Zustand:

Δ{ent:[coder.17,critic.17],q:[revise@.37/-.5,ship@.63]}

Bedeutung:

  • q ist der Superpositionsvektor.
  • revise@.37/-.5 bedeutet: Zustand revise, Gewicht 0.37, Phase -0.5.
  • ship@.63 bedeutet: Zustand ship, Gewicht 0.63, Phase 0.
  • ent sind verschraenkte oder korrelierte entfernte Zustandsreferenzen.

Ein unbeobachtetes Q-Field mit zwei moeglichen States und zwei moeglichen Ausfuehrungslayern:

Δ{q:[revise@.4/-.25,ship@.6],ql:[prod@.45/-.25,sim@.55/.25]}

Das Tensorfeld daraus ist:

q:[prod/revise@.18/-.5,prod/ship@.27/-.25,sim/revise@.22,sim/ship@.33/.25]

Wenn ein Beobachter explizit wird:

Δ{qlphase:-.25,qlpick:prod,qobs:human,qpick:ship}

Dann sind Zustand und Layer kollabiert. Nicht zufaellig, sondern deterministisch aus kanonischem Frame und Beobachter-ID.

Layer Und Interferenz

Layer werden als Referenzen codiert:

u0/a
u0/b
u1/x
u1/y

Ein Gate ist eine sparse Matrix aus Kanten:

gate:[u0/a=u1/x@.8,u0/b=u1/x@.8,u0/a=u1/y@.2,u0/b=u1/y@.2/-.5]

Bedeutung:

  • u0/a=u1/x@.8 leitet Zustand u0/a mit Gain 0.8 nach u1/x.
  • Optionale Phase nach / verschiebt die Welle.
  • Mehrere Beitraege auf dasselbe Ziel interferieren.
  • Das Ergebnis ist wieder ein normaler kompakter Q-Vektor.

Die Mathematik dazu steht in Q_MATRIX_MATH.md.

Was Dieses Projekt Enthält

  • Python-Paket unter src/zpls.
  • Strikter Parser und Serializer fuer ZPL-S v1 Textframes.
  • Kompakte binaere Repraesentation.
  • Stabile semantische Hashes.
  • Q-Matrix-Helfer fuer Superposition, Verschraenkung, Layer-Gates, Layer-Superposition, Tensorfelder, Interferenz und Beobachtung.
  • HMAC-Sealing fuer unveraenderte, pruefbare Maschinenframes.
  • Minimaler Mesh-Kernel mit Agent-Registrierung, Routing, Inbox und Eventlog.
  • Internet-Fabric fuer Discovery, Capability-Negotiation, signierte Envelopes und Gateway-Routing zwischen fremden Knoten.
  • Replay-Schutz fuer Fabric-Envelopes anhand von Source, Trace-ID und Frame-Hash.
  • HTTP-Server fuer Discovery, Fabric Receive, Frame Validation und Packaging.
  • Conformance-Vektoren fuer unabhaengige Implementierungen.
  • Tests fuer Roundtrip, Fehlerfaelle, binaere Aequivalenz und Q-Matrix-Logik.

Schnellstart

python3.12 -m venv .venv  # oder eine andere Python-Version >= 3.11
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e .
zpls validate '§S1 a:critic sh:8f3c op:eval t:17 c:.72 r:med Δ{next:revise,risk:+pricing_stale}'
zpls fabric-demo

Verify implementation:

pip install -e ".[dev]"
pytest -q
zpls conformance

Want the point in one command?

python examples/killer_demo.py

CLI Als Greifbarer Einstieg

Nach der Installation gibt es ein echtes Kommando:

zpls validate '§S1 a:critic sh:8f3c op:eval t:17 c:.72 r:med Δ{risk:+pricing_stale,next:revise}'
zpls seal --key mesh-secret --key-id mesh '§S1 a:critic sh:8f3c op:eval t:17 c:.72 r:med Δ{next:revise}'
zpls verify --key mesh-secret '§S1 a:critic sh:8f3c op:eval t:17 c:.72 r:med Δ{next:revise,seal:hmac-sha256.mesh.67e4f9326fb04daf57b087a1b1ff45fbbacbbbdb5e52581df8865ec85ce5284e}'
zpls conformance
zpls mesh-demo
zpls fabric-demo
zpls serve --node-id worker.local --endpoint http://127.0.0.1:8787/.well-known/zpls.json --key mesh-secret

Q-Zustand bauen, durch ein Gate projizieren und beobachten:

zpls qmake \
  --agent planner --state 8f3c --op plan --target 17 --confidence .81 --risk med \
  --branches 'u0/a@.5,u0/b@.5/.5'

zpls qgate \
  --frame '§S1 a:planner sh:8f3c op:plan t:17 c:.81 r:med Δ{q:[u0/a@.5,u0/b@.5/.5]}' \
  --edges 'u0/a=u1/x@.8,u0/b=u1/x@.8,u0/a=u1/y@.2,u0/b=u1/y@.2/-.5' \
  --keep-gate

zpls qmake \
  --agent planner --state 8f3c --op plan --target 17 --confidence .81 --risk med \
  --branches 'revise@.4/-.25,ship@.6' \
  --layers 'sim@.55/.25,prod@.45/-.25'

zpls qfield \
  --frame '§S1 a:planner sh:8f3c op:plan t:17 c:.81 r:med Δ{q:[revise@.4/-.25,ship@.6],ql:[prod@.45/-.25,sim@.55/.25]}'

zpls observe \
  --observer human --json \
  '§S1 a:planner sh:8f3c op:plan t:17 c:.81 r:med Δ{q:[u1/x@.6667/.25,u1/y@.3333]}'

zpls delta-canon \
  '!market.pricing' '+risk.pricing_stale=true' '~next=revise_pricing' '?source.price_feed'

zpls delta-apply \
  --state '{"market":{"pricing":"stale"},"next":"ship","risk":{}}' \
  '!market.pricing,+risk.pricing_stale=true,~next=revise_pricing,?source.price_feed'

mesh-demo startet keinen Server, aber es zeigt die Runtime-Semantik: Planner und Worker werden registriert, ein Q-Frame wird beobachtet, kollabiert und an die Worker-Inbox geroutet.

fabric-demo zeigt die Internet-Semantik:

  • zwei Knoten veroeffentlichen Discovery-Descriptoren,
  • sie handeln gemeinsame Features aus,
  • ein Planner packt ein gesiegeltes Frame in ein Internet-Envelope,
  • ein Worker-Gateway prueft Seal, TTL und Ziel,
  • danach wird das Frame lokal ins Mesh geroutet.

serve startet einen lokalen HTTP-Fabric-Knoten:

GET  /health
GET  /.well-known/zpls.json
POST /fabric/receive
POST /fabric/pack
POST /frame/validate
from zpls import QBranch, QEdge, apply_qgate, format_qbranches

branches = [
    QBranch("u0/a", .5, 0),
    QBranch("u0/b", .5, .5),
]

gate = [
    QEdge("u0/a", "u1/x", .8, 0),
    QEdge("u0/b", "u1/x", .8, 0),
    QEdge("u0/a", "u1/y", .2, 0),
    QEdge("u0/b", "u1/y", .2, -.5),
]

print(format_qbranches(apply_qgate(branches, gate)))
# ['u1/x@.6667/.25', 'u1/y@.3333']

Wichtige Dokumente

Verhältnis Zu MCP / A2A

ZPL-S ersetzt MCP oder A2A nicht.

  • MCP bleibt Werkzeug- und Ressourcenzugriff.
  • A2A bleibt externe Agenten-Interoperabilitaet.
  • ZPL-S ist die interne Zustandsmatrix darunter.

Kurz: MCP holt Werkzeuge. A2A spricht mit fremden Agenten. ZPL-S transportiert den kompakten Maschinenzustand zwischen den Knoten.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.