sng-asyncfunc/prime-bun

An ultra-fast Prime Agent fork designed to orchestrate concurrent sub-agents and execute long-running coding tasks without the Python latency tax.

TypeScript

17

4,574 commits

updated Sep 17, 2026

See the code

README

Prime Intellect

Prime Bun: A Bun-Native RLM Agent

DocumentationVerifiersPRIME-RLpi-mono

CI Build Binaries

Prime Bun Agent: Bun-native JavaScript RLM

Bun-native by design

Prime Bun replaces the Python notebook with a native Bun implementation. RLM programs execute as persistent JavaScript or TypeScript directly in Bun—not through a Python wrapper or subprocess bridge—with retained session state, prepared runtime globals, native shell execution, abort and recovery handling, and snapshot support.

Lower is better. These are end-to-end host/kernel timings for Prime Bun v0.7.4 on Bun 1.4.0 versus the official Prime Agent v0.8.0 release on Python 3.11.15.

OperationPrime BunPrime AgentPrime Bun delta
Cold kernel startup44.88 ms273.38 ms83.6% faster
Scalar cell0.81 ms2.51 ms67.8% faster
64 KiB output0.96 ms2.64 ms63.7% faster
10,000 one-byte writes1.17 ms14.57 ms92.0% faster
Shell command3.39 ms8.78 ms61.3% faster
Abort synchronous loop113.13 ms76.32 ms48.2% slower
First cell after recovery2.93 ms2.78 ms5.3% slower
32 MiB snapshot12.81 ms16.78 ms23.6% faster
2,000-cell loop, per cell0.78 ms2.71 ms71.2% faster

Measured on an Apple M1 Pro running macOS 26.4.1. Each value is the median result across three matched rounds; each round used 12 cold startups, 40 ordinary-operation samples, six abort/recovery and snapshot samples, and 2,000 scalar cells. One-time runtime installation and bootstrap were excluded.

[!NOTE] Prime Bun is a fork of Prime Agent. All credit for the original agent, RLM architecture, TUI, and surrounding ecosystem goes to Prime Intellect and the Prime Agent contributors. Their thoughtful and ambitious work created an exceptional open-source foundation; this fork focuses on a Bun-native JavaScript and TypeScript runtime.

Prime Bun builds on Prime Agent, an open-source coding and research agent for general and long-running work. It preserves two core abstractions:

  • The Recursive Language Model (RLM) treats context as variables (prompt-as-a-variable) and tools like recursive subagents as function calls (programmatic tool /sub-agent calling) inside a persistent REPL.
  • The Continual Harness stores supplemental prompts, memories, skill descriptions, and reusable subagent specifications as durable state that Prime Bun can refine through small, evidence-backed updates, local to the session by default.

Prime Bun combines a persistent Bun JavaScript control environment with durable harness state, so useful working context and reusable operating patterns can outlive a single chat window.

  • Everything is programmatic: the persistent Bun notebook is the built-in model tool; file operations, shell commands, skill use, subagents, and context management happen through JavaScript or TypeScript.
  • Subagents are built in: rlm(...) spawns real child agents for parallel or background work and returns an admission handle; results arrive through explicit agent messages or files.
  • The harness can improve: /refine reviews the current trajectory and can apply small, evidence-backed updates to supplemental harness state. It never rewrites the immutable base system prompt, and recorded snapshots support rollback.
  • Skills are executable: JavaScript-backed skills load prepared globals into the notebook, and the built-in skill creator can turn recurring workflows into project or personal skills.
  • Sessions run in the background: daemon-backed agents keep running when the terminal disconnects and can be reattached later.
  • Agents communicate directly: running agents can exchange messages and orchestrate one another without routing everything through the user.
  • Long tasks keep moving: automatic compaction, persistent goals, heartbeats, schedules, autonomous mode, and retained subagents preserve progress across turns and terminal sessions.

Getting Started

Install the local checkout with Node.js 22.8 or newer:

git clone https://github.com/sng-asyncfunc/prime-bun.git
cd prime-bun
npm ci
npm link

Prime Bun requires Bun 1.4.0 or newer for its persistent JavaScript runtime. The first install can prepare the official Bun runtime automatically when needed.

npm link exposes the checkout as the prime-bun command. Run it from the repository or directory you want Prime Bun to work in:

cd /path/to/project
prime-bun

On first launch, run /login to choose a subscription or API-key provider. Prime Bun works in the current directory and can run commands and modify files there. Use a disposable clone, clean worktree, or another checkpoint you can inspect and restore.

[!WARNING] Prime Bun executes model-generated JavaScript, TypeScript, and project commands with your user permissions. Its worker and notebook processes improve lifecycle isolation and recovery; they are not a security sandbox. Review changes and use trusted repositories, instructions, skills, and extensions only. Run untrusted code or instructions in an external sandbox or restricted environment.

Useful commands:

prime-bun agents                   # Browse running, idle, and saved sessions
prime-bun attach <agent>           # Reattach to a running session
prime-bun --resume <path|id>       # Resume a saved session
prime-bun status                   # Inspect background service state
prime-bun doctor [--fix]           # Inspect or repair background services
prime-bun shutdown [--force]       # Stop every agent, worker, and background service

Built for Long-Running Work

Prime Bun is built for long-running work, especially for evaluations in research. These features are available in the TUI and when run autonomously.

  • Continual Harness: /refine can persist focused, reviewable lessons as supplemental prompts, memories, reusable skill descriptions, or subagent specifications, with recorded refinement history. It does not replace packaging and reviewing new executable skills.
  • Direct agent-to-agent communication: running agents and retained subagents can discover one another, exchange messages, and steer active work.
  • Daemon-backed continuity: active sessions, Bun notebook state, schedules, and subagents keep running when the terminal detaches and can be reattached later.
  • Heartbeats and schedules: /heartbeat, rlmHeartbeat, and prime-bun schedule can re-enter a session periodically or at a specific time.
  • Persistent goals: /goal keeps an objective and its progress active across turns until it is completed, paused, or cleared.
  • Bounded autonomous mode: /autonomous continues within configured turn, token, and time budgets and can run user-defined quality gates. A passed gate checks only what that gate verifies; reaching a limit does not imply task success.

Documentation

Acknowledgements

Our agent and TUI is built on top of pi. We thank the authors of pi for their valuable work.

License

Prime Bun is fully open source and released under the MIT License.

Disclaimer

I am not claiming JavaScript wins every RLM race. If you are building data pipelines, running heavy numerical analysis, or using the classic scientific stack, Prime Agent's native IPython setup is exactly what you need.

But the future of coding agents isn't strictly data science. It is web infrastructure, edge deployments, and massive TypeScript monorepos. Prime Agent is an incredible leap forward for autonomous coding. But if you are building for the web, do yourself a favor: kill the Python kernel and run it in Bun.

Contributors

(top 30 of 211)

badlogic

3,071 commits

kevinjosethomas

325 commits

sng-asyncfunc

124 commits

sng-asyncfunc/prime-bun

An ultra-fast Prime Agent fork designed to orchestrate concurrent sub-agents and execute long-running coding tasks without the Python latency tax.

TypeScript

17

4,574 commits

updated Sep 17, 2026

See the code

README

Prime Intellect

Prime Bun: A Bun-Native RLM Agent

DocumentationVerifiersPRIME-RLpi-mono

CI Build Binaries

Prime Bun Agent: Bun-native JavaScript RLM

Bun-native by design

Prime Bun replaces the Python notebook with a native Bun implementation. RLM programs execute as persistent JavaScript or TypeScript directly in Bun—not through a Python wrapper or subprocess bridge—with retained session state, prepared runtime globals, native shell execution, abort and recovery handling, and snapshot support.

Lower is better. These are end-to-end host/kernel timings for Prime Bun v0.7.4 on Bun 1.4.0 versus the official Prime Agent v0.8.0 release on Python 3.11.15.

OperationPrime BunPrime AgentPrime Bun delta
Cold kernel startup44.88 ms273.38 ms83.6% faster
Scalar cell0.81 ms2.51 ms67.8% faster
64 KiB output0.96 ms2.64 ms63.7% faster
10,000 one-byte writes1.17 ms14.57 ms92.0% faster
Shell command3.39 ms8.78 ms61.3% faster
Abort synchronous loop113.13 ms76.32 ms48.2% slower
First cell after recovery2.93 ms2.78 ms5.3% slower
32 MiB snapshot12.81 ms16.78 ms23.6% faster
2,000-cell loop, per cell0.78 ms2.71 ms71.2% faster

Measured on an Apple M1 Pro running macOS 26.4.1. Each value is the median result across three matched rounds; each round used 12 cold startups, 40 ordinary-operation samples, six abort/recovery and snapshot samples, and 2,000 scalar cells. One-time runtime installation and bootstrap were excluded.

[!NOTE] Prime Bun is a fork of Prime Agent. All credit for the original agent, RLM architecture, TUI, and surrounding ecosystem goes to Prime Intellect and the Prime Agent contributors. Their thoughtful and ambitious work created an exceptional open-source foundation; this fork focuses on a Bun-native JavaScript and TypeScript runtime.

Prime Bun builds on Prime Agent, an open-source coding and research agent for general and long-running work. It preserves two core abstractions:

  • The Recursive Language Model (RLM) treats context as variables (prompt-as-a-variable) and tools like recursive subagents as function calls (programmatic tool /sub-agent calling) inside a persistent REPL.
  • The Continual Harness stores supplemental prompts, memories, skill descriptions, and reusable subagent specifications as durable state that Prime Bun can refine through small, evidence-backed updates, local to the session by default.

Prime Bun combines a persistent Bun JavaScript control environment with durable harness state, so useful working context and reusable operating patterns can outlive a single chat window.

  • Everything is programmatic: the persistent Bun notebook is the built-in model tool; file operations, shell commands, skill use, subagents, and context management happen through JavaScript or TypeScript.
  • Subagents are built in: rlm(...) spawns real child agents for parallel or background work and returns an admission handle; results arrive through explicit agent messages or files.
  • The harness can improve: /refine reviews the current trajectory and can apply small, evidence-backed updates to supplemental harness state. It never rewrites the immutable base system prompt, and recorded snapshots support rollback.
  • Skills are executable: JavaScript-backed skills load prepared globals into the notebook, and the built-in skill creator can turn recurring workflows into project or personal skills.
  • Sessions run in the background: daemon-backed agents keep running when the terminal disconnects and can be reattached later.
  • Agents communicate directly: running agents can exchange messages and orchestrate one another without routing everything through the user.
  • Long tasks keep moving: automatic compaction, persistent goals, heartbeats, schedules, autonomous mode, and retained subagents preserve progress across turns and terminal sessions.

Getting Started

Install the local checkout with Node.js 22.8 or newer:

git clone https://github.com/sng-asyncfunc/prime-bun.git
cd prime-bun
npm ci
npm link

Prime Bun requires Bun 1.4.0 or newer for its persistent JavaScript runtime. The first install can prepare the official Bun runtime automatically when needed.

npm link exposes the checkout as the prime-bun command. Run it from the repository or directory you want Prime Bun to work in:

cd /path/to/project
prime-bun

On first launch, run /login to choose a subscription or API-key provider. Prime Bun works in the current directory and can run commands and modify files there. Use a disposable clone, clean worktree, or another checkpoint you can inspect and restore.

[!WARNING] Prime Bun executes model-generated JavaScript, TypeScript, and project commands with your user permissions. Its worker and notebook processes improve lifecycle isolation and recovery; they are not a security sandbox. Review changes and use trusted repositories, instructions, skills, and extensions only. Run untrusted code or instructions in an external sandbox or restricted environment.

Useful commands:

prime-bun agents                   # Browse running, idle, and saved sessions
prime-bun attach <agent>           # Reattach to a running session
prime-bun --resume <path|id>       # Resume a saved session
prime-bun status                   # Inspect background service state
prime-bun doctor [--fix]           # Inspect or repair background services
prime-bun shutdown [--force]       # Stop every agent, worker, and background service

Built for Long-Running Work

Prime Bun is built for long-running work, especially for evaluations in research. These features are available in the TUI and when run autonomously.

  • Continual Harness: /refine can persist focused, reviewable lessons as supplemental prompts, memories, reusable skill descriptions, or subagent specifications, with recorded refinement history. It does not replace packaging and reviewing new executable skills.
  • Direct agent-to-agent communication: running agents and retained subagents can discover one another, exchange messages, and steer active work.
  • Daemon-backed continuity: active sessions, Bun notebook state, schedules, and subagents keep running when the terminal detaches and can be reattached later.
  • Heartbeats and schedules: /heartbeat, rlmHeartbeat, and prime-bun schedule can re-enter a session periodically or at a specific time.
  • Persistent goals: /goal keeps an objective and its progress active across turns until it is completed, paused, or cleared.
  • Bounded autonomous mode: /autonomous continues within configured turn, token, and time budgets and can run user-defined quality gates. A passed gate checks only what that gate verifies; reaching a limit does not imply task success.

Documentation

Acknowledgements

Our agent and TUI is built on top of pi. We thank the authors of pi for their valuable work.

License

Prime Bun is fully open source and released under the MIT License.

Disclaimer

I am not claiming JavaScript wins every RLM race. If you are building data pipelines, running heavy numerical analysis, or using the classic scientific stack, Prime Agent's native IPython setup is exactly what you need.

But the future of coding agents isn't strictly data science. It is web infrastructure, edge deployments, and massive TypeScript monorepos. Prime Agent is an incredible leap forward for autonomous coding. But if you are building for the web, do yourself a favor: kill the Python kernel and run it in Bun.

Contributors

(top 30 of 211)

badlogic

3,071 commits

kevinjosethomas

325 commits

sng-asyncfunc

124 commits

Languages

TypeScript

97.6%

JavaScript

1.7%