Skip to content

Minimal Adapter Example

Overview

This is the smallest useful adapter shape in Forge.

It does not call primitives.

It exists only to:

  • accept external input
  • validate it
  • normalize it
  • return a Forge-ready structure

This is a valid adapter.


When To Use This Pattern

Use a minimal adapter when the job is:

  • ingestion
  • validation
  • normalization
  • output shaping
  • ecosystem translation

This pattern is ideal when no canonical compute is needed.


Lifecycle

text
Input → Validate → Transform → Output

Example Use Case

A client submits a portfolio payload in an external format.

The adapter:

  • validates required fields
  • normalizes positions
  • standardizes field names
  • emits a canonical internal envelope

No primitive is called.


Example Flow

text
External JSON

portfolio-ingest adapter

normalized portfolio envelope

Example Request

json
{
  "portfolio_id": "PF-001",
  "as_of": "2026-04-05T12:00:00Z",
  "source_mode": "json",
  "portfolio": {
    "positions": [
      {
        "asset_id": "AAPL",
        "asset_type": "equity",
        "quantity": 100,
        "price": 210.5,
        "currency": "USD",
        "direction": "long"
      },
      {
        "asset_id": "UST-10Y",
        "asset_type": "bond",
        "notional": 250000,
        "yield": 0.042,
        "duration": 7.8,
        "currency": "USD"
      }
    ]
  },
  "macro": {
    "regime": "tightening"
  }
}

Example Response

json
{
  "adapter_name": "portfolio-ingest",
  "adapter_version": "1.0.0",
  "normalized_portfolio": {
    "portfolio_id": "PF-001",
    "as_of": "2026-04-05T12:00:00Z",
    "positions": [
      {
        "node_id": "AAPL",
        "asset_type": "equity",
        "exposure": {
          "quantity": 100,
          "price": 210.5,
          "market_value": 21050,
          "currency": "USD"
        },
        "risk_traits": {
          "directionality": "long"
        }
      },
      {
        "node_id": "UST-10Y",
        "asset_type": "bond",
        "exposure": {
          "notional": 250000,
          "yield": 0.042,
          "duration": 7.8,
          "currency": "USD"
        },
        "risk_traits": {
          "directionality": "long",
          "rate_sensitive": true
        }
      }
    ],
    "macro_context": {
      "regime": "tightening"
    }
  },
  "validation": {
    "ok": true,
    "warnings": []
  }
}

Minimal Shape

A minimal adapter usually contains:

  • input contract
  • validator
  • transformer
  • output contract

It does not need:

  • execution planner
  • primitive request builder
  • execution aggregator

Pseudocode

text
receive input
validate input
normalize input
return normalized output

Why This Matters

This example proves an important Forge rule:

An adapter does not need to execute compute to be valid.

Adapters are boundary systems.

Some boundaries only shape state.

That is enough.


Invariants Satisfied

This pattern preserves all key invariants:

  • no hidden compute
  • no primitive semantic override
  • clear boundary
  • explicit non-compute role

Mental Model

This adapter prepares the world for Forge.

It does not become Forge.


Next