cursorrules

A project-specific rule sheet for an AI coding assistant working on OmoiOS Python code, especially SQLAlchemy database models. SQLAlchemy is a Python library for defining and working with database tables.

In plain words
What is it for?
Use it when creating or editing OmoiOS SQLAlchemy models, checking JSON database fields, or reviewing model inheritance, relationships, and naming.
Why use it?
It prevents the assistant from using attribute names that SQLAlchemy reserves and guides it toward consistent names for model fields and relationships.

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/kivo360/omoios/cursorrules
Clone the repo
git clone --depth 1 https://github.com/kivo360/OmoiOS

Made for: Cursor.

Per session 698 This file is loaded in full into every session.
When invoked 698 The same file — it is already loaded in full.
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.00698 $0.00698
Opus 5 $0.00349 $0.00349
Sonnet 5 $0.00140 $0.00140
Haiku 4.5 $0.00070 $0.00070

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

Security

Grade A, and why

cursorrules 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.

.cursorrules · 82 lines

How it starts

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

Cursor Rules for OmoiOS Project

You are an AI assistant working with the OmoiOS codebase. Follow these rules when working with Python files, especially those containing SQLAlchemy models.

SQLAlchemy Model Rules (CRITICAL)

Reserved Keywords - ABSOLUTELY FORBIDDEN

NEVER use these attribute names in SQLAlchemy model classes:

  • metadata - RESERVED by SQLAlchemy Declarative API
  • registry - RESERVED by SQLAlchemy internal system
  • declared_attr - RESERVED by SQLAlchemy declarative system

Safe Alternatives for Common Patterns

  • For change tracking: change_metadata, item_metadata, config_data, extra_data
  • For registry patterns: agent_registry, service_registry, component_registry
  • For dynamic attributes: custom_field, dynamic_attribute, computed_field

Model Validation Checklist

When editing or creating SQLAlchemy models, ALWAYS check:

  1. No metadata attributes in model classes
  2. No registry attributes in model classes
  3. No declared_attr attributes in model classes
  4. All JSONB fields use descriptive names ending with _data, _config, or _metadata
  5. Model inherits from Base correctly
  6. All relationships are properly typed

Trigger Patterns

Apply these rules when files contain:

  • from sqlalchemy import or import sqlalchemy
  • class.*Base) (SQLAlchemy model inheritance)
  • Mapped[, mapped_column, relationship
  • File paths: **/models.py, **/model*.py

Error Prevention

If you see metadata: as a model attribute, IMMEDIATELY:

  1. Stop the operation
  2. Alert the user to the SQLAlchemy conflict
  3. Suggest alternatives: change_metadata, item_metadata, etc.
  4. Reference the CLAUDE.md rule for detailed explanation

General Python Best Practices

Type Safety

  • Use proper type hints for all function parameters and return values
  • Prefer Mapped[T] over Column(T) for SQLAlchemy models
  • Use Optional[T] for nullable database fields

Import Organization

  1. Standard library imports first
  2. Third-party imports second (sqlalchemy, pydantic, fastapi)
  3. Local imports third (omoi_os.*)
  4. Use relative imports within the same package

Read the full file on GitHub · 82 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 · 82 lines · 698 tokens per session scan A 3c1751ff67e9

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository kivo360/OmoiOS (75 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 698 tokens to every session, about $0.0035 per session on Opus 5. 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.