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.
npx agentmods add instructions/naanyabiz/haggle/agents-mdgit clone --depth 1 https://github.com/NaanyaBiz/haggleWrote 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.
[](https://agentmods.dev/instructions/naanyabiz/haggle/agents-md)<a href="https://agentmods.dev/instructions/naanyabiz/haggle/agents-md"><img src="https://agentmods.dev/badge/instructions/naanyabiz/haggle/agents-md.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.15728 | $0.15728 |
| Opus 5 | $0.07864 | $0.07864 |
| Sonnet 5 | $0.03146 | $0.03146 |
| Haiku 4.5 | $0.01573 | $0.01573 |
Grade A, and why
haggle AGENTS.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 today.
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.
How it starts
The opening of the file, as written. The whole thing — 954 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md — Haggle Integration Guide
One-liner:
haggleis a Home Assistant custom integration that pulls AGL Australia smart-meter interval data from AGL's undocumented REST API and feeds it into HA's Energy dashboard viaimport_statistics().
This file is the canonical documentation for both human contributors and AI agents.
CLAUDE.md is a symlink to this file.
Dev Loop
# Install deps (once, or after pyproject.toml changes)
uv sync
# Run tests
uv run pytest
# Lint + format
uv run ruff check --fix custom_components/ tests/
uv run ruff format custom_components/ tests/
# Type-check
uv run mypy custom_components/haggle
# Validate manifest
python scripts/validate_manifest.py custom_components/haggle/manifest.json
# Run all pre-commit hooks
uv run pre-commit run --all-files
# Hassfest — easiest via CI (push a branch + open PR)
# Or use the dedicated image locally:
docker run --rm \
-v "$(pwd)/custom_components:/github/workspace/custom_components:ro" \
ghcr.io/home-assistant/hassfest \
--integration-path /github/workspace/custom_components/haggle
Test strategy (what layer of testing a change needs, coverage floor, when live-HA manual testing is required): docs/testing.md.
Control expectations: this repository operates under the committed
secure-SDLC standard; every
CO-x.y reference in this tree resolves there. The statement-level
conformance map records how each control
is met (or the recorded exception) — a PR that changes a control surface
(workflow, ruleset baseline, agent grant, release gate, security doc)
updates the affected conformance rows in the same PR.
Repo Map
custom_components/haggle/
├── __init__.py # async_setup_entry / async_unload_entry / async_remove_entry + HaggleRuntimeData
├── manifest.json # HACS/HA metadata; hassfest validates this
├── const.py # all constants — DOMAIN, API hosts, config-entry keys, data keys
├── config_flow.py # PKCE authorize URL → user pastes callback → exchange → select_contract; options flow (solar statistics-writes toggle, poll-interval throttle)
├── diagnostics.py # anonymized config-entry diagnostics (schema v2) — public-safe; parsed by the triage routine (docs/diagnostics.md)
├── coordinator.py # HaggleCoordinator: 30-day backfill (throttled, 429-aware, per-series ranges) + incremental statistics import (aggregate + per-tariff ToU series + solar generation/credit on hasSolar contracts) + bill-period solar totals
├── sensor.py # 14 SensorEntityDescription entries (3 conditional ToU rate sensors, 5 conditional solar sensors); HaggleEnergySensor
├── agl/
│ ├── __init__.py
│ ├── client.py # AglAuth (JWT expiry + token rotation) + AglClient (HTTP methods)
│ ├── models.py # TokenSet, Contract, IntervalReading, DailyReading, BillPeriod, PlanRates
│ ├── parser.py # JSON → typed dataclasses; TOTAL over arbitrary JSON (fuzz-enforced) — filters type=none intervals
│ └── pinning.py # SPKI extraction helper for Trust-On-First-Use TLS pinning
├── strings.json # translatable config-flow strings
└── translations/en.json # English strings (must mirror strings.json)
tests/
├── conftest.py # _auto_enable_custom_integrations fixture
├── fixtures/
│ ├── PROVENANCE.md # fixture provenance + the solar capture consent note
│ ├── hourly_response.json # 30-min interval data (Current/Hourly)
│ ├── overview_response.json # /v3/overview with accounts + contracts
│ ├── plan_response.json # /v2/plan/energy with gstInclusiveRates (flat rate)
│ ├── tou_plan_response.json # Time-of-Use plan — per-band gstInclusiveRates
│ ├── tou_hourly_response.json # mixed peak/offpeak/shoulder/normal intervals
│ ├── solar_hourly_response.json # REAL full-day ElectricitySolar capture (2026-07-01, app-reconciled) — provenance + consent: fixtures/PROVENANCE.md
│ ├── solar_plan_response.json # solar plan — feed-in rate in gstExclusiveRates
│ ├── overview_solar_response.json # /v3/overview variant with hasSolar: true
│ └── bill_period_response.json # usage summary
├── test_init.py # setup/unload smoke tests
├── test_config_flow.py # PKCE step navigation (user → exchange → select_contract)
├── test_agl_client.py # AglAuth token rotation + AglClient HTTP methods + pin-check wiring
├── test_const.py # base64 sanity-check on AGL_AUTH0_CLIENT
├── test_parser.py # parse_interval_readings, parse_overview, parse_plan, ToU rate mapping, _safe_float
├── test_pinning.py # SPKI extraction + host-name guards
├── fuzz/
│ ├── fuzz_parser.py # atheris harness — parser totality + numeric guards (run by fuzz.yml)
│ └── requirements.txt # hash-pinned atheris (Scorecard Pinned-Dependencies)
├── test_coordinator_statistics.py # backfill, incremental resume, idempotency, ToU per-tariff series, numeric guards
├── test_recorder_statistics.py # sum-chain scenarios vs the REAL recorder (recorder_mock) — spike/#114/ToU-partition classes
├── test_sensor.py # sensor descriptions + conditional ToU rate-sensor registration
└── test_diagnostics.py # leak tests (token/contract/account/SPKI never serialize) + schema v1 shape
docs/
├── compliance/
│ ├── secure-sdlc-standard.md # the standard this repo operates under — 19 COs / 94 statements, industry-agnostic (v1.0)
│ └── conformance.md # statement-level conformance map: mechanism per statement + RA-xx exceptions — update rows in the SAME PR as any control-surface change
├── energy-dashboard.md # user guide — which haggle:* statistics to add per plan type, sensor glossary, troubleshooting (#137 footgun)
├── delivery-metrics.md # quarterly delivery-metrics process + recorded time-to-restore exception (CO-18.3)
├── releasing.md # release acceptance policy — beta-soak rule, hotfix evidence rule, downgrade test, acceptance record
├── testing.md # test strategy — four layers, coverage floor, when live-HA manual testing is required
├── diagnostics.md # diagnostics schema v1 reference — users + triage routine (bump with DIAGNOSTICS_SCHEMA_VERSION)
├── threat-model.md # living threat model — trust boundaries, STRIDE register + dispositions, AI agents, regulatory scope, resilience targets
└── agents/
├── triage-routine.md # authoritative spec of the haggle-triage routine (repo-first change control, CO-12.8) — edit HERE, then sync the platform copy
└── injection-corpus.md # canned hostile payloads + manual replay procedure — run before ANY triage-prompt change
scripts/
├── delivery_metrics.py # quarterly CO-18.3 delivery metrics + CHANGELOG/tag/release reconciliation (docs/delivery-metrics.md)
├── wt # bash worktree helper (new / list / rm)
├── access-review.sh # quarterly access review (SECURITY.md "Access Review") — asserts the expected access surface + prints the manual checklist; read-only, maintainer-run with local gh auth, deliberately not CI
├── export-settings.sh # admin-run: re-export control-plane baselines into .github/settings/ (PR-first on any settings change)
├── normalize-ruleset.jq / normalize-repo-public.jq # shared normalizers (export script + settings-drift workflow)
└── validate_manifest.py # used by the validate-manifest Claude hook
.claude/
├── settings.json # committed hooks config
├── agents/ # 8 subagent definitions (5 domain + 3 review)
└── commands/ # 5 slash commands (new-entity, wt, release, hassfest, pr)
.github/
├── settings/ # declared state of the GitHub control plane (rulesets, repo settings) — see settings/README.md; weekly drift check
├── workflows/
│ ├── ci.yml # ruff + mypy + pytest (Python 3.14, coverage floor 89) + gitleaks full-history scan + dependency-review + shellcheck/actionlint/zizmor
│ ├── hacs.yml # HACS validation
│ ├── hassfest.yml # Home Assistant integration manifest validation
│ ├── release.yml # tag-triggered Release (first-party gh CLI): tag-on-main + tag-signature gates, HACS-installed attested zip (zip_release), SBOM attestations, check-run snapshot
│ ├── codeql.yml # weekly + per-PR CodeQL Python scan
│ ├── compat.yml # weekly non-blocking suite vs latest phcc/HA (incl. beta) — early upstream-breakage warning
│ ├── scorecard.yml # weekly + on-push OpenSSF Scorecard self-assessment (feeds README badge)
│ ├── fuzz.yml # weekly deep run + unconditional 120s PR smoke; corpus cached across runs; crash artifacts uploaded
│ └── settings-drift.yml # weekly: re-export rulesets + public repo settings, diff vs .github/settings/, issue on drift
├── CODEOWNERS # @naanyabiz owns everything
└── dependabot.yml # weekly pip + github-actions updates, grouped into one PR per ecosystem
# Repo-root posture files
.gitleaks.toml # repo-specific secret rules (Auth0 refresh tokens, real AGL account/contract numbers) layered on gitleaks defaults
SECURITY.md # disclosure path + threat-model summary
CONTRIBUTING.md # dev loop + commit conventions + PR checklist
CODE_OF_CONDUCT.md # Contributor Covenant 2.1
ROADMAP.md # ~12-month direction + explicit non-goals (single-retailer AGL, read-only, no telemetry)
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.
- today First seen · 954 lines · 15,728 tokens per session scan A f446d762ee0c
haggle AGENTS.md is an instructions file published in the GitHub repository NaanyaBiz/haggle (13 stars, last pushed yesterday), licensed Apache-2.0. It adds 15,728 tokens to every session, about $0.0786 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-09-04.
Other instructions, from other repositories
hacs.integration_blueprint AGENTS.md
Instructions for jpawlowski/hacs.integration_blueprint, covering ai agent instructions, which repository is this?, project overview, where the rules live and routing table.
OVO_Aus_api AGENTS.md
AGENTS.md instructions for HallyAus/OVO_Aus_api, covering ovo energy australia (ha integration) — agent brief, what a mistake costs, stack, run it and where things live.
hacs.integration_blueprint CLAUDE.md
Instructions for jpawlowski/hacs.integration_blueprint, covering claude code instructions and how the pieces reach claude code.
openelectricity AGENTS.md
AGENTS.md instructions for opennem/openelectricity, covering open electricity agent guide, start here, commands and verification, project rules and git and release safety.
openelectricity CLAUDE.md
Claude Code instructions for opennem/openelectricity: Read and follow AGENTS.md first. It is the canonical, model-neutral guide for this repository.
aemo-mcp CLAUDE.md
Claude Code instructions for Bigred97/aemo-mcp, covering aemo-mcp, source, curated datasets (10), repo-specific module set and repo-specific gotchas.