DEV Community

levithefirst
levithefirst

Posted on Edited on

Clew : Remembering the retry that worked

Clew: remembering the retry that worked

Tatum × Walrus Memory “Total Recall” hackathon. Live at useclew.vercel.app.

A transaction reverts. The wallet says “execution reverted”, maybe with a reason string. Someone tweaks a number, resubmits, and it goes through. A week later the same wallet hits the same contract with the same error and starts from zero, because nothing kept the fix.

If you build agents that send transactions, that loop burns retries and leaves you guessing which change actually landed. Wallet users hit the same wall: they pay gas twice and still walk away without knowing whether a slippage limit or a deadline was the thing that moved. Hackathon judges can check a concrete claim on real Mainnet data: a stored memory changes what you do on the next failure.

Clew watches that loop and stores it.

What Clew does

  1. A transaction fails. Clew reads the receipt and decodes why.
  2. The same wallet retries the same contract and succeeds. Clew diffs the two attempts and writes what changed to Walrus Memory on Mainnet.
  3. The next time that wallet fails on that contract with a similar error, Clew recalls the memory and returns the prior successful transaction plus a concrete next action.

With an empty memory it can only say the transaction reverted. Once a memory exists, it can name which words in the call changed, and point at the retry that landed.

The public website never writes. Both the Try it box and the agent endpoint only read.

If you run an agent that retries failed swaps, send the failed hash to /v1/recall and you get the last path that worked for that wallet and contract.

How Tatum is used

Every chain read goes through Tatum, so a pasted failure is decoded from a live receipt.

On Base, Ethereum and Polygon that means the JSON-RPC gateways:

  • eth_getTransactionReceipt for status. Clew treats 0x0 as a failure and only accepts a later 0x1 transaction as the retry.
  • eth_getTransactionByHash for calldata, gas limit, gas price, value and nonce. eth_getBlockByNumber for the timestamp.
  • Revert decoding via debug_traceTransaction with callTracer, falling back to an eth_call replay at block - 1. Clew decodes Error(string) (0x08c379a0), Panic(uint256) (0x4e487b71) and custom error selectors, then normalizes them into a signature such as revert:too_little_received.
  • eth_getBlockReceipts to find the successful retry from the same wallet to the same contract after the failure.

The free plan allows 3 requests a second. Clew spaces its calls about 360 ms apart and backs off on HTTP 429.

Sui uses a different door on the same provider. Tatum’s Sui gateway serves GraphQL only (POST https://sui-mainnet.gateway.tatum.io/graphql). A first attempt at sui_* JSON-RPC came back HTTP 404, so the adapter was rewritten against GraphQL. One transaction query returns the sender, gas budget and price, status, checkpoint, Move calls, Pure inputs, and executionError (the module, function and abort code where it died). That becomes a signature like moveabort:errors::err_amount_out_slippage_check_failed:1. Finding the retry is supposed to take one filtered query: same sender, same package::module, after the failure’s checkpoint.

That GraphQL path was verified on Sui Mainnet on 31 October 2026: the gateway answered at checkpoint 340173364, recent programmable transactions decoded, and two real fail → success pairs were written to Walrus. On 7 November 2026, single-transaction reads still worked and the live /v1/recall endpoint answered two digests with the same structured shape as Base. The list query (transactions) returned “Failed to list transactions” that day, so a new pair could not be discovered then.

How Walrus Memory is used

Memories go to the Walrus Memory Mainnet relayer (https://relayer.memory.walrus.xyz) in namespace clew, through @mysten-incubation/memwal. Later failures from the same wallet can pick up the retry that already worked because that write lives there.

A write is remember(text, { idempotencyKey: "chain:failedTx:successTx" }), then waitForRememberJob until a blob_id comes back. If that confirmation never arrives, the pair is not treated as stored. A read is recall with a query built from the new failure’s chain, contract, wallet, error and selector. Recall is semantic, so Clew then applies a strict filter: exact chain, exact contract, exact wallet, and a similar error. Another wallet’s path is never reused.

The memory text is plain and factual, tags first so both recall and the filter have something to hold on to:

CLEW chain=base contract=0x8ea5… wallet=0x336a… error=revert:too_little_received selector=0x708909ad
failed_tx=0x15f0… success_tx=0x389a… success_block=53152834. … Change: … NEXT_ACTION: …
Enter fullscreen mode Exit fullscreen mode

There are 16 fail → success memories in namespace clew (10 Base, 2 Ethereum, 2 Polygon, 2 Sui), plus one corrected rewrite of the first Base pair (rev=2, blob -TPBis5hFtwGoakXTDFdqTR9coE_OTCNTX70TUTB3sA). Walrus blobs are never edited in place; a correction is a new write with its own idempotency key, linked from memories.json by supersedes. Job and blob ids are in that file. Each blob resolves on Walruscan Mainnet. The content is SEAL-encrypted, so the explorer proves the write happened without exposing the text.

How the memory changes the next action

On 7 November 2026 the measurement harness (npm run measure) loaded eight real Mainnet failures through Tatum and recalled each one twice: once from an empty namespace, once from clew.

chain failed tx memory off memory on confidence successes later failures demotion prior retries most consistent change
base 0xd72b632220fb7e79d8fb671a0109b791a12c6ccc3f9604b52507f6a994864bb6 abstain retry 0.5 2 1 true 2 calldata word 4
base 0x15f0e33c6bcaae91577346de3efac3680848b1158407ee77dbc6d743361ac153 abstain retry 0.5 2 1 true 2 calldata word 4
base 0x05b27e704245baa2b30307e1b283e0a596b5db1f2454dfb0cc96d25806fc07a8 abstain retry 0.5 1 0 false 1 calldata word 1
base 0x54d4427fe0abdc40e6b3f1f5c430ae7352eb58b9f75119a6262dd627bacaeaf1 abstain retry 0.5 2 1 true 2 calldata word 4
base 0x987c3e003ef5d797cecf170f2e5a2342658ac27608728a404f9ce8c6d127abce abstain retry 0.5 1 0 false 1 calldata word 0
ethereum 0xd55c0f54b9b10b56cf83ec4c919224adca39c5ffd825486129f95c4f850b8a20 abstain retry 0.5 1 0 false 1 calldata word 2
polygon 0x08272ab634d6c29f7e7bc88dc56e90d8a890f9bd0f6f9d6d565f37d359492f81 abstain retry 0.5 1 0 false 1 calldata word 0
sui GXwW6feRx386m9W3z7UX9CRWAFNyuGETWPux6zZR48Vj abstain retry 0.5 1 0 false 1 a higher gas price on the retry

Memory off abstained on all eight. With the clew namespace loaded, every row came back as retry.

An agent that calls this without memory gets an abstain. Against namespace clew, that same call gets a retry and the change that already worked.

The three Base rows with two successes are the same wallet (0x336a079d7b894f6b6356674b3ad668bffdd5811d) on the same contract (0x8ea5ad2a58c1dae75394b1e8636e6518eb6dac50) after the same error (“Too little received”). Clew counts which changes repeated across those earlier retries and leads with the most common, labelled with the count.

For 0xd72b…4bb6, memory off says:

Tx 0xd72b632220fb7e79d8fb671a0109b791a12c6ccc3f9604b52507f6a994864bb6 on base reverted (revert:too_little_received). No prior successful path on record for this wallet+contract. Check params and retry.

Memory on ranks the two stored retries and returns a next action of this shape:

Prior successful retry (template): 0x29751e28caca024f75206b8512122148d203afe710f6fa351af4f73e89a8d757
- Most consistent change: calldata word 4, in 2 of 2 earlier retries that succeeded after this same error.
- Also seen: calldata word 15, in 2 of 2.
- Also seen: calldata word 16, in 2 of 2.
- Also differed, not shown as a cause: a higher gas price on the retry (1 of 2).
Enter fullscreen mode Exit fullscreen mode

The live /v1/recall object for that same hash reported action: "retry", confidence: 0.5, priorRetries: 2, evidence.successes: 2, evidence.laterFailures: 1, evidence.mostConsistentChange: "calldata word 4", and demotionFlag: true. Confidence is successes / (successes + laterFailures + 1), so two successes and one later failure land at 0.5. That later failure sets the demotion flag. Retry stays the action because successes still outnumber later failures.

Clew does not invent a reason those words moved. It reports that they moved in both retries that worked, and it hands back the newest of those retries as a template. A gas hint only appears when the failed attempt actually ran out of gas. None of the stored failures did.

The agent endpoint

Agents can call a read-only HTTP endpoint instead of scraping the website.

POST https://useclew.vercel.app/v1/recall
{ "chain": "base", "failedTxHash": "0xd72b…", "agentId": "optional" }
Enter fullscreen mode Exit fullscreen mode

GET /v1/recall?chain=base&failedTxHash=0xd72b… is the same read-only call as a shareable link.

The response is one object: action (retry, abort, or abstain), recommended (calldata with the remembered change applied, gas limit, gas price, nonceStrategy: "next"), confidence, evidence (successes, later failures, the most consistent change, Walrus blob ids), demotionFlag, and priorRetries. On Sui, recommended.calldata is null because Sui uses Pure inputs.

Nothing in this path writes to Walrus. Errors come back as { "error": { "code", "message" } }. The endpoint allows 12 calls a minute and caches an answer for 60 seconds. Live Sui reads require CLEW_SUI_LIVE=1 on the deployment; production has that set.

The Try it page calls this endpoint for the same hash it just compared, and renders the fields under “Agent response”.

An honest note on the data

Most wallets that fail and then succeed on the same contract within minutes are bots: routers, MEV searchers, relayers. Clew labels each stored pair with a small public heuristic (lifetime transaction count, how fast the retry landed, other transactions in between, how often the wallet hit the same contract). Any one of those signals makes a wallet bot-like. When none of them fire, Clew labels the wallet human-like. That label means the heuristic saw no automation. It does not confirm a person sent the transaction.

Of the 17 ledger entries, 14 are bot-like, 2 are human-like, and 1 is unclassified. That unclassified wallet is a Sui sender; Sui has no account nonce, so only retry latency can be checked, and that is not enough. Ethereum 0xaffa7d95ea5984a18e1b4d6f38c1175bdb18a793 (65 prior transactions, retried about 48 seconds later, one calldata word changed: a deadline moved 60 seconds forward) and Base 0xf22f566751f933545deb42c1637adeb7fa11ee24 (982 prior transactions, retried about five minutes later, calldata word 1 changed) are the two human-like wallets. The Base one is the lower-activity example in this set. 982 transactions is still a lot of history, just nowhere near the bot-like wallets in this set (some of those run to tens of thousands or millions of prior transactions, and retry within seconds).

So in the real data the remembered “fix” is often a fresh quote, a new deadline, or a higher gas price. Clew still stores it, because the next failure from that same wallet can reuse the path that actually landed.

Paste a failed hash at useclew.vercel.app if you want to see the memory-off and memory-on split yourself. The screen-by-screen video script is in DEMO_SCRIPT.md.

Top comments (0)