---
title: Choose a retention offer
description: Navigation quality, TypeScript SDK example and recorded choice for the retention benchmark.
sidebar:
  label: Retention
---

**KPI** · Expected 90-day renewal contribution ($50 no offer, $40 credit, $45 pause on renewal).

![Navigation score by prior navigations per World.](/docs/benchmarks/industry-retention.png)

## After 1,000 navigations per World

Spacefolder chose the highest-value action on **96 of 96** held-out navigations.

| Approach | Expected utility | Score / 100 |
| --- | ---: | ---: |
| Spacefolder | 35.580 | 100.00 |
| Vector search + SQL for matching situations¹ | 35.580 | 100.00 |
| SQL for all situations¹ | 31.341 | 65.29 |
| First listed action | 19.818 | 11.05 |
| Ground truth | 35.580 | 100.00 |

¹ Stack analogies. The replay averaged each action’s outcomes in memory, grouping by exact situation for the first baseline and pooling all situations for the second.

## TypeScript SDK example

[TypeScript SDK](/docs/reference/sdks#typescript-and-javascript) · [Navigate API](/docs/reference/api/navigate/navigate)

```ts
import { SpacefolderClient } from "@spacefolder/sdk";

const sf = new SpacefolderClient();
const navigation = await sf.navigate({
  nav_id: crypto.randomUUID(),
  world_id: "retention_example",
  entity_type: "cancellation_attempt",
  entity_id: "cancel-001",
  context: { scene: "Subscriber cites price" },
  actions: {
    no_offer: {"name": "retention.choice", "data": {"offer": "none"}},
    credit: {"name": "retention.choice", "data": {"offer": "credit"}},
    pause: {"name": "retention.choice", "data": {"offer": "pause"}},
  },
  predictions: {
    renewed: {"event": "subscription.renewed", "horizon": "90d"},
  },
});

const margin = { no_offer: 50, credit: 40, pause: 45 };
let chosen: string | undefined;
let best = -Infinity;
for (const action of ["no_offer", "credit", "pause"] as const) {
  const renewed = navigation.actions?.[action]?.predictions.renewed;
  if (!renewed || !("probability" in renewed) || typeof renewed.probability !== "number") continue;
  const utility = renewed.probability * margin[action];
  if (utility > best) {
    best = utility;
    chosen = action;
  }
}
console.log(JSON.stringify({ chosen }, null, 2));
```

## Example output

**Subscriber cites price**

```json
{
  "chosen": "credit"
}
```

Apply the selected offer to the cancellation attempt. Join a paid renewal back to that attempt and close the account's 90-day window before learning from a negative.
