zenml-orm-schema

A guide for defining and updating ZenML ORM schemas. An ORM schema describes database records as code so an application can read and write them through models.

In plain words
What is it for?
Use it when adding or changing schema classes in ZenML’s store, including model inheritance, identifiers, and creation or update timestamps.
Why use it?
It helps new schemas follow ZenML’s file locations, naming conventions, base classes, and shared fields.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/zenml-io/zenml/zenml-orm-schema
Clone the repo
git clone --depth 1 https://github.com/zenml-io/zenml

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,465 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02465
Opus 5 $0.00000 $0.01233
Sonnet 5 $0.00000 $0.00493
Haiku 4.5 $0.00000 $0.00247

Measured yesterday against content hash c0d2c14db0d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

zenml-orm-schema scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/zenml-orm-schema.mdc · 306 lines

How it starts

The opening of the file, as written. The whole thing — 306 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ZenML ORM Schemas

These are common patterns, rules and conventions used in defining ORM schemas within the ZenML project. Make sure to understand these patterns and adhere to these practices when working with the ORM schema.

All ORM schemas are located in the @zenml/src/zenml/zen_stores/schemas directory and referenced in the __init__.py file. The files are named following the convention <concept>_schemas.py (e.g. stack_schemas.py and component_schemas.py) and usually contain only one schema ORM class, unless multiple classes are required to define the same concept.

ORM Model Definition

Base Class Usage

ORM models typically inherit from the BaseSchema or NamedSchema class to ensure consistency and reuse common functionality. BaseSchema is defined in @zenml/src/zenml/zen_stores/schemas/base_schemas.py:

class BaseSchema(SQLModel):
    """Base SQL Model for ZenML entities."""

    id: UUID = Field(default_factory=uuid4, primary_key=True)
    created: datetime = Field(default_factory=datetime.utcnow)
    updated: datetime = Field(default_factory=datetime.utcnow)

NamedSchema is defined in @zenml/src/zenml/zen_stores/schemas/base_schemas.py, inheriting from BaseSchema and adding a name field:

class NamedSchema(BaseSchema):
    name: str

Declarative Style

Models are defined using a declarative style, where classes represent tables and attributes represent columns. For instance, in @zenml/src/zenml/zen_stores/schemas/component_schemas.py:

class StackComponentSchema(NamedSchema, table=True):
    """SQL Model for stack components."""

    __tablename__ = "stack_component"

    type: str
    flavor: str
    configuration: bytes
    labels: Optional[bytes]
    component_spec_path: Optional[str]
    ...

Note that the table=True argument is used to indicate that the model should be a table in the database and the __tablename__ attribute is used to specify the name of the table.

There is a tight relationship between ORM schemas and their associated domain models, especially concerning the names and types of attributes. Make sure to keep them in sync. Read zenml-domain-models.mdc to understand what ZenML domain models are and how they work.

Read the full file on GitHub · 306 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 306 lines · 0 tokens per session scan A c0d2c14db0d4

Subscribe to this mod's changes

zenml-orm-schema is a cursor rule published in the GitHub repository zenml-io/zenml (5,568 stars, last pushed yesterday), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,465 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other cursor rules, from other repositories

workflows

This folder contains all GitHub Actions workflows for the Streamlit repository. Workflows automate CI/CD, testing, releases, and maintenance tasks.

streamlit/streamlit · 0 tokens

python_tests

We use the unit tests to cover internal behavior that can work without the web / backend counterpart. We aim for 95%+ unit test coverage of our Python code in lib/streamlit.

streamlit/streamlit · 0 tokens

skills

This file provides guidance to AI coding agents (Claude Code, Cursor, Copilot, etc.) when working with skills in this repository.

streamlit/streamlit · 0 tokens

e2e_playwright

We use playwright with pytest to e2e test Streamlit library. E2E tests verify the complete Streamlit system (frontend, backend, communication, state, visual appearance) from a user's perspective (black-box). They complement Python/JS unit tests, which are faster and focus on internal logic, input/output validation…

streamlit/streamlit · 0 tokens

embedded_skills

Skills under lib/streamlit/.agents/skills/ ship with the library and load from the user's installed Streamlit, so keep them current as features evolve. developing-with-streamlit uses SKILL.md for routing and references/ for topic files. Follow these conventions when adding or editing guidance.

streamlit/streamlit · 0 tokens

mod-007b-cannot-remove-or-rename-parameters-without-compat-mapper

Cannot remove or rename parameters in production models without implementing backwardcompatargmapper and incrementing modelcheckpointversion to maintain compatibility.

NVIDIA/physicsnemo · 29 tokens