hitl-escalate
Skill756 starsChanged 5 months agoMITView on GitHub
Escalate blocked runs to a human via configured channel or fallback to BLOCKED.md and exit the loop. Use when the loop hits an ambiguous spec, a missing credential, a destructive action needing approval, or 3+ consecutive verify failures on the same task.
In this repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- a11y-passSkill
- active-memory-reminderSkill
- adversarial-verifySkill
- authz-checkSkill
- bisect-regressionSkill
- broken-window-checkSkill
- changelog-from-diffSkill
- clean-commitsSkill
- context-budgetSkill
- contract-testSkill
- coverage-gapsSkill
- decision-recordSkill
- dependency-auditSkill
- design-systemSkill
- eval-harnessSkill
- evaluator-calibrationSkill
- feature-list-jsonSkill
- flaky-hunterSkill
- harness-strippingSkill
- init-script-contractSkill
- input-validationSkill
- kill-dead-codeSkill
- loading-empty-error-statesSkill
- migration-writerSkill
- model-routingSkill
- owasp-reviewSkill
- pdf-ingestionSkill
- planner-spec-expandSkill
- pr-from-diffSkill
- progress-reading-protocolSkill
- prompt-cachingSkill
- readme-auditSkill
- read-the-traceSkill
- rebase-safelySkill
- reduce-nestingSkill
- revert-surgicalSkill
- schema-diffSkill
- secret-scanSkill
- self-eval-biasSkill
- shift-notesSkill
- simplifySkill
- spec-firstSkill
- sprint-contractSkill
- sql-reviewSkill
- structured-outputSkill
- subagent-fanoutSkill
- suggest-next-featuresSkill
- systematic-debuggingSkill
- tool-restraintSkill
- using-loopkitSkill
- verification-before-completionSkill
- write-failing-test-firstSkill
- my-new-skillSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- could be automatic: a setting could enforce it
- Distinctive: line 19
If none of the above hold, do not escalate.
- Very specific: line 23
Read LOOPKIT_HITL_CHANNEL.
- Very specific: line 75
Do not loop endlessly: After the third consecutive /verify failure on the same task, escalate.
- Distinctive: line 76
Do not silently swallow the missing credential: Do not commit a placeholder, do not disable the feature, do not "TODO" the auth.
- Very specific: line 77
Do not escalate for questions the repo already answers: Read AGENTS.md, PROMPT.md, and the last three commits first.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill 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.
Files
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.mdadmits 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
/verifyfailures 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>Non-2xx from the channel is a soft failure. Log it, then fall through to the fallback so the loop still exits cleanly.
Fallback — write BLOCKED.md and exit
Whether the primary succeeds or fails, always write ./BLOCKED.md at the repo root with exactly four sections:
# Blocked
## Question:
<one sentence, answerable with a short reply>
## Context:
<what feature, which file, which commit, why now — 3-6 lines>
## Attempted:
<bulleted list of what you tried and why each fell short>
## Choices:
- A) <option> — <consequence>
- B) <option> — <consequence>
- C) <option> — <consequence>Then exit 2. The loop runner (run.sh) checks for BLOCKED.md at the head of each iteration and exits with code 2 if it exists — that stops the loop until a human clears it.
Human unblocks
The human reads BLOCKED.md, edits PROMPT.md / drops the credential / approves the destructive step, then rm BLOCKED.md and restarts run.sh. The deleted BLOCKED.md is the unblock signal.
Anti-patterns — do not do these
- Do not fabricate an answer. "I'll assume the user meant X" is how divergence starts. Assume nothing under ambiguity — escalate.
- Do not loop endlessly. After the third consecutive
/verifyfailure on the same task, escalate. The fourth attempt is not going to succeed by the same reasoning that failed thrice. - Do not silently swallow the missing credential. Do not commit a placeholder, do not disable the feature, do not "TODO" the auth. Ask.
- Do not escalate for questions the repo already answers. Read
AGENTS.md,PROMPT.md, and the last three commits first. Escalation is expensive human attention — spend it on real ambiguity. - Do not skip writing
BLOCKED.mdbecause the primary channel succeeded. The file is the loop's exit contract. Without it,run.shkeeps spinning.
Pairs with
adversarial-verify— the source of the 3-verify-failure trigger.shift-notes— after escalating, note the block inIMPLEMENTATION_PLAN.mdso the next session (post-unblock) has full context.spec-first— an ambiguousPROMPT.mdis a spec-first failure; the human's unblock should tighten the spec, not just answer the one-off.
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
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.

