Skip to content
Spacefolder Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Choose a retention offer

Navigation quality, TypeScript SDK example and recorded choice for the retention benchmark.

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

Navigation score by prior navigations per World.

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 · Navigate API

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

{
  "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.