Field noteNov 28, 20265 min read1 source

GitHub - anomalyco/psychoscript: A confined JavaScript runtime for programs that call schema-described tools

In one minute

Anomalyco’s Psychoscript is a JavaScript interpreter designed to run untrusted programs with access only to host functions explicitly exposed by the application. Its unusual operational feature is resumability: a run can be suspended, serialized and continued later, giving builders a way to combine constrained execution with long-lived tool workflows.

What changed: The GitHub project page presents Psychoscript as a confined runtime for programs that call schema-described tools.

What happened

Anomalyco describes Psychoscript as a confined JavaScript interpreter. Programs are compiled to bytecode and run on a virtual machine without ambient access to the file system, network, processes or timers. A program can interact with the outside world only through host functions supplied by the application. The README positions it for code from a model, user or plugin that should not receive direct access to the host environment, as well as programs that need to remain active across restarts.

The package can be installed with npm install psychoscript or bun add psychoscript. It requires Node 24 or later, or Bun 1.4 or later. Its Promise-based API does not depend on Effect; a separate psychoscript/effect entry point provides an Effect API. A runtime is configured with globals, which can expose individual host functions or namespaces. In the documented example, a program receives a double function and returns a value through runtime.execute. Results use an { ok, value } or { ok, error } shape, alongside logs, warnings and run metadata.

The README’s host-function API makes the boundary configurable. Host.fn can wrap synchronous or asynchronous calls, and asynchronous calls can be marked idempotent when it is safe to run them again. Calls receive a key, cancellation signal and a way to detect suspension. Host.namespace supports lazy resolution of larger tool catalogs; the host can expose only selected paths and return errors with suggestions for unavailable functions. Runtime options include execution timeouts and output-size limits. The documented example sets a 1,000-millisecond timeout and a 64,000-byte output cap.

Psychoscript also supports suspending a run, converting its state to bytes and resuming it. The README demonstrates a program waiting on an asynchronous host call, saving its state and continuing in a later runtime instance. If an in-progress call is marked idempotent, it may run again after resume with the same call key; without that designation, suspension during the call rejects with a SuspendError. Snapshots record the writing build, including package version and a hash of opcodes, prelude, codecs and built-ins. Resuming with another build or malformed bytes rejects with a SnapshotError, and suspend({ maxBytes }) can cap snapshot size. The README also describes durable host functions whose work can continue across suspension.

What the archive adds

New Runtime’s earlier coverage includes Sandbox SDK, which unified access to several sandbox providers, and BrowserOS’s neo, a browser for coding agents. Psychoscript is a new event: it adds an interpreter-level boundary and resumable state, rather than another provider abstraction or agent browser.

Trend signal

This supports agent security moves to runtime boundaries. Psychoscript places restrictions in the execution environment and host-function interface, rather than relying on instructions in a prompt to keep a program within bounds. The repository describes mechanisms for limiting access, execution time and output, but does not establish how those controls perform under adversarial use.

Why now

The project’s README explicitly targets code produced by models, users or plugins, and the repository history shows a Rust implementation added alongside the TypeScript runtime in November 2026. That timing makes the project relevant to teams exploring controlled execution of generated programs, though the repository does not frame it as a response to a particular incident or deadline.

Why it matters

Generated code can be more flexible than a fixed list of tool calls, but giving it the application’s ordinary privileges also expands the consequences of errors or malicious instructions. Psychoscript’s model makes the application define the callable surface: a program may be able to read through fs.read, for example, without receiving general file-system access. That boundary is useful only if the host functions themselves enforce the right authorization and data limits.

Resumability addresses a separate operational problem. A workflow can wait on an asynchronous tool call, persist its interpreter state and continue after a process restart instead of keeping one process alive indefinitely. The trade-off is added lifecycle complexity: teams need compatible builds, carefully designed snapshots and an explicit policy for calls that might run again. This is an infrastructure component to evaluate and test, not a substitute for reviewing the host API or the code it executes.

Limits and uncertainty

The repository documents the runtime’s design and examples, but those examples do not establish a security guarantee against hostile programs or prove performance in production. The project’s supported JavaScript surface and compatibility boundaries require checking against its interpreter-support documentation and the needs of a particular application. Snapshot compatibility is build-sensitive, and a host call may repeat after resume when configured as idempotent; applications must account for that behavior. The repository page also shows ongoing development, so builders should verify the package version and current implementation details before relying on them operationally.

Skill to build now

Build a small capability map before running generated JavaScript: list each host function, the data it can access, and whether its effects can safely repeat. Then expose only the functions needed for one task, set a timeout and output cap, and test a suspend/resume cycle with a deliberately interrupted async call. This follows the runtime’s documented boundary and retry model without treating the interpreter as a complete application security review.

Reader takeaway

Psychoscript combines a deliberately narrow host API with serializable, resumable JavaScript execution. For builders, the useful idea is the boundary: generated code should receive only explicit capabilities, while retries, snapshot compatibility and limits remain responsibilities of the system that runs it.

How this was made

First seen
Nov 28, 2026, 19:32 UTC in our intake.
Sources
1 source carried the story when we picked it up; we cite the original.
Written by
An AI model; the exact model was not recorded.
Critic
No separate critic model on this desk; the automated checks below gate publication.
Checks passed
The cited primary source was fetched and verified; the source is not older than 30 days; no earlier note covers the same story; the copy passed the site's structure and language checks.
Confidence
Novelty judgement: a new fact, high confidence. Editorial value: high.
Human review
Published without a per-item human sign-off. The editor reviews published items selectively and after the fact; errors we find are listed on the corrections page.

Corrections and error statistics

Evidence / sources

  1. 1github.com/anomalyco/psychoscript
All Field Notes

Next reads

Read next

Open the graph
  1. 01topicGithubExplore the github topic hub.
  2. 02archiveField NotesOpen the latest editorial analysis.
  3. 03sourcesSourcesSee the original sources this archive cites.
Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate...

Open the JSON contract