Skip to content

Rules

Execution and caching

Understand Rule enforcement order, focused runs, and dependency-aware reuse.

SQLBuild evaluates a project in this order:

  1. discovery, expansion, and mandatory compiler correctness
  2. selected native built-in Rules
  3. selected custom Python Rules
  4. artifact completion

Native built-ins always run before custom Rules. Structured compile output reports built-in and custom durations separately, together with cache hits and misses.

sqb compile runs the complete configured Rules set. Build and execution commands use the same compiler path and reject Rule findings before opening a warehouse connection.

sqb rules run is intentionally focused. Use it to inspect one exact code or family, but run the normal compiler before treating the complete project as valid.

Rules cache under target/rules-cache. A cache identity includes the Rule code, implementation and imported helpers, options, invocation subject, accessed compiler facts, dialect, tracked project observations, and compatibility versions.

Model-subject Rules support fine-grained reuse. Editing one model invalidates affected model subjects rather than every Rule invocation. Project-subject Rules run once and are appropriate for genuinely project-wide invariants, with correspondingly broader invalidation.

Positive and negative project-tree observations are dependencies. If a Rule observes that a glob has no matches, adding a matching file invalidates that result.

When no custom Rule is selected, SQLBuild does not initialize the custom Python host. When every custom result is cached, the host is not launched for evaluation.

Generate project-specific guidance from the configured Rules:

sqb rules skills
sqb rules skills --check

SQLBuild manages .agents/skills/sqlbuild-rules/SKILL.md, .claude/skills/sqlbuild-rules/SKILL.md, and .opencode/skills/sqlbuild-rules/SKILL.md without overwriting divergent or unowned content.