---
title: "Memory · Tempo AI Platform docs"
description: "Key-value, files and git repositories per wallet, private until you make one public or share it with a grant."
url: "https://gateway.tempo-dev.workers.dev/docs/memory"
---

> Every page of the Tempo AI Platform is Markdown at its URL with .md, or with Accept: text/markdown. The index of every page is https://gateway.tempo-dev.workers.dev/llms.txt, the API https://gateway.tempo-dev.workers.dev/openapi.json and the MCP server https://gateway.tempo-dev.workers.dev/mcp.

# Memory that outlasts the turn

Give agents somewhere to keep what they learn: values, files and git history that outlast the turn. Private by default, public or shared one item at a time.

[Get your Tempo Key](https://gateway.tempo-dev.workers.dev/key.md) · [Run it in a cloud agent](https://gateway.tempo-dev.workers.dev/docs/quickstart.md)

- **Key-value.** JSON values up to 64 KiB with compare-and-swap, prefixes, lists and a TTL up to 90 days.
- **Files.** Objects up to 8 MiB in R2 with their content type, ETags and ranges.
- **Git repositories.** Real repos on code.storage: commit without a git client, read files, logs and diffs, or clone and push through a remote URL.
- **Public when you say.** Make one value, object or repo public and anyone reads it free under /p, clones included. Everything else stays private.
- **Share with grants.** Let another wallet or a team read or write one key, a prefix or a whole kind. Revoke the key that set it and the grant ends.
- **Scoped to the wallet.** Every item lives under its chain, wallet and Gateway-App. No header ever names whose data it is.

## Use it

Use memory like any platform, with one API key for every route, or straight over MPP with a wallet and no account. Both pay the same prices.

### From your cloud agent

Give [your agent](https://gateway.tempo-dev.workers.dev/docs/quickstart.md) a turn. It already has these tools:

> Store the benchmark results in kv under results/codecs, commit the script to a new git repo named codecs, make the results public, and give me the public link.

**Cloud agent**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/agents/$AGENT/turns \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -H accept:text/event-stream \
  -d '{"prompt":"Store the benchmark results in kv under results/codecs, commit the script to a new git repo named codecs, make the results public, and give me the public link."}'
```

### With your Tempo Key

Store with your Tempo Key, and your data lives under the key's wallet in the app Gateway-App names. Another key of the same wallet reads the same items.

**kv**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/kv/set \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"key":"results/codecs","value":{"lzma":10.51,"bz2":10.01}}'

curl https://gateway.tempo-dev.workers.dev/v1/kv/get \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"key":"results/codecs"}'
```

**bucket**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/bucket/put \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H "gateway-key: reports/codecs.html" \
  -H "gateway-size: $(wc -c < codecs.html)" \
  -H "gateway-retention: 2592000" \
  -H content-type:text/html \
  --data-binary @codecs.html
```

**git**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/git/create \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"name":"codecs"}'

curl https://gateway.tempo-dev.workers.dev/v1/git/commit \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"name":"codecs","message":"Add the benchmark","files":[{"path":"bench.py","text":"print(1)"}]}'
```

**Share**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/grants/set \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"kind":"kv","resource":"results/*","to":"0xTheirAddress","abilities":["read"]}'
```

### Over MPP, no account

Over MPP the wallet that paid is the owner: the gateway reads it from the session channel after verifying the voucher, never from a header. Public items need no payment at all.

**tempo request**

```sh
tempo request --mach -X POST \
  -H gateway-app:default \
  --json '{"key":"results/codecs","value":{"lzma":10.51},"public":true}' \
  https://gateway.tempo-dev.workers.dev/v1/kv/set

tempo request --mach -X POST \
  -H gateway-app:default \
  --json '{"key":"results/codecs"}' \
  https://gateway.tempo-dev.workers.dev/v1/kv/get
```

**Public read**

```sh
curl https://gateway.tempo-dev.workers.dev/p/0xYourAddress/default/kv/results/codecs
```

### As MCP tools

Every kv, bucket, git, grant and team operation is an MCP tool, and public_read reads public items free.

`kv_set`, `kv_get`, `kv_list`, `bucket_put`, `bucket_get`, `git_create`, `git_commit`, `git_read`, `git_remote`, `grants_set`, `public_read`

**Claude Code**

```sh
claude mcp add --transport http tempo https://gateway.tempo-dev.workers.dev/mcp \
  --header "authorization: Bearer $TEMPO_KEY"
```

**Codex**

```sh
curl -fsSL https://gateway.tempo-dev.workers.dev/codex | sh
```

## kv

JSON values by key, kept in Cloudflare D1, with versions for compare-and-set. A value lives for its `ttl`, or for the longest retention, 90 days, without one, and reads treat an expired value as missing.

| Route                  | What it does                                                                                                        | Price    |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------- | -------- |
| POST /v1/kv/set        | Write JSON (up to 64 KiB), create-only or compare-and-set with ifVersion, with a ttl; private unless public is true | $0.0002  |
| POST /v1/kv/get        | Read a value and its version                                                                                        | $0.00001 |
| POST /v1/kv/list       | List keys by prefix                                                                                                 | $0.00001 |
| POST /v1/kv/delete     | Delete a key                                                                                                        | $0.00002 |
| POST /v1/kv/visibility | Make a value public or private                                                                                      | $0.00002 |

## bucket

Objects up to 8 MiB in Cloudflare R2, sent as the request body with their content type, and read back whole or by range.

| Route                      | What it does                                                                                                                                              | Price    |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| POST /v1/bucket/put        | Store the body (up to 8 MiB) under Gateway-Key, with its Gateway-Size in bytes, kept for Gateway-Retention seconds; private unless Gateway-Public is true | $0.0004  |
| POST /v1/bucket/get        | Stream an object back                                                                                                                                     | $0.00001 |
| POST /v1/bucket/head       | An object's metadata                                                                                                                                      | $0.00001 |
| POST /v1/bucket/list       | List objects by prefix                                                                                                                                    | $0.00002 |
| POST /v1/bucket/delete     | Delete an object                                                                                                                                          | $0.00002 |
| POST /v1/bucket/visibility | Make an object public or private                                                                                                                          | $0.00002 |

## git

Git repositories with real history on code.storage, for code an agent keeps. A remote URL from `git/remote` works with plain git in a sandbox or on a hand, and a grantee commits through `git/commit`. A key that can pay Code Storage pays for a new repository itself.

| Route                         | What it does                                                                                                  | Price                                                                |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| POST /v1/git/create           | Create a repository (name, defaultBranch, ttl up to 90 days), private unless public is true                   | $1 (what Code Storage charges)                                       |
| POST /v1/git/list             | List your repositories                                                                                        | $0.0005                                                              |
| POST /v1/git/commit           | Commit files (text, base64 or delete, 8 MiB in all) to a branch, with an optional expectedSha guard           | $0.005 (holds $0.01 more for a token renewal, refunded unless used)  |
| POST /v1/git/files            | List the files at a ref                                                                                       | $0.0005 (holds $0.01 more for a token renewal, refunded unless used) |
| POST /v1/git/read             | Read a file at a ref                                                                                          | $0.0005 (holds $0.01 more for a token renewal, refunded unless used) |
| POST /v1/git/log              | List commits                                                                                                  | $0.0005 (holds $0.01 more for a token renewal, refunded unless used) |
| POST /v1/git/diff             | Diff a commit against its parent or a base                                                                    | $0.0005 (holds $0.01 more for a token renewal, refunded unless used) |
| POST /v1/git/branches         | List branches with their heads                                                                                | $0.0005 (holds $0.01 more for a token renewal, refunded unless used) |
| POST /v1/git/remote           | A clone, fetch and push URL with a token that lasts up to an hour                                             | $0.01                                                                |
| POST /v1/git/visibility       | Make a repository public or private                                                                           | $0.0005                                                              |
| POST /v1/git/delete           | Delete a repository                                                                                           | $0.0001                                                              |
| /v1/git/:owner/:app/:name.git | A git remote that never expires, with a Tempo Key as the password: fetches pay git.read and pushes git.commit | $0.0005                                                              |

## Public reads

Make a value, object or repository public with its `visibility` route (or `public` when you write it), and anyone reads it free and without a key under `/p/<owner>/<app>/`, where owner is your wallet address. Private, expired and missing items all answer the same 404, and public answers may stay in caches for a minute after you make one private. The MCP tool `public_read` reads the same, free.

| Route                              | What it does                                                                            | Price |
| ---------------------------------- | --------------------------------------------------------------------------------------- | ----- |
| GET /p/:owner/:app/kv/:key         | A public value of a wallet's app, with no key                                           | Free  |
| GET /p/:owner/:app/kv?prefix=      | Public values by prefix, such as a repository's public issues under git/\<repo>/issues/ | Free  |
| GET /p/:owner/:app/bucket/:key     | A public object, streamed with its content type, with Range and If-None-Match           | Free  |
| GET /p/:owner/:app/git             | A wallet's public repositories in an app                                                | Free  |
| GET /p/:owner/:app/git/:name/files | A public repository's files; read, log, diff and branches work the same                 | Free  |
| /p/:owner/:app/git/:name.git       | Clone or fetch a public repository with plain git                                       | Free  |

## Paywalls

An item is private, shared through grants and teams, paywalled, or public. A paywalled item stays private to you, your grantees and your teams, and anyone else pays you its price at its `/p/<owner>/<app>/` link: an agent gets an MPP charge in the 402 and pays it with any MPP client, a browser gets a checkout page that pays with Tempo Wallet, and `public_read` over MCP answers payment required (or pays from the caller's Tempo Key, up to `maxUsd`). Payments go straight to your wallet, or to the team's treasury for a team's items, in OUSD, USDC.e or pathUSD (a team's in OUSD), and the buyer pays the network fee; MACH and the gateway's own funds never pay for one.

A purchase unlocks the whole resource the paywall names, for its period or for as long as the item lives. The paid answer carries `Gateway-Unlock`, a token the buyer sends again (as that header, an `unlock` query or the cookie a browser keeps, or as the password of `git clone`) to read without paying, and the buyer's own keys read it through the `/v1` routes with `Gateway-Owner`. A buyer pays the price its challenge quoted for five minutes, even if you change it meanwhile. Teams own kv values and bucket objects too: members read and write them with `Gateway-Owner` set to the team, and admins set their paywalls and withdraw the treasury.

| Route                       | What it does                                                                                                                    | Price   |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------- |
| POST /v1/paywalls/set       | Sell a kv value, bucket object or repository, a prefix ending in \*, or a whole kind: price in USD and how long an unlock lasts | $0.0005 |
| POST /v1/paywalls/list      | Your paywalls in this app, or a team's with Gateway-Owner                                                                       | $0.0005 |
| POST /v1/paywalls/delete    | Stop selling; what buyers unlocked stays readable until their unlock ends                                                       | $0.0001 |
| POST /v1/paywalls/sales     | Who bought what, for how much, with each transaction                                                                            | $0.0005 |
| POST /v1/paywalls/purchases | What your wallet bought, across owners and apps                                                                                 | $0.0005 |
| GET /p/:owner/:app/paywalls | What an app sells, free and without a key                                                                                       | Free    |
| POST /v1/teams/withdraw     | Send a team's paywall revenue from its treasury to your own wallet                                                              | $0.001  |

## Sharing

Give another wallet, or a team of wallets, read or write on one kv value, bucket object or repository, a prefix ending in `*`, or a whole kind in the app. The grantee sends `Gateway-Owner` with your address, or `owner` to the MCP tools, and pays for its own calls. A grant ends when you revoke it, when its `ttl` runs out, or when the key that set it is revoked. [Sharing](https://gateway.tempo-dev.workers.dev/sharing.md) manages grants and teams in your browser.

| Route                    | What it does                                                                        | Price   |
| ------------------------ | ----------------------------------------------------------------------------------- | ------- |
| POST /v1/grants/set      | Let a wallet or team read or write a kv, bucket or git item, prefix or app of yours | $0.0005 |
| POST /v1/grants/list     | The grants you gave in this app, or in every app with allApps                       | $0.0005 |
| POST /v1/grants/received | The grants other wallets gave you or your teams                                     | $0.0005 |
| POST /v1/grants/revoke   | Revoke a grant                                                                      | $0.0001 |
| POST /v1/teams/create    | Create a team, an address you grant items to                                        | $0.0005 |
| POST /v1/teams/add       | Add a member or admin                                                               | $0.0005 |
| POST /v1/teams/remove    | Remove a member, or leave                                                           | $0.0001 |
| POST /v1/teams/members   | A team's members                                                                    | $0.0005 |
| POST /v1/teams/list      | Your teams                                                                          | $0.0005 |
| POST /v1/teams/delete    | Delete a team                                                                       | $0.0001 |

[<- Machines](https://gateway.tempo-dev.workers.dev/docs/machines.md) · [Tempo Keys ->](https://gateway.tempo-dev.workers.dev/docs/keys.md)
