sayou-python-conventions

A set of Python coding rules for the sayou codebase, including its agent and benchmark code. It covers asynchronous programming, configuration, formatting, type annotations, and safe handling of secrets.

In plain words
What is it for?
Use it when writing or reviewing Python modules, database access, FastMCP handlers, settings classes, public functions, and code checked by Ruff.
Why use it?
It prevents new code from conflicting with the project’s existing style, runtime model, configuration method, or automated checks.

Cursor rule

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/pixell-global/sayou/sayou-python-conventions
Clone the repo
git clone --depth 1 https://github.com/pixell-global/sayou
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 535 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.00535
Opus 5 $0.00000 $0.00267
Sonnet 5 $0.00000 $0.00107
Haiku 4.5 $0.00000 $0.00053

Measured 2d ago against content hash 3463759eb4f2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sayou-python-conventions 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 2d ago.

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.

rules/sayou-python-conventions.mdc · 47 lines

How it starts

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

Sayou Python conventions

Async

  • All I/O-bound code must use async/await. The codebase is async throughout (SQLAlchemy async, aiosqlite, FastMCP async handlers).
  • Never introduce synchronous database calls (session.execute(...) without await) in any hot path.
  • Use asyncio.gather for concurrent operations where appropriate.

Configuration and environment

  • All configuration is driven by SAYOU_* environment variables (e.g. SAYOU_DATABASE_URL, SAYOU_API_KEY, SAYOU_EMBEDDING_PROVIDER).
  • Use Pydantic BaseSettings (via pydantic-settings) for config classes. Do not read os.environ directly in business logic.
  • Secrets and deployment-specific values must never be hardcoded; always reference the corresponding SAYOU_* env var.

Code style (Ruff)

  • Line length: 100 characters.
  • Target Python version: 3.11.
  • Follow Ruff defaults for import ordering, unused imports, and style. Run ruff check and ruff format before committing.
  • Use from __future__ import annotations at the top of every module for deferred annotation evaluation.

Type annotations

  • All public functions and methods must have full type annotations (parameters and return type).
  • Use collections.abc types (Sequence, Mapping, AsyncIterator, …) rather than typing equivalents where possible (Python 3.11+).

Database access

  • Use SQLAlchemy 2 async session (AsyncSession). Always acquire sessions through the dependency-injected factory; do not create ad-hoc engine instances in application code.
  • Alembic migrations live in alembic/versions/. New schema changes must include a migration script.

Error handling

  • Raise domain-specific exceptions rather than bare Exception. Define custom exceptions in the relevant module.
  • MCP tool handlers must return structured error responses (not raise uncaught exceptions) so the MCP client receives a well-formed error.

Tests

  • All tests are async and use pytest-asyncio with asyncio_mode = "auto".
  • Use moto for mocking AWS services (S3) and provide in-memory SQLite (aiosqlite:///:memory:) for DB tests.

Read the full file on GitHub · 47 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. 2d ago First seen · 47 lines · 0 tokens per session scan A 3463759eb4f2

Subscribe to this mod's changes

sayou-python-conventions is a cursor rule published in the GitHub repository pixell-global/sayou (28 stars, last pushed 3mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 535 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.