process-management

process-management is a cursor rule for Cursor from brendadeeznuts1111/betting-brain-v3. It costs 0 tokens per session (942 once invoked), scanned A, original, MIT.

A set of rules for starting and stopping child processes, which are programs launched by another program. It focuses on cleaning them up so they do not remain running after a timeout or failed task.

In plain words
What is it for?
Use it in scripts and automation that run external commands, especially when those commands have time limits or may fail.
Why use it?
It prevents zombie processes and leftover work that can consume resources or interfere with later commands. The examples show how to kill one process or clean up all managed processes.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import processManager from '../tests/utils/process-cleanup';.

Good fit Use it in scripts and automation that run external commands, especially when those commands have time limits or may fail.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/brendadeeznuts1111/betting-brain-v3
agentmods
npx agentmods add rules/brendadeeznuts1111/betting-brain-v3/process-management

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 process-management

README.md
[![agentmods](https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/process-management/github.svg)](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/process-management)
Your own site
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/process-management"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/process-management/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 process-management

Your own site · 80×15
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/process-management"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/process-management.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 942 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00000 $0.00942
Opus 5 $0.00000 $0.00471
Sonnet 5 $0.00000 $0.00188
Haiku 4.5 $0.00000 $0.00094

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

Security

Grade A, and why

process-management scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/process-management.mdc · 163 lines

How it starts

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

Process Management Rules

Zombie Process Prevention

ALWAYS use the process cleanup utility for spawning child processes:

// ❌ BAD - Can create zombie processes
const proc = Bun.spawn(['command', 'args']);
await Promise.race([proc.exited, timeout]); // Process not killed on timeout

// ✅ GOOD - Automatic cleanup
import processManager from './tests/utils/process-cleanup';
const proc = processManager.spawn(['command', 'args']);
try {
  await Promise.race([proc.exited, timeout]);
} catch (error) {
  await processManager.kill(proc, 15, 2000);
} finally {
  await processManager.killAll(3000);
}

Process Spawning Patterns

Script Files

For automation scripts that spawn processes:

import processManager from '../tests/utils/process-cleanup';

async function runCommand(command: string[], timeout: number) {
  const proc = processManager.spawn(command, {
    cwd: process.cwd(),
    stdio: ['ignore', 'pipe', 'pipe']
  });
  
  try {
    const exitCode = await Promise.race([
      proc.exited,
      new Promise<never>((_, reject) => 
        setTimeout(() => reject(new Error('Timeout')), timeout)
      )
    ]);
    return exitCode === 0;
  } catch (error) {
    await processManager.kill(proc, 15, 2000);
    throw error;
  }
}

Test Files

Always use process manager in tests:

import { describe, test, beforeEach, afterEach } from 'bun:test';
import processManager from '../utils/process-cleanup';

describe('My Test Suite', () => {
  afterEach(async () => {
    // Cleanup all spawned processes after each test
    await processManager.killAll(3000);
  });
  
  test('should spawn process', async () => {
    const proc = processManager.spawn(['echo', 'hello']);
    await proc.exited;
  });
});

Signal Handling

Always ensure scripts handle cleanup on exit:

// Automatic via processManager (recommended)
import processManager from './tests/utils/process-cleanup';
// Signal handlers are automatically set up

// Or manual (if needed)
process.on('SIGINT', async () => {
  console.log('Cleaning up...');
  await processManager.killAll(3000);
  process.exit(0);
});

Read the full file on GitHub · 163 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 · 163 lines · 0 tokens per session scan A 1a040d7e07fe

Subscribe to this mod's changes

process-management is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed 11mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 942 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.