# Spacefolder > Fold all your data. Navigate what’s next. # Introduction Source: https://www.spacefolder.com/docs Spacefolder helps developers make predictions from their data on demand, without training a separate model for each question. To learn more about our model, see [**Large Adaptive World Model (LAWM)**](/docs/concepts/large-adaptive-world-model). ## Fold ![Fold aligns startup latency with preconnect, preload, and playback events and encodes the before-and-after change in world state.](/docs/diagrams/fold.svg) [Fold](/docs/concepts/primitives#fold) learns from events across your sources: analytics, coding agents, telemetry, observability, payments, and more. This small model runs close to your data. It compares metrics before and after an event and encodes that change in latent space to update your world state. ## Navigate ![Navigate compares futures from the same world state and context. Preloading has the lowest predicted startup latency, followed by preconnecting and taking no action.](/docs/diagrams/navigate.svg) [Navigate](/docs/concepts/primitives#navigate) combines learned world state with the current user or task context to predict the outcome of each possible action. It ranks actions by the outcomes you want to maximize or minimize. In the example above, preloading ranks first because it has the lowest predicted startup latency at the chosen horizon. ## Integrations - [Eve agent framework](/docs/integrations/eve) — use feedback to personalize responses and learn which actions work for each task. ## Start building - [Get API key on Spacefolder platform](https://platform.spacefolder.com/api-keys) to connect your application. - [Get started](/docs/get-started) to create a World, fold events, and compare actions. - [Primitives](/docs/concepts/primitives) to understand Worlds, events, context, predictions, actions, and objectives. - [Benchmarks](/docs/benchmarks) to compare agent navigations and see the TypeScript SDK examples behind them. - [Reference](/docs/reference) for the SDKs, HTTP API, and CLI. --- # Benchmarks Source: https://www.spacefolder.com/docs/benchmarks ## Navigation on generated histories These runs use generated event histories and known outcome probabilities. Columns count prior navigations per World. Scores measure expected utility from 0 (worst action) to 100 (best) on the same held-out cases. | Category | Agent navigation | 0 | 10 | 100 | 1,000 | | --- | --- | ---: | ---: | ---: | ---: | | Coding | [Recover a failed migration](/docs/benchmarks/coding) | 48.96 | 50.61 | 94.91 | **100.00** | | Tool calling | [Recover an inventory lookup](/docs/benchmarks/tools) | 25.24 | 49.67 | 91.72 | **100.00** | | Personal assistant | [Time a personal reminder](/docs/benchmarks/personal) | 30.00 | 66.50 | 83.33 | **100.00** | | Retention | [Choose a retention offer](/docs/benchmarks/retention) | 11.05 | 74.88 | 86.48 | **100.00** | | Fraud | [Intervene at checkout](/docs/benchmarks/fraud) | 52.08 | 26.15 | 60.28 | **100.00** | | Shopping | [Recommend a seller](/docs/benchmarks/fulfillment) | 67.71 | 52.08 | 52.08 | **100.00** | | Streaming | [Configure video playback](/docs/benchmarks/movies) | 46.21 | 68.75 | 81.25 | **98.13** | | Robotics | [Correct a robot placement](/docs/benchmarks/robotics) | 0.00 | 35.98 | 96.17 | **98.25** | | Video capture | [Recover a blurred capture](/docs/benchmarks/capture) | 84.15 | 75.32 | 94.01 | **97.43** | | Publishing | [Choose a publishing format](/docs/benchmarks/publishing) | 54.42 | 33.60 | 80.88 | **100.00** | At 1,000 navigations, 7 of 10 categories scored 100. Each World repeats two stable situations. A baseline using past outcomes for the same situation matched Spacefolder’s pick in 60 of 60 World–situation pairs. ## Performance on public industry datasets | Dataset | Folded events | Navigation results | | --- | --- | --- | | [ZOZO Open Bandit Dataset](/docs/benchmarks/shopping) | Item impressions, display probabilities and clicks. | **Estimated clicks per 1,000 impressions ↑** · Spacefolder 22.53, cached popularity 22.53, specialist recommender 16.89 on 30,188 held-out impressions. | | [UCI Bike Sharing](/docs/benchmarks/capacity) | Completed rentals per day. | **Mean absolute capacity error in rentals per day ↓** · Spacefolder 2,135.21, SQL 2,128.22, earlier model 2,133.53, fixed capacity 2,099.45 over 92 days. | ## Agent frameworks | Benchmark | Framework | Spacefolder impact | | --- | --- | --- | | [Coding agent](/docs/benchmarks/eve-coding-agent) | [Eve (Vercel)](/docs/integrations/eve) | On synthetic symptom-only bugs, Eve reached useful evidence about **4× faster** with a nearly **3× reduction in tokens**. | --- # UCI Bike Sharing Source: https://www.spacefolder.com/docs/benchmarks/capacity Over 92 days, mean absolute capacity error was **2,135.21 rentals/day** for Spacefolder, **2,133.53** for the earlier model, **2,128.22** for yesterday’s demand in SQL and **2,099.45** for fixed capacity. Lower is better. ![Cumulative planning loss relative to always holding over 92 ordered navigation days.](/docs/benchmarks/capacity-curve.png) Spacefolder and SQL chose different capacity on three days. Spacefolder added 489 and 581 units of error on October 4 and 12, and saved 427 on October 25. The replay reserved 1,000 extra units when predicted demand exceeded 7,572.5 rentals. All 92 Spacefolder forecasts were checked against the next day’s count. **About the dataset** Capital Bikeshare recorded completed rentals in 2011–2012. UCI provides hourly and daily totals. This replay uses daily totals to evaluate next-day capacity plans. [Explore the UCI dataset](https://archive.ics.uci.edu/dataset/275/bike+sharing+dataset) --- # Recover a blurred capture Source: https://www.spacefolder.com/docs/benchmarks/capture **KPI** · Usable footage probability minus blur probability. ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-capture.png) ## After 1,000 navigations per World Spacefolder chose the highest-value action on **68 of 96** held-out navigations. | Approach | Expected utility | Score / 100 | | --- | ---: | ---: | | Spacefolder | 0.517 | 97.43 | | Vector search + SQL for matching situations¹ | 0.517 | 97.43 | | SQL for all situations¹ | 0.446 | 88.82 | | First listed action | -0.311 | 0.00 | | Ground truth | 0.538 | 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: "capture_example", entity_type: "demonstration_segment", entity_id: "demo-segment-018", context: { scene: "Fast hand motion under bright task lighting" }, actions: { no_action: {"name": "decision.configuration_retained", "data": {}}, shorter_exposure: {"name": "capture.configuration_set", "data": {"camera_id": "head-camera", "exposure_us": 2000, "frame_rate_hz": 60, "stabilization_enabled": false}}, stabilize_capture: {"name": "capture.configuration_set", "data": {"camera_id": "head-camera", "exposure_us": 4000, "frame_rate_hz": 60, "stabilization_enabled": true}}, repeat_slower: {"name": "capture.operator_prompted", "data": {"prompt_id": "repeat-motion-slower", "segment_id": "demo-segment-018"}}, }, predictions: { usable: {"event": "demonstration.segment_accepted", "horizon": "10s"}, blur: {"event": "capture.motion_blur_detected", "horizon": "10s"}, }, }); let chosen: string | undefined; let best = -Infinity; for (const action of ["no_action", "shorter_exposure", "stabilize_capture", "repeat_slower"] as const) { const usable = navigation.actions?.[action]?.predictions.usable; if (!usable || !("probability" in usable) || typeof usable.probability !== "number") continue; const blur = navigation.actions?.[action]?.predictions.blur; if (!blur || !("probability" in blur) || typeof blur.probability !== "number") continue; const utility = usable.probability - blur.probability; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Fast hand motion under bright task lighting** ```json { "chosen": "repeat_slower" } ``` Apply the chosen capture setting to the segment, then record usability and blur from that segment's quality checks. --- # Recover a failed migration Source: https://www.spacefolder.com/docs/benchmarks/coding **KPI** · Probability of completing the task within five minutes. ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-coding.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 | 0.609 | 100.00 | | Vector search + SQL for matching situations¹ | 0.609 | 100.00 | | SQL for all situations¹ | 0.506 | 61.18 | | First listed action | 0.370 | 48.96 | | Ground truth | 0.609 | 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: "coding_example", entity_type: "task_revision", entity_id: "migration-schema", context: { scene: "Transient database connection failure" }, actions: { retry: {"name": "agent.retry", "data": {"scope": "migration"}}, search: {"name": "agent.search", "data": {"scope": "migration_and_schema"}}, replan: {"name": "agent.replan", "data": {"strategy": "inspect_schema_then_patch"}}, }, predictions: { success_rate: {"event": "task.completed", "horizon": "5m"}, }, }); let chosen: string | undefined; let best = -Infinity; for (const action of ["retry", "search", "replan"] as const) { const success_rate = navigation.actions?.[action]?.predictions.success_rate; if (!success_rate || !("probability" in success_rate) || typeof success_rate.probability !== "number") continue; const utility = success_rate.probability; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Transient database connection failure** ```json { "chosen": "retry" } ``` Run the selected retry, schema search or replan on the failed revision. Record task completion against that revision before the five-minute deadline. --- # Eve coding agent Source: https://www.spacefolder.com/docs/benchmarks/eve-coding-agent ![Time in seconds on the horizontal axis and model tokens on the vertical axis. Each line connects Qwen alone to Qwen with Spacefolder. Across all three scenarios, the agent used fewer tokens and reached the measured endpoint sooner with Spacefolder.](/docs/benchmarks/eve-coding-frontier.png) | Scenario | Speed | Time | Usage | Tokens | | --- | ---: | ---: | ---: | ---: | | pandas CI | **1.29× faster** | 148.6 → 115.0 s | **1.95× reduction** | 9,950 → 5,104 | | xarray CI | **3.30× faster** | 128.5 → 38.9 s | **1.61× reduction** | 3,297 → 2,043 | | Symptom-only diagnosis | **4.41× faster** | 31.4 → 7.1 s | **2.89× reduction** | 930 → 322 | ## Token usage gains On synthetic symptom-only bugs, Spacefolder cut token usage through first useful evidence by **65% (a 2.89× reduction)**. The pandas queue saw the largest end-to-end saving, with **49% fewer tokens** for the same verified diagnoses. On xarray, Eve saved model calls by going straight to verification when a known failure recurred. It still checked the current log before reusing the diagnosis. ## Speed gains On synthetic symptom-only bugs, Eve reached useful evidence **4.41× faster** with Spacefolder. Qwen usually searched the repository first. Spacefolder had learned that reproducing the failure often exposed the failing assertion, so Eve tried that earlier. Later repair attempts used more tokens. On real CI jobs, the largest speedup was **3.30×** for the single-worker xarray queue, with the same jobs verified. ## Methodology We compared the same Eve agent and Qwen2.5 3B model with and without guidance learned from earlier jobs. - **pandas CI.** Three workers investigated a mix of real GitHub Actions failures. For familiar typing failures, Spacefolder could route Eve directly to the type checker. Both agents verified the same jobs on the charted queue. On a harder queue where summaries lacked enough evidence, a fixed rule based on the failed step was faster and verified one more job than Spacefolder. - **xarray CI.** One worker investigated real failures across several pull requests, including a recurring Iris conversion error. When workers investigated jobs in parallel, Eve used fewer tokens with Spacefolder and verified the same jobs as Qwen alone. - **Symptom-only diagnosis.** We ran ten synthetic JavaScript bugs three times each with a generic CI failure message. Eve chose the first tool in both versions. With Spacefolder, it received a suggestion based on earlier tool outcomes. CI results are totals for a single queue replay. Synthetic results are averages per attempt through first useful evidence, with misses included. For evaluating whether a code change fixes a reported issue and passes the repository’s tests, see the [SWE-bench Verified dataset](https://huggingface.co/datasets/princeton-nlp/SWE-bench_Verified/tree/c104f840cc67f8b6eec6f759ebc8b2693d585d4a) **About the framework** Eve is Vercel’s TypeScript framework for durable agents. The Spacefolder extension lets an Eve agent record which tool it used and what happened, then use that experience to choose an investigation on a later job. [Official Eve documentation](https://eve.dev/docs/getting-started) · [Eve agent framework](/docs/integrations/eve) --- # Intervene at checkout Source: https://www.spacefolder.com/docs/benchmarks/fraud **KPI** · Expected dollars per checkout ($30 per timely payment, minus $180 per reported fraud and $0/$0.50/$3 for continue/verify/review). ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-checkout.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 | 12.978 | 100.00 | | Vector search + SQL for matching situations¹ | 12.978 | 100.00 | | SQL for all situations¹ | 10.434 | 82.81 | | First listed action | 7.352 | 52.08 | | Ground truth | 12.978 | 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: "checkout_example", entity_type: "shopping_order", entity_id: "shopper-trip:checkout-verification", context: { scene: "Returning customer on a recognized device" }, actions: { continue_checkout: {"name": "checkout.payment_submitted", "data": {"provider": "stripe"}}, request_verification: {"name": "checkout.verification_requested", "data": {"method": "existing_account_auth"}}, pause_review: {"name": "checkout.review_requested", "data": {"queue": "merchant"}}, }, predictions: { paid: {"event": "payment_intent.succeeded", "horizon": "5m"}, fraud_reported: {"event": "checkout.fraud_reported", "horizon": "120d"}, }, }); const cost = { continue_checkout: 0, request_verification: 0.50, pause_review: 3 }; let chosen: string | undefined; let best = -Infinity; for (const action of ["continue_checkout", "request_verification", "pause_review"] as const) { const paid = navigation.actions?.[action]?.predictions.paid; if (!paid || !("probability" in paid) || typeof paid.probability !== "number") continue; const fraud_reported = navigation.actions?.[action]?.predictions.fraud_reported; if (!fraud_reported || !("probability" in fraud_reported) || typeof fraud_reported.probability !== "number") continue; const utility = 30 * paid.probability - 180 * fraud_reported.probability - cost[action]; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Returning customer on a recognized device** ```json { "chosen": "continue_checkout" } ``` Submit the selected checkout intervention once. Observe five-minute payment completion and allow 120 days for fraud reports before closing the trial. --- # Recommend a seller Source: https://www.spacefolder.com/docs/benchmarks/fulfillment **KPI** · Purchase probability plus on-time fulfillment probability. ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-shopping.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 | 1.053 | 100.00 | | Vector search + SQL for matching situations¹ | 1.053 | 100.00 | | SQL for all situations¹ | 1.002 | 67.71 | | First listed action | 0.730 | 32.29 | | Ground truth | 1.053 | 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: "shopping_example", entity_type: "shopping_order", entity_id: "shopper-trip:headphone-order", context: { scene: "Urban delivery with a flexible budget" }, actions: { sound_direct: {"name": "shopping.offer_recommended", "data": {"seller_id": "sound_direct", "sku": "headphones"}}, city_audio: {"name": "shopping.offer_recommended", "data": {"seller_id": "city_audio", "sku": "headphones"}}, }, predictions: { purchased: {"event": "order.placed", "horizon": "1h"}, on_time: {"event": "delivery.on_time", "horizon": "2d"}, }, }); let chosen: string | undefined; let best = -Infinity; for (const action of ["sound_direct", "city_audio"] as const) { const purchased = navigation.actions?.[action]?.predictions.purchased; if (!purchased || !("probability" in purchased) || typeof purchased.probability !== "number") continue; const on_time = navigation.actions?.[action]?.predictions.on_time; if (!on_time || !("probability" in on_time) || typeof on_time.probability !== "number") continue; const utility = purchased.probability + on_time.probability; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Urban delivery with a flexible budget** ```json { "chosen": "sound_direct" } ``` Recommend the selected seller and record the actual purchase and on-time fulfillment against that order. Keep orders with incomplete delivery coverage unresolved. --- # Configure video playback Source: https://www.spacefolder.com/docs/benchmarks/movies **KPI** · Watch probability plus purchase probability. ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-movies.png) ## After 1,000 navigations per World Spacefolder chose the highest-value action on **82 of 96** held-out navigations. | Approach | Expected utility | Score / 100 | | --- | ---: | ---: | | Spacefolder | 0.792 | 98.13 | | Vector search + SQL for matching situations¹ | 0.792 | 98.13 | | SQL for all situations¹ | 0.767 | 79.38 | | First listed action | 0.506 | 3.68 | | Ground truth | 0.792 | 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: "movies_example", entity_type: "viewer_session", entity_id: "user_123", context: { scene: "Returning viewer on a living-room TV" }, actions: { no_action: {"name": "decision.configuration_retained", "data": {}}, enable_autoplay: {"name": "experience.trailer_autoplay_set", "data": {"enabled": 1}}, enable_preload: {"name": "experience.player_preload_set", "data": {"enabled": 1}}, }, predictions: { watch: {"event": "movie_watched", "horizon": "1h"}, purchase: {"event": "movie_purchased", "horizon": "1h"}, }, }); let chosen: string | undefined; let best = -Infinity; for (const action of ["no_action", "enable_autoplay", "enable_preload"] as const) { const watch = navigation.actions?.[action]?.predictions.watch; if (!watch || !("probability" in watch) || typeof watch.probability !== "number") continue; const purchase = navigation.actions?.[action]?.predictions.purchase; if (!purchase || !("probability" in purchase) || typeof purchase.probability !== "number") continue; const utility = watch.probability + purchase.probability; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Returning viewer on a living-room TV** ```json { "chosen": "enable_preload" } ``` Apply the chosen player configuration for the viewer session. Record subsequent watch and purchase events against the same session. --- # Time a personal reminder Source: https://www.spacefolder.com/docs/benchmarks/personal **KPI** · Probability of same-day completion minus interruption cost (0.10 now, 0.02 digest, zero silent). ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-personal.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 | 0.838 | 100.00 | | Vector search + SQL for matching situations¹ | 0.838 | 100.00 | | SQL for all situations¹ | 0.737 | 69.71 | | First listed action | 0.618 | 44.79 | | Ground truth | 0.838 | 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: "personal_example", entity_type: "task_attempt", entity_id: "personal-001", context: { scene: "In focus time; digest before deadline" }, actions: { notify_now: {"name": "personal.action", "data": {"choice": "notify_now"}}, digest: {"name": "personal.action", "data": {"choice": "digest"}}, silent: {"name": "personal.action", "data": {"choice": "silent"}}, }, predictions: { completed: {"event": "task.completed", "horizon": "1d"}, }, }); const cost = { notify_now: 0.10, digest: 0.02, silent: 0 }; let chosen: string | undefined; let best = -Infinity; for (const action of ["notify_now", "digest", "silent"] as const) { const completed = navigation.actions?.[action]?.predictions.completed; if (!completed || !("probability" in completed) || typeof completed.probability !== "number") continue; const utility = completed.probability - cost[action]; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **In focus time; digest before deadline** ```json { "chosen": "digest" } ``` Honor the user's permitted notification windows. Record the selected delivery or silence and follow the task through its one-day completion window. --- # Choose a publishing format Source: https://www.spacefolder.com/docs/benchmarks/publishing **KPI** · Engagement probability plus audience growth probability. ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-personal_brand.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 | 0.835 | 100.00 | | Vector search + SQL for matching situations¹ | 0.835 | 100.00 | | SQL for all situations¹ | 0.719 | 54.42 | | First listed action | 0.623 | 50.00 | | Ground truth | 0.835 | 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: "personal_brand_example", entity_type: "content_campaign", entity_id: "personal-brand:next-post", context: { scene: "Builders seeking implementation details" }, actions: { blog_guide: {"name": "post.published", "data": {"draft_id": "blog_guide", "channel": "blog", "format": "guide", "title": "A practical guide to agents that learn from experience", "text": "A worked example of recording tool outcomes and comparing the next actions before an agent executes them.", "topic": "agent_experience", "audience": {"segment": "founders_and_builders", "roles": ["founder", "software_engineer"], "interests": ["coding_agents", "developer_tools"], "language": "en"}, "published_hour_utc": 9}}, linkedin_story: {"name": "post.published", "data": {"draft_id": "linkedin_story", "channel": "linkedin", "format": "personal_story", "title": "Our agent kept retrying the same failed strategy. Here is what we changed.", "text": "We started measuring which action worked in each context. Here are the results, the surprising failure, and the code we changed.", "topic": "agent_experience", "audience": {"segment": "founders_and_builders", "roles": ["founder", "software_engineer"], "interests": ["coding_agents", "developer_tools"], "language": "en"}, "published_hour_utc": 9}}, x_thread: {"name": "post.published", "data": {"draft_id": "x_thread", "channel": "x", "format": "thread", "title": "Three lessons from building an agent that uses past experience", "text": "A short thread: record outcomes, compare candidate actions, and check whether the recommendation actually helped.", "topic": "agent_experience", "audience": {"segment": "founders_and_builders", "roles": ["founder", "software_engineer"], "interests": ["coding_agents", "developer_tools"], "language": "en"}, "published_hour_utc": 9}}, }, predictions: { engagement: {"event": "post.engaged", "horizon": "24h"}, audience_growth: {"event": "audience.subscribed", "horizon": "7d"}, }, }); let chosen: string | undefined; let best = -Infinity; for (const action of ["blog_guide", "linkedin_story", "x_thread"] as const) { const engagement = navigation.actions?.[action]?.predictions.engagement; if (!engagement || !("probability" in engagement) || typeof engagement.probability !== "number") continue; const audience_growth = navigation.actions?.[action]?.predictions.audience_growth; if (!audience_growth || !("probability" in audience_growth) || typeof audience_growth.probability !== "number") continue; const utility = engagement.probability + audience_growth.probability; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Builders seeking implementation details** ```json { "chosen": "blog_guide" } ``` Publish the chosen format and record engagement and audience growth for the same campaign through their respective observation windows. --- # Choose a retention offer Source: https://www.spacefolder.com/docs/benchmarks/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. --- # Correct a robot placement Source: https://www.spacefolder.com/docs/benchmarks/robotics **KPI** · Placement success probability minus contact probability. ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-robotics.png) ## After 1,000 navigations per World Spacefolder chose the highest-value action on **83 of 96** held-out navigations. | Approach | Expected utility | Score / 100 | | --- | ---: | ---: | | Spacefolder | 0.589 | 98.25 | | Vector search + SQL for matching situations¹ | 0.589 | 98.25 | | SQL for all situations¹ | 0.448 | 68.53 | | First listed action | 0.086 | 0.00 | | Ground truth | 0.597 | 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: "robotics_example", entity_type: "task_attempt", entity_id: "placement-042", context: { scene: "Part displaced mainly along the fixture x axis" }, actions: { no_action: {"name": "decision.configuration_retained", "data": {}}, correct_x: {"name": "robot.pose_correction", "data": {"frame": "fixture", "translation_m": {"x": -0.002, "y": 0, "z": 0}}}, correct_xyz: {"name": "robot.pose_correction", "data": {"frame": "fixture", "translation_m": {"x": -0.002, "y": 0.001, "z": -0.0005}}}, adjust_grasp: {"name": "robot.grasp_correction", "data": {"grasp_id": "grasp-7", "gripper_width_m": 0.03, "grip_force_n": 9.0}}, }, predictions: { success: {"event": "task.succeeded", "horizon": "5s"}, contact: {"event": "safety.contact_detected", "horizon": "5s"}, }, }); let chosen: string | undefined; let best = -Infinity; for (const action of ["no_action", "correct_x", "correct_xyz", "adjust_grasp"] as const) { const success = navigation.actions?.[action]?.predictions.success; if (!success || !("probability" in success) || typeof success.probability !== "number") continue; const contact = navigation.actions?.[action]?.predictions.contact; if (!contact || !("probability" in contact) || typeof contact.probability !== "number") continue; const utility = success.probability - contact.probability; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Part displaced mainly along the fixture x axis** ```json { "chosen": "correct_x" } ``` Dispatch the controller-permitted correction in the virtual workcell. Attribute placement and contact observations to the same attempt over five seconds. --- # ZOZO Open Bandit Dataset Source: https://www.spacefolder.com/docs/benchmarks/shopping On 30,188 held-out impressions, Spacefolder and cached popularity tied at **22.53 estimated clicks per 1,000 impressions**. The specialist logistic recommender scored **16.89**. ![Cumulative click estimates by elapsed test hour. Spacefolder and cached popularity overlap.](/docs/benchmarks/shopping-curve.png) Personalization changed 33 picks. The randomized logger displayed the new pick on none of those impressions, so their click value remains uncertain. The chart estimates clicks by weighting observations by inverse display probability. Each policy was frozen before the test period. **About the dataset** ZOZO logged which fashion item appeared on ZOZOTOWN, its probability of being shown and whether the shopper clicked. This replay uses the first recommendation slot in the randomized men’s campaign. [Explore the ZOZO dataset](https://research.zozo.com/data.html) --- # Recover an inventory lookup Source: https://www.spacefolder.com/docs/benchmarks/tools **KPI** · Probability of delivering a valid inventory response in five seconds. ![Navigation score by prior navigations per World.](/docs/benchmarks/industry-tools.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 | 0.667 | 100.00 | | Vector search + SQL for matching situations¹ | 0.667 | 100.00 | | SQL for all situations¹ | 0.550 | 54.69 | | First listed action | 0.455 | 48.96 | | Ground truth | 0.667 | 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: "tools_example", entity_type: "tool_attempt", entity_id: "tools-001", context: { scene: "Primary service recovering after a timeout" }, actions: { retry_primary: {"name": "tools.action", "data": {"choice": "retry_primary"}}, refresh_cache: {"name": "tools.action", "data": {"choice": "refresh_cache"}}, query_replica: {"name": "tools.action", "data": {"choice": "query_replica"}}, }, predictions: { on_time: {"event": "inventory.valid_response", "horizon": "5s"}, }, }); let chosen: string | undefined; let best = -Infinity; for (const action of ["retry_primary", "refresh_cache", "query_replica"] as const) { const on_time = navigation.actions?.[action]?.predictions.on_time; if (!on_time || !("probability" in on_time) || typeof on_time.probability !== "number") continue; const utility = on_time.probability; if (utility > best) { best = utility; chosen = action; } } console.log(JSON.stringify({ chosen }, null, 2)); ``` ## Example output **Primary service recovering after a timeout** ```json { "chosen": "retry_primary" } ``` After the timeout, issue exactly one lookup through the selected path. Record a success only when a valid inventory response arrives within five seconds. --- # Large Adaptive World Model Source: https://www.spacefolder.com/docs/concepts/large-adaptive-world-model A **Large Adaptive World Model (LAWM)** learns a representation of a changing world from experience and uses that representation to predict possible futures. Spacefolder separates learning and prediction into two complementary models: **Fold** updates the world representation from observations, actions, and outcomes; **Navigate** reasons over that representation to predict outcomes and compare possible actions. ## Fold learns from what happens Fold is a small model designed to run close to your data, on your infrastructure. It continuously learns from observations, actions, and outcomes, turning application activity into compact learned trajectories. These trajectories represent how the world changes over time. As new activity arrives, Fold updates the learned state with that experience. ## Navigate predicts what could happen Navigate is a large model that runs on Spacefolder infrastructure. It combines folded state with the current user or task context, a predictive question, and optional candidate actions to predict outcomes for the decision at hand. When objectives compete, Navigate can describe a Pareto frontier: the options for which improving one objective requires giving something up on another. ## A continuous learning loop Learning and prediction form a continuous loop: 1. **Observe:** your application records what happened, including actions taken and their measured outcomes. 2. **Fold:** Fold incorporates that activity into learned trajectories and world state. 3. **Navigate:** Navigate combines the state with current context to predict outcomes and compare candidate actions. 4. **Measure:** your application chooses what to do, measures the result, and feeds that experience back into the loop. Navigate does not execute the actions it compares. Your software remains responsible for decisions, constraints, and execution. ## Predictions grounded in experience Spacefolder preserves history and traces sources so predictions can be compared with actual outcomes. Measured outcomes become new experience for Fold, connecting future predictions to what actually happened. Read [Primitives](/docs/concepts/primitives) for Worlds, events, predictions, actions, and objectives. --- # Primitives Source: https://www.spacefolder.com/docs/concepts/primitives Spacefolder exposes two operations: **Fold** records what happened; **Navigate** asks what could happen next. A **World** connects their event history and learned state. Context, predictions, actions, and objectives describe a Navigate request. ## World A World holds your application’s event history and learned state. Use its `world_id` in every Fold and Navigate request. [World API reference](/docs/reference/api/worlds/create-world) ## Fold Fold records events in a World. Reuse the same event ID when retrying so each event is counted once. [Fold API reference](/docs/reference/api/fold/fold) ### Event An event records an observation, an action that was taken, or an outcome that was measured. It describes something that happened, with a stable ID and timestamp. ```json { "id": "view-001", "name": "movie_viewed", "source": "player", "timestamp": "2026-11-11T12:00:00Z", "entity_id": "user_123", "entity_type": "user", "data": {"movie_id": "movie_456"} } ``` | Field | Meaning | | --- | --- | | `id` | Stable event identity. Reuse it when retrying the same event. | | `name` | What happened, such as `movie_viewed` or `movie_watched`. Keep names consistent across ingestion and predictions. | | `source` | Optional name of the system that produced this event. | | `timestamp` | When it happened. Use an RFC 3339 timestamp with a timezone. | | `entity_id`, `entity_type` | Optional identifiers for the entity the event concerns. | | `data` | Application-specific JSON data, such as a movie ID or measured latency. | A proposed action in a Navigate request becomes an observed event only after your application takes it and sends the corresponding event through Fold. ## Navigate Navigate uses a World’s history and the current context to forecast an outcome or compare possible actions. [Navigate API reference](/docs/reference/api/navigate/navigate) ### Context `context` is a required object for information you know when you call Navigate, such as `{"screen": "movie_details", "movie_id": "movie_456"}`. Choose the keys your application uses. Pass `{}` when you have nothing to add. ### Prediction A prediction names the outcome you want to estimate and how far ahead to look. Give each prediction a label, such as `watch` or `revenue`. Navigate uses that label in the response.
| Question | Prediction | | --- | --- | | Will the shopper place an order within a day? | `{"event": "order.placed", "horizon": "1d"}` | | What revenue reading should we expect tomorrow? | `{"event": "revenue.data.value", "horizon": "1d"}` | | What will daily sales total over the next week? | `{"event": "sale.data.amount", "aggregation": "sum", "interval": "1d", "horizon": "7d"}` |
Use the folded event name to predict its probability with or without a proposed action. Without actions, Navigate finds earlier occurrences of the entity’s latest event among entities of the same type. It compares non-overlapping windows at the same delay and horizon. Fold an `observation.coverage` receipt with `data.event` and `data.complete_through` to mark a historical window complete. For example, two covered product views followed by two orders give a smoothed probability of 75%. The calculation is `(windows with an order + 1) / (covered windows + 2)`. If no comparable window is covered, Navigate returns `insufficient_event_history`. Append `.data.` and a numeric field path to predict a reading, with or without actions. For example, `sale.data.amount` reads `data.amount` from each `sale` event. For standalone readings, fold one untagged series per entity with consistent units and a reading in each of the two most recent intervals. `horizon` sets how far ahead to predict. A single interval returns `value`. Set `interval` shorter than `horizon` to get timestamped `points`, as in the weekly sales example with seven daily totals. Both fields accept durations such as `30s`, `15m`, `1h` or `7d`, up to 366 days. `aggregation` combines numeric readings within each interval. For two sales of 10 and 20, the default `mean` gives 15, `sum` gives 30, `min` gives 10 and `max` gives 20. Supply `unit` if you want to label the units used in Fold. The [Navigate API reference](/docs/reference/api/navigate/navigate) also documents explicit event and field syntax, including literal event names containing `.data.`. The current model supports named event probabilities and numeric readings. The contract also defines next-event distributions and event counts for future model support. ### Action An action is a choice you want Navigate to evaluate, such as keeping the standard price or running a promotion. Fold the action your application takes. [Weekly revenue example](/docs/get-started#4-compare-weekly-revenue) ### Objective An objective names the prediction to maximize or minimize. For example, maximize `revenue` when comparing pricing actions. ### Confidence Confidence is a 0–1 score for how strongly comparable World observations support a forecast. A score of `0` means zero support. A missing or `null` score means confidence is unavailable. ### Verification Fold the observed outcome, any action taken, and an `observation.coverage` receipt when reporting is complete. After the check, call `navigation(run_id)` in either SDK and read the measured revenue from `verification.revenue.value`. For events, verification returns `1` for an observed occurrence or `0` for a confirmed absence. [SDK methods](/docs/reference/sdks#methods) --- # Get started Source: https://www.spacefolder.com/docs/get-started Create a **World** for your application, **Fold** observed events into it, then **Navigate** to predict outcomes and compare possible actions. This example compares continuing standard pricing with continuing a promotion. The goal is to maximize one store’s revenue over the next seven days. ## 1. Get an API key Sign in to [Spacefolder](https://platform.spacefolder.com), select your workspace, and create a key in [API keys](https://platform.spacefolder.com/api-keys). Set it in your server environment: ```sh export SPACEFOLDER_API_KEY='your-workspace-api-key' ``` The SDKs and CLI already connect to the hosted API. Your key grants access to the selected workspace; keep it on your server. Keys expire after 30 days by default, with an expiry of up to 365 days available in the platform. ## 2. Create a World The examples use curl, so you can start without installing a package. Choose an unused World ID: ```sh curl --fail-with-body https://api.spacefolder.com/v1/worlds \ -H "Authorization: Bearer $SPACEFOLDER_API_KEY" \ -H 'Content-Type: application/json' \ -d '{"id":"my_app","name":"My application"}' ``` Use `my_app` as the `world_id` in the following requests. [Worlds](/docs/concepts/primitives#world) keep independent streams of event history and learned state. ## 3. Fold observed events Save the [example sales history](/docs/examples/weekly-revenue-fold.json) as `fold.json`. It contains two simulated pricing histories for the same store. Each has two sales per day for eight days. Each sale carries its dollar amount in `data.usd` and its pricing action in `data.forecast_action`. Use the complete file so both actions have enough history for a seven-day forecast. ```sh curl --fail-with-body https://api.spacefolder.com/v1/fold \ -H "Authorization: Bearer $SPACEFOLDER_API_KEY" \ -H 'Content-Type: application/json' --data-binary @fold.json ``` The [Fold receipt](/docs/reference/api/fold/fold) returns `run_id`, `world_version`, `accepted_count`, and `deduplicated_count`. Reuse an event's `id` when retrying its delivery. Continue folding events as your application observes them, including actions taken and their measured outcomes. ## 4. Compare weekly revenue Save this as `navigate.json`: ```json { "world_id": "my_app", "nav_id": "weekly_revenue", "entity_type": "store", "entity_id": "store_42", "context": {}, "actions": { "standard": { "name": "pricing.standard" }, "promotion": { "name": "pricing.promotion" } }, "predictions": { "revenue": { "event": "sale.completed.data.usd", "aggregation": "sum", "horizon": "7d", "interval": "1d" } }, "objectives": { "revenue": { "direction": "maximize" } } } ``` Navigate adds sales within each day and uses the same `sum` operation on the seven daily action scores to rank the week. Each action still returns seven forecast points. Reuse `nav_id` for later runs of this decision. Navigate generates a separate `run_id` for each call. ```sh curl --fail-with-body https://api.spacefolder.com/v1/navigate \ -H "Authorization: Bearer $SPACEFOLDER_API_KEY" \ -H 'Content-Type: application/json' --data-binary @navigate.json ``` Read `actions.promotion.predictions.revenue.points` and `actions.standard.predictions.revenue.points` for the daily forecasts. Each point has an `ended_at` timestamp and a dollar value. The `rank` on each action gives the comparison result. Read `actions.promotion.predictions.revenue.confidence` for the [confidence score](/docs/concepts/primitives#confidence) for the whole promotion forecast. In this synthetic replay, the seven displayed forecasts total $924 for promotion (rank 1) and $854 for standard pricing (rank 2). These are forecasts for continuing each recorded pricing strategy. For a live decision, Fold the action actually taken, its sales and a coverage receipt before the verification deadline. [Metric verification](/docs/concepts/primitives#verification) ## Use the CLI or an SDK Once their first releases are published, install the packages: ```sh npm install -g @spacefolder/cli spacefolder auth status spacefolder fold fold.json spacefolder navigate navigate.json ``` ```sh npm install @spacefolder/sdk # or, for Python: pip install spacefolder-sdk ``` All three clients read `SPACEFOLDER_API_KEY`. See [SDKs](/docs/reference/sdks) for source installation before the first release, or the [CLI reference](/docs/reference/cli) for commands and JSON input. --- # Eve agent framework Source: https://www.spacefolder.com/docs/integrations/eve Learn about the Eve agent framework in [Vercel’s overview](https://vercel.com/eve) and the [official Eve docs](https://eve.dev/docs). ## Why add Spacefolder to your Eve agents? Eve is Vercel’s framework for building agents. Spacefolder lets an agent use what happened on earlier requests to decide how to help this user now. A personal assistant might learn that someone acts on reminders in their daily digest but dismisses them during meetings. A support agent might learn which response helps a customer resolve a return. **Coding agent benchmark** On Eve coding agents, Spacefolder reached useful evidence 4.41× faster with a 2.89× reduction in tokens. [See the benchmark](/docs/benchmarks/eve-coding-agent) You choose what a good outcome means. For reminder timing, the goal can be getting the task done with fewer interruptions. For recommendations, it can be helping the user find an item they want. The Spacefolder benchmarks explore both kinds of decisions. [**Reminder timing on generated histories**](/docs/benchmarks/personal) · [**Shopping recommendations on public data**](/docs/benchmarks/shopping) · [**All benchmarks**](/docs/benchmarks) ## Install the extension From the root of an Eve project running Node 24+, use `eve add` to install the Spacefolder extension from npm and create `agent/extensions/spacefolder.ts`. The extension includes `@spacefolder/sdk` as a dependency. [Install integrations in Eve](https://eve.dev/docs/install-integrations) ```sh npx eve add https://www.spacefolder.com/docs/r/spacefolder.json ``` For a manual install, run `npm install @spacefolder/eve` and create `agent/extensions/spacefolder.ts` with the configuration below. Set your World ID and workspace key in the environment that runs the agent. [Create a World and key](/docs/get-started) ```sh export SPACEFOLDER_WORLD_ID='' export SPACEFOLDER_API_KEY='' ``` ## Configure a decision Choose a decision your agent makes repeatedly. The starter skips a turn when `navigate` returns `null`. To guide a decision, return the context available when the agent acts, its possible actions, and the outcome you want to predict. Use `horizon` to specify how long after the decision that outcome counts. [Decision context and actions](/docs/concepts/primitives#context) · [How Eve mounts extensions](https://eve.dev/docs/extensions) This example assumes your agent already has tools named `notify_now` and `add_to_digest`. It uses the signed-in user’s ID and whether the request mentions a meeting to choose when to send a reminder. Success means the user completes the task within a day. ```ts import spacefolder from "@spacefolder/eve"; export default spacefolder({ navigate(ctx) { const request = ctx.turn?.input.find((part) => part.kind === "text")?.text; const userId = ctx.session.auth.current?.principalId; const world = process.env.SPACEFOLDER_WORLD_ID; if (!world || !userId || !request || !/\bremind(?:er)?\b/i.test(request)) return null; return { world, context: { user: { id: userId }, mentionsMeeting: /\bmeeting\b/i.test(request) }, options: { notify_now: "Use notify_now to send the reminder immediately.", add_to_digest: "Use add_to_digest to include it in the user's next daily digest.", }, outcome: "task.completed", horizon: "1d", }; }, fold(observation, candidates) { if (observation.kind === "tool" && candidates.includes(observation.name)) { return observation.name; } return null; }, }); ``` **Navigate** compares how likely each option is to lead to the configured outcome. When it can score an option, Eve receives the corresponding suggestion. If Navigate returns no scores, Eve proceeds without a suggestion. In either case, **Fold** records the tool Eve actually used when that tool completes. [Navigate API reference](/docs/reference/api/navigate/navigate) · [Dynamic instructions in Eve](https://eve.dev/docs/guides/dynamic-capabilities) ## Record the outcome Keep the Spacefolder decision ID with the item your agent acted on. When your application observes the outcome, use `foldEvent` to record it in the same World with that decision ID. For a local test, the ID is the `episode` value in the `Spacefolder Navigate` log. In the reminder example, call this function when the user marks the task complete: ```ts import { foldEvent, SpacefolderClient } from "@spacefolder/eve/experience"; export async function recordCompletion(world: string, decisionId: string, completedAt: Date) { await foldEvent( new SpacefolderClient(), { world, id: decisionId }, "task.completed", completedAt.toISOString(), decisionId + "-completed", ); } ``` If the user dismisses the reminder, record `reminder.dismissed` with its own event ID. Linking each response to the original decision lets Spacefolder learn which timing works for that user. [Fold and events](/docs/concepts/primitives#fold) · [Fold API reference](/docs/reference/api/fold/fold) --- # Reference Source: https://www.spacefolder.com/docs/reference Use the same World, Fold, and Navigate primitives from code, HTTP, or your terminal. | Reference | What you will find | | --- | --- | | [SDKs](/docs/reference/sdks) | TypeScript and Python installation, configuration, examples, and methods | | [API](/docs/reference/api) | Authentication, request and response schemas, pagination, and errors | | [CLI](/docs/reference/cli) | Installation, commands, flags, JSON input, and exit codes | For a first integration, start with [Get started](/docs/get-started). Create your workspace API key in the [platform](https://platform.spacefolder.com/api-keys). --- # API reference Source: https://www.spacefolder.com/docs/reference/api Use the Spacefolder HTTP API to create Worlds, Fold application events, and Navigate predictions with a workspace API key. ## API conventions Base URL: `https://api.spacefolder.com/v1`. `/api/v1` is also accepted. Requests and responses use JSON. Browse Worlds, Fold, and Navigate below, or download [OpenAPI JSON](/docs/spacefolder-api.openapi.json). The domain schemas are generated from the Rust contracts used by the API and SDKs. ### Authentication Send `Authorization: Bearer YOUR_API_KEY` on each request. Obtain a workspace key in the [platform](https://platform.spacefolder.com/api-keys). Keys grant workspace access until expiry or signing-key rotation; individual revocation is unavailable. Never distribute an operator/admin credential to users. Create keys in the platform before making API requests. Each key is scoped to its workspace. ### Requests Create a World before folding or navigating. JSON request bodies are limited to 8 MiB. Use a batch size your application can retry comfortably. Keep event IDs stable when retrying Fold requests. Supply the same required `nav_id` for a recurring decision in a World. Each Navigate request creates its own `run_id`, including retries. #### Navigate context Every `POST /navigate` request requires a `context` JSON object containing the user or task information available at decision time. Keys are application-defined. Context describes the immediate situation alongside the World's folded history; continue folding observed events and outcomes. For example, a prediction without action alternatives can include the movie currently shown to a viewer: ```json { "world_id": "my_app", "nav_id": "watch_after_impression", "entity_id": "user_123", "context": { "movie_id": "movie_456", "screen": "movie_details" }, "predictions": { "watch": { "event": "movie_watched", "horizon": "1h" } } } ``` When updating an older request, give the recurring decision a stable `nav_id` and add `"context": {}` if no decision-time information is available. This applies to HTTP, SDK, and CLI requests, including predictions without actions. Omitting `context`, passing `null`, or passing an array or scalar is invalid. See [Context](/docs/concepts/primitives#context) and the [Navigate request schema](/docs/reference/api/navigate/navigate). Dates and times are RFC 3339 strings with a timezone, such as `2026-01-09T12:00:00Z`. Elapsed times such as `duration_ms` are numbers. #### Navigate confidence Read `confidence` on each scored prediction under `predictions` or `actions..predictions`. A score is a number from 0 to 1, rounded to hundredths. It measures support from comparable World observations. For an event, `probability` estimates the likelihood of occurrence and `confidence` describes support for that estimate. A numeric series has one score for its least-supported interval. Treat `0` as a valid score. A `null` or absent field carries no score. A saved run returns the original forecast and confidence along with the latest verification values. See [Confidence](/docs/concepts/primitives#confidence). ### Pagination World listing uses `limit` (1–100) and a `cursor` from the previous page. Continue using `next_cursor` until it is null. Fold and Navigate history require `world_id`. Each row identifies one run. Pass `next_cursor` back as `cursor`, keeping the World and any `nav_id` filter consistent. Read a saved result at `GET /navigate/{id}`. It returns the forecast with current verification values. Add `?trace=true` to inspect its original execution. ### Errors | Status | Meaning | | --- | --- | | 400 / 422 | Invalid input, query, or unsupported request | | 401 / 403 | Missing/invalid credentials or rejected access | | 404 | Record not found | | 409 | Conflict, inactive World, or permanently deleted World ID | | 501 | No verified model runtime configured | | 503 | Runtime, state, storage, or authentication dependency unavailable | A non-successful response includes an explanation in its body. Error bodies vary by route: some use an `error` string, others an `error` object. Inspect the HTTP status and returned body. The SDKs preserve status and payload in `SpacefolderApiError`; CLI failures use JSON on stderr. Deletion can return `202` while cleanup is in progress. Inspect `state` and retry the same confirmed deletion; a `202` is not proof cleanup has completed. ### Agents Read [/llms.txt](/docs/llms.txt) for the documentation index, [/llms-full.txt](/docs/llms-full.txt) for the full text, or append `.md` to a page URL. Use [/spacefolder-api.openapi.json](/docs/spacefolder-api.openapi.json) for the machine-readable API contract. Version 0.1.0 Base URL: `https://api.spacefolder.com/v1` ## Worlds - [`POST /worlds`](/docs/reference/api/worlds/create-world) — Create a world. - [`GET /worlds`](/docs/reference/api/worlds/list-worlds) — List worlds. - [`GET /worlds/{id}`](/docs/reference/api/worlds/get-world) — Get a world. - [`PATCH /worlds/{id}`](/docs/reference/api/worlds/rename-world) — Rename a world. - [`DELETE /worlds/{id}`](/docs/reference/api/worlds/delete-world) — Delete a world. ## Fold - [`POST /fold`](/docs/reference/api/fold/fold) — Fold events. - [`GET /fold`](/docs/reference/api/fold/list-fold-runs) — List Folds. - [`GET /fold/{id}`](/docs/reference/api/fold/get-fold-detail) — Get a Fold. ## Navigate - [`POST /navigate`](/docs/reference/api/navigate/navigate) — Navigate predictions. - [`GET /navigate`](/docs/reference/api/navigate/list-navigate-runs) — List navigations. - [`GET /navigate/{id}`](/docs/reference/api/navigate/get-navigate-detail) — Get a navigation. --- # Fold events Source: https://www.spacefolder.com/docs/reference/api/fold/fold Ingest observed events into a world. Reuse event IDs on retries; inspect accepted_count and deduplicated_count. `POST /fold` **Request body** (`application/json`, required) - `events` (Event[], required) - `world_id` (WorldId, required) Request body example: ```json { "world_id": "my_app", "events": [ { "id": "standard-01-12", "name": "sale.completed", "timestamp": "2026-01-01T12:00:00Z", "entity_type": "store", "entity_id": "store_42", "data": { "usd": 40, "forecast_action": { "name": "pricing.standard" }, "forecast_observation": "metric", "timeline_id": "standard" }, "source": "billing" }, { "id": "standard-01-23", "name": "sale.completed", "timestamp": "2026-01-01T23:59:59Z", "entity_type": "store", "entity_id": "store_42", "data": { "usd": 60, "forecast_action": { "name": "pricing.standard" }, "forecast_observation": "metric", "timeline_id": "standard" }, "source": "billing" } ] } ``` **Responses** - `200` — Success Response example, 200: ```json { "accepted_count": 0, "deduplicated_count": 0, "run_id": "string", "world_id": "string", "world_version": 0 } ``` --- # Get a Fold Source: https://www.spacefolder.com/docs/reference/api/fold/get-fold-detail Read one Fold run. event_count counts all submitted events, including duplicates. Find the batch in trace.request.events and its receipt in trace.response. `GET /fold/{id}` **Responses** - `200` — Success Response example, 200: ```json { "created_at": "2019-08-24T14:15:22Z", "event_count": 0, "run_id": "string", "status": "completed", "trace": { "completed_at": "2019-08-24T14:15:22Z", "duration_ms": 0, "error": "string", "operation": "string", "spans": [ { "attributes": {}, "completed_at": "2019-08-24T14:15:22Z", "duration_ms": 0, "name": "string", "span_id": "string", "start_offset_ms": 0.1, "started_at": "2019-08-24T14:15:22Z", "status": "string" } ], "started_at": "2019-08-24T14:15:22Z", "status": "string", "trace_id": "string", "world_id": "string", "request": { "world_id": "my_app" }, "response": { "world_id": "my_app" } }, "world_id": "string" } ``` --- # List Folds Source: https://www.spacefolder.com/docs/reference/api/fold/list-fold-runs Returns one row per run, newest first. Pass next_cursor as cursor for the next page. `GET /fold` **Responses** - `200` — Success Response example, 200: ```json { "data": [ { "created_at": "2019-08-24T14:15:22Z", "event_count": 0, "run_id": "string", "status": "completed", "world_id": "string" } ], "next_cursor": "string" } ``` --- # Get a navigation Source: https://www.spacefolder.com/docs/reference/api/navigate/get-navigate-detail Returns the original Navigate response including its original confidence and current verification values. Set trace=true to include the original request, response, and execution spans. `GET /navigate/{id}` **Responses** - `200` — Success Response example, 200: ```json { "actions": { "your_action_name": { "predictions": { "your_prediction_name": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property1": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property2": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" } }, "rank": 0 }, "property1": { "predictions": { "your_prediction_name": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property1": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property2": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" } }, "rank": 0 }, "property2": { "predictions": { "your_prediction_name": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property1": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property2": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" } }, "rank": 0 } }, "nav_id": "string", "outcomes": { "action_evidence_ids": [ "string" ], "as_of_world_version": 0, "observed_action": "string", "predictions": { "your_prediction_name": { "evidence_ids": [ "string" ], "status": "observed", "value": null }, "property1": { "evidence_ids": [ "string" ], "status": "observed", "value": null }, "property2": { "evidence_ids": [ "string" ], "status": "observed", "value": null } } }, "predicted_at": "2019-08-24T14:15:22Z", "predictions": { "your_prediction_name": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property1": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" }, "property2": { "confidence": 0, "status": "predicted", "event": "string", "horizon": "30s", "probability": 0.1, "type": "event" } }, "run_id": "string", "trace": { "completed_at": "2019-08-24T14:15:22Z", "duration_ms": 0, "error": "string", "operation": "string", "spans": [ { "attributes": {}, "completed_at": "2019-08-24T14:15:22Z", "duration_ms": 0, "name": "string", "span_id": "string", "start_offset_ms": 0.1, "started_at": "2019-08-24T14:15:22Z", "status": "string" } ], "started_at": "2019-08-24T14:15:22Z", "status": "string", "trace_id": "string", "world_id": "string", "request": { "world_id": "my_app" }, "response": { "world_id": "my_app" } }, "verification": { "your_prediction_name": { "value": 0.1 }, "property1": { "value": 0.1 }, "property2": { "value": 0.1 } }, "world_id": "string", "world_version": 0 } ``` --- # List navigations Source: https://www.spacefolder.com/docs/reference/api/navigate/list-navigate-runs Returns one row per run, newest first. Pass next_cursor as cursor for the next page. `GET /navigate` **Responses** - `200` — Success Response example, 200: ```json { "data": [ { "created_at": "2019-08-24T14:15:22Z", "entity_id": "string", "entity_type": "string", "nav_id": "string", "run_id": "string", "status": "completed", "world_id": "string" } ], "next_cursor": "string" } ``` --- # Navigate predictions Source: https://www.spacefolder.com/docs/reference/api/navigate/navigate Request predictions and compare proposed actions against objectives. Include a context object with decision-time user and task information; pass an empty object when none is available. See [Context](/docs/concepts/primitives#context). Your application decides which action to execute. Scored estimates include [forecast confidence](/docs/concepts/primitives#confidence). See [Navigate](/docs/concepts/primitives#navigate), [predictions](/docs/concepts/primitives#prediction), [actions](/docs/concepts/primitives#action), and [objectives](/docs/concepts/primitives#objective) for definitions. `POST /navigate` **Request body** (`application/json`, required) - `actions` (object | null) — Choose a name for each proposed action. - `context` (object, required) — Decision-time user and task context. Pass an empty object when none is available. - `entity_id` (string | null) — ID of the subject whose history and later outcomes belong to this prediction. - `entity_type` (string | null) — Kind of subject, such as store or customer. Use the same type and ID as in Fold. - `model` (string | null) — Optional served model alias. Defaults to world-context-v1. - `nav_id` (string, required) — Stable name for a recurring decision within this World. Reuse it across runs to group their results. - `objectives` (object) — Use the name of a requested prediction as the key for its objective. - `predictions` (object, required) — Choose a name for each prediction. Expand the example below to choose its event, horizon and optional fields. - `verification` (Verification | null) - `world_id` (WorldId, required) Request body example: ```json { "world_id": "my_app", "nav_id": "weekly_revenue", "entity_type": "store", "entity_id": "store_42", "context": {}, "actions": { "standard": { "name": "pricing.standard" }, "promotion": { "name": "pricing.promotion" } }, "predictions": { "revenue": { "event": "sale.completed.data.usd", "aggregation": "sum", "horizon": "7d", "interval": "1d" } }, "objectives": { "revenue": { "direction": "maximize" } } } ``` **Responses** - `200` — Success Response example, 200: ```json { "nav_id": "weekly_revenue", "run_id": "nav_df4c02f8-cf08-4042-a805-cc765280ca91", "world_id": "my_app", "world_version": 32, "predicted_at": "2026-01-08T23:59:59Z", "actions": { "promotion": { "rank": 1, "predictions": { "revenue": { "confidence": 0.5, "points": [ { "ended_at": "2026-01-09T23:59:59Z", "value": 126 }, { "ended_at": "2026-01-10T23:59:59Z", "value": 128 }, { "ended_at": "2026-01-11T23:59:59Z", "value": 130 }, { "ended_at": "2026-01-12T23:59:59Z", "value": 132 }, { "ended_at": "2026-01-13T23:59:59Z", "value": 134 }, { "ended_at": "2026-01-14T23:59:59Z", "value": 136 }, { "ended_at": "2026-01-15T23:59:59Z", "value": 138 } ] } } }, "standard": { "rank": 2, "predictions": { "revenue": { "confidence": 0.5, "points": [ { "ended_at": "2026-01-09T23:59:59Z", "value": 116 }, { "ended_at": "2026-01-10T23:59:59Z", "value": 118 }, { "ended_at": "2026-01-11T23:59:59Z", "value": 120 }, { "ended_at": "2026-01-12T23:59:59Z", "value": 122 }, { "ended_at": "2026-01-13T23:59:59Z", "value": 124 }, { "ended_at": "2026-01-14T23:59:59Z", "value": 126 }, { "ended_at": "2026-01-15T23:59:59Z", "value": 128 } ] } } } }, "verification": {} } ``` --- # Create a world Source: https://www.spacefolder.com/docs/reference/api/worlds/create-world Create a workspace-scoped World to receive events and support predictions. `POST /worlds` **Request body** (`application/json`, required) - `id` (WorldId, required) - `name` (string | null) Request body example: ```json { "id": "string", "name": "My application" } ``` **Responses** - `200` — Success Response example, 200: ```json { "created_at": "2019-08-24T14:15:22Z", "id": "string", "name": "string" } ``` --- # Delete a world Source: https://www.spacefolder.com/docs/reference/api/worlds/delete-world Repeat the ID from the URL in confirm_id to confirm permanent deletion. Deleted World IDs cannot be reused. `DELETE /worlds/{id}` **Request body** (`application/json`, required) - `confirm_id` (WorldId, required) — Repeat the World ID from the URL to confirm permanent deletion. Request body example: ```json { "confirm_id": "string" } ``` **Responses** - `200` — Deleted - `202` — Deletion is in progress; retry with the same confirmation Response example, 200: ```json { "error": "string", "state": "string" } ``` --- # Get a world Source: https://www.spacefolder.com/docs/reference/api/worlds/get-world Read a World's name and creation time using its workspace-scoped ID. `GET /worlds/{id}` **Responses** - `200` — Success Response example, 200: ```json { "created_at": "2019-08-24T14:15:22Z", "id": "string", "name": "string" } ``` --- # List worlds Source: https://www.spacefolder.com/docs/reference/api/worlds/list-worlds List workspace Worlds with cursor pagination and configurable page sizes. `GET /worlds` **Responses** - `200` — Success Response example, 200: ```json { "next_cursor": "string", "worlds": [ { "created_at": "2019-08-24T14:15:22Z", "id": "string", "name": "string" } ] } ``` --- # Rename a world Source: https://www.spacefolder.com/docs/reference/api/worlds/rename-world Update the display name of an existing workspace World without changing its ID. `PATCH /worlds/{id}` **Request body** (`application/json`, required) - `name` (string, required) Request body example: ```json { "name": "string" } ``` **Responses** - `200` — Success Response example, 200: ```json { "created_at": "2019-08-24T14:15:22Z", "id": "string", "name": "string" } ``` --- # CLI reference Source: https://www.spacefolder.com/docs/reference/cli ## Install After the first CLI package release, install with Node.js 22 or newer: ```sh npm install -g @spacefolder/cli spacefolder --version ``` The npm package includes native binaries for Apple Silicon and Intel macOS, and arm64/x64 Linux with glibc (built on Ubuntu 24.04). Windows and Alpine/musl binaries are not currently provided. It does not download executable code during installation. Before the first release, build from the repository: ```sh cargo build --locked --release -p spacefolder-cli ./target/release/spacefolder --help ``` ## Configure ```sh export SPACEFOLDER_API_KEY='your-workspace-api-key' spacefolder auth status ``` Alternatively set `SPACEFOLDER_API_KEY_FILE` to a file containing the key. A key file takes precedence over `SPACEFOLDER_API_KEY`. ```sh spacefolder --api-key-file /path/to/key --timeout 30 world list ``` The CLI connects to the hosted API automatically. Global flags must come before the command. `--timeout` accepts 1–300 seconds and defaults to 30. ## Commands | Command | Purpose | | --- | --- | | `auth status` | Check credentials against the API | | `world create [--name NAME]` | Create a World | | `world list [--limit COUNT] [--cursor CURSOR]` | List Worlds | | `world show ` | Read World metadata | | `fold ` | Ingest observed events | | `navigate ` | Request predictions | | `fold list [--limit COUNT]` | Read Fold history | | `navigate list [--nav-id ID] [--cursor CURSOR]` | Read Navigate history | | `fold get ` | Read Fold detail | | `navigate get [--trace]` | Read Navigate detail | | `--help` / `--version` | Print help/version without connecting | History list commands also accept API filter names as `--name value` pairs; hyphens become underscores. Each flag may occur once. Use the SDK or HTTP API for repeated array values. World rename/delete are available through the API and SDKs. ## JSON files and stdin Request JSON has the same shape as the [API](/docs/reference/api). Every Navigate request must include a [`context` object](/docs/concepts/primitives#context) describing the situation at decision time; use `"context": {}` when none is available. See [Get started](/docs/get-started) for `fold.json` and `navigate.json`. ```sh spacefolder world create my_app --name 'My application' spacefolder fold fold.json spacefolder navigate navigate.json cat fold.json | spacefolder fold - ``` JSON input is limited to 8 MiB. Successful commands print JSON to stdout. Failures print JSON to stderr. Redirects are not followed and requests are not automatically retried. ## Exit codes | Code | Meaning | | --- | --- | | 0 | Success | | 1 | Transport, local, or other API error | | 2 | Invalid command or configuration | | 3 | HTTP 401 / 403 | | 4 | HTTP 404 | | 5 | HTTP 409 | Keep credentials in environment variables or a key file; do not place them in request JSON. Use shell exit codes and JSON output to integrate with agents and scripts. --- # SDKs Source: https://www.spacefolder.com/docs/reference/sdks The SDKs are thin HTTP clients for the same API. They read `SPACEFOLDER_API_KEY` and connect to the hosted API automatically; you do not need to configure a URL. Registry installation becomes available after the first package releases. Until then, use the source installation commands below from a checkout of this repository. ## TypeScript and JavaScript Node.js 22 or newer: ```sh npm install @spacefolder/sdk ``` ```ts import { SpacefolderClient, SpacefolderApiError } from "@spacefolder/sdk"; const sf = new SpacefolderClient(); await sf.createWorld({ id: "my_app", name: "My application" }); await sf.fold({ world_id: "my_app", events: [{ id: "view-001", name: "movie_viewed", timestamp: new Date().toISOString(), entity_id: "user_123", data: {}, }], }); const navigation = await sf.navigate({ nav_id: "watch_after_impression", world_id: "my_app", context: { task: { history: [{ name: "movie_impression", data: { movie_id: "movie_456" } }], }, }, entity_id: "user_123", predictions: { watch: { event: "movie_watched", horizon: "1h" }, }, }); const watch = navigation.predictions?.watch; const confidence = watch && "confidence" in watch ? watch.confidence : null; console.log(confidence ?? "Confidence unavailable"); ``` Explicit configuration uses milliseconds for `timeout`: ```ts const sf = new SpacefolderClient({ apiKey: process.env.SPACEFOLDER_API_KEY, timeout: 30_000, }); ``` Keep API keys on your server. Browser applications should call your server, which uses the SDK to reach Spacefolder. A rejected HTTP response throws `SpacefolderApiError`, with `status` and `payload`. Network failures and timeouts throw transport errors. Requests do not automatically retry or follow redirects. ## Python Python 3.11 or newer; the SDK requires `jsonschema` and does not install Torch or model weights: ```sh pip install spacefolder-sdk ``` ```python from datetime import datetime, timezone from spacefolder_sdk import SpacefolderClient, SpacefolderApiError sf = SpacefolderClient() sf.create_world("my_app", name="My application") sf.fold({ "world_id": "my_app", "events": [{ "id": "view-001", "name": "movie_viewed", "timestamp": datetime.now(timezone.utc).isoformat(), "entity_id": "user_123", "data": {}, }], }) navigation = sf.navigate({ "nav_id": "watch_after_impression", "world_id": "my_app", "context": { "task": { "history": [{"name": "movie_impression", "data": {"movie_id": "movie_456"}}], }, }, "entity_id": "user_123", "predictions": { "watch": {"event": "movie_watched", "horizon": "1h"}, }, }) confidence = navigation.get("predictions", {}).get("watch", {}).get("confidence") print(confidence if confidence is not None else "Confidence unavailable") ``` Explicit configuration uses seconds for `timeout`: ```python sf = SpacefolderClient( api_key="your-workspace-api-key", timeout=30, ) ``` HTTP rejections raise `SpacefolderApiError`, with `status` and `payload`. Schema validation errors are `jsonschema.ValidationError`. Network failures use standard library exceptions. Set `api_key=""` to disable environment authentication. Requests do not automatically retry or follow redirects. Every Navigate request requires a `context` object with decision-time user or task information. Pass `context: {}` in TypeScript or `"context": {}` in Python when none is available. For [context](/docs/concepts/primitives#context), prediction, action, and objective payloads, see [Navigate](/docs/concepts/primitives#navigate) and the [Navigate endpoint](/docs/reference/api/navigate/navigate). ## Forecast confidence Both SDKs return the API's [forecast confidence](/docs/concepts/primitives#confidence) alongside the estimate. For comparisons, read the same field under `actions..predictions.`. Check for an absent or null score and preserve `0`. Use `navigation(run_id)` to retrieve the original score and the latest verification. ## Methods | Operation | TypeScript | Python | | --- | --- | --- | | Create World | `createWorld(request)` | `create_world(world_id, name=None)` | | Get World | `world(id)` | `world(world_id)` | | List Worlds | `worlds({ cursor, limit })` | `worlds(cursor=None, limit=100)` | | Rename World | `renameWorld(id, { name })` | `rename_world(world_id, name)` | | Delete World | `deleteWorld(id, { confirm_id })` | `delete_world(world_id, confirm_id)` | | Fold events | `fold(request)` | `fold(request)` | | Navigate | `navigate(request)` | `navigate(request)` | | Fold history | `folds(world_id, filters)` | `folds(world_id, **filters)` | | Navigate history | `navigations(world_id, filters)` | `navigations(world_id, **filters)` | | Fold detail | `foldDetail(world_id, run_id)` | `fold_detail(world_id, run_id)` | | Get forecast and verification | `navigation(run_id)` | `navigation(run_id)` | | Include the execution trace | `navigation(run_id, { trace: true })` | `navigation(run_id, trace=True)` | Pass `next_cursor` as `cursor` to read the next page of Worlds, Folds, or navigations. Filter names match the [API reference](/docs/reference/api). ## Install from source Run in the repository root: ```sh npm ci npm run build:sdk npm pack --workspace @spacefolder/sdk # Install the resulting .tgz in your application. python -m pip install ./sdk/python ``` The Python SDK and the repository's internal `spacefolder-reference` package both contain the `spacefolder_sdk` namespace. Install the public SDK in a separate environment from the reference/model package.