r/BestGitHubRepos • • 1d ago

🛠 Developer tools psychoscript: A confined JavaScript runtime for programs that call schema-described tools (527 stars)

What it does

All text below is quoted directly from the project README.

A confined, resumable JavaScript interpreter.

Key points:

  • Programs are compiled to bytecode and run on a VM with no ambient access: no file system, network, process or timers.
  • The only way a program reaches the outside world is through the host functions you give it.
  • A run can be suspended while it waits, saved to bytes, and resumed later, in the same process or another one, with the same result.
  • No ambient I/O. No fetch, fs, process, timers or host-engine globals; everything outside the program is a host function you passed.
  • No dynamic code. No eval, Function constructor or with; programs are strict mode only.
  • Bounded. Time via timeoutMs, output via maxOutputBytes, and the caps above.

Use it to run code you don't fully trust (from a model, a user, a plugin) against an API you control, and to keep long-running programs alive across restarts.

How it works

You install the npm package and create a Runtime with a globals function that returns the host functions a program may call, built with Host.fn, Host.namespace or Host.durableFn. You pass JavaScript source to runtime.execute. It is compiled to bytecode and run on a VM that has no file system, network or timers, so every outside effect goes through those host functions. The result comes back as an ok value or an error with kind, message and location. Limits such as timeoutMs and maxOutputBytes bound a run. With runtime.program you can suspend a waiting run, save it with toBytes, and resume it later with fromBytes.

Repository

https://github.com/anomalyco/psychoscript

More about this repo on our website: https://bestgithubrepositories.com/anomalyco/psychoscript

Repository stats

MetricValue
Stars527
Forks12
Last releasev0.7.0 (2026-12-02)
LanguagesRust 47.9%, TypeScript 33.0%, JavaScript 17.0%
Contributors15
AI contributor accounts (Claude / Codex / Cursor / Copilot)none
AI co-authored commitsnone

Main contributor

FieldValue
NameAiden Cline
GitHub@rekram1-node
Commits to this repo190 (top contributor)
BioBuilding OpenCode
Company / LocationAnomaly / Austin, TX
X / Twitter@rekram11
Followers967
Public repos51
On GitHub since2020

──────────────────────────────

📌 Please support our community by subscribing to our newsletter.

Every Monday and Thursday we send the 10 best repos shared here, plus what developers said about each one in the comments. It's free, it takes two minutes to read, and every new subscriber helps r/BestGitHubRepos grow.

📬 Subscribe free to the Best GitHub Repos newsletter

6 Upvotes

0 comments sorted by