> ## Documentation Index
> Fetch the complete documentation index at: https://docs.perpsagent.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Commit → attest → recall flow

> The on-chain lifecycle that proves every Perps Agent run.

Every Perps Agent run goes through the same on-chain phases on Mantle Sepolia. There is no "off-chain track record."

## 1. Commit

Before the grid engine is allowed to place a single order:

* The AI loop finalizes the strategy config.
* The config and the user's risk caps are hashed.
* The hash is committed to **`StrategyLedger`** under a `runId`.

From this point on, the agent is **locked** to that config for that `runId`.

## 2. Trade

The grid engine runs on Bybit through the exchange adapter, using the trader's trade-only API keys. Fills, PnL, drawdown, and risk metrics are tracked in real time. Nothing about this phase touches the proof layer.

## 3. Attest

When the run ends (target hit, stop hit, or user-stopped):

* The verified outcome (`pnl`, `maxDrawdown`, `riskScore`, `status`) is hashed.
* The attestation is written to **`StrategyLedger`**, referencing the original commit by `runId`.
* The `regime → params → outcome` record is appended to **`StrategyMemory`**.
* Fees and performance settle through **`Vault`** in native MNT.

## 4. Recall

The next time the AI loop proposes params:

* It queries `StrategyMemory` for past attested runs on similar markets / regimes.
* It reads only attested outcomes — in-progress runs and uncommitted backtests are ignored.
* Those attestations become training signal.

<Tip>
  Commit + attest + recall is the whole loop. Everything else — grid engine, Telegram UX, AI loop — is implementation around this on-chain skeleton.
</Tip>

See [Deployed addresses](/mantle/deployed-addresses) for the live contracts.
