neon-api-branches

neon-api-branches is a cursor rule for coding agents from neondatabase/ai-rules. It costs 13 tokens per session (9,819 once invoked), scanned A, original, MIT.

A set of rules for creating and managing branches in Neon. A database branch is a separate database version that can be created from another branch or from an earlier point in time.

In plain words
What is it for?
Automating database branches for development, testing, or other isolated database versions, including branches based on a parent branch, timestamp, or log position.
Why use it?
It gives the request structure needed to create branches and optionally attach compute endpoints to them.

Cursor rule

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/neondatabase/ai-rules/neon-api-branches
Clone the repo
git clone --depth 1 https://github.com/neondatabase/ai-rules

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 neon-api-branches

README.md
[![agentmods](https://agentmods.dev/badge/rules/neondatabase/ai-rules/neon-api-branches.svg)](https://agentmods.dev/rules/neondatabase/ai-rules/neon-api-branches)
Your own site
<a href="https://agentmods.dev/rules/neondatabase/ai-rules/neon-api-branches"><img src="https://agentmods.dev/badge/rules/neondatabase/ai-rules/neon-api-branches.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 9,819 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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 $0.00013 $0.09819
Opus 5 $0.00006 $0.04909
Sonnet 5 $0.00003 $0.01964
Haiku 4.5 $0.00001 $0.00982

Measured 3d ago against content hash 8e714c65d1d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

neon-api-branches 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 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl 'https://console.neon.tech/api/v2/projects/hidden-river-50598307/branches' \
neon-api-branches.mdc · 990 lines

How it starts

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

Overview

This document outlines the rules for managing branches in a Neon project using the Neon API.

Manage branches

Create branch

  1. Action: Creates a new branch within a specified project. By default, a branch is created from the project's default branch, but you can specify a parent branch, a point-in-time (LSN or timestamp), and attach compute endpoints.

  2. Endpoint: POST /projects/{project_id}/branches

  3. Path Parameters:

    • project_id (string, required): The unique identifier of the project where the branch will be created.
  4. Body Parameters: The request body is optional. If provided, it can contain endpoints and/or branch objects.

    endpoints (array of objects, optional): A list of compute endpoints to create and attach to the new branch.

    • type (string, required): The endpoint type. Allowed values: read_write, read_only.
    • autoscaling_limit_min_cu (number, optional): The minimum number of Compute Units (CU). Minimum value is 0.25.
    • autoscaling_limit_max_cu (number, optional): The maximum number of Compute Units (CU). Minimum value is 0.25.
    • provisioner (string, optional): The compute provisioner. Specify k8s-neonvm to enable Autoscaling. Allowed values: k8s-pod, k8s-neonvm.
    • suspend_timeout_seconds (integer, optional): Duration of inactivity in seconds before a compute is suspended. Ranges from -1 (never suspend) to 604800 (1 week). A value of 0 uses the default of 300 seconds (5 minutes).

    branch (object, optional): Specifies the properties of the new branch.

    • name (string, optional): A name for the branch (max 256 characters). If omitted, a name is auto-generated.
    • parent_id (string, optional): The ID of the parent branch. If omitted, the project's default branch is used as the parent.
    • parent_lsn (string, optional): A Log Sequence Number (LSN) from the parent branch to create the new branch from a specific point-in-time.
    • parent_timestamp (string, optional): An ISO 8601 timestamp (e.g., 2025-08-26T12:00:00Z) to create the branch from a specific point-in-time.
    • protected (boolean, optional): If true, the branch is created as a protected branch.
    • init_source (string, optional): The source for branch initialization. parent-data (default) copies schema and data. schema-only creates a new root branch with only the schema from the specified parent.
    • expires_at (string, optional): An RFC 3339 timestamp for when the branch should be automatically deleted (e.g., 2025-06-09T18:02:16Z).

Read the full file on GitHub · 990 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 · 990 lines · 13 tokens per session scan A 8e714c65d1d7

Subscribe to this mod's changes

neon-api-branches is a cursor rule published in the GitHub repository neondatabase/ai-rules (86 stars, last pushed 3mo ago), licensed MIT. It adds 13 tokens to every session and 9,819 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.