ha-selora-ai: Instructions file for Claude Code

CLAUDE.md

ha-selora-ai CLAUDE.md is an instructions file for Claude Code from SeloraHomes/ha-selora-ai. It costs 32,124 tokens per session, scanned A, original, MIT.

Repository guidance for coding agents maintaining a Selora AI integration for Home Assistant, a platform for controlling smart-home devices. It describes the integration's architecture, files, and conventions.

In plain words
What is it for?
Use it when modifying device discovery, natural-language commands, data collection, model connections, sensors, or generated automations.
Why use it?
It explains how device data, language models, suggestions, and Home Assistant automations fit together, reducing the risk of inconsistent changes.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions Claude Code.

This is SeloraHomes/ha-selora-ai's own configuration. It tells Claude Code how to work on ha-selora-ai itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ha-selora-ai configures →

Reuse

Borrowing it

Nothing to install: this file belongs to SeloraHomes/ha-selora-ai. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/SeloraHomes/ha-selora-ai/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/SeloraHomes/ha-selora-ai

Made for: Claude Code.

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 ha-selora-ai CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/selorahomes/ha-selora-ai/claude-md/github.svg)](https://agentmods.dev/instructions/selorahomes/ha-selora-ai/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/selorahomes/ha-selora-ai/claude-md"><img src="https://agentmods.dev/badge/instructions/selorahomes/ha-selora-ai/claude-md/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 ha-selora-ai CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/selorahomes/ha-selora-ai/claude-md"><img src="https://agentmods.dev/badge/instructions/selorahomes/ha-selora-ai/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32,124 This file is loaded in full into every session.
When invoked 32,124 The same file — it is already loaded in full.
Security scan A 0 findings. 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.32124 $0.32124
Opus 5 $0.16062 $0.16062
Sonnet 5 $0.06425 $0.06425
Haiku 4.5 $0.03212 $0.03212

Measured 6d ago against content hash dd421c4095bb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

ha-selora-ai CLAUDE.md 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 6d 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.

CLAUDE.md · 1,758 lines

How it starts

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

Selora AI — Home Assistant Integration

This file is read by AI coding assistants (Claude Code, Zencoder, Copilot, etc.) to maintain consistency across developers and models. Keep it up to date.

What This Is

A custom Home Assistant integration (custom_components/selora_ai/) that acts as a "smart butler":

  • Analyzes device states and usage patterns via LLM — Selora AI (Selora Cloud, or the on-device Selora AI Local model), Anthropic Claude, Google Gemini, OpenAI, OpenRouter, or local Ollama
  • Auto-generates HA automations (disabled, prefixed [Selora AI] for user review)
  • Accepts natural language commands via the Selora panel and Home Assistant Assist
  • Discovers and onboards network devices during initial setup

Architecture

HA entity registry / state machine / recorder (SQLite)
    |
    v
DataCollector  ──snapshot──>  LLMClient (Selora Cloud / Selora Local / Anthropic / Gemini / OpenAI / OpenRouter / Ollama)
    |                              |
    |                         suggestions
    v                              v
logging + sensors         automations.yaml (disabled) + reload

Project Structure

custom_components/selora_ai/
├── __init__.py          # Integration setup/teardown, entry routing
├── config_flow.py       # UI config flow (LLM setup → device discovery → area assignment → results)
├── collector.py         # Hourly data collection + LLM automation writer
├── llm_client/          # LLM facade package (client, prompts, parsers, intent, command_policy, lang_detect, state_filter, usage)
├── providers/           # Pluggable LLM backends (Selora Cloud/Local, Anthropic, Gemini, OpenAI, OpenRouter, Ollama)
├── device_manager.py    # Device discovery, pairing, area assignment, dashboard generation
├── conversation.py      # Assist Conversation Agent — routes natural language to HA service calls
├── automation_utils.py  # Validation, risk assessment, YAML I/O, async automation CRUD
├── automation_normalize.py # Pure payload reshaping: field coercion, null-dropping, window merging
├── automation_store.py  # Lifecycle + versioning for [Selora AI] automations
├── group_manager.py     # HA group-helper CRUD (drives HA's own `group` config flow)
├── dashboard_manager.py # Lovelace view/card read + edit (chat tool surface)
├── registry_manager.py  # Area/floor/entity/device registry reads + writes, helper inventory
├── script_manager.py    # scripts.yaml CRUD (mapping, not a list — unlike automations)
├── label_manager.py     # Label registry + delta assignment across entities/devices/areas
├── diagnostics_tools.py # Read-only: system_log errors, automation run traces
├── code_stamp.py        # Source-signature skew detection (restart-required handshake)
├── scene_store.py       # Scene creation + persistence
├── websocket/           # Panel websocket handlers, one module per domain (registered lazily)
├── button.py            # Hub action buttons (Discover, Scan, Cleanup, Reset)
├── sensor.py            # Hub sensors (Status, Devices, Discovery, Last Activity)
├── selora_auth.py       # Multi-auth orchestration (HA token, MCP token, Selora JWT)
├── mcp_token_store.py   # Local MCP API token store (CRUD, hash-only storage)
├── telemetry.py         # Anonymous, opt-in repair-counter telemetry (PostHog)
├── types.py             # Shared TypedDict definitions (automations, patterns, suggestions, etc.)
├── const.py             # Constants, config keys, known integrations database
├── manifest.json        # HA integration manifest
├── strings.json         # UI strings for config flow
├── translations/         # HA-side translations (en, fr, de, es, it, nl, hu, pt, ru, ja, ko, zh-Hans, zh-Hant) — all keys must match strings.json
├── brand/               # Logo and icon assets
└── frontend/
    └── src/
        ├── panel.js                  # LitElement host (properties, lifecycle, render dispatch)
        └── panel/
            ├── render-automations.js # Automation list, cards, flowchart, unavailable modal
            ├── render-chat.js        # Chat messages, YAML editor, new-automation dialog
            ├── render-settings.js    # Settings tab
            ├── render-telemetry-consent.js # One-time telemetry opt-in banner
            ├── render-stale-code-notice.js  # Restart/reload-required banner
            ├── version-actions.js    # Code-skew handshake (unknown command ⇒ restart)
            ├── render-suggestions.js # Suggestion cards
            ├── render-version-history.js # Version history drawer + diff viewer
            ├── stale-automations.js  # Stale detection helpers + stale modal/detail
            ├── automation-crud.js    # CRUD websocket calls
            ├── automation-management.js # Bulk edit, enable/disable, filter
            ├── session-actions.js    # Session list actions
            ├── suggestion-actions.js # Accept/dismiss/snooze suggestion actions
            ├── chat-actions.js       # Send message, streaming
            └── styles/               # CSS-in-JS style modules

Read the full file on GitHub · 1,758 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. 6d ago Changed · +40 lines · +719 tokens per session dd421c4095bb
  2. 11d ago First seen · 1,718 lines · 31,405 tokens per session scan A 87faafd337f2

Subscribe to this mod's changes

ha-selora-ai CLAUDE.md is an instructions file published in the GitHub repository SeloraHomes/ha-selora-ai (84 stars, last pushed 2d ago), licensed MIT. It adds 32,124 tokens to every session, about $0.1606 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.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens