Skip to content

RULES — invariants enforced by the gate (v3 Part 14)

A rule is enforced by a check, a lint, or a startup assertion — independent of whether anyone followed a skill. A rule that depends on memory is not a rule. When a change has no matching skill it may warrant a new rule here — added with an enforcement check, never prose alone. pytest checks skip (visibly) until their # WIRE: seam in checks/config.py is satisfied, so the gate is adoptable incrementally.

IDRuleOriginEnforced by
R1No module references a specific library function; reach them only via the registry (the reflection builder + hand-written custom/ run logic are exempt).v1check_import_graph.py
R2The term dictionary defines parameter terms, never functions.v2lint_term_dictionary.py
R3One schema-of-record (JSON Schema) drives form + Pydantic.v3test_invariants.py::test_r3_*
R4Library functions are declarative manifest entries; custom functions declare a params schema-of-record + an execute.v3lint_function_folders.py
R5Every function returns the contract envelope (CallResult).v3test_contracts.py (skip-until-SYNTH_FIXTURE)
R6/R7Compute history is append-only; never COMPLETED→QUEUED; rerun appends.v1test_invariants.py (R6/R7 needs a run harness)
R8Effect class is explicit; plotting render params are managed.v2test_invariants.py::test_r8_*
R9One uvicorn worker; sessions never span worker processes.v1supervisord --workers 1
R10State-changing ops are queued mutating jobs under the write lock.v1test_invariants.py::test_r10_*
R11Retired. Governed the AI agent's context replay; the agent was removed.v3
R12Retired. Governed the AI agent's meta-tool set; the agent was removed.v3
R13Snapshots share the render core; assets are content-hashed.v3test_invariants.py::test_r13_*
R14Retired. Required a widget and a describe_function resolver per binding type; the resolver was the AI agent's, which was removed. The widget requirement (FunctionForm.tsx) still applies but is enforced by review, not this gate.v3
R15Deps permissive or adjudicated; no torch/scvi; scan + SBOM before distribution.v2/v3scan_licenses.py
R16Term-dictionary coverage must not regress below the floor.v3lint_term_dictionary.py
R17A checkpoint schema (backend/app/schemas/checkpoint/*.schema.json) and docs/CHECKPOINT_FORMAT.md change together.v3check_checkpoint_schema_docs.py

Run the gate: make check (use PYTHON=<backend interpreter> to enforce the import-dependent rules rather than skip them).