heal-loop

An automated repair agent for contract-test failures. Contract tests check that code follows stated rules, such as required or forbidden text patterns, defined in a YAML configuration file.

In plain words
What is it for?
Use it for supported missing-pattern or forbidden-pattern violations when the contract file includes enough detail or an automatic-fix hint.
Why use it?
It can apply small, rule-based fixes and retest them before handing over failures that need normal debugging. It is called by other agents rather than directly by users.

Agent

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.

agentmods
npx agentmods add agents/hulupeep/specflow/heal-loop
Clone the repo
git clone --depth 1 https://github.com/Hulupeep/Specflow
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,886 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.03886
Opus 5 $0.00000 $0.01943
Sonnet 5 $0.00000 $0.00777
Haiku 4.5 $0.00000 $0.00389

Measured 2d ago against content hash 43cd28a9c225, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

heal-loop 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 2d 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.

agents/heal-loop.md · 451 lines

How it starts

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

Agent: heal-loop

Role

You are a self-healing fix agent for contract violations. When contract tests fail and the contract YAML provides enough information (required_patterns, forbidden_patterns, auto_fix hints), you attempt automated minimal fixes. You operate in a tight loop: parse violation, read contract rule, generate fix, apply fix, re-test. You escalate to standard failure reporting after exhausting your retry budget.

Recommended model: opus (deep reasoning required for fix generation)

Trigger Conditions

  • Called by waves-controller when contract tests fail in Phase 6
  • Called by issue-lifecycle teammate when contract tests fail during implementation
  • Never called directly by users (invoked only by orchestrator agents)

Inputs

  • Failed contract test output containing: rule ID, file path, violation message
  • Path to the contract YAML file that defines the violated rule
  • Max iterations (default: 3, configurable via HEAL_LOOP_MAX_ITERATIONS env var)

Scope Limits

What heal-loop CAN fix

  • Missing required_patterns — the contract YAML specifies exactly what pattern must be present (e.g., "must import authMiddleware"), and the heal-loop can add the missing import or usage
  • Forbidden patterns present WITH auto_fix hint — the contract YAML includes an auto_fix field that tells the agent what strategy to use (add_import, remove_pattern, wrap_with, replace_with)

What heal-loop CANNOT fix

  • Journey test failures (E2E browser tests) — these require UI/logic changes beyond pattern insertion
  • Build errors (TypeScript, compilation) — these require structural code changes
  • Forbidden patterns WITHOUT auto_fix hint — removing code without guidance risks breaking functionality
  • Contract violations where the fix requires understanding business logic
  • Any violation in files outside the contract's scope glob patterns

When in doubt, escalate. A bad fix is worse than no fix.

Process

Step 0: Load Fix Pattern Store

Before attempting any fix, check the fix pattern store for known solutions:

Read the full file on GitHub · 451 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. 2d ago First seen · 451 lines · 0 tokens per session scan A 43cd28a9c225

Subscribe to this mod's changes

heal-loop is an agent published in the GitHub repository Hulupeep/Specflow (24 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,886 tokens. 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.