loop-engineering

A reference for building and debugging agent workflows that repeat steps until a task is verified or finished. It covers loops such as search, check, retry, and scan until no work remains.

In plain words
What is it for?
Use it when creating or troubleshooting skills that fetch information, verify results, retry failures, or process items until everything is handled.
Why use it?
It helps make repeated agent work predictable and gives the loop clear checks and stopping conditions.

Skill for Claude CodeCodex

Part of the COG-second-brain plugin — 33 skills, 10 agents shipped together

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/huytieu/cog-second-brain/loop-engineering
Any agent
npx skills add huytieu/COG-second-brain --skill loop-engineering
Clone the repo
git clone --depth 1 https://github.com/huytieu/COG-second-brain

Made for: Claude Code, Codex.

Or install COG-second-brain, the plugin that ships this one along with the rest of its 33 skills, 10 agents.

Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 150 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.00063 $0.00150
Opus 5 $0.00032 $0.00075
Sonnet 5 $0.00013 $0.00030
Haiku 4.5 $0.00006 $0.00015

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

Security

Grade A, and why

loop-engineering 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 3d 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.

.agents/skills/loop-engineering/SKILL.md · 11 lines

What it actually says

Read .claude/skills/loop-engineering/SKILL.md and execute it exactly as written — that file is the authoritative playbook. Then follow .agents/rules/cog.md.

Antigravity substitution: where the playbook delegates to a .claude/agents/<name> worker, invoke .agents/agents/<name>.md via invoke_subagent instead.

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. 3d ago First seen · 11 lines · 63 tokens per session scan A 0ee060d9b289

Subscribe to this mod's changes

loop-engineering is a skill published in the GitHub repository huytieu/COG-second-brain (1,153 stars, last pushed 8d ago), licensed MIT. It adds 63 tokens to every session and 150 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.

Related

Other skills, from other repositories

api-testing

API testing patterns for Playwright -- apiRequest fixture usage, Zod response schema creation and validation, test.step wrapping for multi-call tests, per-field negative/validation testing, path parameter fuzzing, and helper fixtures for shared setup/teardown. Use when writing or updating API test specs, adding tests…

idavidov13/agentic-playwright · 132 tokens

debugging

Playwright test debugging conventions for the scaffold — reading failure messages, classifying failure modes (TimeoutError, ZodError, strict-mode violation, locator not found, network errors, schema drift), the playwright.config.ts capture defaults (trace on-first-retry, screenshot only-on-failure, video…

idavidov13/agentic-playwright · 179 tokens

pr-reviewer

Reviews a Git branch as a pull request against the base branch (auto-resolved from origin/HEAD — usually main or master) using this repo's own rules — the CLAUDE.md constitution and the .claude/skills/ that apply to the changed files. Fetches the branch, switches to it, diffs it against the merge-base, routes the…

idavidov13/agentic-playwright · 278 tokens

ai-native-workflow

Sole entry-point router for AI-assisted work on this Playwright scaffold — owns the 8-phase main workflow (classify → route → explore → plan+confidence → human gate → apply → verify → report), the human↔agent conversation contract, the routing matrix that picks the right specialized skill, and the confidence-gate…

idavidov13/agentic-playwright · 188 tokens

data-strategy

Test data strategy for the Playwright scaffold — Faker + Zod factories for dynamic happy-path data, static TS files (.ts with as const exports — never .json) for domain-specific curated invalid sets, and the universal type-mismatch arrays in test-data/static/util/invalid-values.ts. Use when creating or editing a data…

idavidov13/agentic-playwright · 160 tokens

helpers

Plain utility function conventions for the Playwright scaffold — app-specific helpers in helpers/{area}/ (authentication bootstrap, storage-state creation, data seeding) and generic utilities in helpers/util/ (date formatting, string manipulation, parsing). Use when adding a reusable function that does NOT need the…

idavidov13/agentic-playwright · 152 tokens