30-background-agents

30-background-agents is a cursor rule for Cursor from bybren-llc/safe-agentic-workflow. It costs 16 tokens per session (689 once invoked), scanned A, original, MIT.

Guidance for Cursor background agents, which are AI workers that run longer coding tasks in separate virtual machines and branches. It describes their repository, branch, pull-request, workflow, and completion requirements.

In plain words
What is it for?
Use it when assigning long-running implementation tasks to Cursor background agents, especially tasks that must follow project tickets, coding patterns, commit rules, and pull-request steps.
Why use it?
It clarifies what happens when work runs outside the local checkout and helps keep autonomous changes aligned with the team's development process. It also sets checkpoints before work begins and before a pull request is accepted.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: reads .claude/ paths; mentions Cursor.

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.

agentmods
npx agentmods add rules/bybren-llc/safe-agentic-workflow/30-background-agents
Clone the repo
git clone --depth 1 https://github.com/bybren-llc/safe-agentic-workflow

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 30-background-agents

README.md
[![agentmods](https://agentmods.dev/badge/rules/bybren-llc/safe-agentic-workflow/30-background-agents.svg)](https://agentmods.dev/rules/bybren-llc/safe-agentic-workflow/30-background-agents)
Your own site
<a href="https://agentmods.dev/rules/bybren-llc/safe-agentic-workflow/30-background-agents"><img src="https://agentmods.dev/badge/rules/bybren-llc/safe-agentic-workflow/30-background-agents.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 689 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00016 $0.00689
Opus 5 $0.00008 $0.00345
Sonnet 5 $0.00003 $0.00138
Haiku 4.5 $0.00002 $0.00069

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

Security

Grade A, and why

30-background-agents 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 3d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/30-background-agents.mdc · 75 lines

How it starts

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

Background Agent Guidelines

Cursor Background Agents run long tasks autonomously in isolated Ubuntu VMs with internet access. They clone the repo from GitHub, work on a separate branch, and open PRs when complete.

How Background Agents Work

  • Each background agent runs in an isolated Ubuntu VM provisioned by Cursor
  • The agent clones the repository from GitHub (it does NOT use your local checkout)
  • It works on a dedicated branch and can commit, push, and open pull requests
  • You are notified when the task completes or if the agent needs input
  • Multiple background agents can run in parallel on different tasks

SAFe Gate Chain Compliance

Background agents MUST follow the same SAFe workflow as interactive sessions:

  1. Stop-the-Line Gate: Verify AC/DoD exists before starting work
  2. Pattern Discovery: Search patterns_library/ before implementing
  3. Commit Format: Use SAFe format type(scope): description [{{TICKET_PREFIX}}-XXX]
  4. Branch Naming: Use {{TICKET_PREFIX}}-{number}-{description}
  5. Exit States: Declare the correct exit state when complete

PR Creation from Background Agents

When a background agent opens a PR:

  • Reference the Linear ticket in the PR title: feat(scope): description [{{TICKET_PREFIX}}-XXX]
  • Follow the PR template from CONTRIBUTING.md
  • Include a test plan in the PR body
  • Tag appropriate reviewers per the 3-stage review process
  • The PR still requires QAS validation and HITL merge authority

Best Practices

  • Assign one ticket per background agent for clear scope
  • Provide the full spec path: specs/{{TICKET_PREFIX}}-XXX-feature-spec.md
  • Reference the agent role: "Act as the BE Developer" or "Act as the FE Developer"
  • Include validation commands the agent should run before opening the PR
  • Monitor agent progress via Cursor's background agent dashboard

Limitations

  • Background agents cannot access your local filesystem or environment variables
  • They start fresh from the GitHub remote each time
  • They cannot interact with local Docker containers or databases
  • Session state does not persist between background agent runs
  • They inherit repository-level Cursor rules but not user-level settings

Read the full file on GitHub · 75 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. 3d ago First seen · 75 lines · 16 tokens per session scan A c8bc1a5e3437

Subscribe to this mod's changes

30-background-agents is a cursor rule published in the GitHub repository bybren-llc/safe-agentic-workflow (406 stars, last pushed 1mo ago), licensed MIT. It adds 16 tokens to every session and 689 once invoked, about $0.0001 per session on Opus 5. 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-09-03.