Guardrails for Windsurf, built from your own rules.
Your company's rules reach Windsurf before every file write. A write that breaks them never lands.
npx -y @cybedefend/vibedefend@latest install
Windsurf is writingbilling/refund.ts
export async function refund(req: Request) { const { id, amount } = await req.json(); const invoice = await db.invoices.find({ id, tenant: req.tenant, }); if (amount > 500) await approvals.second(invoice); return payments.refund(invoice, amount); }
Every query is scoped to the tenant.
rules/data-access.mdRefunds above €500 need a second approver.
Approved once by Sofia M.Checked before the commit: clean
Set up in four steps.
- Run one commandIn any terminal, on macOS, Linux or Windows. Node 18.17 or later.
- Choose your region, sign inEU or US. Your browser opens to sign in, no key to paste.
- Tick WindsurfThe installer finds the agents on your machine and ticks them for you.
- Code as usualOpen Windsurf: VibeDefend runs alongside it.
What VibeDefend adds to Windsurf.
Rules served
Writes onlyFile writes only: pre_write_code is the moment Windsurf exposes.
Windsurf is writingsrc/billing/cart-checkout.ts
const total = new Decimal128(cart.sum); const rows = await db.query( "SELECT * FROM carts WHERE id = $1", [id] );
Monetary amounts use Decimal128, never Number.
Mined from src/billing.ts:14Parameterise every query that mixes user input.
OWASP Top 10Served before the edit
Live findings
SAST, SCA, secrets, IaC and CI/CD findings, live in the session.
Windsurf
SAST
src/db/users.repo.ts:42SQL injection
SCA
package.jsonlodash 4.17.20, CVE-2021-23337
Secrets
config/prod.ymlAWS access key
IaC
infra/main.tfS3 bucket public-read
CI/CD
.github/workflows/deploy.ymlpull_request_target
In the agent's context, live
Limits in Windsurf
- Secret guardThrough .windsurfrules
- Action guardWrites only
Your questions.
Does VibeDefend change my Windsurf configuration?
~/.codeium/windsurf/hooks.json, ~/.codeium/windsurf/mcp_config.json, .windsurfrules. Your own hooks stay: re-running the installer only replaces VibeDefend's entries.What leaves my machine?
Which version of Windsurf do I need?
Do I need to link each repository?
vibedefend link once. It writes .cybedefend/config.json with the project ID.How do I remove it?
vibedefend uninstall: it removes every file VibeDefend installed. If you installed the package globally, then run npm uninstall -g @cybedefend/vibedefend.Why are Action Guards limited in Windsurf?
pre_write_code hook can block file writes, not reads, shell commands or fetches. For those, VibeDefend adds a snippet to .windsurfrules that asks the agent to call cybe_guards_check through MCP first. It holds when the model follows its rules file.Technical details for Windsurf
- MCP server
- Available
~/.codeium/windsurf/mcp_config.json - Rules before each edit
- Writes only
pre_write_codeFile writes only: pre_write_code is the moment Windsurf exposes. - Dangerous actions blocked
- Writes only
pre_write_code.windsurfrulesWrites are hard-blocked. For reads, shell commands and fetches, a .windsurfrules snippet asks the agent to call cybe_guards_check first: it holds when the model follows its rules file. - Rules loaded at start
- On each prompt
pre_user_promptWindsurf has no session-start event. VibeDefend uses pre_user_prompt, which fires on every turn; the check is cheap and returns at once when nothing is pending. - End-of-session review
- Available
post_cascade_responseRuns at the end of each response, once the edit threshold is crossed. - Review of long sessions
- Not availableNo equivalentWindsurf has no event before compaction.
- Reminder on every prompt
- Not availableNo equivalentNot available in Windsurf.
What it writes for Windsurf
~/.codeium/windsurf/hooks.json~/.codeium/windsurf/mcp_config.json.windsurfrules
And the hook runner in ~/.cybedefend/. Your own hooks stay: re-running the installer only replaces VibeDefend's entries.
Run the installer from your repository root: the .windsurfrules snippet is written in the folder you run it from.
Windsurf exposes fewer moments than the other agents. File writes are hard-blocked; the other actions rely on the agent following .windsurfrules.
Something off? vibedefend status gives a read-only report, and vibedefend doctor repairs what it can.