From chidi-optimal-brain
Agentic loop discipline. Use when the user wants to loop until done, iterate until tests pass, keep fixing until green, run until verification passes, or mentions red-green-refactor in an iterative fix context.
How this skill is triggered — by the user, by Claude, or both
Slash command
/chidi-optimal-brain:agent-loopThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Plan → Act → Observe → Verify → Stop**
Plan → Act → Observe → Verify → Stop
A stateful control cycle for autonomous engineering work. Read docs/agents/loops.md if it exists; if missing, use conservative defaults (iteration cap 5, no push/deploy/CI changes) and suggest /setup-agent-loops.
When exploring the codebase, read CONTEXT.md (if it exists) so changes use the project's domain vocabulary.
When you encounter a knowledge gap (unknown terminology, missing concepts, need to ground a decision), reach for research-from-vault (or run external research first then synthesize into the vault). Goals of the form "research X using the vault until a synthesis note and learning record exist" are valid and encouraged when the vault is configured.
Before the first change:
docs/agents/loops.md for verification commands, stop rules, and editable scope./tdd skill.One bounded change per iteration — a vertical slice, not a bulk rewrite.
docs/agents/loops.md.Run the after-each-change verifier(s) from docs/agents/loops.md.
Paste or summarize the relevant output — pass/fail must be unambiguous from exit code and output.
Apply stop rules from STOP-RULES.md:
/diagnosing-bugs before blind retries.If continuing: increment iteration count, return to Act with a changed strategy — don't repeat the same fix.
The loop is done when verification passes and a success brief is presented, or any stop rule fires with an explicit brief to the user.
Scans a codebase for architectural friction, presents candidates as a visual HTML report with before/after diagrams, and guides you through deepening refactors.
npx claudepluginhub chidiokoene/optimal-brain