tinyscript and Psychoscript

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 verdictCompare every engine

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

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.

QuestionPsychoscripttinyscript
LanguageA subset; 19,802 of the 22,469 test262 files it keeps62.9% of all of test262 in strict mode
TypeScriptRejectedErased, used as hints
Bounding a callActive time, checked between stepsExact fuel; the call continues
Clock and randomnessHost's own; no seed optionAlways the host's
Where it runsNode.js, Bun, browsers; a Rust VM tooA 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.

Which one to choose

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

  • Use Psychoscript whenyour 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 whenyou need TypeScript, Proxy, Reflect or new Function, exact fuel, or an engine embedded from C rather than from JavaScript.

Visit PsychoscriptCompare every engine