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 skills add ihabkhaled/AI-Psychiatry --skill loop-detectorgit clone --depth 1 https://github.com/ihabkhaled/AI-PsychiatryWrote 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/skills/ihabkhaled/ai-psychiatry/loop-detector)<a href="https://agentmods.dev/skills/ihabkhaled/ai-psychiatry/loop-detector"><img src="https://agentmods.dev/badge/skills/ihabkhaled/ai-psychiatry/loop-detector.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.1 | $0.00035 | $0.00230 |
| Opus 5 | $0.00017 | $0.00115 |
| Sonnet 5 | $0.00007 | $0.00046 |
| Haiku 4.5 | $0.00003 | $0.00023 |
Grade A, and why
loop-detector 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 8d 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.
What it actually says
Loop Detector
Core principle
Detect semantic repetition, not only identical syntax; high activity plus flat outcome is probable livelock.
Procedure
- List recent actions and their intended evidence.
- Group semantically equivalent actions.
- Compare completed requirements, removed blockers, and newly passing tests.
- Mark repeated actions that added no information.
- Identify retry, tool, edit-revert, critic, replan, context, or oscillation patterns.
- Trigger attention or strategy recovery at the configured threshold.
Required output
Loop type, repeated strategy, unchanged outcome, threshold, and recovery action.
Limits
Same strategy 3; critics 2; context reloads 2; stalled cycles 4.
Common mistakes
Do not call renamed commands or alternate tools meaningful novelty when they test the same hypothesis.
Stop condition
Stop when repetition is interrupted and a materially different bounded action is selected.
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.
- 8d ago First seen · 37 lines · 35 tokens per session scan A 64f2a4cccd38
loop-detector is a skill published in the GitHub repository ihabkhaled/AI-Psychiatry (3 stars, last pushed 24d ago), licensed MIT. It adds 35 tokens to every session and 230 once invoked, about $0.0002 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-31.
Other skills, from other repositories
cpp
Use when writing, reviewing, modernizing, building, or debugging C++ - RAII and resource lifetime, smart-pointer ownership, move semantics and the Rule of Zero/Five, target-based CMake with FetchContent, and killing undefined behavior with ASan/UBSan/TSan plus clang-tidy. NOT borrow-checker / Result-Option / cargo…
gamedev-physics
Use when working with a game engine's physics — rigid bodies, colliders, collision layers and masks, character controllers, joints, forces versus impulses, raycasts and shapecasts, or when a simulation is unstable (tunnelling, jitter, missed overlaps). Covers the Godot, Unity and Unreal equivalents. NOT rendering or…
observability
Use when instrumenting a service from the inside so an incident can be explained from telemetry alone — wiring OpenTelemetry logs, metrics and traces, standing up a Collector, exporting via OTLP, and defining telemetry-driven alerts. NOT outside-in uptime probes, on-call rotation, or who-gets-paged (that is…
angular
Use when building, refactoring, or debugging Angular (v20/21+): standalone components, signals, zoneless change detection, @if/@for/@defer control flow, inject() DI, resource()/httpResource(), RxJS interop, NgRx SignalStore, ng CLI. NOT React (that is react), NOT Next.js (that is nextjs), NOT a TypeScript language…
debug
Use when something is broken — a failing or flaky test, crash, wrong result or regression — and the root cause must be reproduced and proven before any fix. On-demand; callable mid-implement. NOT a feature to spec or build (that is specify/implement), NOT the lint/test gate (that is verify), NOT adversarial diff…
autonomous-bug-fix
Reproduces, diagnoses, fixes, and verifies bugs unaided.