DuckDB Agent Rules

An in-process analytical database with a columnar, vectorized SQL engine.

On this page

Overview

DuckDB's instructions connect the SQL execution pipeline to its C++ types, directories, and test format. They distinguish routine testing from CI repair, route external-extension changes to dedicated instructions, and show how to migrate vector operations without erasing legitimate exceptions.

Documents

├── 
├──  · imports AGENTS.md
├── .github
│   └── patches
│       └── extensions
│           └── 
├── src
│   └── parser
│       └── peg
│           └── 
├── test
│   └── 
├── 
└── 

Patterns in this file

01 / Good and bad pairs

Show the replacement beside the deprecated idiom

The Vector API section places a legacy selection-and-validity loop beside an iterator-and-writer implementation. It then preserves exceptions for scalar executors and type-erased code, so the migration rule is not presented as an unconditional search-and-replace.

Source excerpt starting at line 273.
writers (writing). **The old-style vector loops are deprecated and must not be used in new code:**

02

Document the boundary of a safety setting

The timeout example gives the units, default scope, and global alternative. It also identifies the interrupt-check call site and warns that planning and non-interruptible execution are not bounded, preventing an agent from treating the setting as a universal deadline.

Source excerpt starting at line 52.
The deadline is enforced at `ClientContext::InterruptCheck()` call sites, so it only fires once execution reaches one of them. Queries that check in frequently abort close to the limit, but time spent in planning or inside a long non-interruptible stretch is not bounded by it.

03 / Verification by change type

Separate the daily test loop from CI repair

Routine work uses the optimized build with debug symbols because the debug build is slower. A separate CI section names four commands, including configuration and vector tests, that must succeed when the task is to fix CI.

Source excerpt starting at line 100.
Below is a set of tests that should be run in order to make sure a changeset passes extensive tests in CI. If the user is asking you to fix CI make sure that the below commands succeed.

04 / Architecture as narrative

Make the pipeline a navigation procedure

A diagram walks from SQL through parsing, binding, optimization, physical planning, and execution. Component descriptions attach classes and directories to those stages, and the feature-investigation checklist tells the agent to follow the same path starting from tests.

Source excerpt starting at line 460.
2. Trace from parser → planner → optimizer → execution

05 / Nested instruction files

Route extension changes by ownership boundary

In-tree extensions may be edited directly, while external extensions are changed through patch files. Before changing an external extension or its revision, the file explicitly routes the agent to a nested instruction document.

Source excerpt starting at line 232.
- Before adapting an out-of-tree extension, changing its pinned revision, or modifying `.github/patches/extensions`, read and follow `.github/patches/extensions/AGENTS.md`.

06 / Hard prohibitions

Name obsolete test practices and generated outputs

The testing section prohibits adding an obsolete verification pragma. Separately, the navigation section supplies the regeneration command and enumerates its outputs, including bindings, settings, and serialization code, so source edits have an explicit follow-up step.

Source excerpt starting at line 87.
Do not add `PRAGMA enable_verification` to tests - it should no longer be used in new tests.

Ideas for your repo

  1. Put a replacement code sample next to each deprecated idiom, and state the exceptions.
  2. Explain where timeouts and other safety controls stop providing guarantees.
  3. Separate fast local checks from the commands required to diagnose CI failures.
  4. Use the system's execution stages as a repeatable code-navigation path.
  5. Route changes across repository boundaries to the instructions that govern patching and version pins.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in DuckDB. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works