<!-- https://tinyscript.tinyactors.dev/compare/psychoscript/ -->
# tinyscript and Psychoscript · Compare

Kind: explanation. For: [Embedder](https://tinyscript.tinyactors.dev/audiences/embedder.xml), [Agent builder](https://tinyscript.tinyactors.dev/audiences/agent-builder.xml), [Platform builder](https://tinyscript.tinyactors.dev/audiences/platform.xml).
Voice: [Dario](https://tinyscript.tinyactors.dev/voices/explanation.xml).

> How tinyscript compares with Psychoscript, Anomaly's confined, resumable JavaScript interpreter for agent code mode.

Psychoscript is a confined, resumable JavaScript interpreter from Anomaly, the makers of opencode. It is the shortest path to running model-written code inside a Node.js or Bun app. Here is where it and tinyscript part ways.

[Skip to the verdict](https://tinyscript.tinyactors.dev/compare/psychoscript/index.md#choose) · [Compare every engine](https://tinyscript.tinyactors.dev/compare/index.md)

<a id="what"></a>

## What Psychoscript does well

> An agent that waits minutes for a tool can't keep a whole process alive for each run it has parked.

Psychoscript compiles a strict-mode subset of JavaScript to bytecode and runs it on a VM written in TypeScript, inside your JavaScript process. There is no WebAssembly and no native addon: you install it from npm.

Its centre is durability. A run that waits on a host call can be saved to bytes and resumed in another process, so a long-running program survives a restart.

Ignore the satirical "NormalScript" marketing on its site. The README is precise, and names its own gaps.

- **Suspended while waiting, resumed elsewhere**: A run can be suspended while it waits, saved to bytes, and resumed later, in the same process or another one. Source: [Psychoscript, README](https://github.com/anomalyco/psychoscript/blob/fe37f2273bc9b520fcfe8eb0f4f68f468e6f48a3/README.md)

<a id="differences"></a>

## Where tinyscript differs

> A subset chosen for safety is also a list of code that will not run.

Psychoscript rejects eval, new Function, Proxy, Reflect, private members and TypeScript syntax by design. tinyscript compiles new Function through the same compiler, runs Proxy and Reflect, and reads TypeScript as compiler hints.

| Question | Psychoscript | tinyscript |
|---|---|---|
| Language | A subset; 19,802 of the 22,469 test262 files it keeps | 62.9% of all of test262 in strict mode |
| TypeScript | Rejected | Erased, used as hints |
| Bounding a call | Active time, checked between steps | Exact fuel; the call continues |
| Clock and randomness | Host's own; no seed option | Always the host's |
| Where it runs | Node.js, Bun, browsers; a Rust VM too | A C library and a command-line tool |

The two test262 numbers count different things: Psychoscript's its own kept files, tinyscript's every strict-mode test. Don't set them side by side as one measure.

<a id="choose"></a>

## Which one to choose

> Most readers need one answer: which engine to try first.

- **Use Psychoscript when**: your agent lives in Node.js, Bun or a browser, its programs fit the subset, and runs must survive restarts while they wait on tools.
- **Use tinyscript when**: you need TypeScript, Proxy, Reflect or new Function, exact fuel, or an engine embedded from C rather than from JavaScript.

[Visit Psychoscript](https://github.com/anomalyco/psychoscript) · [Compare every engine](https://tinyscript.tinyactors.dev/compare/index.md)
