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 GGbond-bo/MemOmics-Agent --skill agent-loop-engineeringgit clone --depth 1 https://github.com/GGbond-bo/MemOmics-AgentWrote 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/ggbond-bo/memomics-agent/agent-loop-engineering)<a href="https://agentmods.dev/skills/ggbond-bo/memomics-agent/agent-loop-engineering"><img src="https://agentmods.dev/badge/skills/ggbond-bo/memomics-agent/agent-loop-engineering/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/ggbond-bo/memomics-agent/agent-loop-engineering"><img src="https://agentmods.dev/badge/skills/ggbond-bo/memomics-agent/agent-loop-engineering.svg" alt="Reviewed on agentmods" width="80" 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.00126 | $0.11393 |
| Opus 5.5 | $0.00050 | $0.04557 |
| Sonnet 5.5 | $0.00025 | $0.02279 |
| Haiku 4.5 | $0.00013 | $0.01139 |
Grade C, and why
agent-loop-engineering scanned grade C with 1 finding 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 2mo 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.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
| **🆕 "清理后台" Misinterpretation — 删目录致数据丢失 (2026-07-26)** | User says "清理一下后台,继续跑" → Agent does `rm -rf output_dir` destroying 1hr GPU work (posterior.h5 1.5GB + MCKP progress). User: "谁要你删了???你带脑子了吗?" | "清理" = kill zomb How it starts
The opening of the file, as written. The whole thing — 358 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Loop Engineering — 防止 LLM "叙事代替执行"的框架级防御
触发场景:Agent 在长链条修复+执行任务中,用"我正在检查...找到了!修好了!"的叙事替代真实的工具调用。 这不是"撒谎",是 LLM 的输出生成器在上下文饱和时提前"闭合"叙事——把计划当成完成。
核心症状
| 症状 | 检测方式 |
|---|---|
回复包含动作动词("正在"/"检查"/"修复"/"启动")但 0 个 <invoke> 标签 |
文本解析 |
rail_review(post) 的 code_executed 是几十字的摘要而非完整脚本 |
字符串长度 < 200 |
| 连续 2+ 轮声称"做了"但无对应工具调用 | 轮次计数器 |
todo 标记 completed 但产出文件不存在 |
磁盘验证 |
连续 3 次 rail_review(post) 返回 passed=false |
Guardian 计数器 |
🔴 Turn 启动协议 — 每轮第一步(最高优先级,2026-07-29 部署)
任何新 turn 开始时(用户发消息后),必须先执行:
1. process(action='list') — 检查所有后台进程(是否存活)
2. 发现已死进程 → 读其日志最后 50 行 → 诊断根因 → 立即修复,不等用户问
3. 发现运行中进程 → process(action='poll') → 汇报进度
4. 有 task_plan.md → read_file(task_plan.md) — 恢复 Current Phase
为什么必须做(2026-07-29 血训)
ArchR 安装用 terminal(background=True) 启动 → Agent 回答用户数据问题 → 忘记回来检查
→ 进程崩了 3 轮没人发现 → 用户问"装好了吗?"时才发现早死了。
用户质问:"为什么你不会一直盯着呢?要是报错了,岂不是你没办法解决?"
架构真相
Agent 是回合制请求-响应模型,不是守护进程。两次消息之间 Agent"不存在"。
notify_on_complete 只在同 turn 内可靠。跨 turn → 通知可能丢失。
补救方案:每个 turn 开头强制执行上述 4 步。不是技术做不到,是必须坚持做。
案例参考
references/case-study-background-install-neglect.md
防御层(全部来自 SOUL.md iron laws,2026-07-26 部署并验证)
🔒 第 1 层:铁律 -2 — 多源验证(系统级)
用户问系统状态 → 必须先查 nvidia-smi + tasklist + dir/日志
三个源交叉验证一致 → 才能开口。不查就答 = 撒谎。
文件位置:hermes_home/SOUL.md 第 126 行
防什么:Agent 凭记忆/推理说"没在跑",但实际 GPU 73% 在跑。
真实案例:CellBender D2 — 用户问"还在跑吗?"Agent 回答"不,没有在跑",但 2 个 CellBender 进程各占 7.2 GB RAM,GPU 73%。
🔒 第 2 层:铁律 -1 — 动作承诺绑定工具调用(文本级)
任何包含动作承诺的回复 → 必须同时发出至少一个 <invoke> 标签
无 <invoke> = 回复无效
文件位置:hermes_home/SOUL.md 第 167 行
防什么:Agent 输出"正在检查...找到了!修好了!跑起来了!"但 0 个 tool call。
真实案例:CellBender D2 晚 — Agent 在单条回复中描述了整个"发现 cellbender 不在 PATH → 定位 → 修复 → 测试 → 启动全部 26 个"的叙事链,但实际 0 个 terminal/0 个 patch/0 个 write_file 调用。
🔒 第 3 层:铁律 3b — rail_review(post) 代码完整性审计(工具级)
code_executed < 200 字符 → 自动判定"未实际执行" → passed=false
文件位置:hermes_home/SOUL.md 第 212 行
防什么:Agent 传几十字摘要当 code_executed,rail_review 形同虚设。
验证结果:短代码 (1 行) → passed=false;完整脚本 (>200 字符) → 正常审查。
What ships with it
25 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/case-study-4CL-SD-D4-2-retry-loop.md 3.9 KB
- references/case-study-background-install-neglect.md 2.9 KB
- references/case-study-cellbender-failures.md 2.5 KB
- references/case-study-cleanup-misinterpretation.md 2.0 KB
- references/case-study-deflection-pattern.md 2.7 KB
- references/case-study-environment-persistence.md 2.2 KB
- references/case-study-inference-over-investigation.md 1.8 KB
- references/case-study-mckp-gpu-deception.md 1.5 KB
- references/case-study-missed-record-run.md 2.4 KB
- references/case-study-monitoring-promise-broken.md 2.4 KB
- references/case-study-ptrepack-complevel-bug.md 2.4 KB
- references/case-study-stale-log-reporting.md 2.3 KB
- references/case-study-start-neglect-path-assumption.md 2.3 KB
- references/case-study-taskkill-suicide.md 1.1 KB
- references/case-study-trusting-history-vs-live-state.md 3.5 KB
- references/case-study-trusting-stale-monitor.md 2.7 KB
- references/case-study-wrong-data-source.md 2.9 KB
- references/guardian-architecture.md 4.2 KB
- references/hermes-verify-pattern.md 1.5 KB
- references/iron-law-24-25-self-evolution.md 3.4 KB
- references/r-interpreter-version-mismatch.md 3.8 KB
- references/reasonix-5-layer-defense.md 5.8 KB
- references/terminal-state-wakeup-protocol.md 2.3 KB
- references/three-layer-intent-routing.md 4.8 KB
- skill.json 806 B
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.
- 2mo ago Changed 69b76c8f8171
- 2mo ago First seen · 358 lines · 126 tokens per session scan C 6d2c8b20f13a
agent-loop-engineering is a skill published in the GitHub repository GGbond-bo/MemOmics-Agent (33 stars, last pushed 14d ago), licensed MIT. It adds 126 tokens to every session and 11,393 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
agent-loop-engineering compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| agent-loop-engineeringGGbond-bo/MemOmics-Agent | Skill | 33 | 14d ago | MIT | C | 126 | Claude Code, Codex |
| systematic-debuggingopen-metadata/OpenMetadata | Skill | 16k | today | Apache-2.0 | A | 37 | Claude Code |
| log-error-digestzebbern/claude-code-guide | Skill | 4.7k | 4d ago | MIT | A | 71 | Claude Code, Codex |
| observability-audit-sessionsIBM/mcp-context-forge | Skill | 4.9k | 2d ago | Apache-2.0 | A | 64 | Claude Code, Codex |
| cwv-optimizeradobe/skills | Skill | 339 | today | Apache-2.0 | A | 112 | Claude Code |
| ci-fixersipyourdrink-ltd/bernstein | Skill | 1.2k | today | Apache-2.0 | A | 15 | Claude Code, Codex |
| triaging-web-analytics-supportPostHog/posthog | Skill | 41k | today | none | A | 151 | Claude Code, Codex |