02 · System Architecture & Tech Stack

SSOT Status: Authoritative Specification

Machine Source: spec/fiderail.manifest.json (schemaVersion: 1.0.0)

Release: v2.3.5


1. Hybrid Control Plane Architecture (Option C)

FideRail separates deterministic edge enforcement from cloud-side cross-chain indexing so agents evaluate spending caps and cryptographic mandates locally in microseconds while consuming live anti-sybil reputation intelligence over HTTP or MCP:

flowchart LR
    subgraph Edge["Edge / Client Execution Layer (SDK & MCP)"]
        Mandate["Attenuated Capability Mandate<br/>Offline Ed25519 Verification"]
        Core["@fiderail/core (Protocol-Agnostic Kernel)<br/>PaymentIntent -> Mandate -> Risk -> Verdict"]
        Adapters["Protocol Adapters<br/>x402 · MCP-Pay · A2A · SessionKey"]
        LocalStore["Embedded SQLite Ledger & TTL Cache<br/>node:sqlite / Python sqlite3"]
        Wallet["Client Wallet / Session Key<br/>Private Keys Stay 100% Local"]

        Mandate --> Core
        LocalStore --> Core
        Adapters <--> Core
        Core -->|"ALLOW + QuoteDigest"| Wallet
    end

    subgraph Cloud["Cloud Intelligence Plane (api.fiderail.com)"]
        API["REST API + Streamable HTTP MCP<br/>x402#2299 Hook + Open Bazaar Grader"]
        Engine["Pluggable Trust Engine (trust-v2)<br/>Deterministic Features + Ed25519 Signed stateRoot"]
        PG[("PostgreSQL 16 (Production)<br/>Monthly Partitioned Payments · NUMERIC(78,0)")]
        Workers["4-Chain Indexer Workers<br/>Base · Solana · Arbitrum · Polygon"]

        Workers --> PG --> Engine --> API
    end

    subgraph Crypto["Cryptographic Verification Artifacts"]
        SAR["fiderail-sar-v2<br/>RFC 8785 JCS + 128-bit Salt + Causal Hash"]
        Keys["/.well-known/fiderail-keys.json<br/>Ed25519 SPKI Public Key & keyId"]
    end

    LocalStore <-->|"Cache Miss / TTL Refresh"| API
    Core -.->|"Anonymous L2 SAR Telemetry"| SAR --> API
    Engine -->|"Ed25519 Signed Merkle Root"| Keys

2. Core Architectural Components

2.1 Protocol-Agnostic Control Pipeline

@fiderail/core has zero Node-specific dependencies and executes a 4-stage deterministic pipeline:

  1. PaymentIntent: Normalized payment descriptor (intentId, taskId, chain, assetContract, amountRaw, amountUsd, payee, domain, protocol, metadataHash).
  2. AttenuatedMandateVerification: Offline verification of mandate chain signatures, expiry, revocation status, monotonic attenuation bounds, and spent totals.
  3. RiskAndIdentityEvaluation: Lookup of TrustProfile, confidence, riskLevel, riskFlags, isolated associatedCredit, and endpoint liveness diagnostics (via local TTL cache or RemoteTrustClient).
  4. DeterministicVerdictAndAttestation: Deterministic ALLOW / WARN / BLOCK verdict with explicit reason codes and cryptographic receipts (fiderail-sar-v2).

Outbound Secret Scrubber Scope: scanOutboundSecrets() in @fiderail/core is a deterministic accidental-leakage guardrail for plaintext secrets (API keys, PEM private keys, JWTs, labeled seed phrases), not an adversarial exfiltration sandbox against prompt-injection encoding or obfuscation. Never place high-privilege credentials inside LLM prompt context.

2.2 Attenuated Capability Delegation Chain

Implemented in packages/guard/src/mandate.ts and packages/core/src/policy.ts:

2.3 Deterministic Cryptographic Primitives

Implemented in packages/zk-types/src/index.ts and packages/db/src/state-root-signer.ts:


3. Repository Package Layout (v2.3.5)