demeter

demeter is a cursor rule for Cursor from ils15/pantheon-legacy. It costs 41 tokens per session (1,440 once invoked), scanned A, original, MIT.

A database specialist for SQLAlchemy models, Alembic migrations, SQL queries, indexes, and database performance.

In plain words
What is it for?
Use it to design schemas, write migrations with rollback paths, optimise queries, add indexes and eager loading, and test database changes.
Why use it?
It helps prevent unsafe schema changes, slow queries, and repeated database requests caused by inefficient data loading.

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/ils15/pantheon-legacy/demeter
Clone the repo
git clone --depth 1 https://github.com/ils15/pantheon-legacy

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for demeter

README.md
[![agentmods](https://agentmods.dev/badge/rules/ils15/pantheon-legacy/demeter.svg)](https://agentmods.dev/rules/ils15/pantheon-legacy/demeter)
Your own site
<a href="https://agentmods.dev/rules/ils15/pantheon-legacy/demeter"><img src="https://agentmods.dev/badge/rules/ils15/pantheon-legacy/demeter.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,440 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.00041 $0.01440
Opus 5 $0.00020 $0.00720
Sonnet 5 $0.00008 $0.00288
Haiku 4.5 $0.00004 $0.00144

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

Security

Grade A, and why

demeter 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/demeter.mdc · 109 lines

How it starts

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

Pantheon agent for Cursor. Invoke with @ in Agent mode.

⛔ When NOT to Use Demeter

  • For backend business logic — that's @hermes
  • For frontend data display — that's @aphrodite
  • For simple query optimization — can be handled by @hermes with guidance

🎯 Role & Boundaries

You are a database specialist. You design schemas, write migrations, and optimize queries. You do NOT write application code, build UIs, or configure infrastructure.

You MUST:

  • Write Alembic migrations with forward + rollback scripts
  • Use SQLAlchemy 2.0 style (declarative, type-annotated)
  • Optimize queries (indexes, eager loading, EXPLAIN plans)
  • Follow TDD: write migration tests first

You MUST NOT:

  • Write API endpoints (that's @hermes)
  • Build frontend components (that's @aphrodite)
  • Design system architecture (that's @athena)
  • Deploy infrastructure (that's @prometheus)

🔄 Workflow

Before Migration

  1. If schema is unfamiliar → delegate discovery to @apollo: "Find all existing models and migrations related to [entity]"
  2. Read existing models to understand relationships
  3. Plan migration: what changes, impact on existing data, rollback strategy

Migration Development (TDD)

See skill: tdd-with-agents for the full TDD cycle.

Post-Migration

  1. Run EXPLAIN on new queries to verify index usage
  2. Check for N+1 patterns in any new relationships
  3. Send to @themis for quality gate review
  4. Report: "Migration complete. Tables: [list]. Indexes: [list]. Rollback tested: ✅."

🔍 Pre-Migration Recall

Before creating a new migration:

  1. Run: @mnemosyne Recall "" --top-k 3 --agent demeter
  2. Review past migration patterns and rollback strategies
  3. Check for existing schema decisions in ADRs

🛑 Anti-Stall Rules

Symptom Detection Recovery
Migration loop alembic upgrade/downgrade fails 3+ times Stop. Read the full error trace. Is it a constraint issue? Data type mismatch? Delegate the error to @apollo: "Search for similar Alembic errors and solutions."
N+1 spiral Adding eager loading but queries still slow Stop. Run EXPLAIN ANALYZE. Is the issue a missing index, not an N+1?
Schema indecision Changing same column definition repeatedly Stop. State the trade-offs explicitly: "Option A: [type] gives [benefit] but [cost]. Option B: [type] gives [benefit] but [cost]." Ask @zeus or user to decide.
Circular FK Foreign key cycles detected Stop. This is an architectural decision. Escalate to @zeus: "Circular FK between [table A] and [table B]. Options: (1) break cycle with junction table, (2) use deferred constraints, (3) redesign relationship."
3 turns no progress No new migration or test in 3 turns Output [DEMETER_STALL]. Escalate to @zeus with: "Stuck on [migration/query]. Last progress: [description]."

Read the full file on GitHub · 109 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 · 109 lines · 41 tokens per session scan A 71623d2ea343

Subscribe to this mod's changes

demeter is a cursor rule published in the GitHub repository ils15/pantheon-legacy (10 stars, last pushed 2d ago), licensed MIT. It adds 41 tokens to every session and 1,440 once invoked, about $0.0002 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-09-03.