agent-guardrails-template: Cursor rule for Windsurf

.windsurfrules

windsurfrules is a cursor rule for Windsurf from TheArchitectit/agent-guardrails-template. It costs 935 tokens per session, scanned A, original, BSD-3-Clause.

A set of rules that controls how an agent reads, edits, tests, and commits code in a project.

In plain words
What is it for?
It helps enforce safe code edits, test checks, rollback planning, and restrictions such as not committing secrets or force-pushing to the main branch.
Why use it?
It reduces unsafe changes by requiring the agent to read files first, stay within the allowed scope, verify changes, and stop when important details are unclear.

Cursor rule for Windsurf

Written for Windsurf: a Windsurf rule.

This is TheArchitectit/agent-guardrails-template's own configuration. It tells Windsurf how to work on agent-guardrails-template itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything agent-guardrails-template configures →

Reuse

Borrowing it

Nothing to install: this file belongs to TheArchitectit/agent-guardrails-template. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/TheArchitectit/agent-guardrails-template/main/.windsurfrules
Clone the repo
git clone --depth 1 https://github.com/TheArchitectit/agent-guardrails-template

Made for: Windsurf.

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 windsurfrules

README.md
[![agentmods](https://agentmods.dev/badge/rules/thearchitectit/agent-guardrails-template/windsurfrules/github.svg)](https://agentmods.dev/rules/thearchitectit/agent-guardrails-template/windsurfrules)
Your own site
<a href="https://agentmods.dev/rules/thearchitectit/agent-guardrails-template/windsurfrules"><img src="https://agentmods.dev/badge/rules/thearchitectit/agent-guardrails-template/windsurfrules/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 windsurfrules

Your own site · 80×15
<a href="https://agentmods.dev/rules/thearchitectit/agent-guardrails-template/windsurfrules"><img src="https://agentmods.dev/badge/rules/thearchitectit/agent-guardrails-template/windsurfrules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 935 This file is loaded in full into every session.
When invoked 935 The same file — it is already loaded in full.
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.00935 $0.00935
Opus 5.5 $0.00374 $0.00374
Sonnet 5.5 $0.00187 $0.00187
Haiku 4.5 $0.00093 $0.00093

Measured 1mo ago against content hash c0c7842073cc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

windsurfrules 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 1mo 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.

.windsurfrules · 127 lines

How it starts

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

WINDSURF GUARDRAILS

These rules apply to ALL code generation, edits, and suggestions in this project.

The Four Laws of Agent Safety

  1. Read Before Editing - Never modify code without reading it first. Always use the Read tool before any edit.
  2. Stay in Scope - Only touch files explicitly authorized. No "while I'm here" fixes.
  3. Verify Before Committing - Test and check all changes. Run relevant tests.
  4. Halt When Uncertain - Ask for clarification instead of guessing.

Pre-Operation Checklist (MANDATORY)

Before ANY file modification:

  • Read target file(s) completely
  • Verify operation is within authorized scope
  • Identify the rollback procedure
  • Check for test/production separation requirements

Forbidden Actions (NEVER DO)

  1. Modifying code without reading it first
  2. Mixing test and production environments
  3. Force pushing to main/master
  4. Committing secrets, credentials, or .env files
  5. Running untested code in production
  6. Modifying unread code
  7. Working outside authorized scope

Halt Conditions (STOP and Ask User)

  • Attempting to modify code you haven't read
  • No rollback procedure exists or is unclear
  • Production impact is uncertain
  • User authorization is ambiguous
  • Test and production environments may mix
  • Uncertain about ANY aspect of the task
  • Operation has failed 3 times

Three Strikes Rule

  • Strike 1: Retry with adjusted approach
  • Strike 2: Try alternative approach
  • Strike 3: HALT and escalate to user

Never continue beyond 3 failures. Continuing wastes tokens, contaminates context, and rarely succeeds.

Production-First Rule

Production code MUST be created before test code or infrastructure code.

Order:

  1. Production implementation
  2. Production validation (lint, type check, compile)
  3. Tests for the production code
  4. Infrastructure/deployment config

Scope Rules

Only touch files within the authorized scope:

  1. Explicit file list from user (highest authority)
  2. Files identified in the task description
  3. Direct dependencies of target files (with approval)
  4. When uncertain: HALT and ask user

Read the full file on GitHub · 127 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. 1mo ago First seen · 127 lines · 935 tokens per session scan A c0c7842073cc

Subscribe to this mod's changes

windsurfrules is a cursor rule published in the GitHub repository TheArchitectit/agent-guardrails-template (1 stars, last pushed 2d ago), licensed BSD-3-Clause. It adds 935 tokens to every session, about $0.0037 per session on Opus 5.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-08.