Documentation v 1.0.1 July 2026

The operating system for autonomous onchain agents.

fold. gives agents the layer beneath reasoning: identity, payments, budgets, tools, gasless execution, transparency, and a runtime that persists after the human closes the tab.

Authors: Fold Computer LLC Status: technical docs draft Network: Base mainnet
24 paid endpoints live /exec marketplace service tref audit pending browser-native kernel

§1Introduction

Agents do not fail because they cannot think. They fail because they cannot live: they cannot pay, cannot hold gas, cannot access gated tools, cannot enforce budgets, and cannot persist as a process.

fold. is an operating system for autonomous onchain agents. The word operating system is literal: fold treats agents as first-class processes with resources, identity, permissions, budgets, and system calls. A human does not repeatedly prompt an agent; the human briefs it, fences it, funds it, and deploys it.

The earlier fold product was narrower: a deployment surface for trading agents. That first system taught the core lesson. A trading agent did not merely need a better prompt. It needed a wallet, scoped signing rights, budget enforcement, paid information, gas abstraction, and a transparent audit trail. The OS version of fold generalizes that stack beyond trading.

The thesis

The thesis is narrow and falsifiable: an agent economy does not emerge from larger models alone. It emerges when agents can buy what they need, act without human-funded gas, and operate inside constraints that are enforced below the prompt.

  1. Reasoning is not enough. A perfect model still dies at a 402 Payment Required response it cannot pay.
  2. Autonomy requires infrastructure. Wallets, budgets, tools, gas, and settlement are not accessories. They are the living conditions of an agent.
  3. Safety belongs below the model. A mandate must bind at runtime and signing boundaries, not merely as text in a system prompt.

What fold is

fold is composed of four layers, shipped in risk order rather than narrative order.

LayerStatusPurpose
Paid service layerlive24 x402-paid endpoints for trading intelligence, LLM inference, search, extraction, RPC, prediction markets, and market data.
Execution layerliveFlat-fee /exec endpoint so external agents can buy search, RPC, and prediction results for 0.01 USDT per paid call.
Kernel and shellin developmentBrowser desktop where wallets, tools, apps, and resident agents are windows and processes.
tref deploymenttestnet · audit pendingPlain-language brief → ERC-4337 smart account → session-scoped key → mandate-enforced running agent.

Design principles

Operating principle

Deploy, don’t prompt. An agent is a durable process with an identity and a lifespan, not a conversation pinned to a tab.

PrincipleMeaning
Mandate as contractThe human writes the objective, constraints, budgets, and stop conditions. fold compiles them into enforceable policy.
Machines pay like machinesOne HTTP 402 challenge, one signed payment, one result. No account dashboard, no card, no subscription gate.
Draw the fenceThe human defines the boundary. The agent optimizes freely inside it and cannot sign outside it.
Show the workEvery material decision carries rationale, confidence, information spend, cumulative spend, and references.

§2The agent as process

A fold agent is not a chatbot plus wallet. It is a process with a security principal, a private state, tools, resource limits, and a lifecycle.

An agent is represented as:

$$A = (w, M, \pi, \sigma, T)$$
Agent tuple · wallet, mandate, policy, state, tools

where w is the wallet, M is the mandate, π is the model-driven policy, σ is mutable private state, and T is the set of priced tools the agent can call.

Resource semantics

Every action has a cost vector. Paid tool calls have a fee. Onchain transactions transfer value. Gas is accounted separately because fold can sponsor gas through the execution layer.

$$S(e{:}n)=\sum_{m=0}^{n}\big(c(a_m)+v^+(a_m)\big),\qquad v^+(a)=\max(v(a),0)$$
Cumulative spend · fees plus value transferred out
$$G(e{:}n)=\sum_{m=0}^{n}g(a_m)$$
Gas exposure · platform-side under sponsorship

This separation matters. If an agent must hold ETH to act, it inherits a liveness dependency on a human. If the platform sponsors gas and prices it into fees, the agent can act from a wallet that has never held the native token.

§3The mandate

The mandate is the central abstraction of fold. A human writes what the agent should do, how it should behave, and what it must never do. fold compiles that into an enforced envelope.

$$M=(O,C,B,H)$$
Mandate · objective, constraints, budgets, halts
FieldMeaningExample
OObjective: bounded utility functional the agent maximizes.Find profitable Base opportunities while minimizing drawdown.
CHard constraints: predicates over proposed actions and current state.Only Base spot; no token younger than 30 days; no unknown contracts.
BBudget triple: per-transaction, per-day, lifetime spend ceilings.25 USDC per trade, 100 USDC per day, 1000 USDC lifetime.
HHalt conditions: deadlines, drawdown floors, kill switches.Stop on August 1 or after 20% drawdown.

Three enforcement rings

Prompt-only guardrails are not guardrails. fold enforces the mandate in three concentric rings.

RingLocusMechanismSurvives
R3PolicyMandate text in model context.Advisory only.
R2RuntimePre-flight check before dispatch.Model ignores instructions.
R1ChainSession-key policy: signable set ⊆ admissible set.Runtime compromise.
Budget safety

If every value-bearing action requires a session-key signature whose policy enforces the mandate budget at validation time, then cumulative spend cannot exceed the lifetime budget even if the model is adversarial.

From brief to policy

The brief compiler has three stages:

  1. Elicitation. Natural-language brief is converted into candidate objectives, constraints, budgets, and halts. Ambiguity is legal only here.
  2. Normalization. Confirmed components become a canonical schema: typed predicates, integer budgets, timestamps, thresholds.
  3. Projection. The schema is projected into prompt text, runtime checks, and the enforceable subset encoded into session-key policy.
// Normalized mandate sketch
{
  "objective": { "kind": "bounded_utility", "goal": "research and act inside constraints" },
  "constraints": [
    { "type": "allowlist", "field": "chain", "values": ["base"] },
    { "type": "deny", "field": "unknown_contract" }
  ],
  "budget": { "perTx": "25e6", "daily": "100e6", "lifetime": "1000e6" },
  "halts": { "deadline": "2026-08-01T00:00:00Z", "drawdownPct": 20 }
}

§4x402 payment layer

Payments are the circulatory system of the agent economy. x402 lets a machine buy one unit of computation or data with one signed payment.

The exchange is intentionally small:

StepActorAction
1ClientPOSTs to a paid endpoint without payment.
2ServerReturns 402 Payment Required with a machine-readable challenge.
3ClientSigns an authorization for the exact challenged amount.
4ClientRetries the same request with an X-PAYMENT header.
5ServerValidates the request before settlement.
6ServerSettles onchain and executes the request.
7ServerReturns result plus settlement reference.
Validate before settle

A malformed request is rejected with 400 before any value moves. The payer loses a round trip, not a fee.

Deployed service surface

The service layer exposes endpoints across trading intelligence, inference, search, extraction, chain access, prediction markets, and market data.

FamilyRepresentative endpointsSchemePrice
Trading intelligence/signal, /scan, /setups, /divergence, /funding-scanupto≤ 0.02 USD
Indicators/indicators, /levels, /snapshotexact0.005 USD
LLM inference/llm + model routesupto0.0005–2.00 USD
Search/searchexact0.007 USD
Extraction/extract, /read, /structureexact0.002–0.005 USD
RPC/rpc across Base, Ethereum, Arbitrum, Optimism, Polygonexact0.001 USD
Prediction markets/predictionexact0.002 USD
Market data/token-price, /trending, /holders, /pools, /yieldexact0.001–0.005 USD

Permit2 self-settlement

For assets without native authorization transfer, fold uses Uniswap Permit2 signature transfer. The payer signs a permit binding token, amount, nonce, deadline, spender, and witness. The settlement signer redeems it; the identity wallet receives value.

$$p \xrightarrow[\text{redeemed by }s]{\text{Permit2}} r$$
payer p · settlement signer s · payee identity wallet r

The separation between settlement signer and identity wallet limits operational risk. The signer can redeem a valid permit, but cannot enlarge it, replay it, redirect it, or move funds outside the signed constraints.

§5The /exec endpoint

/exec is the smallest complete instance of fold: a service an external agent can discover, price, pay, and consume in one loop.

The endpoint charges a flat 0.01 USDT per paid call and supports three tools whose marginal cost remains below the flat fee.

ToolInputOutput
search{ query }Web/news results: title, URL, date, highlights.
rpc{ chain, method, params }Read-only JSON-RPC result for supported EVM chains.
prediction{ query, limit }Prediction market questions, outcomes, prices, and volume.
// /exec request body
{
  "tool": "search",
  "params": {
    "query": "Base agents using x402 payments"
  }
}

Server-side handling

1  if payment header is absent:
2      return 402 + challenge(0.01 USDT, payee, settlementSigner, nonce, deadline)
3  if tool is unsupported:
4      return 400 + supportedTools       // never charged
5  if params are invalid:
6      return 400 + reason               // never charged
7  settle payment
8  dispatch in process
9  return 200 + result + settlement reference

§6Gasless execution

Gas is death one for autonomous agents. fold moves gas from the agent's liveness path onto the platform's execution layer.

Agent transactions can be submitted as ERC-4337 user operations. The smart account validates the signature and the session-key policy; the paymaster sponsors gas subject to its own policy. The agent does not need the native token.

$$E[\text{sponsor cost per op}] = E[g(u)] \cdot E[\text{gasPrice}] \cdot P_{ETH}$$
Sponsor exposure · measured and priced by the platform

The strategic value of gaslessness is not merely cost reduction. It removes the human operation of funding a wallet with native gas before an agent can act.

§7Economics of autonomous agents

An autonomous agent must survive three deaths before it can earn: gas, data, and tools. Each failure is infrastructural, not intellectual.

$$p_{\text{convert}} = \prod_{i \in \{gas,data,tools\}} p_i$$
Survival probability · multiplicative failure modes

If each subsystem is 70% available, conversion is only about 34%. An OS raises each factor architecturally: sponsorship for gas, x402 for paid data, and unified tools for execution.

Value of information

Agents should buy information when it changes decisions enough to exceed its cost.

$$\text{buy} \Longleftrightarrow VoI(q,\theta) > c$$
Information purchase rule

In the symmetric case, the minimum decision stake is:

$$V^* = \frac{2c}{2q-1}$$
Minimum rational stake above which data purchase pays
Priceq=.55q=.60q=.65q=.75q=.90
0.001 rpc0.020.010.0070.0040.003
0.002 prediction0.040.020.0130.0080.005
0.007 search0.140.070.0470.0280.018
0.010 exec0.200.100.0670.0400.025
0.020 signal0.400.200.1330.0800.050

Agent unit economics

$$\Pi_A = \lambda p_{\text{convert}}(\mu-\phi)-\lambda d$$
Agent profit rate · conversions less tool and information spend

The platform's job is to make everything except judgment cheap enough that judgment is what gets tested. If infrastructure drag dominates the equation, the agent economy never starts.

Marketplace dynamics

Flat pricing is not an aesthetic choice. A buyer agent comparing services must parse the price before it evaluates quality. A single flat number reduces evaluation cost and increases discoverability. This is why /exec uses one price even though its tools have different marginal costs.

§8The fold kernel

The kernel is a computer you walk into: a browser desktop where humans and agents share the same tools through different surfaces.

human · browser desktop · LLM shell apps wallet · llm · search · signal · markets · rpc · x402 · swap · deploy agent runtime mandates · scheduler · decision records · resident processes x402 payment driver exact / upto · Permit2 self-settle · service storefront
Figure 8.1 · Humans and agents enter at different layers but exit through the same payment driver and chain.

Application surface

AppBacks ontoStatus
walletBase account, balances, transferlive service-backed
llm/llm model routeslive service-backed
search/search + /extractlive service-backed
signaltrading intelligence familylive service-backed
marketstoken price, trending, poolslive service-backed
rpc/rpc, five EVM chainslive service-backed
x402service storefront + terminallive service-backed
agentsregistry, status, budgetsgated on tref
deploytref pipelinegated on tref
consoledecision-record streamsgated on tref

The GUI and the API are views of one system. Every capability a human can click, an agent can call, subject to the same mandate and payment rules.

§9tref deployment

tref is the path from a plain-language brief to a running, funded, mandate-fenced agent.

// tref deployment pipeline
1. elicit and confirm brief β into (O, C, B, H)
2. deploy ERC-4337 smart account w
3. issue session key k with policy projection of (C, B, H)
4. register (w, k, hash(M)) onchain
5. transfer funding F from principal wallet to agent wallet
6. start runtime process π with (w, k, M)
7. begin append-only decision-record stream
Production status

tref is specified and testnet-backed, but mainnet deployment is gated on independent audit. No unaudited contract should custody user value.

Threat model

IDThreatMitigationResidual
T1Compromised or adversarial policyR1 caps spend and targets.Bounded bad trades.
T2Compromised runtime hostR1 unchanged; keys never leave signer boundary.Bounded as T1.
T3Session key exfiltrationPolicy travels with key; caps and expiry bind.Bounded until expiry.
T4Malicious paid serviceExact payment bounds loss to per-call fee; reputation handles repeats.Fee per call.
T5Settlement signer compromiseSigner cannot redirect payee.Service disruption.
T6Bad judgment inside fenceTransparency and intervention.Mandate-bounded loss.
T7Contract bugsAudit before mainnet funds.Unknown until audit.

§10Transparency

Autonomy without legibility is a liability. fold agents emit decision records so humans can read the machine’s work.

$$D_n=(n,a_n,rationale_n,\gamma_n,d_n,S(e{:}n),refs_n)$$
Decision record · action, rationale, confidence, spend, references
{
  "n": 421,
  "ts": "2026-07-08T18:42:10Z",
  "action": { "kind": "call", "endpoint": "/search" },
  "rationale": "Need current market context before deciding.",
  "confidence": 0.74,
  "informationSpend": [
    { "endpoint": "/search", "cost": "0.007e6", "settlement": "0x..." }
  ],
  "cumulativeSpend": "12.41e6",
  "refs": ["ipfs://..."]
}

Confidence is treated carefully. Until enough outcomes exist for calibration, confidence is stated confidence, not measured probability. The intended loop bins decisions, measures calibration error, and applies a monotone recalibration map before using confidence as an R2 gate.

§11Wire formats

The request lifecycle is small enough to model explicitly. Smallness is a property: fewer states mean fewer hidden edge cases.

StateMeaning
q0Request received; payment header presence checked.
q1402 issued with fresh challenge; no side effects.
q2Tool and parameters checked against schema.
q3400 issued; no settlement attempted.
q4Permit redemption submitted onchain.
q5Settlement failed; fresh challenge required.
q6Tool execution in progress.
q7200 served with result and settlement reference.
q8Upstream error surfaced after settlement.
No charge without validation

Settlement is reachable only after the request passes schema validation. Unknown tools and invalid parameters terminate before value moves.

§12Reference schemas

Mandate schema

{
  "version": "1.0",
  "objective": {
    "name": "bounded autonomous execution",
    "utility": "maximize task completion under constraints"
  },
  "constraints": [
    { "type": "target_allowlist", "targets": ["0xRouter..."] },
    { "type": "chain_allowlist", "chains": ["base"] }
  ],
  "budget": {
    "perTransaction": "25000000",
    "perDay": "100000000",
    "lifetime": "1000000000",
    "asset": "USDC"
  },
  "halts": {
    "deadline": "2026-08-01T00:00:00Z",
    "killSwitch": "enabled"
  }
}

402 challenge schema

{
  "scheme": "exact",
  "asset": "USDT",
  "amount": "10000",
  "payTo": "0xPayee...",
  "network": "base",
  "nonce": "0x...",
  "expiry": "2026-07-08T18:45:00Z"
}

§13Buyer-agent quickstart

A buyer agent does not create an account. It makes a request, receives a price, signs, retries, and receives the result.

// 1. Attempt request without payment.
const body = {
  tool: "prediction",
  params: { query: "Will ETH ETF inflows exceed expectations this week?", limit: 5 }
};

const r1 = await fetch("https://x402.fold.computer/exec", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(body)
});

// 2. If 402, parse challenge and sign the exact authorization.
const challenge = await r1.json();

// 3. Retry with X-PAYMENT.
const r2 = await fetch("https://x402.fold.computer/exec", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-PAYMENT": signedPayment
  },
  body: JSON.stringify(body)
});

const result = await r2.json();

§14Verification and security checklist

CheckExpected behavior
Malformed /exec callReturns 400 and no settlement occurs.
Unsupported toolReturns supported tools list; never charged.
Expired challengeSettlement fails and a fresh challenge is required.
Replay attemptNonce prevents second settlement.
Budget breachRuntime blocks at R2; session key blocks at R1 when value-bearing.
Halt flagRuntime stops dispatch; session key revocation prevents further signing.

§15Roadmap

Phases ship in order, and each phase must leave a working system behind.

PhaseScopeExit criterion
P1 · donePaid service layer24 endpoints live on mainnet; external settlements.
P2 · doneExecution + marketplace/exec live; independent marketplace review passed.
P3 · nowKernel shellDesktop and first-party apps operable end-to-end in browser.
P4 · nextKernel appsWallet, LLM shell, search, markets as windows; symmetric API.
P5tref audit & mainnetIndependent audit passed; mainnet deploys under mandates.
P6Resident economyDeployed agents buying fold services under value-of-information logic at scale.

§16Glossary

TermDefinition
AgentA policy with a wallet, a mandate, and tools; a process of the fold kernel.
MandateThe compiled envelope of permitted behavior: objective, constraints, budgets, and halts.
Ring R1Chain-level enforcement through session-key policy.
x402HTTP 402-based machine payment protocol.
Exact schemex402 settlement mode that charges the challenged amount exactly once.
Upto schemex402 mode authorizing a ceiling and settling actual metered usage up to it.
Permit2Signature-transfer standard used for self-settlement where native authorization transfer is unavailable.
PaymasterERC-4337 contract that sponsors gas for user operations.
Session keyScoped signing key whose policy encodes the enforceable projection of a mandate.
trefThe fold deployment pipeline: brief → smart account → session key → running agent.
fold. · x402 · research · manifesto v 1.0.1 · 2026