Rules
Execution and caching
Understand Rule enforcement order, focused runs, and dependency-aware reuse.
SQLBuild evaluates a project in this order:
- discovery, expansion, and mandatory compiler correctness
- selected native built-in Rules
- selected custom Python Rules
- 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.
Authoritative enforcement
Section titled “Authoritative enforcement”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.
Dependency-aware caching
Section titled “Dependency-aware caching”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.
Built-in-only execution
Section titled “Built-in-only execution”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.
Agent guidance
Section titled “Agent guidance”Generate project-specific guidance from the configured Rules:
sqb rules skillssqb rules skills --checkSQLBuild 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.