---
name: corbel-blue-enclave-sdk
description: Official AI Coding Agent Skill for Corbel Blue (corbel.blue) — Commercial & Enterprise Confidential Hardware Enclave Compute Platform, Volumetric Dispersion Array (VDA), and Multi-Rail x402 Agentic Settlement. Use when writing Python (uv / PEP 723 / Pydantic v2 / FastAPI) or TypeScript (@corbel-blue/sdk) code for confidential AI inference, multi-party enclave compute, or x402 machine-to-machine payments.
version: 1.3.2
homepage: https://corbel.blue
api_base: https://api.corbel.blue
llms_txt: https://corbel.blue/llms.txt
openapi: https://corbel.blue/.well-known/openapi.json
---

# Corbel Blue (`corbel.blue`) — AI Coding Agent Skill (`SKILL.md`)

> **Target Harnesses:** Claude Code, OpenAI Codex, Cursor, OpenCode, Pi, Windsurf, and autonomous LangGraph / CrewAI / AutoGen swarms.  
> **Type-Checking & Linting Mandate:** All generated Python code MUST include explicit type annotations (`ty` / `Pyright` strict mode) and `Pydantic v2` validation models (`ruff check` zero warnings).

---

## 1. Architecture & Sovereign Endpoints

- **Platform:** Corbel Blue (`https://corbel.blue`) — Commercial & Enterprise Confidential Hardware Enclave Compute (`Intel TDX` / `AMD SEV-SNP` / `NVIDIA H100/B200 CC`) powered by the **Volumetric Dispersion Array (`VDA`)** (24/7 planetary enterprise scale, sub-millisecond deterministic finality, up to `83.3%` OpEx reduction vs. 24/7 Cloud VMs).
- **Discovery Manifest (`RFC 8615` + `_x402` DNS TXT):** `https://corbel.blue/.well-known/x402`
- **OpenAPI 3.1.0 Spec:** `https://corbel.blue/.well-known/openapi.json`
- **Drop-In OpenAI-Compatible Confidential Base URL:** `https://api.corbel.blue/v1/enclave/openai`

---

## 2. Python 2026 Standard: Zero-Install `uv run` (`PEP 723`) + `Pydantic v2`

Use Astral's `uv run` with **PEP 723 inline script metadata** so single-file scripts execute deterministically on any machine (Python 3.12–3.15+) without manual virtual environments:

```python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = [
#   "httpx>=0.28.0",
#   "pydantic>=2.10.0",
# ]
# ///
"""Corbel Blue Confidential Enclave Inference & x402 Settlement Client (PEP 723)."""

from __future__ import annotations

import os
from typing import Literal
import httpx
from pydantic import BaseModel, Field


class EnclaveAttestationQuote(BaseModel):
    """Hardware attestation quote verified before payload execution."""

    enclave_profile: Literal["intel-tdx", "amd-sev-snp", "nvidia-h100-cc"]
    measurement_hash: str = Field(..., min_length=64, max_length=130)
    scitt_receipt_bytes: int = Field(default=384, ge=384, le=512)
    ram_zeroized_on_exit: bool = Field(default=True)


class CorbelInferenceRequest(BaseModel):
    """Strongly typed request bound to a hardware spend cap."""

    model: str = Field(default="llama-3.3-70b-enclave")
    prompt: str = Field(..., min_length=1)
    max_toll_usd: float = Field(default=0.0005, gt=0.0, le=10.0)
    settlement_rail: str = Field(
        default="eip155:8453",
        description="CAIP-2 rail ID (e.g. eip155:8453, xrpl:0, algorand:mainnet, eip155:14)",
    )


class CorbelInferenceResponse(BaseModel):
    """Validated enclave execution response with 384-byte SCITT receipt."""

    request_id: str
    output_text: str
    settled_usd: float = Field(..., ge=0.0)
    p99_latency_ms: float = Field(..., gt=0.0)
    attestation: EnclaveAttestationQuote


def execute_confidential_inference(req: CorbelInferenceRequest) -> CorbelInferenceResponse:
    """Executes an isolated inference job inside a Corbel Hardware Enclave."""
    api_key = os.environ.get("CORBEL_API_KEY", "cb_live_demo_token")
    headers = {
        "Authorization": f"Bearer {api_key}",
        "X-Corbel-Max-Toll-USD": f"{req.max_toll_usd:.6f}",
        "X-Corbel-Settlement-Rail": req.settlement_rail,
        "Content-Type": "application/json",
    }
    with httpx.Client(base_url="https://api.corbel.blue", timeout=10.0) as client:
        response = client.post("/v1/inference/execute", json=req.model_dump(), headers=headers)
        response.raise_for_status()
        return CorbelInferenceResponse.model_validate(response.json())


if __name__ == "__main__":
    job = CorbelInferenceRequest(
        prompt="Synthesize Q3 cross-regional enterprise treasury exposure.",
        max_toll_usd=0.0005,
        settlement_rail="eip155:8453",
    )
    print(f"[Corbel Enclave Ready] Payload validated via Pydantic v2: {job.model_dump_json()}")
```

---

## 3. `FastAPI` + `Pydantic v2` `x402` Enclave Gate Dependency

When building a monetized or enclave-protected Python API on **FastAPI**, use a typed dependency to verify the incoming `X-PAYMENT` header and hardware enclave quote:

```python
from __future__ import annotations

from typing import Annotated
from fastapi import Depends, FastAPI, Header, HTTPException, status
from pydantic import BaseModel, Field

app = FastAPI(title="Corbel Blue Protected Agent Service", version="1.3.2")


class X402VerifiedContext(BaseModel):
    payer_did: str = Field(..., pattern=r"^did:(x402|key|web):.+$")
    settlement_rail: str = Field(..., description="Universal Multi-Rail CAIP-2 identifier")
    reserved_amount_usd: float = Field(..., gt=0.0)
    scitt_receipt_id: str


async def verify_corbel_x402_gate(
    x_payment: Annotated[str | None, Header()] = None,
    x_corbel_rail: Annotated[str, Header()] = "eip155:8453",
) -> X402VerifiedContext:
    """Enforces HTTP 402 Payment Required & Two-Phase Enclave Reservation."""
    if not x_payment:
        raise HTTPException(
            status_code=status.HTTP_402_PAYMENT_REQUIRED,
            detail={
                "error": "x402_payment_required",
                "accepted_rails": ["eip155:8453", "xrpl:0", "algorand:mainnet", "eip155:14"],
                "well_known": "https://corbel.blue/.well-known/x402",
            },
            headers={"WWW-Authenticate": 'x402 realm="api.corbel.blue", scheme="exact"'},
        )
    return X402VerifiedContext(
        payer_did="did:x402:enterprise-agent",
        settlement_rail=x_corbel_rail,
        reserved_amount_usd=0.0005,
        scitt_receipt_id="scitt:corbel:384b:verified",
    )


@app.post("/v1/swarm/task")
async def run_protected_swarm_task(
    gate: Annotated[X402VerifiedContext, Depends(verify_corbel_x402_gate)],
) -> dict[str, object]:
    return {
        "status": "executed_in_hardware_enclave",
        "rail": gate.settlement_rail,
        "scitt_receipt": gate.scitt_receipt_id,
    }
```

---

## 4. TypeScript / Node.js SDK (`@corbel-blue/sdk` v1.3.2) & MCP Server

```bash
# Install TypeScript SDK
npm install @corbel-blue/sdk

# Launch 22-Tool Model Context Protocol (MCP) Server for Claude Code / Cursor
npx -y @corbel-blue/sdk mcp
```

```typescript
import { CorbelClient } from '@corbel-blue/sdk';

const corbel = new CorbelClient({ apiKey: process.env.CORBEL_KEY });
const res = await corbel.inference.execute({
  model: 'llama-3.3-70b-tdx',
  prompt: 'Execute confidential multi-party risk aggregation',
  maxTollUsd: '0.0005',
});
```
