Skip to main content
Palyra utilizes a strictly versioned set of schemas to ensure type safety and contract enforcement across its distributed components, including the Rust daemon, the CLI, and various frontend surfaces. The protocol architecture is centered around Protobuf for high-performance RPC and JSON Schema for model-facing tool definitions and dynamic UI updates. The primary contract is the PROTOCOL_MAJOR_VERSION, which is synchronized across generated stubs to prevent incompatible deployments schemas/generated/rust/protocol_stubs.rs#5-5.

Protobuf Ecosystem and Generated Stubs

The core communication between the palyra-daemon and its clients (or external workers) is defined via Protobuf v3. These schemas are organized into functional domains (v1) and are used to generate native stubs for Rust, Kotlin, and Swift.

Protocol Domains

Cross-Language Support

Stubs are automatically generated and committed to the repository to ensure that frontends (Web/React, Desktop/Tauri, Mobile) stay in sync with the daemon’s internal logic.
LanguageGenerated File PathPurpose
Rustschemas/generated/rust/protocol_stubs.rsInternal daemon and CLI communication.
Kotlinschemas/generated/kotlin/ProtocolStubs.ktAndroid and JVM-based integrations schemas/generated/kotlin/ProtocolStubs.kt#1-2.
Swiftschemas/generated/swift/ProtocolStubs.swiftiOS and macOS native application support schemas/generated/swift/ProtocolStubs.swift#1-3.
For details on the generation pipeline and CI validation, see Protobuf Schemas and Generated Stubs. Sources: schemas/generated/rust/protocol_stubs.rs#1-60, schemas/generated/kotlin/ProtocolStubs.kt#1-35, schemas/generated/swift/ProtocolStubs.swift#1-78.

JSON Schemas and Model Contracts

While Protobuf handles the “system-to-system” space, JSON Schemas govern the “Model-to-Daemon” space. Every tool in the Palyra registry includes a JSON Schema that defines its input requirements, which is served to the LLM during the prompt compilation phase.

Builtin Tool Registry

The palyra-daemon maintains a static registry of builtin tools (e.g., palyra.memory.search, palyra.process.run). These tools use object_schema definitions to enforce strict validation on model-generated arguments crates/palyra-daemon/src/application/tool_registry/builtin.rs#23-50.

The Instruction Compiler

The InstructionCompiler acts as a bridge, transforming system state and tool schemas into a deterministic instruction set for the LLM. It tracks a INSTRUCTION_COMPILER_VERSION to ensure that any change in the underlying contract (such as tool descriptions or safety notes) results in a new content hash for auditability crates/palyra-daemon/src/application/instruction_compiler.rs#22-26.

Protocol Validation Space

Sources: crates/palyra-daemon/src/application/tool_registry/builtin.rs#1-17, crates/palyra-daemon/src/application/instruction_compiler.rs#1-26, crates/palyra-common/src/process_runner_input.rs#100-112.

Cross-Surface Communication Flow

The protocol definitions ensure that an action initiated in one surface (e.g., the Web Console) is correctly interpreted by the daemon and executed within the safety boundaries.

Entity Mapping

The following diagram illustrates how high-level protocol concepts map to specific code entities within the daemon’s transport and application layers.

Key Runtime Contracts

For details on A2UI updates and telemetry contracts, see JSON Schemas and Cross-Surface Contracts. Sources: crates/palyra-daemon/src/application/memory.rs#1-20, crates/palyra-daemon/src/application/recall.rs#1-25, crates/palyra-common/src/process_runner_input.rs#44-67, crates/palyra-daemon/src/sandbox_runner.rs#1-15.

Child Pages