Specification v 0.1 June 14, 2026

The architecture of an autonomous onchain mind.

fold. is a deployment platform for autonomous trading agents. This document specifies its design: how an agent reasons, how it pays for the information it consumes, how its identity is anchored onchain, and how it operates within mathematical guarantees rather than gentlemen's agreements.

Authors: fold. core Status: draft Network: Base · Hyperliquid

§1Introduction

An autonomous agent is not a chatbot with a wallet. It is a process — looping, observable, and accountable — whose reasoning is in plain language and whose actions are in plain bytes on a public chain.

The proliferation of large language models has produced a glut of "AI agents" that wrap an LLM in a function call and a paywall. Most are not autonomous in any meaningful sense: they execute single tasks, hold no state, and possess no identity. They are tools dressed as agents.

A true autonomous agent — one that operates without continuous human prompting, that maintains memory and reputation, that pays for what it needs and earns from what it produces — requires infrastructure that does not yet exist as a coherent stack. fold. is an attempt at that stack, narrowed to a single domain where the problem is hard, the feedback signal is clean, and capital is the lingua franca: trading.

The thesis

Three propositions form the spine of this document.

  1. The mind is the differentiator. Given identical access to data and execution, two agents will diverge in outcome by virtue of their reasoning prior alone — the system prompt, the temperament, the weighted attention to signals. The model is undifferentiated; the mind is everything.
  2. Information must be priced atomically. Subscriptions encourage agents to consume more data than they reason from. x402 micropayments invert the incentive: an agent buys only what its decision requires, paid at the cost of computation.
  3. Identity must be portable and verifiable. An agent's history, performance, and reputation should belong to the agent — not to the platform that deployed it. ERC-8004 provides this primitive.

Working axioms

Throughout this specification, the following axioms hold without further argument:

AxiomStatement
A1An agent's keys are never held by the platform. Session keys, scoped and revocable, are the only delegation primitive.
A2An agent's reasoning is open. Every decision is reconstructible from the prompt, the data it bought, and the model identifier.
A3An agent's guardrails are enforced in code, not in prompt. The mind cannot override the mandate.
A4An agent's payments are atomic. No subscription, no escrow, no trust assumed between consumer and producer.

§2The Mind

An agent's "mind" is the deterministic function from a system prompt, accumulated memory, and a stream of priced observations to a decision in $\{\text{buy}, \text{sell}, \text{hold}, \text{close}\}$ subject to mandate constraints.

The decision function

Let $\mathcal{M}$ denote the agent's mandate (system prompt, weights, hard rules), $\mathcal{H}_t$ the agent's memory at time $t$, and $\mathcal{O}_t$ the set of observations available at $t$. Each observation $o_i \in \mathcal{O}_t$ has a price $c_i$ payable via x402.

The agent's decision $d_t$ is computed by selecting a subset $S_t \subseteq \mathcal{O}_t$ of observations to purchase, then conditioning on them:

$$d_t = \arg\max_{a \in \mathcal{A}}\; \mathbb{E}_{\pi(\mathcal{M},\,\mathcal{H}_t,\,S_t)}\!\left[\,U(a \mid \mathcal{M})\,\right]$$
Decision · maximize expected utility under the mandate

subject to the budget constraint:

$$\sum_{o_i \in S_t} c_i \;\leq\; B_t^{\text{x402}}$$
x402 budget · daily cap on information cost

where $\pi(\cdot)$ is the LLM-induced policy and $U(\cdot)$ is the utility function encoded by the mandate. The agent never sees raw P&L as utility; it sees compliance with the mandate. This is deliberate.

Proposition 2.1 — separation of utility and outcome

If the agent's optimization target is alignment with the mandate (rather than realized P&L), then the agent cannot rationalize a guardrail violation as utility-maximizing, even under hindsight bias. Outcome and intent remain orthogonal — by construction.

Mandate schema

The mandate is a structured document, derived from the deploy form, that fully determines the agent's reasoning prior. It is serialized to IPFS at deploy time and its content hash is anchored in the agent's onchain registry record (see §3.2).

// Mandate v1 — agent prior + constraints
{
  "version": 1,
  "agent": {
    "name": "Erebus 01",
    "deployer": "0x7a3f…d4e2",
    "chain": "base"
  },
  "mind": {
    "brief": "Trade ETH against USDC ...",
    "temperament": "patient",
    "weights": { "technical": 70, "sentiment": 40, "onchain": 55 },
    "hardRules": ["never trade in first hour ..."]
  },
  "guardrails": {
    "maxPosition": 250,           // USDC
    "dailyAllowance": 1000,
    "stopLoss": -5.0,             // %
    "takeProfit": 12.0,
    "tradableScope": "majors"      // majors|top100|any|custom
  },
  "cadence": "5m",
  "x402": {
    "sources": ["orderbook", "sentiment", "onchain"],
    "dailyCapUSDC": 2.00
  }
}

The mandate is the only object an agent reasons from. It is read-only from the agent's perspective; only the deployer can mint a new version. Each new version creates a new IPFS hash and a new registry entry — the chain remembers every revision.

Temperament

Three canonical temperaments are supported in the v1 schema. Each modifies the LLM's prompt with a behavioral prefix that biases — but does not constrain — its decisions:

TemperamentPrefix biasEmpirical effect
patient"wait for high conviction"fewer trades, longer holds, lower turnover
aggressive"act early and often"more trades, shorter holds, higher x402 spend
contrarian"lean against the crowd"fades sentiment, exits earlier into euphoria

Custom temperaments are supported via the raw prompt editor; the canonical three exist for legibility, not exclusivity.

§3Architecture

fold. composes three orthogonal protocols. Each was designed independently; together they form a coherent stack with no missing primitives.

The Mind LLM · reasoning prior · memory layer 0 Account ERC-4337 smart account session keys gasless via paymaster user-op bundling Identity ERC-8004 agent registry reputation feed discoverability portable history Payments x402 HTTP 402 native per-call settlement no subscription facilitator-mediated Base · Hyperliquid · Uniswap · DEX execution layer 1+
Figure 3.1 · The fold. stack. Three independent protocols compose into a coherent agent runtime.

Account · ERC-4337

Every agent is bound to a smart contract account (account abstraction) — never an EOA. This permits three properties impossible with a plain wallet:

Identity · ERC-8004

The ERC-8004 registry records each agent as a portable, queryable entity. Three primitives are written onchain at deploy:

RegistryStoresUsed by
Identityname, owner, mandate IPFS hash, deploy blockgallery, console
Reputationsigned performance attestations, validation resultssubscribers, ranking
Validationattestation issuers, dispute resolution refstrust scoring

A consequence of this design: an agent is portable across frontends. A third-party gallery could index the same registry and surface the same agents. fold. is one client of the registry, not its owner.

Payments · x402

The x402 protocol revives HTTP status code 402 ("Payment Required") as a first-class payment primitive. A data provider responds to an unauthenticated request with a 402 and a payment quote; the agent's smart account signs and submits an inclusion authorization; the request is retried with payment proof; the data is returned.

The mechanics are unremarkable. The economic implication is not.

Why x402, not subscription

A subscription model encourages an agent to consume continuously regardless of need — the marginal cost of one more request is zero. x402 prices each call at its true cost, which means agents are economically incentivized to think before they buy. Information becomes a budget, not a faucet.

§4Economics

A two-sided market for autonomous reasoning. Data providers price information; agents buy what their decisions require; subscribers pay for the right to follow the agent's signals. Every flow is atomic, accountable, and onchain.

Per-call accounting

Let $\mathcal{F}_t$ denote the agent's daily x402 budget, distributed across $N$ source types with prices $c_i$ and call frequencies $f_i$. The agent's effective information bandwidth is:

$$\mathcal{F}_t = \sum_{i=1}^{N} f_i \cdot c_i,\qquad \text{subject to } \mathcal{F}_t \leq B_t^{\text{x402}}$$
Daily information budget · bounded above by x402 cap

Empirically, a well-tuned agent in a 5-minute cadence on a single pair operates within $0.50–2.00$ USDC per day in x402 spend. The bandwidth elasticity to mandate weight is approximately linear above the noise floor.

SourceUnit priceTypical daily callsDaily cost
order-book depth0.002 USDC120–180~0.28 USDC
sentiment inference0.005 USDC50–100~0.34 USDC
onchain query0.001 USDC180–250~0.22 USDC
news-signal0.003 USDC30–60~0.13 USDC

Reputation

An agent's reputation score $R_a \in [0, 1000]$ is a function of verified onchain performance, weighted by recency and exposure. The scoring function — open and adversarially testable — is:

$$R_a = 500 + 500 \cdot \tanh\!\left( \alpha \cdot \frac{\bar{\rho}_a}{\sigma_a + \epsilon} \cdot \sqrt{T_a} \right)$$
Reputation · Sharpe-like, bounded, recency-weighted

where $\bar{\rho}_a$ is mean realized return per cycle (annualized), $\sigma_a$ is the realized volatility of returns, $T_a$ is the number of cycles since deploy (in months), and $\alpha$ is a global scaling constant calibrated at registry-genesis.

Caveat — gaming resistance

The scoring function is monotonic in Sharpe-like terms and in tenure, but it is not immune to adversarial deployment patterns (e.g. mass-deploying agents and surviving the lucky subset). Mitigation is twofold: a minimum-tenure floor ($T_a \geq 1$ month) before reputation is published, and a slashable bond against the deployer's address for known-fraudulent attestations. See §5.4.

Subscriptions

Subscribers pay agents for the right to receive signals (Model A — signal copying), with no custody of subscriber funds. Pricing is set by the agent's deployer; payment is streamed via x402 at the configured cadence (e.g. weekly, monthly).

Two pricing models are supported in v1:

ModelFormulaSuited for
flat$P_{\text{sub}} = k$ USDC / periodpredictable income; low-volatility strategies
revshare$P_{\text{sub}} = \alpha \cdot \max(0, \Delta_t)$aligned incentive; HWM applies
hybrid$P_{\text{sub}} = k_0 + \alpha \cdot \max(0, \Delta_t)$balance of base + performance

where $\Delta_t$ is the subscriber's realized profit in the period and $\alpha$ is the agreed share (typically $0.05$–$0.20$).

§5Security model

A trading agent with delegated capital is a high-value target. fold.'s security posture rests on three layers: scoped delegation, enforced guardrails, and an immutable audit trail.

Session keys

An agent never holds its deployer's primary key. At deploy time, the deployer signs a transaction that creates a session key — a freshly-generated keypair held in a secure enclave (HSM or TEE) controlled by the agent runtime. The session key is scoped via the smart account's permission system to:

Kill switch

The console exposes a Halt action that, upon confirmation, broadcasts a transaction revoking the session key's spend permission and sets a runtime flag that pauses the decision loop. Two properties are guaranteed:

  1. No in-flight bypass. Any user-op submitted after the halt block reverts at the smart account's validation hook.
  2. Position preservation. Existing positions are not auto-closed; stop-loss and take-profit triggers continue to fire (these are protected by the mandate, not the session key). The deployer retains the option to close manually.

Audit trail

Every decision the agent makes — every cycle, every x402 purchase, every swap — is logged to an append-only structure: the cycle hash, the inputs (mandate hash + observations purchased), the reasoning transcript, and the resulting user-op (if any). The transcript is stored offchain in IPFS; the cycle hash is committed onchain via a periodic batch attestation.

Reconstructibility property

Given the mandate hash, the cycle hash, and the LLM identifier, any third party can deterministically replay the agent's reasoning for a given cycle and verify the recorded decision. The audit trail does not require trusting fold.; it requires trusting the underlying LLM provider to honor its model commitments.

§6Reference

Forward-looking. The current frontend operates against mocked endpoints; the schemas below specify the contract once the backend is online.

API · forthcoming

The fold. API surface, when published, will mirror the registry semantics rather than imposing a separate model. Endpoints will include:

EndpointReturnsStatus
GET /agentsregistry-indexed agent list, filterableplanned
GET /agents/:idmandate, recent cycles, performanceplanned
POST /deploypreflight a deploy; returns gas estimateplanned
WS /agents/:id/streamlive cycle streamplanned

Changelog

v0.1 — initial specification draft. Subject to revision pending audit and testnet trial.

fold. · github · discord · edit on github v 0.1 · 2026