• Start

Agent rules

Building AI agents and agent rules with SurrealDB.

Agent rules are small, pre-written .mdc files that steer AI coding assistants toward idiomatic SurrealDB patterns: correct SurrealQL, sensible SDK usage, and consistent handling of vectors and indexes. They reduce hallucinated APIs and help generated code align with how SurrealDB actually behaves. Treat them as living project context you can commit beside application code so every contributor’s assistant follows the same constraints.

The rules cover:

  • SurrealQL — Language and statement conventions for schemas, queries, and functions.

  • Vector indexes and queries — Defining vector indexes and writing vector search in line with current SurrealQL capabilities.

  • SDK-specific rules — Targeted guidance for languages such as Python and JavaScript (and related runtimes), including patterns that match the official SDKs.

The canonical copies live in the docs repository under public/integrations/agent-rules/ on GitHub. Copy the files you need into your project’s .cursor/rules/ directory (or the equivalent location your tool expects). Rename or scope files if your editor supports multiple rule sets per folder.

For Cursor, Zed, OpenCode, and other editors, follow each vendor’s instructions for project rules and how rule files are loaded—see Cursor rules, Zed rules, and OpenCode rules. A fuller walkthrough, including example configuration, is on the Agent rules integration page.

Was this page helpful?