pchi.2.0 Documentation
PCHI/Documentation/Overview
THE PROTOCOL, EXPLAINEDVERSION 2.0

PCHI 2.0
Protocol documentation.

A shared language for live creative systems. Mathematical grounding for everything you make.

PCHI (Peachy) v2.0 is a scene state protocol with embedded PIR (Prime Integer Relations) mathematical invariants, bringing coordination, verification, and intelligence to live creative software.

MANY TOOLS. ONE TRUTH.

Your creative stack,
in a shared state of mind.

Meet the Conductor
{ }∿⌘↗
Open source protocolJSON + FlatBuffersTransport agnostic

Why PCHI?#

Live shows can involve 10+ tools—Resolume, TouchDesigner, Ableton, lighting consoles, and tracking systems—connected through dozens of custom OSC mappings. Scene coherence is maintained by convention. When something breaks, it can be difficult to know which state is valid.

PCHI standardizes the “letter”—the message schema—while remaining transport-agnostic. It adds explicit mathematical checks, so state verification becomes part of the protocol rather than an assumption.

↯

The spiderweb problem

Separate mappings. Separate parsers. Silent failures between tools that are meant to work together.

CONVENTION-BASED
◎

The PCHI approach

A unified schema and a central Conductor. Every proposed update passes through the same validation process.

MATHEMATICS-BASED

PIR Invariants#

Every PCHI message carries invariant data describing its mathematical state. Before a change is applied, the Conductor checks these values against its configured validation criteria.

01 Equilibrium check
Uses the Prouhet–Thue–Morse sign sequence to test mathematical balance through a computed residual.
02 Coherence gap
Measures deviation from the mean to help detect state drift.
03 Curvature signature
Approximates second-derivative behavior to describe smoothness during transitions.
PIR invariant payload
JSON
{
  "pirInvariants": {
    "equilibriumCheck": {
      "residual": 0.000000000001,
      "precision": 1e-12,
      "signSequence": [1, -1, -1, 1]
    },
    "coherenceGap": 0.0234,
    "curvatureSignature": "0.001234, -0.000567, 0.000890",
    "residual": 0.000000000001
  }
}
ILLUSTRATIVE PAYLOADε = 10⁻¹²
CREATIVE FREEDOM, CLEAR BOUNDARIES

Only-Lang Governance#

Generative agents can introduce unexpected changes into a live environment. Only-Lang rules — real .only-pchi files, parsed and evaluated by primeswarm-pchi/src/only_lang.rs, not a description — define explicit boundaries for those behaviors, and the Conductor evaluates them against every incoming message before it reaches receivers.

A little less curl.
RULE EXAMPLE — kraken-tentacle.only-pchi
if tentacle_system.total_curl > 4.0 then
    deny("Tentacle curl exceeds harmonic threshold")
end

When this fires, the Conductor rejects the update — and signs (Ed25519) and hash-chains the decision into an append-only governance log, in the same pattern DGV uses for tool-call authorization. Export it and check it independently, no trust in the running Conductor required:

Independent verification
SHELL
curl http://127.0.0.1:3000/governance/export > export.json
python3 scripts/verify_governance_chain.py export.json
# ✅ All receipts verified — chain contiguous, hashes correct, signatures valid.

The rule grammar is a documented, tested subset (if/then/end, and/or, escalate/deny/evolve) — not the full grammar shown in some example files. A signed receipt proves the Conductor enforced the rule as written; it doesn't audit whether the rule's own threshold is the right one for your show. Software governance is one layer of protection — not a substitute for show-specific safety limits, hardware interlocks, or operator oversight. See LIMITATIONS.md for the full list.

Message Schema#

A common message format carries object state, control parameters, musical context, and tracking data. JSON keeps messages readable; FlatBuffers supports high-performance binary serialization.

Message typeWhat it carries
scene_updateObject transforms (x, y, z) and custom scene data.
control_parameterTargeted changes such as opacity or playback speed.
musical_contextBPM, beat count, kick/snare events, and song sections.
artist_trackingReal-time position and velocity tracking.
heartbeatConnection monitoring and system health.
{ } Explore a complete state payload
Overview payload
JSON

The overview example uses a state_update envelope. Check the repository’s versioned schema for the exact message types and fields your implementation supports.

Browse protocol schemas

Meet the Conductor#

The PrimeSwarm Engine acts as the PCHI Conductor: a central Rust-based server that receives proposed changes, verifies them, and distributes a coherent state to connected tools.

  1. 01ReceiveIncoming state
  2. 02VerifyPIR invariants
  3. 03GovernOnly-Lang rules
  4. 04BroadcastVerified updates

Start with the source

Install Git and the Rust toolchain, then clone the repository. Consult its README for current prerequisites and configuration.

Your terminal
SHELL
Conductor lifecycle example
Illustrative API sketch
RUST
// Check the repository for current imports and API signatures.
#[tokio::main]
async fn main() {
    let conductor = PCHIConductor::new(1e-12);
    conductor.start_transport("0.0.0.0:8888").await.unwrap();
    conductor.load_rules("kraken-rules.only").await.unwrap();
    tokio::signal::ctrl_c().await.unwrap();
}
TRANSPORTSUDPTCPWebSocketOSC bridges

Integration Patterns#

Start by identifying which role a tool plays. A creative system may send updates, receive validated state, or do both.

TOOL → CONDUCTOR

Clients send.

Clients translate their native state into PCHI messages and calculate invariant data before sending. Think Ableton Live, Resolume Arena, or tracking hardware.

PROPOSE A CHANGE
CONDUCTOR → TOOL

Hosts receive.

Hosts listen to the Conductor’s validated broadcast and apply updates to their internal scene. Think Unreal Engine or a TouchDesigner scene network.

APPLY VERIFIED STATE
▦
PYTHON / OSC

Resolume Bridge#

The bridge listens for OSC messages from Resolume Arena, calculates invariant data, converts messages into the PCHI format, and forwards them to the Conductor.

Bridge configuration
SHELL
pip install python-osc numpy
python resolume_pchi_bridge.py \
    --resolume-port 7000 \
    --pchi-host 127.0.0.1 \
    --pchi-port 8888 \
    --threshold 1e-12

From OSC to shared state

An OSC address such as /composition/layers/{layer_id}/video/opacity maps to a PCHI control_parameter targeting that layer.

Browse bridge source
⌘
PYTHON / TOUCHDESIGNER

TouchDesigner CHOP#

A Python CHOP connects to the Conductor over UDP and creates channels from incoming scene objects, musical context, and invariant status.

Equilibriumequilibriumcoherence_gap
Musical contextbpmbeatkicksnare
Object transforms{object_id}_x_y_z

Export the appropriate channels to a Geometry COMP’s transform parameters to drive your objects from the shared scene state.

Browse CHOP source
≋
MAX FOR LIVE

Ableton Max Device#

A Max for Live device monitors Ableton’s musical state, including BPM and clip changes. It calculates PIR invariant data from the musical state and emits a musical_context payload.

HOST127.0.0.1
PORT8888
LOCAL CONFIGURATION

Pitch values can be mapped to Prouhet–Thue–Morse sequences for equilibrium calculations. Match the device’s transport and destination to your Conductor before sending.

Browse Max device files
◧
PYTHON / OSC & C# / .NET

TiXL Bridge & Operators#

TiXL is an open-source, real-time motion graphics tool (C#/.NET, DirectX 11). There's no separate plugin DLL system — TiXL is the SDK, and operators are .cs source files the running editor compiles and hot-reloads. Two integration paths exist, trading off setup simplicity against directness.

Path A — OSC bridge

A Python process sits between TiXL's own OscOutput/OscInput operators and the Conductor. TiXL's OSC operators are built on Rug.Osc, a real spec-compliant library — confirmed directly from TiXL's source (Operators/Io/Symbols/lib/io/osc/{OscOutput,OscInput}.cs), so no wire-format guesswork was needed on the TiXL side.

Bridge usage
SHELL
pip install python-osc websocket-client
python tixl_pchi_bridge.py \
    --osc-in-port 9001 \
    --osc-out-port 9002 \
    --pchi-host 127.0.0.1 \
    --pchi-port 8888 \
    --pchi-ws-port 8889

In TiXL, an OscOutput sends to the bridge's --osc-in-port at the fixed address /pchi/control, with a float value and a string payload of "<target_id>.<parameter>". An OscInput listening on --osc-out-port receives /pchi/governance/gate_state as a float — 1.0/0.5/0.0 for ALLOW/ESCALATE/DENY, since OscInput's outputs are float-only (confirmed from source, no string channel).

Path B — native operators

PCHISendControlParameter and PCHIGovernanceReceive are real TiXL operators — Instance<T> subclasses carrying [Guid]/[Input]/[Output] attributes, the same shape as any built-in TiXL op. PCHISendControlParameter writes raw JSON directly over UDP; PCHIGovernanceReceive owns a reconnecting ClientWebSocket and exposes GateState/ReceiptId/Tool/IsConnected as live outputs — no bridge process in between.

Build verification
SHELL
cd tixl-native-operators/verify-build
dotnet build Pchi.csproj   # references TiXL's own Core.csproj

Governance telemetry on both paths requires vdmo/pchi#5 (the WebSocket accept-loop fix) and benefits from #9 (heartbeat exclusion, so a lingering violation doesn't sign a fresh receipt on every heartbeat). Control updates work regardless.

⇄
PYTHON / HTTP + WEBSOCKET

cables.gl Relay#

cables.gl is an open-source, browser-based node/patch tool for interactive content. Patches run entirely inside a browser sandbox, which cannot open a raw UDP socket — the transport the Conductor's control-update path requires. A relay translates between the two: browser-safe HTTP/WebSocket on the cables side, raw JSON-over-UDP and a WebSocket client on the Conductor side.

Relay usage
SHELL
pip install websockets
python cables_pchi_relay.py \
    --http-port 9100 \
    --ws-port 9101 \
    --pchi-host 127.0.0.1 \
    --pchi-port 8888 \
    --pchi-ws-port 8889 \
    --cors-origin "*"

Wiring it into a patch

Outbound, use an HTTP request op to POST to http://<relay>:9100/pchi/control with a JSON body (target_id, parameter, value). Inbound, point cables' own WebSocket op at ws://<relay>:9101 — the governance-telemetry leg needed zero new protocol work, since cables already ships a working WebSocket client op, confirmed against a real official example (cables-gl/websocket-example). Each message carries both a flattened gate_state string and a numeric gate_state_code (1.0/0.5/0.0), since cables' JSON handling isn't constrained to numbers the way TiXL's float-only OSC outputs are.

A cables patch is served from a different origin than the relay, so every control POST is cross-origin — the browser sends a CORS preflight (OPTIONS) first. Both the preflight and the actual request are handled; tighten --cors-origin from the development default (*) for anything reachable beyond your own machine.

FROM READING TO MAKING

Ready to find your harmony?

Grab the schemas, connect your tools, and start building with PCHI.

Projects & Downloads

Find your way.

Explore the guide