general

general is a cursor rule for Cursor from ckrl/ha-gitops. It costs 1,013 tokens per session, scanned A, original, MIT.

A set of core rules for the ha_gitops custom Home Assistant integration. Home Assistant is software for managing smart-home devices, and an integration connects it to a particular system or service.

In plain words
What is it for?
Use it when developing or reviewing the ha_gitops integration, especially its Python, Git, Home Assistant, asynchronous I/O, documentation, tests, and user-facing responses.
Why use it?
It records the project’s required architecture, technology choices, language conventions, and restrictions. This helps prevent changes that would break existing configurations or conflict with the project documentation.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when developing or reviewing the ha_gitops integration, especially its Python, Git, Home Assistant, asynchronous I/O, documentation, tests, and user-facing responses.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ckrl/ha-gitops/general
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.

Clone the repo
git clone --depth 1 https://github.com/ckrl/ha-gitops

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 general

README.md
[![agentmods](https://agentmods.dev/badge/rules/ckrl/ha-gitops/general/github.svg)](https://agentmods.dev/rules/ckrl/ha-gitops/general)
Your own site
<a href="https://agentmods.dev/rules/ckrl/ha-gitops/general"><img src="https://agentmods.dev/badge/rules/ckrl/ha-gitops/general/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for general

Your own site · 80×15
<a href="https://agentmods.dev/rules/ckrl/ha-gitops/general"><img src="https://agentmods.dev/badge/rules/ckrl/ha-gitops/general.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,013 This file is loaded in full into every session.
When invoked 1,013 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01013 $0.01013
Opus 5.5 $0.00405 $0.00405
Sonnet 5.5 $0.00203 $0.00203
Haiku 4.5 $0.00101 $0.00101

Measured 1mo ago against content hash fc2baeeb8653, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

general scanned grade A with 1 finding 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 1mo 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- Использовать `async def` + `await` для всех git/IO операций; никаких `subprocess.run`/`os.system` в продакшен-коде.
.cursor/rules/general.mdc · 46 lines

How it starts

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

General Rules

Important

  • Проект — кастомная Home Assistant integration ha_gitops, распространяется через HACS.
  • Источник истины по архитектуре и требованиям — docs/architecture.md (в репо, нумерация разделов стабильна). Все правила, docstrings, тесты ссылаются на параграфы оттуда. При расхождении кода и architecture.md — документ выигрывает; правки в документ — отдельным шагом, не вместе с кодом.
  • Никаких ссылок на ресурсы вне репо (KB-пути, личные заметки, Notion и т. п.) ни в коде, ни в правилах, ни в комментариях. Репо самодостаточен.
  • DOMAIN компонента: ha_gitops. Менять нельзя — ломает существующие конфиги.
  • Все ответы и обсуждения — на русском; код, идентификаторы, commit messages, UI-строки и логи — на английском.

Core Stack (do NOT switch unless explicitly asked)

  • Python 3.11+ (соответствует HA 2024.1+).
  • Home Assistant Core API (homeassistant.*) — entity-модель, config flow, services.
  • asyncio — все I/O-операции неблокирующие; git-операции через GitPython в asyncio.to_thread; ssh-keygen — asyncio.create_subprocess_exec.
  • GitPython + git на PATH — бэкенд с v0.1.8 (manifest.json: GitPython), публичный API GitManager без изменений.
  • pytest + pytest-homeassistant-custom-component — тесты.
  • uv (Astral) — управление venv и зависимостями. Версия Python пинится через .python-version, lockfile — uv.lock. Команды: uv sync --extra dev, uv run pytest, uv add --dev <pkg>. НЕ использовать pip install напрямую и не вводить параллельный Pipfile/poetry.lock.
  • HACS — дистрибуция (manifest.json + hacs.json).

Запрещено вводить без обсуждения: dulwich, pygit2, paramiko, FastAPI/Flask, ORM, БД, Node.js-инструменты.

DO

  • Использовать async def + await для всех git/IO операций; никаких subprocess.run/os.system в продакшен-коде.
  • Логировать через logging.getLogger(__name__); имя логгера — custom_components.ha_gitops.<module>.
  • Идемпотентность: повторный push без изменений = no-op (без пустого коммита). Повторный initialize не падает.
  • Любая git-ошибка → SyncStatus.ERROR в сенсоре + persistent_notification с человекочитаемым текстом, HA не падает.
  • Все пути — pathlib.Path, не str. Конфиг-директория HA — hass.config.path(...).
  • Type hints на всех публичных функциях. from __future__ import annotations в каждом модуле.

Read the full file on GitHub · 46 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. 1mo ago First seen · 46 lines · 1,013 tokens per session scan A fc2baeeb8653

Subscribe to this mod's changes

general is a cursor rule published in the GitHub repository ckrl/ha-gitops (5 stars, last pushed 5mo ago), licensed MIT. It adds 1,013 tokens to every session, about $0.0041 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.