psychoscriptTHE PLAYGROUND
A SMALL EXPERIMENT IN DURABLE JAVASCRIPT

Little programs.
Long attention spans.

01 / WRITE. SLEEP. REPEAT.

Tiny programs. Hours, days, or a human reply.
Save a few kilobytes of state. Wake on a timer, an answer, or a webhook.

Yes, even after you close this tab.

Give an idea a life of its own.

REAL CODE. REAL EXECUTION. A LITTLE MAGIC.
Start with working codeNo AI generation needed

A human is the trigger. The program keeps its draft until you choose what happens next.

01 — YOUR PROGRAM
Your runs
Recent runs Finished runs kept for 24h
  • Your runs will appear here.
Turn an idea into a durable workflow.
OR BORROW AN IDEA
YOUR TOOLBOX printsleepaskaifetchJsonkv
02 — THE LIFE OF A PROGRAM LIVE VIEW
+

Big things happen.
Even in the pauses.

Run a workflow. Close the tab.
The next event picks up the story.

↗RunA Worker gets to work
ⅡSave & sleepState saved. Worker stops.
↻ResumeRight where it left off
THE IDEA, ILLUSTRATED. YOUR LIVE RUN WILL APPEAR HERE.
POWERED BY CLOUDFLAREWorkers · Durable Objects · AI
THE WORLD IS ASYNCHRONOUS

Don’t keep a computer running
just to wait for life to happen.

TWO PARTS. ONE CONTINUOUS PROGRAM.

The program stops.
The story doesn’t.

An hour of waiting shouldn’t need an hour of running.

01 / CLOUDFLARE WORKER

Do the work.

const name = "Ada"
print("See you soon, " + name)
await sleep(3600000)
JavaScript is executing
save state
02 / DURABLE OBJECT

Keep the bookmark.

name: "Ada"variables + call stackexecution position
Ⅱ   Stored in SQLite. No Worker running.
alarm / webhook
03 / A WORKER

Pick up here.

// Same name. Next line.
print("Welcome back, " + name)
› Welcome back, Ada
Execution resumes from saved state
WHAT PSYCHOSCRIPT MAKES POSSIBLE

JavaScript you can put down and pick up.

Psychoscript preserves variables, the call stack, and execution position. A small execution snapshot—not a whole V8 isolate, container, or virtual machine.

WHAT WE BUILT AROUND IT

A durable home on Cloudflare.

Our runner adds durable storage, alarms, and signal-driven wake-ups on Cloudflare. Our host functions add choices, webhooks, and Workers AI. No Worker stays running just to wait; storage still has a cost.

Keep the context. Variables survive the wait.Let the Worker stop. Persist state between turns.Leave the tab. The backend handles the wake-up.
DO THE WORK. SKIP THE WAITING ROOM.

A thousand waiting programs.
Not a thousand waiting computers.

Keep the thought. Release the execution. See what changes as the wait gets longer.

10,000programs with a place to resume
62.6 MBsnapshot bytes, at 6,255 B each
0program executions held open just to wait

What does that wait cost?

USD · selected components for one batch
Snapshot storage6,255 bytes × workflows × wait duration
Worker CPUYour assumed active work; unchanged by the wait
Resident DO durationComparison: one non-hibernating 128 MB object per workflow

Linear cost scale; subpixel values are marked with a dot. Rate-equivalent illustration, not a total bill.

Ordinary Workers do not charge CPU for I/O waiting. A Durable Object that already hibernates also avoids idle-duration charges. The advantage here is preserving your JavaScript execution without keeping it open.

Rates, assumptions & what’s excluded

Paid overage rates checked December 3, 2026: Worker CPU $0.02 / million CPU-ms; SQLite storage $0.20 / GB-month; resident Durable Object duration $12.50 / million GB-s at 0.125 GB per object. Storage uses decimal GB and a 30-day month. The 6,255-byte snapshot comes from our one-hour example; actual programs vary.

Before included allowances and billing-unit rounding. Excludes plan fees, requests, DO coordination, SQLite reads/writes, metadata, logs, post-completion retention, and model or external API charges. These components are not an apples-to-apples total bill or a provider benchmark.

Sources: Cloudflare Workers pricing ↗ · Durable Objects pricing ↗

Build your own host tools How ask(), webhooks, and agent handoffs fit together
sendEmail()renderVideo()runAgent()queryCRM()yourTool()
Small JavaScript program→Your host functions→Your APIs, models & services

ask() and waitForWebhook() are host functions we built for this playground. Psychoscript provides the interpreter and resumable execution. You provide the capabilities: email, a renderer, an agent, or a model.

EXAMPLE HOST FUNCTION · YOUR PROVIDER, YOUR PERMISSIONS
sendEmail: ps.Host.fn(async ([to, body], call) => {
  return mail.send({ to, body, idempotencyKey: call.key })
}, { type: "async", idempotent: true })

mail is your provider integration. The script can call sendEmail(); you control its implementation, credentials, and allowed recipients. Use a provider that honors the idempotency key so retries are safe.

With the runner library, park on await waitFor("render.done"), then deliver the payload from your webhook handler:

await runner.client(env).signal(runId, "render.done", payload, { background: true })

If a provider only supports polling, use fetchJson() and sleep() in a loop. Each wait persists the program without maintaining a connection. Use idempotency keys for external side effects that might be replayed.