haggle: Agent for Claude Code

.claude/agents/async-performance-reviewer.md

async-performance-reviewer is an agent for Claude Code from NaanyaBiz/haggle. It costs 42 tokens per session (938 once invoked), scanned A, original, Apache-2.0.

A reviewer for asynchronous Python code in a Home Assistant integration. Asynchronous code lets other tasks keep running while waiting for network or file work; blocking calls can freeze the whole application.

In plain words
What is it for?
It is for reviewing the integration's coordinator and API client code, especially for blocking input/output and event-loop performance problems.
Why use it?
It finds slow or blocking operations, incorrect network-session use, polling problems, and wasteful memory use without making changes itself.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions CLAUDE.md.

This is NaanyaBiz/haggle's own configuration. It tells Claude Code how to work on haggle 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 haggle configures →

Reuse

Borrowing it

Nothing to install: this file belongs to NaanyaBiz/haggle. 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/NaanyaBiz/haggle/main/.claude/agents/async-performance-reviewer.md
Clone the repo
git clone --depth 1 https://github.com/NaanyaBiz/haggle

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 async-performance-reviewer

README.md
[![agentmods](https://agentmods.dev/badge/agents/naanyabiz/haggle/async-performance-reviewer.svg)](https://agentmods.dev/agents/naanyabiz/haggle/async-performance-reviewer)
Your own site
<a href="https://agentmods.dev/agents/naanyabiz/haggle/async-performance-reviewer"><img src="https://agentmods.dev/badge/agents/naanyabiz/haggle/async-performance-reviewer.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 938 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 2 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.00042 $0.00938
Opus 5 $0.00021 $0.00469
Sonnet 5 $0.00008 $0.00188
Haiku 4.5 $0.00004 $0.00094

Measured 3d ago against content hash 78d10dbb3063, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

async-performance-reviewer scanned grade A with 2 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 3d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| `import requests` / `requests.get(...)` | Synchronous HTTP |

Runs shell commandslowCapability

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

| `subprocess.run(...)` / `os.system(...)` | Blocking subprocess |
.claude/agents/async-performance-reviewer.md · 80 lines

How it starts

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

You are an async performance reviewer for the haggle Home Assistant custom integration.

Your scope

Review async code in custom_components/haggle/ — especially coordinator.py and agl/client.py — for blocking I/O, session misuse, polling cadence regressions, and memory inefficiency. Report violations. Do NOT fix them.

Blocking I/O in the HA event loop freezes the entire HA instance. This is the highest-severity class of bug in any HA integration.

Delegate:

  • HA wiring patterns → ha-integration-architect
  • AGL API correctness → agl-api-explorer

Blocking I/O — CRITICAL, must flag immediately

Any of the following in an async def function (without executor offload) is a blocker:

Pattern Why it blocks
import requests / requests.get(...) Synchronous HTTP
import urllib / urllib.request.urlopen(...) Synchronous HTTP
import httpx + httpx.get(...) (sync form) Synchronous HTTP
time.sleep(n) Blocks event loop — use await asyncio.sleep(n)
open(path) / Path(p).read_text() / json.load(f) Blocking file I/O
subprocess.run(...) / os.system(...) Blocking subprocess
Any CPU-bound loop >1ms (e.g. parsing 10k rows synchronously) Starves the loop

Executor offload (await hass.async_add_executor_job(fn)) makes file/CPU work safe. Flag unguarded usage, not offloaded usage.

aiohttp session rules

  • ClientSession must be obtained once and reused. Never create aiohttp.ClientSession() inside a request method.
  • Prefer aiohttp_client.async_get_clientsession(hass) (HA-managed, shared).
  • If using aiohttp_client.async_create_clientsession(hass), ensure it's closed in async_unload_entry.
  • Flag async with aiohttp.ClientSession() as session: inside any function called more than once — that pattern creates and destroys a session per call.

Polling cadence (from CLAUDE.md)

Any new DataUpdateCoordinator or async_track_time_interval schedule must match these floors:

Data type Minimum interval
30-min interval data 24 h
Daily series 6 h
Plan / overview 7 days
Token refresh Just-in-time only (<2 min to exp) — never scheduled

Read the full file on GitHub · 80 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. 3d ago First seen · 80 lines · 42 tokens per session scan A 78d10dbb3063

Subscribe to this mod's changes

async-performance-reviewer is an agent published in the GitHub repository NaanyaBiz/haggle (13 stars, last pushed 5d ago), licensed Apache-2.0. It adds 42 tokens to every session and 938 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 2 findings (makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.