cursorrules

Coding rules for the Claude IDE Bridge project, including its bridge and VS Code extension. They define build, test, formatting, tool registration, extension-handler, and error-response practices.

In plain words
What is it for?
Use them when adding or changing bridge tools, registering extension handlers, rebuilding the extension and VSIX, checking code, running tests, or formatting errors.
Why use it?
They help contributors keep the bridge and extension compatible and make tool failures predictable. They also prevent unsafe socket handling and incorrect protocol errors.

Cursor rule for 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/oolab-labs/patchwork-os/cursorrules
Clone the repo
git clone --depth 1 https://github.com/Oolab-labs/patchwork-os

Made for: Cursor.

Per session 1,019 This file is loaded in full into every session.
When invoked 1,019 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.01019 $0.01019
Opus 5 $0.00509 $0.00509
Sonnet 5 $0.00204 $0.00204
Haiku 4.5 $0.00102 $0.00102

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

Security

Grade A, and why

cursorrules 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 2d 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

This is a copy

100% identical to cursorrules — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursorrules · 77 lines

How it starts

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

Claude IDE Bridge — Cursor Rules

Build

  • Run npm run build for bridge, cd vscode-extension && npm run build && npm run package for extension.
  • Run npx biome check . before every commit.
  • Run npm test before every commit.
  • Always rebuild bridge + extension + VSIX before testing changes.

Tool Pattern

  • Create tools using createXxxTool(deps) returning { schema, handler }.
  • Register every tool in src/tools/index.ts.
  • Set extensionRequired: true if the tool needs the VS Code extension.
  • Tool names must match /^[a-zA-Z0-9_]+$/.
  • Use readOnlyHint: true in annotations for tools that do not modify state.
  • Never throw from a tool handler — catch and return { content: [...], isError: true }.

Extension Handlers

  • Create handlers as standalone async functions.
  • Register in vscode-extension/src/handlers/index.ts.
  • All ws.send() calls must use safeSend() or readyState check + try-catch.

Error Handling

  • Tool execution errors: return isError: true in content blocks. See docs/adr/0004-tool-errors-as-content.md.
  • Protocol errors: use ErrorCodes (JSON-RPC -32xxx). Never mix the two.
  • Never use JSON-RPC error codes in tool handlers.

Input Validation

  • All tool arguments are validated by AJV schemas at the transport layer.
  • Use resolveFilePath() for any user-supplied path — blocks null bytes, symlinks, and workspace escapes.
  • Use isValidRef() for git ref arguments — blocks leading-dash refs.
  • Clipboard operations enforce 1MB cap via Buffer.byteLength.
  • searchAndReplace rejects null bytes and --prefixed glob patterns.

Security

  • runCommand only executes allowlisted commands. Interpreter commands (node, python, bash) are permanently blocked.
  • sendHttpRequest blocks private/loopback IPs (SSRF). DNS pre-resolves hostnames. Host header overridden after user headers.
  • Never include auth tokens, IPs, or domain names in source code or documentation.
  • Lock files use O_EXCL creation (symlink attack prevention) and chmod 0o600.

Read the full file on GitHub · 77 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. 2d ago First seen · 77 lines · 1,019 tokens per session scan A a532bccc3f69

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository Oolab-labs/patchwork-os (30 stars, last pushed 2d ago), licensed MIT. It adds 1,019 tokens to every session, about $0.0051 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to cursorrules, differing in 0 lines, and is treated as a copy.