project-level

A set of project rules for writing and organizing Python, YAML, and AI-tool integration code. It defines practices such as type hints, PEP 8 formatting, component structure, imports, file paths, and tests.

In plain words
What is it for?
Use it when maintaining a Python project that relies on YAML configuration or AI tools and needs consistent code-quality rules.
Why use it?
It gives coding assistance a consistent standard to follow across the project. This reduces style differences, unused code, and missing tests.

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/metagit-ai/metagit-cli/project-level
Clone the repo
git clone --depth 1 https://github.com/metagit-ai/metagit-cli

Made for: Cursor.

Per session 1,340 This file is loaded in full into every session.
When invoked 1,340 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.01340 $0.01340
Opus 5 $0.00670 $0.00670
Sonnet 5 $0.00268 $0.00268
Haiku 4.5 $0.00134 $0.00134

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

Security

Grade A, and why

project-level 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.

.cursor/rules/project-level.mdc · 131 lines

How it starts

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

You are an expert in Python, YAML configurations, and AI toolchain integration. Your role is to assist developers working on their projects, ensuring code quality, and maintainability.

Code Style and Structure

  • Write Python code compliant with PEP 8 and optimized for readability and maintainability.
  • Use type hints for all function parameters and return types.
  • Always strongly type variables using the pydantic library for data structures.
  • Always use Protocol definitions for interface definitions.
  • Maintain a component driven project structure with each component in their own directory within the src/metagit/core path.
  • Avoid duplication by using clear, modular code organization.
  • All file paths should be constructed using os.path.join() instead of string concatenation.
  • All library and class imports must be at the top of the file and never be imported on-demand.
  • Remove all unused imports from each python file after editing them.
  • Never assign variable names which are unused, instead assign these variables as '_'.
  • Unit tests are expected for all functions and class methods and are to be stored centrally in the tests folder.
  • Combine if statements instead of nesting them where possible.
  • Use ternary operators to assign simple logic defined variables instead of if-else-blocks.
  • Favor using Python native libraries instead of subprocess to reduce external dependencies.
  • Use 2 spaces for indentation.
  • Private class members should be prefixed with an underscore (_).
  • Use isinstance() for type comparisons.

Naming Conventions

  • Use snake_case for variables, functions, and filenames.
  • Use PascalCase for class names.
  • Prefix environment variables with provider name (e.g., OLLAMA_, OPENAI_).
  • Use descriptive names for configuration files (e.g., agents.yaml, tasks.yaml).

Environment and Configuration

  • Use python-dotenv to manage environment variables.
  • Maintain .env.example as a template for environment setup.
  • Structure YAML files clearly and validate on load:
    • Use yaml.safe_load for security.
    • Include clear error messages for missing or invalid keys.

Read the full file on GitHub · 131 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 · 131 lines · 1,340 tokens per session scan A 2df5d682de7b

Subscribe to this mod's changes

project-level is a cursor rule published in the GitHub repository metagit-ai/metagit-cli (2 stars, last pushed 4d ago), licensed MIT. It adds 1,340 tokens to every session, about $0.0067 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-31.