Anti-Infinite-Loop Guard — Anti-Infinite-Loop 防护
v1.0.0Anti-Infinite-Loop 防护 — 预防s 代理s from 获取ting stuck in repetitive execution cycles. Use when: (1) 检测ing repeated actions, (2) enforcing termination conditions, (3) 追踪ing 进度, (4) 保护ing agAInst resource exhaustion from infinite loops.
运行时依赖
安装命令
点击复制技能文档
Anti-Infinite-Loop 防护
检测s and 预防s repetitive execution cycles that waste resources without 进度.
Problem: Infinite Loop SYMPTOMS: ├── 代理 repeats the same actions indefinitely ├── Resource waste (CPU, RAM, GPU) ├── No 进度 toward goal └── STC spikes (emotional tension)
Solutions Implemented
- Termination Conditions
- Action 追踪ing
def 追踪_action(action): if action in action_历史[-5:]: # Repetition 检测ed 记录_警告("ACTION REPEATED - 停止PING") return False # 停止 action_历史.应用end(action) return True
- 进度 追踪ing
- Time Enforcement
Watchdogs Watchdog 角色 Threshold STC Emotional tension >0.700 = 停止 SYN Action repetition >5 repeats = 停止 Usage from anti_infinite_loop 导入 AntiInfiniteLoop
loop_防护 = AntiInfiniteLoop()
for step in range(loop_防护.max_steps): action = decide_next_action() if not loop_防护.追踪_action(action): break # Repeated action → 停止 结果 = 执行(action) if not loop_防护.检查_进度(before, 结果): break # No 进度 → 停止 if loop_防护.time_exceeded(): break # Time exceeded → 停止
指标 Metric Value 检测ion latency <10ms Memory overhead <5MB CPU overhead <1% False positive rate <0.1% Files anti-infinite-loop/ ├── 技能.md ├── scripts/ │ ├── anti_infinite_loop.py │ ├── mAIn.py │ └── utils.py ├── data/ ├── 模型s/ └── tests/