Skip to content

Latest commit

 

History

History
367 lines (296 loc) · 15.8 KB

File metadata and controls

367 lines (296 loc) · 15.8 KB

Orpheon Protocol

The Intent-Native Interaction Standard for Autonomous Systems

Version Status Implementation Language License
1.0.0-alpha Specification Rust (Official) MIT / Apache 2.0

1. Abstract

Orpheon destroys the rigid "Request/Response" paradigm of the last two decades. It introduces a new interaction model designed specifically for AI Agents, Autonomous Orchestrators, and High-Reliability Systems.

In traditional REST/GraphQL APIs, clients are responsible for orchestration (calling endpoints in order, handling errors, polling for state). In Orpheon, the client declares an Intent (what they want), and the server (the Orpheon Node) takes responsibility for the Plan (how to get there).

This document outlines the Orpheon Protocol, its core primitives, and its reference implementation in Rust.


2. Why Rust?

Orpheon is designed to be the backbone of mission-critical autonomous agents. Therefore, the implementation language was chosen not for ease of prototyping, but for correctness, concurrency, and performance.

2.1 The Safety Guarantees

  • Memory Safety: Orpheon nodes handle thousands of concurrent state simulations and negotiations. Rust’s ownership model ensures we never face race conditions or segmentation faults during complex state mutations.
  • Type System as Contract: We leverage Rust's Affine Types to model linear state transitions—an intent cannot be "executed" twice; the type system physically prevents it.

2.2 Performance

  • Zero-Cost Abstractions: The Planner module uses complex heuristic search algorithms. Rust allows us to implement high-level abstractions for these algorithms without the runtime penalty of Garbage Collection.
  • Async Runtime: Built on top of tokio, Orpheon handles massive concurrency (100k+ active intents) with minimal overhead, critical for high-frequency negotiation environments.

2.3 WASM Portability

  • Edge Planning: The Orpheon Planner (written in Rust) compiles to WebAssembly (WASM), allowing clients to run "pre-flight" simulations in the browser or on edge devices before submitting intents to the mesh.

3. Core Primitives (The Rust Type System)

The Protocol is defined by its data structures. Below are the canonical Rust definitions for the core primitives.

3.1 The Intent (Intent<T>)

An Intent is a declaration of a desired future state. It is immutable once signed.

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Intent {
    pub id: Uuid,
    /// The semantic type of the intent (e.g., "fulfill_order", "book_flight")
    pub kind: String,
    
    /// Hard constraints that MUST be met.
    pub constraints: Vec<Constraint>,
    
    /// Optimization preferences (e.g., Minimize Cost vs Minimize Latency).
    pub preferences: Vec<Preference>,
    
    /// The budget allowed for this execution (Time + Money).
    pub budget: Budget,
    
    /// The temporal window in which this intent is valid.
    pub validity_window: TimeWindow,
    
    /// Cryptographic signature of the issuer.
    pub signature: Signature,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum Constraint {
    /// E.g. "region == 'US-EAST'"
    StateMatch(String),
    /// E.g. "total_cost < 5.00"
    ResourceLimit { resource: String, limit: f64 },
    /// E.g. "latency < 200ms"
    SLA { metric: String, threshold: u64 },
}

3.2 The Plan (Plan)

A Plan is a directed acyclic graph (DAG) of steps generated by the Planner to satisfy an Intent.

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Plan {
    pub intent_id: Uuid,
    pub steps: Vec<Step>,
    pub estimated_cost: f64,
    pub estimated_latency_ms: u64,
    pub confidence_score: f32, // 0.0 to 1.0
    pub strategy: PlanningStrategy,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum PlanningStrategy {
    Deterministic, // Rule-based
    Heuristic,     // A* search / optimization
    Generative,    // LLM/AI-driven
}

3.3 The Execution Artifact (Artifact)

Orpheon provides "Proof of Outcome". When an intent is finalized, an immutable artifact is generated.

#[derive(Serialize, Deserialize, Debug)]
pub struct ExecutionArtifact {
    pub intent: Intent,
    pub final_plan: Plan,
    pub trace: Vec<ExecutionEvent>,
    pub outcome: Outcome,
    pub timestamp: DateTime<Utc>,
    /// Merkle root of the execution trace for verifiable logging
    pub merkle_root: String,
}

4. The Architecture

The Orpheon Node is a modular system composed of four engines.

graph TD
    Client -->|Submits Intent| Ingress
    Ingress --> Engine
    
    subgraph Orpheon Node
        Engine[Engine Core]
        Planner[Planner (Heuristic/AI)]
        Neg[Negotiation Module]
        State[Temporal State Store]
        
        Engine -->|Requests Plan| Planner
        Planner -->|Reads State| State
        Planner -->|Returns Plan| Engine
        
        Engine -->|Proposes Contract| Neg
        Neg <-->|Bidirectional Stream| Client
        
        Engine -->|Executes| Executors
    end
    
    Executors -->|Updates| State
    State -->|Push Changes| Client
Loading

4.1 The Planner

  • Role: Determines how to fulfill an intent.
  • Logic:
    1. Receives Intent.
    2. Simulates potential execution paths against the Temporal State Store.
    3. Prunes paths that violate Constraints.
    4. Ranks paths based on Preferences.
    5. Returns the optimal Plan.

4.2 The Negotiation Module

  • Role: Handles the dynamic agreement between Client and Server.
  • Transport: WebSocket / QUIC.
  • Protocol:
    1. Server offers a Plan with cost X and SLA Y.
    2. Client counter-offers (e.g., "I need it cheaper, I can wait longer").
    3. Server re-optimizes and accepts/rejects.

4.3 The Temporal State Store

  • Role: A time-travel capable database.
  • Features:
    • Append-Only: No data is ever overwritten.
    • branching: Simulations run on "forks" of the state tree.
    • Subscribable: Supports complex boolean watch expressions (SEL - State Expression Language).

5. Advanced Features

5.1 Speculative Execution (Time Travel)

Orpheon allows clients to query the future.

Usage:

orp --intent "scale_cluster" --simulate --time "2025-12-01"

How it works:

  1. The State Store creates a "Copy-on-Write" fork of the current state.
  2. The Planner executes the intent against this virtual state.
  3. The resulting state changes and side effects are returned as a SimulationReport.
  4. No actual resources are consumed.

5.2 Recursive Intents (Atomic Composability)

An intent can spawn child intents. This allows for fractal complexity handling.

  • Parent Intent: Organize Conference
    • Child Intent A: Book Venue
    • Child Intent B: Order Catering
    • Child Intent C: Notify Speakers

If Child Intent B fails (no food available), the Parent Intent fails, and Child Intent A (Booking) is automatically rolled back (via compensation logic) by the Protocol.

5.3 Zero-Knowledge Auditing

For enterprise/privacy use cases, Orpheon supports ZK-proofs.

  • A client can verify that a plan executed correctly and met all constraints without seeing the underlying data or sensitive internal steps.

5.4 Federated Execution (The Mesh)

Multiple Orpheon Nodes can form a mesh.

  • If Node A cannot fulfill an Intent (due to load or lack of capability), it can subcontract the Intent to Node B.
  • The Client interacts only with Node A; the complexity of the mesh is abstracted.

9. The Capability Matrix (100+ Features)

Orpheon is built to be the "Operating System" for Autonomous Agents. Its feature set spans cognition, networking, security, and economics.

🧠 The Cognitive Sphere (Planning & AI)

  1. Recursive Sub-Intents: Fractal decomposition of complex goals.
  2. Probabilistic Plan Branching: Monte-Carlo tree search for best outcomes.
  3. Just-In-Time (JIT) Compilation: Compiles plans to WASM for speed.
  4. Heuristic Pruning: A* variants for pathfinding in state space.
  5. Multi-Objective Pareto Optimization: Balances cost/speed/quality.
  6. Feedback-Loop Learning: System learns from past plan failures.
  7. Human-in-the-Loop Interruption: Pause execution for manual approval.
  8. Atomic Rollback Directives: Granular undo steps for every action.
  9. Plan Memoization: Caches successful plans for similar intents.
  10. Dynamic Constraint Relaxation: Soften constraints if no hard path exists.
  11. Parallel Plan Speculation: Race multiple strategies and pick the winner.
  12. Deadlock Detection: Graph-cycle analysis for resource locks.
  13. Resource Starvation Prevention: Fair scheduling algorithms.
  14. Hot-Swappable Strategies: Change from "Cheap" to "Fast" mid-flight.
  15. LLM Intuition Layer: Uses LLMs to guess likely successful paths.
  16. Counterfactual Reasoning: "What if" analysis for debugging.
  17. Sentiment-Aware Negotiation: Adapts to client "urgency" signals.
  18. Semantic Plan Search: Find plans by meaning, not just ID.
  19. Adversarial Hardening: Red-teaming the planner against bad inputs.
  20. Model Distillation: Edge nodes run tiny, distilled planner models.

🌐 The Network Sphere (Distribution)

  1. P2P Gossip Protocol: Fast state propagation across the mesh.
  2. Federated Mesh: Nodes subcontract work to other nodes.
  3. CRDT State Merging: Conflict-free data synchronization.
  4. Geofenced Zones: Restrict execution to specific legal jurisdictions.
  5. Latency-Aware Routing: Direct intents to the closest capable node.
  6. Disruption Tolerant (DTN): Queues intents when offline, syncs later.
  7. Edge Offloading: Pushes computation to client devices.
  8. QUIC Transport: Multiplexed, low-latency streams over UDP.
  9. Multi-Path Routing: Use redundant paths for reliability.
  10. DHT Service Discovery: Decentralized finding of capability providers.
  11. Partition Healing: Auto-recovers from network splits.
  12. Leaderless Finality: Consensus without single points of failure.
  13. Backpressure Signaling: Slows down clients when overloaded.
  14. Tenant Rate Limiting: Token-bucket fairness per API key.
  15. Distributed Tracing: OpenTelemetry spanning across the entire mesh.

🛡️ The Trust Sphere (Security & Privacy)

  1. Zero-Knowledge Proofs: Verify execution without revealing data.
  2. Homomorphic Encryption: Compute on encrypted state (experimental).
  3. Macaroon Tokens: Caveat-based authorization (e.g., "valid for 5 mins").
  4. Quantum-Resistant Sig: Dilithium/Kyber algorithm support.
  5. TEE Enclaves: Run sensitive plans in Intel SGX/AMD SEV.
  6. Immutable Audit Ledger: Merkle-chain of all actions.
  7. Replay Protection: Nonce + Timestamp windows.
  8. Formal Verification: Mathematical proof of plan safety.
  9. Dynamic Scopes: Permissions that shrink as execution proceeds.
  10. Tor Integration: Anonymous intent submission.
  11. Multi-Sig Approvals: Requiring 2-of-3 keys for critical intents.
  12. Behavioral Anomaly AI: Detects "weird" intent patterns.
  13. Wasm Sandboxing: Plugins run in strict isolation.
  14. Side-Channel Mitigation: Constant-time execution paths.
  15. Supply Chain Auth: Signed binaries for all plugins.

💾 The Temporal Sphere (Data & State)

  1. Time-Travel Querying: SELECT * FROM state AS OF 2024.
  2. Content-Addressable Storage: Artifacts hashed like IPOFS.
  3. Differential Compression: Stores only state deltas.
  4. Ephemeral Tiers: RAM-only state for high speed.
  5. Durable Tiers: NVMe/S3 state for long retention.
  6. Cross-Shard Atomicity: ACID transactions across nodes.
  7. Vector State Embeddings: Search state by semantic meaning.
  8. Graph Relations: Knowledge-graph style state linking.
  9. Event Sourcing: Reconstruct state from zero by replaying events.
  10. Schema Evolution: Hot-upgrade of data structures.
  11. JQ Subscription Filter: Complex boolean logic for streams.
  12. Copy-on-Write Snapshots: Cheap branching.
  13. Data Sovereignty: Pin state to specific physical drives.
  14. Erasure Coding: RAID-like redundancy across nodes.
  15. GDPR 'Right to Forget': Crypto-shredding key deletion.

💰 The Economic Sphere (Markets)

  1. Micropayment Channels: Streaming money for streaming APIs.
  2. Dynamic Congestion Pricing: Uber-style surge pricing for compute.
  3. Resource Bonding Curves: Price changes based on supply.
  4. Computational Futures: Buy "compute credits" for next month.
  5. Execution Insurance: Payouts if SLAs are missed.
  6. Arbitrage Detection: Finds cheapest path across providers.
  7. Tokenized Quotas: Tradeable API limits.
  8. Spot Markets: Bid on spare capacity.
  9. Carbon-Aware Scheduling: Execute when grid energy is green.
  10. Stablecoin Settlement: Native USDC/USDT support.

🛠️ The Developer Sphere (DX)

  1. Visual Plan Debugger: Step-through replay of execution.
  2. Time-Slider UI: Scrub back and forth in system history.
  3. Intent Standard Library: std::intent::* for common tasks.
  4. Rust Macro DSL: intent! { do X where Y }.
  5. TS Type Gen: Auto-generate TypeScript interfaces.
  6. CLI Simulator: Run the full stack locally.
  7. LSP Server: IDE autocompletion for Intent files.
  8. Chaos Injection: Randomly fail steps to test robustness.
  9. Live Log Tailing: WebSocket stream of planner logs.
  10. Hot-Reload Plugins: Update logic without restarts.
  11. Mock Mode: Fake external API responses.
  12. Interactive Docs: Try intents directly in documentation.
  13. Scaffold Generator: orpheon new project_name.
  14. Github Action: CI/CD integration for Intent validation.
  15. Canary Deployments: Rollout plans to 1% of users.

⚡ The Hardware Sphere (Low Level)

  1. FPGA Acceleration: Offload A* search to hardware.
  2. DPDK Networking: Bypass OS kernel for speed.
  3. RTOS Support: Run on real-time embedded systems.
  4. Satellite Optimization: Protocol handles high-latency links.
  5. Acoustic Link Support: For underwater/subterranean use.
  6. IPFS Bridges: Fetch resources from decentralized storage.
  7. BCI Triggers: (Experimental) Intent via Brain-Computer Interface.
  8. Biometric Signing: Use FaceID/TouchID keys.
  9. AR Overlay: Visualize drone paths / robot intents.
  10. Entropy Beacons: True hardware randomness sources.
  11. Dead Man's Switch: Auto-execute if keepalive fails.

7. Comparison Overview (Updated)

Feature REST / OpenAPI GraphQL Orpheon Protocol
Primary Unit Resource Endpoint Data Query Intent
Responsibility Client (Do this, then that) Client (Fetch this) Server (Plan & Execute)
State Polling / Webhooks Subscription (limited) Real-time State Sync
Time Instantaneous Instantaneous Temporal (Past/Future)
Failure Exception / Error Code Error Field Compensation / Rollback
Typing JSON Schema Schema Language Rust Type System
AI Ready? No (Too granular) No (Data only) Native (Outcome based)

8. Implementation Roadmap

Phase 1: Core (Current)

  • Rust SDK (orpheon-sdk)
  • Basic Planner (A* implementation)
  • In-Memory State Store
  • Spec: Intent definition v1.0

Phase 2: Distribution

  • Persistent storage (Postgres/Sled backend)
  • P2P Negotiation Protocol
  • WASM Planner compilation

Phase 3: Ecosystem

  • Language bindings (Rust, TypeScript)
  • "Orpheon Studio" (Visual debugger)
  • Standard Intent Library (Common tasks)

Built with 🦀 Rust. Designed for the Autonomous Future.