agentleFS
jango-blockchainedjango-blockchained/advanced-homeassistant-mcp/AGENTS.md

advanced-homeassistant-mcp

AGENTS.md57 starsChanged 13 months agoApache-2.0View on GitHub

Note: This file was updated 2026-06-10 as part of a project audit and cleanup. Several claims below were corrected to match the current state of the repo after removal of dead code, dependency cleanup, and config consolidation. The project documentation lives in docs-site/ (Astro v6 + MDX + Tailwind v4 + shadcn-style components, deployed to GitHub Pages). It is a separate package — cd docs-site to work on it.

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Logging: Use winston logger from @/utils/logger, never console.log

    line 51
  2. Very specific:

    Error handling: Always check instanceof Error before accessing .message

    line 52
  3. Very specific:

    Config: Import from src/config/app.config (single source of truth).

    line 59

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent Instructions

Note: This file was updated 2026-06-10 as part of a project audit and cleanup. Several claims below were corrected to match the current state of the repo after removal of dead code, dependency cleanup, and config consolidation.

Commands

  • Build (all 3 entry points): bun run build:all (esbuild → dist/, minified, with inline sourcemaps)
  • Single test: bun test __tests__/path/to/file.test.ts
  • All tests: bun test (auto-preloads test/setup.ts per bunfig.toml)
  • Typecheck: bun x tsc --noEmit (tsconfig is typecheck-only, not used by build)
  • Lint: bun run lint
  • Format: bun run format
  • Clean: bun run clean (removes dist/, dist-ts/, .bun/, coverage/, bin/*.js)

Architecture

  • Three entry points (post-cleanup):
    • src/index.ts → dist/index.cjs — HTTP+WS, custom MCPServer (Express)
    • src/stdio-server.ts → dist/stdio-server.mjs — STDIO, fastmcp v3
    • src/http-server.ts → dist/http-server.mjs — HTTP, fastmcp v3
  • MCP core: src/mcp/MCPServer.ts (custom) + src/mcp/transports/ (transport layers)
  • Tools: src/tools/homeassistant/ (domain-specific), src/tools/ (generic) — not under src/mcp/
  • HA client: src/hass/ (WebSocket API client)
  • Build output: dist/ with external deps (esbuild config in package.json scripts)

Module System

  • Source: TypeScript with ESM-style imports, path alias @/* → src/*
  • Build: esbuild outputs CJS (.cjs) and ESM (.mjs) — NOT tsc
  • Imports: .js extensions are required for relative imports (esbuild resolves to .ts source); the project uses them throughout
    // Correct (matches current codebase)
    import { MCPServer } from "@/mcp/MCPServer";
    // or
    import { MCPServer } from "../mcp/MCPServer.js";
  • tsconfig: module: ESNext, moduleResolution: Bundler (matches package.json#type: module)

Testing Gotchas

  • Preload required: test/setup.ts sets HASS_TOKEN, JWT_SECRET, and other env vars
  • Coverage thresholds: 80% statements/lines/functions, 70% branches (see bunfig.toml)
  • Test location: __tests__/ directory (not src/ or test/)
  • E2E tests: under __tests__/integration/ (not test/e2e/ which was removed)
  • Config: bunfig.toml [test] section controls test behavior; testMatch only matches .test.ts (no .js, no .disabled)

Important Patterns

  • Logging: Use winston logger from @/utils/logger, never console.log
  • Error handling: Always check instanceof Error before accessing .message
    catch (error) {
      const msg = error instanceof Error ? error.message : String(error);
    }
  • External deps: Listed in esbuild --external flags (not bundled). Keep this list in sync with package.json#dependencies.
  • Config: Import from src/config/app.config (single source of truth). The legacy src/config.ts and src/config.js are gone.
  • Validation: Zod (NOT Valibot, despite earlier docs). Schemas live in src/schemas/.

Smithery Deployment

  • Entry: src/smithery-sdk.ts (uses @modelcontextprotocol/sdk)
  • Build: bun run smithery:build → dist/smithery.js
  • Container: Dockerfile.smithery builds dist/http-simple.mjs (the simple HTTP server)
  • Local debug: npx @smithery/cli playground-stdio -- npm run start:stdio

Docs Site

The project documentation lives in docs-site/ (Astro v6 + MDX + Tailwind v4 + shadcn-style components, deployed to GitHub Pages). It is a separate package — cd docs-site to work on it.

  • Dev: cd docs-site && bun install && bun run dev (http://localhost:4321)
  • Build: cd docs-site && bun run build → docs-site/dist/
  • Typecheck: cd docs-site && bun x astro check
  • Preview build: cd docs-site && bun run preview
  • Content: MDX files in docs-site/src/content/docs/, one per page. Frontmatter schema (zod) is in docs-site/src/content.config.ts and enforces title, description, section, order, draft.
  • Theme: pure grayscale B/W with a single indigo accent (--ring: hsl(239 84% 67%)). All semantic tokens live in docs-site/src/styles/global.css and are mapped to Tailwind utilities via @theme inline. The shadcn config in docs-site/components.json matches.
  • Base path: /advanced-homeassistant-mcp (matches the GitHub Pages URL).
  • Deploy: .github/workflows/deploy-docs.yml runs on push to main when docs-site/** changes.

Environment

  • Runtime: Bun (dev/test/build), Node.js >=18 (production)
  • Config: src/config/app.config.ts loads from dotenv, validates with Zod (Valibot was removed)
  • Lockfile: bun.lock is canonical; package-lock.json is also present for npm fallback
  • TypeScript: Strict mode enabled, bun-types in type array

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.