bun-runtime

bun-runtime is a cursor rule for Cursor from brendadeeznuts1111/betting-brain-v3. It costs 1,622 tokens per session, scanned A, original, MIT.

A set of rules for using Bun, a JavaScript and TypeScript runtime, consistently. It covers Bun's file APIs, process launching, test imports, package installation, and code-search commands.

In plain words
What is it for?
Use it when reviewing runtime code, replacing Node.js file access, checking process spawning, standardizing tests on bun:test, or replacing npm and Yarn commands.
Why use it?
It helps prevent mixing Bun with incompatible or unnecessary Node.js, Vitest, Jest, npm, or Yarn patterns. The search examples make those differences easier to find.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when reviewing runtime code, replacing Node.js file access, checking process spawning, standardizing tests on bun:test, or replacing npm and Yarn commands.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/brendadeeznuts1111/betting-brain-v3/bun-runtime
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/brendadeeznuts1111/betting-brain-v3

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bun-runtime

README.md
[![agentmods](https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/bun-runtime/github.svg)](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/bun-runtime)
Your own site
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/bun-runtime"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/bun-runtime/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bun-runtime

Your own site · 80×15
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/bun-runtime"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/bun-runtime.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,622 This file is loaded in full into every session.
When invoked 1,622 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01622 $0.01622
Opus 5 $0.00811 $0.00811
Sonnet 5 $0.00324 $0.00324
Haiku 4.5 $0.00162 $0.00162

Measured 9d ago against content hash 31633f571231, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

bun-runtime scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

ast-grep --pattern 'import { spawn } from "child_process"' src/
.cursor/rules/bun-runtime.mdc · 241 lines

How it starts

The opening of the file, as written. The whole thing — 241 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Bun Runtime Rules

🔍 Code Searchability Patterns

Find Bun Runtime Issues with ast-grep

# Find incorrect process spawning (should use processManager)
ast-grep --pattern 'Bun.spawn($$$)' src/
ast-grep --pattern 'import { spawn } from "bun"' src/
ast-grep --pattern 'import { spawn } from "child_process"' src/
sg -p 'Bun.spawn' src/
sg -p 'from "child_process"' src/

# Find Node.js fs usage (should use Bun file APIs)
ast-grep --pattern 'import fs from "fs"' src/
ast-grep --pattern 'import { readFile } from "fs/promises"' src/
sg -p 'from "fs"' src/
sg -p 'from "fs/promises"' src/

# Find incorrect test imports (should use bun:test)
ast-grep --pattern 'import { describe, test, expect } from "vitest"' tests/
ast-grep --pattern 'import { describe, test, expect } from "@jest/globals"' tests/
sg -p 'from "vitest"' tests/
sg -p 'from "@jest/globals"' tests/

# Find npm/yarn usage (should use bun)
ast-grep --pattern 'npm install' scripts/
ast-grep --pattern 'yarn install' scripts/
sg -p 'npm install' scripts/
sg -p 'yarn install' scripts/

Bun Runtime Discovery Commands

# Find all Bun-specific patterns
sg search 'Bun.' src/
sg search 'bun:' src/
sg search 'processManager' src/

# Find Node.js anti-patterns
sg search 'from "fs"' src/
sg search 'from "child_process"' src/
sg search 'npm ' scripts/
sg search 'yarn ' scripts/

# Find Bun native APIs
sg search 'Bun.file' src/
sg search 'Bun.write' src/
sg search 'Bun.password' src/

Process Spawning (CRITICAL)

Always Use Process Manager

// ❌ WRONG - Creates zombie processes
import { spawn } from 'bun';
const proc = Bun.spawn(['command']);

// ❌ WRONG - Old Node.js pattern
import { spawn } from 'child_process';

// ✅ CORRECT - Tracked and cleaned up
import processManager from './tests/utils/process-cleanup';
const proc = processManager.spawn(['command'], options);

See Process Management Rules for details.

File Operations

Read the full file on GitHub · 241 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 241 lines · 1,622 tokens per session scan A 31633f571231

Subscribe to this mod's changes

bun-runtime is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed 11mo ago), licensed MIT. It adds 1,622 tokens to every session, about $0.0081 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.