# ForgetMe v1: the wire contract

ForgetMe v1 is the HTTP contract behind the ForgetMe button: four routes a server serves so a person
can preview a deletion, confirm its exact terms, follow the operation and fetch signed receipts. This
page is the full contract: it defines how a host and a Company discover each other, authorize over
Poppy 1.0, preview and submit a deletion, exchange approvals, report outcomes, sign receipts and answer
errors, and it ends with a five-step summary for each side.

Status: spec revision 1.0-draft.4, frozen on 2026-11-28; the next revision waits for a provider that
wants to serve it. A third-party extension proposal targeting Poppy 1.0, the Personal Agent Protocol,
not approved, adopted or reviewed by anyone.

**ForgetMe** is the button a person sees beside a memory their personal agent keeps, and the same flow
by voice or chat. **ForgetProof** is the engine behind it: the scanner, the eraser, the signed receipts.
Two servers speak this contract. The **host** is the personal agent's own server, behind the button.
A **recipient Company** is an organisation the host shared a record with; it serves the same contract
on its own origin, so the agent can ask it to withdraw the record and receive the Company's own
evidence. A Company can implement the contract from this page, the schemas and the fixtures alone, on
its own stack, without installing ForgetProof or giving anyone access to its storage. The
[glossary](/docs/glossary) defines the words this page uses.

## Names and versions

The extension's namespace is `stellarminds.ai/forget-me` and its major version is `"1"`. ForgetMe is
the capability name and the namespace; ForgetProof is the product and the Python and JavaScript
packages. The extension's major version, the Poppy version it targets, the receipt format
(`forget-me-receipt/1`; the engine's own `forgetproof-receipt/0.2` is a different document) and the
package versions are independent and move independently. The older surface `forgetproof.agent.Provider`
serves (`/.well-known/forgetproof.json`, `POST /forgetproof/forget`) is unchanged and documented in
[the provider surface](/docs/provider-surface); a standalone provider may keep serving it, and a ForgetMe
host may serve both.

## Where the pieces are

The button and its five-method host interface: [`packages/forgetme-button`](/docs/button).
Machine-readable schemas and fixtures: [`schemas/forget-me/v1/`](/schemas/forget-me/v1/); the Poppy
kit's schemas our documents are checked against: [`schemas/poppy-1.0-kit/`](/schemas/poppy-1.0-kit/README.md).
The reference Company: [`company/`](/docs/company) (`company/poppy.py` is its Poppy verifier).
The demo host and Personal Agent, Pim: [`demo/forgetme.py`](/docs/src/demo/forgetme.py),
[`demo/recipients.py`](/docs/src/demo/recipients.py), [`demo/poppy_agent.py`](/docs/src/demo/poppy_agent.py). The
engine's wire-format helpers: `forgetproof.forgetme`.

## Upstream documents

Where this page says *spec*, it means the Personal Agent Protocol 1.0 specification
(https://personalagentprotocol.org/docs/1.0/spec), by section number. *Operations* means the Operations
extension, version 3 (https://personalagentprotocol.org/docs/1.0/extensions/operations). Where this
page and upstream disagree, upstream wins and the disagreement is a bug here.

## 1. Parties and words

| Party | Role |
|---|---|
| **Person** | Whose data it is. Signed in to each party in that party's own way. |
| **Host** | The personal agent's side: serves the contract behind the button, holds its own stores, and may hold references to records it shared with recipients. In the demo: Pim. |
| **Recipient Company** | An organisation the host shared a record with. Serves the same contract on its own origin, with its own key, and issues evidence for what it did. In the demo: Bay Parcel, a courier. |
| **Verifier** | Anyone holding a portable receipt and the issuer's published keys: the person, a page in their browser, another agent, an auditor. |

- **Record**: one thing a holder stores for the person (a memory item, an address record). Addressed by
  an opaque **reference** the holder issued when it stored it.
- **Holder**: one store of one party (`memory`, `notes`, `records`, `invoices`): the unit that gets an
  outcome and a receipt.
- **Operation**: one confirmed request, with exact terms, that erases and produces evidence.
- **Outcome**: one of six words per holder (section 8), worst first; the overall outcome of an operation
  is the worst of its holders.

## 2. Discovery

### 2.1 The fragment in `/.well-known/poppy.json`

A Company that speaks ForgetMe merges this fragment into its existing Poppy discovery document:

```json
{"extensions": {"stellarminds.ai/forget-me": [{"version": "1", "endpoint": "https://company.example/forget-me/v1",
                                              "scopes": {"item": "forget-me:item", "account": "forget-me:account"}}],
                "operations": [{"version": "3"}]}}
```

One entry per major version served. `endpoint` is an absolute `https` URL or a path on the document's
own origin. `scopes` (optional) names the Company's OAuth scopes (spec 4.7: each Company defines its own)
that this extension's two request scopes need; a 401 challenge names them too (section 4). The
`operations` entry is Poppy's, not ours: a Company that serves ForgetMe over Poppy lists the Operations
extension, version 3, because that is the approval exchange a withdrawal goes through (section 6). The
rest of `poppy.json` belongs to Poppy (spec 3.1: `protocol_version`, `organization`, `auth`, `apis`, …);
the schema ([`discovery.schema.json`](/schemas/forget-me/v1/discovery.schema.json)) checks only our
fragment, and the reference Company's whole document is checked against upstream's `poppy.schema.json`
in the tests. A complete document is
[`fixtures/discovery/valid/company-poppy.json`](/schemas/forget-me/v1/fixtures/discovery/valid/company-poppy.json);
the reference Company serves one at `/.well-known/poppy.json`, with the two OAuth metadata documents
spec 3.2 asks for beside it.

A client that finds no entry for version `"1"` has found a Company that does not speak ForgetMe v1.
That is an **observation by the client**, never a Company receipt (section 8.3).

### 2.2 Routes derive from the endpoint

Every route is the endpoint plus a fixed suffix. Nothing else is advertised, and a client builds the
routes itself:

| Route | Method | Purpose |
|---|---|---|
| `{endpoint}` | GET | The **index**: the issuer's name and keys, the routes, scopes, size bounds, status. Public, tenant-neutral. |
| `{endpoint}/preview` | POST | What a withdrawal would touch. No side effects. |
| `{endpoint}/submit` | POST | Confirm exact terms; start the operation. |
| `{endpoint}/operations/{id}` | GET | Owner-scoped status. |
| `{endpoint}/operations/{id}/evidence` | GET | Owner-scoped portable receipts. |

A request under a version prefix the host does not serve (for example `.../forget-me/v2/preview`)
answers `404 unsupported_version` with `supported: ["1"]`.

### 2.3 Issuer keys live in the index

`GET {endpoint}` answers the index ([`index.schema.json`](/schemas/forget-me/v1/index.schema.json)):

```json
{
  "namespace": "stellarminds.ai/forget-me", "version": "1",
  "issuer": "Bay Parcel (reference Company)",
  "keys": [{"public_key": "…43 chars base64url…", "key_fingerprint": "…32 hex…", "valid_from": "2026-11-01T00:00:00Z"}],
  "routes": {"index": "…/forget-me/v1", "preview": "…/preview", "submit": "…/submit", "operation": "…/operations/{id}", "evidence": "…/operations/{id}/evidence"},
  "scopes": ["item", "account"],
  "evidence_format": "forget-me-receipt/1",
  "status": "third-party proposal targeting Poppy 1.0; not approved, adopted or reviewed by anyone",
  "limits": {"max_body_bytes": 16384, "idempotency_key": [8, 128], "poll_interval_ms": 1000},
  "well_known": {"poppy": "https://company.example/.well-known/poppy.json"},
  "approval": {"extension": "operations", "version": "3", "approver": "user"},
  "identity": {"protocol": "poppy", "version": "1.0", "issuer": "https://company.example", "oauth_scopes": {"item": "forget-me:item", "account": "forget-me:account"}}
}
```

`approval` says how destructive execution is approved here (section 6) and whose approvals the host
acts on: `user` (the person, in their agent's own interface) or `user-or-agent`. `identity` says who
decides the account on every request (section 4). The index is a description document: it carries no
Session header and may be cached, like `poppy.json` (spec 5.2).

`keys` is every key whose receipts should still verify: the current one and rotated-out predecessors.
A verifier accepts a portable receipt only if its `public_key` is in `keys[].public_key` of the index
fetched from the issuer's own origin. `issuer` is the exact string receipts carry. A host that also
serves the 0.2 provider surface lists the same keys in `/.well-known/forgetproof.json` and may point
to it from `well_known.forgetproof`. Public discovery material carries nothing tenant-specific: no
account, no reference, no operation.

## 3. Transport, headers, size bounds

- HTTPS in production. JSON bodies, `Content-Type: application/json; charset=utf-8` both ways; a
  request without a JSON object body where one is required is `400 bad_request`.
- At a Company, every route but the index is a Poppy resource: the request carries `Poppy-Session`,
  `Poppy-Version` and `Poppy-Extensions` (spec 3.4, 5.2), an access token in `Authorization` (spec 4.5),
  and on a submit with the person's approval `Poppy-Approval` (Operations 6). Section 4 says what is
  checked; the discovery documents, the index and the OAuth endpoints carry none of these.
- Responses to the authenticated routes carry `Cache-Control: no-store`. The index may be cached.
- `429` and `503` answers carry `Retry-After` (seconds) and `retry_after` in the body.
- **Size bounds** (a host refuses more with `413 too_large`; a client sends less): request body
  ≤ 16 KiB; `idempotency_key` 8–128 printable ASCII characters, no spaces; ≤ 64 exceptions; labels
  ≤ 200 characters; free text ≤ 2000; ≤ 32 holders in a preview; ≤ 64 holder rows and ≤ 200 log entries
  in an operation. References match `^fmr_[A-Za-z0-9_-]{16,48}$`, operation ids
  `^fmo_[A-Za-z0-9_-]{16,48}$`.
- Unknown fields in a **request** are refused (`400 bad_request`); unknown fields in a **response**
  are ignored by clients. New optional response fields are compatible within a major version; a new
  required request field, a changed meaning or a removed field is a new major version.

## 4. Authorization

Every route except the index needs the **signed-in account**, and the server resolves it on every
read and write from what the protocol verifies, never from the body. A request can't say who. A
caller-supplied email, a checkbox in a page, or a Session that is signed out conveys no authority.

### 4.1 At a Company: Poppy 1.0

A recipient Company is a Poppy Company and ForgetMe is one of its extensions. Who the caller is, and
on which account it acts, is Poppy's job; this extension adds nothing to it and relies on all of it:

| Step | Upstream rule | What the Company does |
|---|---|---|
| Identity | spec 5.2, 5.3: the Session header | Verifies `Poppy-Session` before anything else: the delegation (`poppy_dlg`, `typ poppy-delegation+jwt`, signed with a key from the agent's `jwks_uri`, not expired, at most 24 hours), then the Session JWT (`typ poppy-session+jwt`, `alg ES256`, `kid` the delegated key's thumbprint), then `aud` (the Company's identifier, character for character), `htm`, `htu` (RFC 9449 section 4.3), `iat` (a one-minute window), `jti` (a reuse is refused). The agent's documents are fetched at `iss` without following redirects, over HTTPS, never from a loopback or private address unless configured for development (spec 3). A Session JWT without a delegation, or signed with a `jwks_uri` key, is refused. Any failure: `400 invalid_session`. |
| Negotiation | spec 3.4 | `Poppy-Version` must be compatible with a version the Company serves (same major): else `400 version_unsupported`. `Poppy-Extensions` is an RFC 9651 List of Strings; absent or unparseable, it declares nothing; unknown names and versions are ignored (spec 3.3). The declarations are the same on every request of a Session (the agent's MUST); this Company refuses a change with `invalid_session` and says why, so an operation offered under one declaration is never approved under another. |
| Account | spec 4.5, 5.3 step 3, section 7 | The access token in `Authorization: Bearer` was issued by the Company's issuer to the same `client_id` as the Session JWT's `iss`, and `ath` is its hash. No token: `401` with `WWW-Authenticate: Bearer scope="forget-me:item"` and no error code. A bad or expired token: `401 invalid_token`. The scopes the route needs (below) missing: `403 insufficient_scope`, with the scope named in the challenge. |
| Continuity | spec 5.3 step 4, 5.4 | The Session is looked up by (`client_id`, `sid`, `sub`); an unknown one starts signed out. A token for another account than the Session used before is `400 session_ended`. |
| Scopes | spec 4.7 | Two OAuth scopes, named in the discovery entry: one for withdrawals by reference and the reads of their operations and evidence (the reference Company: `forget-me:item`), one, granted separately and never implied, for `{"scope": "account"}` (`forget-me:account`). |

The Company's OAuth is plain OAuth (spec 4): `private_key_jwt` client assertions whose `aud` is exactly
the issuer (never an endpoint URL), at most five minutes, a fresh `jti`; a `refresh_token` grant that
may narrow `scope` and names at most the Company's one `resource`; RFC 7009 revocation, which also ends
the access tokens under the refresh token. The reference Company's issuer offers Personal Agents no
sign-in type (`auth.disabled: true`, spec 3.2): its only account holder is fictional. The demo's
labelled fixture (`POST /fixture/accounts`) creates a synthetic account and mints the refresh token a
Direct Sign-In would have produced, for the one `client_id` the request names; from there on
everything is the protocol, and that fixture is the one thing a real Company replaces with sign-in.

### 4.2 At a host behind the button

The host behind the button is the personal agent's own server, and the button is its own page: the
person's sign-in is the host's own (a same-origin cookie, or a bearer the host issued), and the host
resolves the owner from it on every call (`401 no_session` without one). Toward the recipients it
shared a memory with, that host is the Poppy Personal Agent of 4.1: it holds one Session per recipient
and scenario, declares `"stellarminds.ai/forget-me";v="1", "operations";v="3"` on every request of it,
carries an access token for the person's account there, and never sends a Session header to a
discovery document, an index or a token endpoint (spec 5.2). The demo's Pim does exactly this
([`demo/recipients.py`](/docs/src/demo/recipients.py)); its client identity is the metadata document at
`/poppy/agent.json` (spec 4.1).

### 4.3 Rules both keep

- **Owner binding.** A reference or operation that exists but belongs to another account answers
  exactly as an unknown one: `404 unknown_reference` or `404 unknown_operation`. Nothing distinguishes
  "not yours" from "not there".
- **Tenancy.** Two accounts may hold the same value (two people at one address). A reference names one
  account's record; withdrawing it touches no other account's record, and the evidence says nothing
  about other accounts (section 9.2). An email address, a phone number or an address is never a
  locator: there is no route that takes a value.
- **Authority can lapse.** A queued step re-checks the authority it was submitted with before it runs.
  If the agent's grant was revoked or the account closed in between, the step erases nothing and the holder
  ends `error` with the sentence "nothing done: the request lost its authority before this step ran".
- **An unavailable extension authorizes nothing.** A Company that cannot run the approval exchange of
  section 6 for a request (the request did not declare Operations version 3, or declared another major)
  refuses the submit with `403 extension_required` (`extension: "operations"`, spec 3.3). No other
  deletion flow, and no approval header, stands in for the negotiation. Ordinary Poppy interactions,
  and every read of this extension, work without it.

## 5. Preview

`POST {endpoint}/preview` with `{"scope": "item", "reference": "fmr_…"}` or `{"scope": "account"}`
([`preview-request.schema.json`](/schemas/forget-me/v1/preview-request.schema.json)). Answers `200 Preview`
([`preview.schema.json`](/schemas/forget-me/v1/preview.schema.json)):

```json
{
  "namespace": "stellarminds.ai/forget-me", "version": "1", "scope": "item",
  "item": {"reference": "fmr_…", "label": "Delivery address, saved in March", "text": "118 Harbor Lane, Oakland CA 94607", "kind": "address", "saved_at": "…"},
  "holders": [
    {"holder": "records", "title": "Bay Parcel's address book and delivery summaries", "kind": "sqlite", "retention": "persistent", "what": "…"},
    {"holder": "invoices", "title": "Bay Parcel's invoices", "kind": "sqlite", "retention": "persistent", "what": "one invoice carries the delivery address and is kept under tax law"},
    {"holder": "archive",  "title": "Bay Parcel's legacy export", "kind": "files", "retention": "persistent", "what": "a JSONL export made before provenance tracking; inspected for the exact text only"}
  ],
  "retention": "persistent",
  "changes": ["Bay Parcel stops returning the record at once and deletes it by id", "derived delivery summaries are rebuilt without the address", "…"],
  "exceptions": [
    {"id": "fmx_invoice_2026_0412", "label": "Invoice BP-2026-0412", "text": "Carries the delivery address; kept 90 days under tax law.",
     "holders": ["invoices"], "default": "keep", "options": [{"value": "keep", "label": "Kept until 18 February 2027, then erased"}],
     "reason": "retention disclosed: tax law, 90 days", "retained_until": "2027-02-18T00:00:00+00:00"}
  ],
  "terms": {"reference": "fmr_…", "scope": "item", "exceptions": {"fmx_invoice_2026_0412": "keep"}},
  "note": "The holders are Bay Parcel's own stores. Nothing has been changed by this preview."
}
```

- `holders` lists who keeps the item. `retention` per holder is `persistent`, `none` or `unknown`;
  **unknown is a different answer from none.** A preview whose holders all have `retention: "none"`
  offers nothing to confirm; the button says "Nothing is kept". A holder that belongs to another party
  (a recipient the host shared the item with) carries `party` and `recipient`.
- `exceptions` are the other places the exact value lives that the person decides about: another live
  record of theirs (keep or delete), a recipient the host shared it with (ask it to withdraw, or leave
  it), or a record a holder keeps under a disclosed retention (then `options` has the single value
  `keep`, with `reason` and `retained_until`). Exception ids are opaque and meaningful only within
  this host's previews.
- `terms` is what submit must echo, with every exception decided. A preview has no side effects and
  may be repeated.
- A recipient that speaks Poppy states, before anyone confirms, the exact terms it will perform: the
  host asks it at preview time (a preview, then a submit without an approval, which the Company answers
  with `403 approval_required` and the operation, Operations 4) and carries the answer on the recipient's
  exception as `approval` ([`approval-offer`](/schemas/forget-me/v1/common.schema.json)): the recipient's
  `operation_id`, `revision`, `summary`, `terms` and `expires_at`, unchanged, plus `party`, `protocol`
  (`operations/3`) and `approver`. The button shows the summary and the terms word for word, as text
  (Operations 3: no links, images or HTML rendered). Confirming with that recipient chosen is the person's
  approval of exactly that revision (section 6).

## 6. Submit, idempotency, retries

`POST {endpoint}/submit` with the terms and the client's key
([`submit-request.schema.json`](/schemas/forget-me/v1/submit-request.schema.json)):

```json
{"scope": "item", "reference": "fmr_…", "exceptions": {"fmx_invoice_2026_0412": "keep", "fms_Qz8vT1nWc4A2b7Yx": "delete"},
 "approvals": {"fms_Qz8vT1nWc4A2b7Yx": {"operation_id": "wd_5Rt2mQ9xKp3v", "revision": "1795248000-k3Jd9Qx2mW8v", "input_type": "tap"}},
 "idempotency_key": "0d1c7c6e-3d4b-4f0a-9a7e-2b1f8e5c6a11"}
```

`approvals` (optional) carries, per recipient exception chosen `delete` whose preview showed the
recipient's exact terms, the `operation_id` and `revision` the person saw and how they answered
(`input_type`, a short word: `tap`, `keyboard`, `voice`, …). A host accepts only what its own preview
offered and only while it is valid; a missing or different one is `400 terms_incomplete` with the
exception id in `missing`. The host then records the approval in its ledger (an opaque `apr_…`
reference, unique per person, never reused across Companies) and sends it to the recipient as
Operations 6 describes. A host never fills an approval in by itself.

| Answer | Meaning |
|---|---|
| `202 Operation` | New operation, state `accepted`. |
| `200 Operation` | The same key was used before by this account with the same terms: the same operation, whatever its state. This is the retry path. |
| `409 conflict` | The same key with **different** terms; `operation` names the earlier one. The client has a bug or the person changed their mind: a new confirmation needs a new key. |
| `409 double_submit` | The record already has an operation that is running, or settled (`inspected-and-clear` / `intentionally-retained`); `operation` and `state` name it. Follow it. A record whose earlier operation ended `bytes-still-found` or `error` may be submitted again. |
| `400 terms_incomplete` | `exceptions` doesn't decide exactly those the preview listed; `missing` and `unexpected` say which. |

**Retry semantics.** A client keeps one `idempotency_key` per confirmation and reuses it on every
retry, including after a disconnect, a reload or a crash: the host answers the same operation. Keys are
scoped to the account and valid for at least as long as the operation is retrievable (section 7).
Concurrent submits with the same key produce one operation; a host must make the check-and-create
step atomic. Concurrent submits for the same record with different keys: one `202`, the rest
`409 double_submit`. Nothing is ever erased twice for one record.

**What happens at accept.** Before answering `202`, a host that can stops active retrieval of the
record (it no longer appears in listings, lookups or answers to other parties) and records
`retrieval_stopped_at`. Physical cleanup follows, in the background, and is recorded separately.

### 6.1 At a Company: the approval exchange (Operations, version 3)

A withdrawal is destructive, so a Company performs it only through Poppy's Operations extension, and
advertises that (`operations` version 3 in `poppy.json`, `approval` in the index). The exchange, with
upstream's rules and this extension's choices marked:

1. **The request must declare `"operations";v="3"`** in `Poppy-Extensions`. Operations 2: a Company
   MUST NOT return operations to a request that doesn't declare it; it handles approval itself or refuses
   with `extension_required`. A ForgetMe Company has no other way to approve a withdrawal, so it refuses:
   `403 extension_required`, `extension: "operations"`. A different major version does not count.
2. **A submit without `Poppy-Approval` performs nothing** and answers `403 approval_required` with the
   operation (Operations 4, APIs): `operation_id`, `revision`, `summary`, `terms`, `expires_at`. The terms
   are legible and complete (Operations 3: everything that affects the action): the action, the recipient
   (name, issuer), the authorized account, the scope and reference, the record (label, text, kind, when
   saved, count), the holders touched, what the Company performs, every exception with its choice and any
   disclosed retention, and the retention exceptions in words. The summary stands alone. The reference
   Company stores the operation under the identity that may approve it (the agent's `client_id`, its User
   ID, the account) and lets a revision live 15 minutes (Operations 3: long enough to read and decide).
   Every submit without an approval states a new operation (a new id); a reworded request with the same
   meaning is the same action.
3. **A submit with `Poppy-Approval`** (an RFC 9651 Dictionary: `operation_id`, `revision`, `approver`,
   optionally `approved_at`, `input_type`, `reference`; unknown members ignored; an unusable header is
   `400 invalid_request`) goes through the checks of Operations 6, in order, after the Session and token
   checks of section 4: *(1)* the Session can approve it: the same agent and User ID that received it,
   signed in to the same account, else the request is handled as if it had no approval; *(2)* the
   operation has not been performed: if it has, the original answer comes back (`200 Operation`), however
   often and under whatever idempotency key the approval is sent (Operations 7); *(3)* the revision was
   returned for this operation, has not expired, and the request asks for exactly what it describes (the
   ForgetMe terms: reference, scope, exceptions; the idempotency key is inconsequential): else nothing is
   performed and a new revision for what the request asks comes back under the approval's `operation_id`,
   never the revision the approval names.
4. **Then the Company's own policy.** The reference Company acts on user approvals only (Operations 6,
   8.1: a Company may decline approvals it won't act on, such as agent approvals for an action): an
   `approver: "agent"` is declined with `403 approval_declined` (`operation_id`, `revision`, `reason`, no
   new operation, nothing recorded), and the same user approval afterwards performs the action. A Company
   that accepts agent approvals says so in its index (`approver: "user-or-agent"`).
5. **Then the action, at most once.** The Company stops retrieval, creates the ForgetMe operation and
   records the approval on it (`approval` in the Operation: `operation_id`, `revision`, `approver`,
   `approved_at`, `input_type`, `reference`, the agent's name) and answers `202`. Concurrent submits with
   the same approval produce one operation (check-and-perform is one atomic step); a retry gets the same
   answer; a performed operation is remembered for the life of the account, longer than its revision.
6. **A change in scope needs a new approval.** The approval covers one revision of one operation; another
   reference, another scope, another exception choice, or an expired revision, is check 3 failing: nothing
   performed, new terms to approve. A Personal Agent that receives a new revision asks the person again
   (Operations 5) and never approves it on an earlier answer.

Preview, polling and evidence reads are not operations: they need the Session and the scope, never an
approval. Local-only users of a host keep the host's own tools; nothing here reaches them.

## 7. Operations and polling

`GET {endpoint}/operations/{id}` answers `200 Operation`
([`operation.schema.json`](/schemas/forget-me/v1/operation.schema.json)); unknown or another account's
id is `404 unknown_operation`.

```json
{
  "operation": "fmo_…", "namespace": "stellarminds.ai/forget-me", "version": "1",
  "state": "accepted" | "running" | "done" | "error",
  "terms": {"…": "…"}, "item": {"…": "…"},
  "submitted_at": "…", "started_at": "…", "finished_at": "…", "updated_at": "…", "retrieval_stopped_at": "…",
  "outcome": null | {
    "overall": "intentionally-retained",
    "sentence": "Delivery address, saved in March withdrawn from Bay Parcel. Invoice BP-2026-0412 kept under tax law until 18 February 2027.",
    "holders": [
      {"holder": "records", "title": "…", "kind": "sqlite", "outcome": "inspected-and-clear", "detail": "…", "receipt_id": "fmo_….records",
       "party": "Bay Parcel", "action": "deleted and erased", "evidence": "fmo_….records", "unresolved": null, "at": "…"},
      {"holder": "invoices", "title": "…", "outcome": "intentionally-retained", "detail": "…", "receipt_id": "fmo_….invoices",
       "action": "kept, as disclosed", "evidence": "fmo_….invoices", "unresolved": "erased on 18 February 2027", "at": "…", "retained_until": "2027-02-18T00:00:00+00:00"}
    ],
    "counts": {"intentionally-retained": 1, "inspected-and-clear": 1},
    "outstanding": 0
  },
  "log": [{"actor": "Bay Parcel", "text": "…", "at": "…"}],
  "reconciled": null,
  "status_url": "…/operations/fmo_…", "evidence_url": "…/operations/fmo_…/evidence"
}
```

- `outcome` is `null` until the state is final (`done` or `error`). The human `sentence` comes before
  the counts. Each holder row says what was done (`action`), the evidence (a `receipt_id`, or `null`
  for an observation), what is `unresolved` (a retention date, a pending inspection) and when (`at`).
- **Polling.** Poll at the index's `poll_interval_ms` or slower, honour `Retry-After`, and back off; a
  host answers status reads cheaply. An operation id stays retrievable for at least 30 days after it
  finishes (the demo: for the life of the scenario).
- **A done operation may still improve.** A holder row with outcome `queued` reports a final outcome
  later under the same id; `outstanding` counts rows that are not final and `updated_at` moves. A client
  that resumes with the operation id sees the new outcome. The state does not go back to `running`.
- **Restart.** A host that restarts mid-operation reconciles before serving: an operation accepted
  but not started simply runs; one interrupted between erasing and signing is settled by **scanning
  again, never erasing again**, and `reconciled` says so; one whose stores are gone ends `error` with
  `outcome.uncertain: true` and claims nothing.
- **Final states.** `done` means the host finished its work, whatever the outcomes say. `error` means
  the host could not finish; `outcome` then still has `overall: "error"` and a sentence.

## 8. Outcomes

### 8.1 The six words

Per holder, exactly one of, **worst first**:

| Outcome | Meaning |
|---|---|
| `error` | The step failed in this holder. Nothing is claimed about its bytes. |
| `bytes-still-found` | After erasing, the exact text was still found where it should not be. Not done; the row says what is unresolved. |
| `queued` | The step could not run now (the holder is open or being rewritten) and will run later under the same operation id. |
| `unsupported` | The holder cannot be inspected from here: an API-only store, a recipient that acknowledges but issues no evidence, unknown retention. Never read it as clean. |
| `intentionally-retained` | The exact text stays in a record the person chose to keep, or in a record kept under a retention the preview disclosed (then `retained_until` says when it goes). |
| `inspected-and-clear` | The record and its known derived items are gone, the residue the deletion left was erased, and an inspection afterwards found the exact text in no live record of the person's and in no recoverable residue. |

The overall outcome of an operation is the worst of its holders: **one clean store never overrides an
outstanding one.** `inspected-and-clear` and `intentionally-retained` are the settled outcomes.

### 8.2 Derived items and provenance

A holder that keeps items derived from a record (a stored summary, a route sheet, a search document)
keeps the link at write time and uses it when the record is withdrawn: derived items are removed, or
rebuilt without the record. Data written before provenance tracking existed cannot be tied to a
record without guessing, so a holder **does not guess**: it inspects such data only with the exact
supported checks (exact text search, residue checks the scanner knows) and reports the gap in
`coverage.limits`. A live record is never deleted on the strength of a semantic match.

### 8.3 Recipients that do not speak ForgetMe

A host that shared a record with a Company lists the Company as a holder with `party` and as an
exception the person decides ("ask Bay Parcel to withdraw it too"). When asked:

- a Company that speaks v1 is driven through this contract, and its **own** portable receipts are
  re-served in the host's evidence, marked with the Company's `issuer` and `issuer_key_url`;
- a Company that only acknowledges through some API ends `unsupported`, with the acknowledgment in the
  row's `action` and a receipt **signed by the host** that says exactly that (its `coverage.inspected`
  is false);
- a Company that is unreachable ends `queued` (the host retries; resuming with the operation id shows
  the new outcome), and a Company that publishes no ForgetMe endpoint ends `unsupported` as an
  **observation by the host** (`evidence.observations`), never as a Company receipt.

## 9. Portable evidence

`GET {endpoint}/operations/{id}/evidence` answers `200 Evidence`
([`evidence.schema.json`](/schemas/forget-me/v1/evidence.schema.json)): one `forget-me-receipt/1`
per holder that produced one, plus observations for rows that have none.

```json
{
  "operation": "fmo_…", "state": "done",
  "issuer": "Bay Parcel (reference Company)", "issuer_key_url": "https://company.example/forget-me/v1",
  "receipts": [{"receipt_id": "fmo_….records", "holder": "records", "party": "Bay Parcel", "fingerprint": "…32 hex…", "receipt": { "format": "forget-me-receipt/1", "…": "…" }}],
  "observations": [],
  "note": "Each receipt is one holder's signed statement: counts, timestamps and vocabulary words, never a path or a value."
}
```

### 9.1 `forget-me-receipt/1`

The portable receipt ([`receipt.schema.json`](/schemas/forget-me/v1/receipt.schema.json); signed
examples in [`fixtures/receipt/valid/`](/schemas/forget-me/v1/fixtures/receipt/valid/)) is a projection
of whatever the host keeps internally. It carries **no host path, no filename, no raw subject value,
no cross-service identifier, no token and no value hash**: counts, timestamps, vocabulary words and
sentences from a fixed list. Every field is present; nothing else is allowed.

| Field | Meaning |
|---|---|
| `format`, `namespace`, `version` | `forget-me-receipt/1`, `stellarminds.ai/forget-me`, `"1"`. |
| `issuer`, `issued_at` | The exact issuer string from the issuer's index; when it was signed. |
| `operation` | The issuer's opaque, owner-bound operation id: the only coupling to the request. |
| `holder`, `kind`, `scope` | Which store, what kind (`sqlite`, `chroma`, `files`, `api`, …), item or account. |
| `outcome`, `verdict` | One of the six words, and the 0.2 verdict word it maps to (`CLEAN`, `RESIDUE_REMAINS`, `UNVERIFIABLE`) so old readers recognise it. |
| `coverage` | `inspected` (bool), `checks` (check ids such as `sqlite.free_pages`, `exact-text`, `provenance`), `scope` (whose records the statement is about), `limits` (sentences about what could not be covered). |
| `before`, `after` | `residue` (count of recoverable findings) and `exact_text_in_your_records` (bool), before and after. |
| `actions` | Sentences from the fixed list in the schema ("record deleted through the holder's own API, by id", "derived items rebuilt without the withdrawn record", …). |
| `subject_values` | How many exact values the subject had. Never the values. |
| `retrieval_stopped_at`, `physical_cleanup_at` | Two timestamps, kept apart: when the holder stopped returning the record, and when the bytes were rewritten. |
| `restore` | `{"attempted": true, "prevented": bool}` when the holder tried its own restore path once and it was refused (or not), or `{"coverage": "unsupported"}` when the holder has no restore path to test. |
| `retained_until` | For a disclosed retention: when the holder erases it. |
| `source_receipt` | Format and SHA-256 digest of the host's own full receipt behind this projection (for example a `forgetproof-receipt/0.2` with file hashes), so the host can match them later without publishing its paths; or `null`. |
| `public_key`, `signature` | Ed25519 over the canonical JSON (keys sorted by code point, no whitespace, non-ASCII raw, UTF-8) of the receipt without `signature`. **The portable representation itself is what is signed.** |

`forgetproof verify` and `forgetproof-verify` check the signature of a `forget-me-receipt/1` with the
same rule as `forgetproof-receipt/0.1` and `0.2`; old receipts and their verdicts remain verifiable.
A verifier also checks that `public_key` is in the issuer's index (`issuer_key_url`), fetched from
the issuer's own origin; a key embedded in the receipt alone never confirms the issuer.

### 9.2 What the statement is about

The counts and the outcome are about **the person's records and their residue**. Another account's
live record that happens to carry the same value (the current tenant at an old address) is outside the
statement: a withdrawal does not touch it and the receipt does not mention it, so the evidence of one
account reveals nothing about another. `coverage.scope` says so in words on every receipt.

### 9.3 What a verifier reports

A verifier answers three questions and keeps the answers apart; none stands in for another:

| Question | Answer | How |
|---|---|---|
| **Signature** | valid, or why not | Ed25519 over the canonical bytes (9.1). Valid means: the holder of `public_key` signed exactly these bytes and nothing changed since. |
| **Issuer** | `confirmed`, `pinned`, `rejected`, `unconfirmed` | `confirmed` only when `public_key` is in the `keys` of the issuer's index (2.3), fetched by the verifier from the origin **it** expects the issuer at, never from a URL inside the receipt or its envelope. `pinned` when no discovery was consulted and the key matches one the verifier obtained out of band (offline verification). `rejected` when discovery or the pin was consulted and the key is not there. `unconfirmed` when there was nothing to check against: **a key embedded in a receipt never confirms an issuer by itself.** A valid signature with an unconfirmed issuer is merely well-signed. |
| **Declared** | the receipt's `outcome`, `verdict`, `coverage`, counts | The issuer's statement, shown as such, with whether `outcome` and `verdict` agree. No signature makes it true (section 13). |

File hashes (an engine receipt's `files`) help only where the files are: a page in a browser cannot
inspect a remote disk, and says so rather than implying a check it did not make. The reference verifier
is `forgetproof-verify` (`verifyEvidence`, `fetchIndex`), the demo's `/verify` page is it in use, and the
Python side is `forgetproof verify` and `forgetproof.forgetme.verify(rec, keys)`.

## 10. Errors

Every non-2xx answer is `{"error": code, "error_description": sentence, …}`
([`error.schema.json`](/schemas/forget-me/v1/error.schema.json)):

| Status | `error` | When |
|---|---|---|
| 401 | `no_session` | At a host behind the button: no signed-in user. The request can't name one. |
| 400 | `invalid_session` | At a Company (spec 5.3): no `Poppy-Session`, or it fails a check; also a change of `Poppy-Version` or `Poppy-Extensions` within a Session. |
| 400 | `session_ended` | At a Company (spec 5.4, 5.5): the Session was signed in to another account before. Start a new Session. |
| 400 | `version_unsupported` | At a Company (spec 3.4): `Poppy-Version` missing or not compatible. |
| 401 | *(no code)* | At a Company (spec 7): the route needs the account and the request has no access token; `WWW-Authenticate: Bearer scope="…"`. |
| 401 | `invalid_token` | At a Company (spec 7): the access token is expired, revoked, unknown, or was issued to another client than the Session's. |
| 403 | `insufficient_scope` | At a Company (spec 7): the token lacks the scope the route needs (`scope`, also in `WWW-Authenticate`). Replaces phase 2's `forbidden_scope`. |
| 403 | `extension_required` | At a Company (spec 3.3): a submit without `"operations";v="3"` declared (`extension`). |
| 403 | `approval_required` | At a Company (Operations 4): nothing performed; `operation` is the operation to approve. |
| 403 | `approval_declined` | At a Company (Operations 6): the approval passed its checks and the Company declined it (`operation_id`, `revision`, `reason`); nothing performed, no new operation. |
| 400 | `invalid_request` | At a Company: a `Poppy-Approval` header that is present but unusable. |
| 400 | `bad_request` | Not a JSON object, wrong types, an unknown field, a bad `idempotency_key`, or an exception choice other than `keep`/`delete`. |
| 413 | `too_large` | The body exceeds the size bound. |
| 400 | `bad_scope` | `scope` is not `item` or `account`, or `account` came with a reference. |
| 400 | `missing_reference` | Scope `item` without a reference. It never means account-wide. |
| 400 | `terms_incomplete` | The exceptions decided don't match the preview's (`missing`, `unexpected`). |
| 404 | `unknown_reference` | No such reference for the signed-in account; another account's gets the same answer. |
| 410 | `reference_expired` | The reference has expired; ask the holder for the record again. |
| 409 | `conflict` | Same `idempotency_key`, different terms (`operation`). |
| 409 | `double_submit` | The record already has an operation (`operation`, `state`). |
| 404 | `unknown_operation` | No such operation for the signed-in account; another account's gets the same answer. |
| 404 | `unsupported_version` | The version prefix is not served (`supported`). |
| 429 | `rate_limited` | Too many requests (`retry_after`). |
| 503 / 410 | `not_ready` / `scenario_expired` | Demo-specific: the scenario is still building, or has expired. |

Examples: [`fixtures/error/valid/`](/schemas/forget-me/v1/fixtures/error/valid/).

## 11. Example exchanges

All against the reference Company; account credentials are the demo's labelled fixtures.

**Immediate.** `POST /preview {reference}` → holders `records`, `invoices`, `archive`, one exception
(the invoice, keep only). `POST /submit` → `202 accepted`, `retrieval_stopped_at` set. Two polls later:
`done`, overall `intentionally-retained`: `records` inspected-and-clear (restore attempted and refused),
`invoices` intentionally-retained until the retention date, `archive` inspected-and-clear with a
coverage limit about pre-provenance data. Evidence: three signed receipts.

**Queued.** The archive export is being rewritten (the demo's fixture sets `archive_busy`). Submit →
`202`; `done` with `archive` `queued`, `outstanding: 1`, overall `queued`. The Company's sweep (or its
next start) runs the queued step; polling the same id then shows `archive` inspected-and-clear,
`outstanding: 0`, and the evidence gains the third receipt.

**Unsupported recipient.** Pim asks a Company whose `poppy.json` lists no ForgetMe entry: no request is
sent; Pim's row says `unsupported`, `evidence: null`, and Pim's evidence carries an **observation**, not
a receipt. An API-only recipient that acknowledges a deletion gets a receipt signed by Pim with
`coverage.inspected: false` and outcome `unsupported`.

**Retained record.** The invoice above: disclosed in the preview as an exception with the single
option `keep`, ends `intentionally-retained` with `retained_until`; the row's `unresolved` names the
date. The Company erases it then, under a new operation of its own.

**Account-wide.** `POST /preview {"scope": "account"}` with a token granted `forget-me:account` →
every record of the account; submit → every holder, every record, the retained invoices still retained.
The same with an item-only token → `403 insufficient_scope`.

**The approval exchange.** Pim, at preview time: `POST /preview {reference}` then `POST /submit {terms,
idempotency_key}` with `Poppy-Session`, `Poppy-Version: 1.0`, `Poppy-Extensions: "stellarminds.ai/forget-me";v="1",
"operations";v="3"` and the access token → `403 approval_required` with operation `wd_…`, revision
`1795…-…`, the summary and the exact terms; Pim puts them on the Bay Parcel exception of its own preview
as `approval`. John reads them in the button and confirms with Bay Parcel chosen → Pim's submit carries
`approvals[fms_…] = {operation_id, revision, input_type: "tap"}` → Pim records `apr_…` in its ledger and
sends the same Company request again with `Poppy-Approval: operation_id="wd_…", revision="1795…-…",
approver="user", approved_at=…, input_type="tap", reference="apr_…"` → `202 Operation` with
`approval` filled; the same request again → `200`, the same operation. An `approver="agent"` instead →
`403 approval_declined`. The same approval on another reference → `403 approval_required`, a new
revision under `wd_…`. Without `"operations";v="3"` declared → `403 extension_required`.

## 12. Quickstarts

The runnable versions, with commands against the live demo and the reference Company, are
[`quickstart-company.md`](/docs/quickstart-company) and [`quickstart-client.md`](/docs/quickstart-client)
(served at `/docs/quickstart-company` and `/docs/quickstart-client`). The five steps of each:

### 12.1 A minimal provider (Company)

1. Store records with an opaque reference per record and per account (`fmr_` + 24 random base64url
   characters is fine), bound to the account that owns it, with an expiry. Keep the reference → record
   map private. Keep provenance for derived items at write time.
2. Be a Poppy Company (spec 3, 3.2, 4, 5): `poppy.json` with your organization and issuer, the protected
   resource and issuer metadata, an OAuth issuer that accepts `private_key_jwt` client assertions and
   issues refresh and access tokens with your two ForgetMe scopes, and Session header verification in
   front of every route but the index. Add the fragment of section 2.1 with your scope names, and list
   `operations` version 3. Serve `GET {endpoint}` with your name, your Ed25519 public key(s), the derived
   routes, `approval` and `identity`.
3. `POST {endpoint}/preview`: resolve the account from the access token (issued to the Session's agent),
   the record from the reference (404 for anyone else's), list holders, exceptions and the exact terms.
   No side effects.
4. `POST {endpoint}/submit`: refuse without `"operations";v="3"` declared (`extension_required`);
   validate the terms against a fresh preview; without `Poppy-Approval`, answer `403 approval_required`
   with legible exact terms and perform nothing; with one, make the checks of section 6.1 in order, then
   `(account, idempotency_key)` unique, refuse a second operation for a record that has one, stop
   retrieval, record the approval, answer `202`; run the rest in the background: delete by id, remove or
   rebuild derived items, erase residue, inspect, try your own restore path once, sign one portable
   receipt per holder.
5. `GET …/operations/{id}` and `…/evidence`: owner-scoped reads. Reconcile on start. Validate your
   answers against the schemas (and your Poppy documents against the kit's, `schemas/poppy-1.0-kit/`);
   the fixtures are the shapes a client expects.

The reference Company ([`company/`](/docs/company)) is this in about a thousand lines over
SQLite, with its own key and its own origin, using the engine only for the erase and the inspection.

### 12.2 A minimal client (Pim, or any agent)

1. Be a Poppy Personal Agent (spec 4.1, 5.2): publish your client metadata document and key set over
   HTTPS; sign a delegation per delegated key (one key per User ID per Company); sign a Session JWT per
   request; keep `Poppy-Version` and `Poppy-Extensions` identical for the life of a Session.
2. `GET https://company.example/.well-known/poppy.json`, check it speaks for its host and its protocol
   version is compatible, pick the `stellarminds.ai/forget-me` entry with version `"1"`, resolve
   `endpoint` and the scope names, note whether `operations` version 3 is listed. Find the issuer through
   the protected resource metadata and confirm it in the issuer's own metadata (spec 3.2). No entry:
   record an observation, send nothing. No Operations: you cannot be asked to approve, so you cannot
   withdraw there; say so.
3. `GET {endpoint}`: remember `issuer` and `keys`. Get an access token for the person's account from the
   token endpoint with a client assertion (`aud` the issuer). Declare
   `"stellarminds.ai/forget-me";v="1", "operations";v="3"` on every request from here.
4. `POST {endpoint}/preview` with the reference the Company gave you when you shared the record (not
   an email, not an address), then `POST {endpoint}/submit` with the exact terms and a fresh
   `idempotency_key` and no approval: the `403 approval_required` carries the Company's exact terms.
   Show the person the holders, the exceptions, and those terms word for word; let them decide.
5. On the person's approval, send the same submit again with `Poppy-Approval` (`approver="user"`,
   `approved_at`, `input_type`, your ledger `reference`). On any failure to get an answer, send the same
   request with the same approval again; never approve a new revision on the earlier answer. Poll
   `GET …/operations/{id}` at the index's interval until the state is final; keep the id and poll again
   later while `outstanding` is not zero.
6. `GET …/evidence`; for each receipt check the schema, the signature, and that `public_key` is one of
   the index's `keys`. Show one row per holder: action, evidence, unresolved item, time.

The test client in [`tests/test_wire.py`](/docs/src/tests/test_wire.py) does exactly this over real HTTP
between two processes, with `httpx` and the `cryptography` package only.

## 13. Limits

- It does not infer what is *about* a person without naming them, and it never deletes a live record
  on a semantic match. A holder that wants wider coverage tags records at write time.
- It does not reach copies outside the holder's stores: backups, replicas, logs. The receipt's
  `coverage.limits` says what was not covered; the holder's retention policy covers the rest.
- It does not make a signature mean honesty. A valid signature proves which key signed exactly this
  receipt and that nothing changed since; it does not prove the issuer did what the receipt says.
- It does not carry identity. Who the account is, and that the caller may act for it, is Poppy's job
  (section 4: the Session header, OAuth, the scopes); this contract only insists that the server decides
  it, on every request, and that destructive execution waits for the person's approval of exact terms
  (section 6.1). An approval shows what the Personal Agent stated the person approved; the Company
  cannot see the agent's interface (Operations 8.1).

## 14. Decisions this extension made on its own

Upstream leaves these open or says nothing; each is a choice here, not a rule of Poppy's:

- The two OAuth scope names (`forget-me:item`, `forget-me:account`) and the `scopes` member of the
  discovery entry that carries them.
- The index's `approval` and `identity` members.
- The exception's `approval` and the submit's `approvals`: how a host carries a recipient's exact terms
  to the person and the person's answer back, so that the approval covers terms the person saw.
- A change of `Poppy-Version` or `Poppy-Extensions` within a Session is refused with `invalid_session`
  (spec 3.4 puts the MUST on the agent and names no Company response).
- A `Poppy-Approval` header that is present but unusable is `400 invalid_request` (Operations names the
  code for an unusable website reference and nothing for a malformed header).
- The idempotency key is inconsequential to check 3 (Operations 6 allows a Company to ignore differences
  it considers inconsequential; the key is a retry identifier, not a term).
- The reference Company declines agent approvals (Operations 6 and 8.1 allow a Company to decline
  approvals it won't act on); a revision lives 15 minutes; a performed operation is remembered for the
  life of the account; each submit without an approval states a new operation id.
- The reference Company's issuer sets `auth.disabled: true` and offers the `refresh_token` grant only;
  the demo's fixture mints the refresh token a sign-in would have produced. A real Company replaces the
  fixture with Direct or Device Sign-In and changes nothing else.
- The index is treated as a description document (no Session header), like `poppy.json`.
- The Company rejects a reused Session `jti` (spec 5.3 says MAY) with a one-minute in-process cache.
- The verifier and the signer are written here with `cryptography` only: no upstream-compatible library
  exists (the PyPI package `poppy` is an optics toolkit; the protocol's kit ships a Node validator and
  JSON schemas). The kit's schemas are vendored and every document is checked against them; the kit's
  validator needs an HTTPS deployment and is listed for phase 4.

## Next steps

- [Quickstart: a Company that serves ForgetMe](/docs/quickstart-company): run the reference Company and implement the five steps of section 12.1.
- [Quickstart: a client that asks](/docs/quickstart-client): drive the four routes from Node or Python against the demo, then ask a Company as a Poppy agent.
- [The schemas](/docs/schemas): the nine JSON Schemas and their fixtures, and how to validate your answers.
- [forgetme-button](/docs/button): the element and the five-method host interface behind it.
