hitl-escalate

A procedure for stopping an AI agent loop and asking a person for help when the task cannot be safely or unambiguously continued. The request can use a configured communication channel or a BLOCKED.md file.

In plain words
What is it for?
Use it for ambiguous specifications, missing API keys or configuration, destructive actions needing approval, three or more repeated verification failures, or unavailable required dependencies.
Why use it?
It prevents the agent from guessing through unclear requirements, missing credentials, risky actions, repeated verification failures, or unavailable services.

Skill for Claude CodeCodex

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 skills/archive228/loopkit/hitl-escalate
Any agent
npx skills add Archive228/loopkit --skill hitl-escalate
Clone the repo
git clone --depth 1 https://github.com/Archive228/loopkit

Made for: Claude Code, Codex.

Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,176 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.00059 $0.01176
Opus 5 $0.00030 $0.00588
Sonnet 5 $0.00012 $0.00235
Haiku 4.5 $0.00006 $0.00118

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

Security

Grade A, and why

hitl-escalate 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.

skills/hitl-escalate/SKILL.md · 85 lines

How it starts

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

Human-in-the-Loop Escalate

Long-running agent loops fail in a specific way when they meet a question they can't answer: they guess. The guess ships, the next session builds on it, and by the time a human looks the divergence is three commits deep. This skill is the release valve — when the agent is stuck, it stops and asks, cleanly, in a shape the human can act on.

Trigger — escalate when any of these are true

  • Ambiguous spec. PROMPT.md admits two implementations and the choice changes user-visible behavior.
  • Missing credential. A required env var, API key, or config file is absent, and there is no sanctioned way for the agent to create one.
  • Destructive action needing approval. Dropping a table, force-pushing, deleting user data, spending money, sending mail to real recipients.
  • 3+ consecutive /verify failures on the same task. The loop is thrashing. Stop and get a human eye before the fourth attempt.
  • External dependency down. A third-party service the feature needs is unreachable and no offline path exists.

If none of the above hold, do not escalate. Guessing is bad; escalating on a solvable problem is also bad (it trains humans to ignore the channel).

Primary action — call the human via the configured channel

Read LOOPKIT_HITL_CHANNEL. Supported values:

Value Shape
telegram POST to https://api.telegram.org/bot$LOOPKIT_HITL_TELEGRAM_TOKEN/sendMessage with chat_id=$LOOPKIT_HITL_TELEGRAM_CHAT, text=<question + repo + short context>.
slack POST JSON {"text": "..."} to $LOOPKIT_HITL_SLACK_WEBHOOK (incoming-webhook URL).
dial Run $LOOPKIT_HITL_DIAL_CMD with the message on stdin. Whatever the operator wired up — SMS gateway, ntfy, phone call, pager.
none (or unset) Skip the primary action. Go straight to fallback.

Message body — always these five lines, in this order:

[loopkit] blocked in <repo-name> on <ISO timestamp>
Q: <one-line question>
Context: <one-line what you were doing>
Attempted: <one-line what you tried>
Choices: <A | B | C>

Read the full file on GitHub · 85 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 · 85 lines · 59 tokens per session scan A 6463edf5c23f

Subscribe to this mod's changes

hitl-escalate is a skill published in the GitHub repository Archive228/loopkit (753 stars, last pushed 1mo ago), licensed MIT. It adds 59 tokens to every session and 1,176 once invoked, about $0.0003 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.