/chidi-optimal-brain:setup-agent-loopsfrom chidi-optimal-brain
Configure this repo for agent loops (verification commands, stop rules, scope, starter recipes), or design a custom recurring workflow spec. Use when the user is about to run /until-done or autonomous iteration for the first time, wants stop rules, or wants to design a repeatable workflow.
Ships in chidi-optimal-brain. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Scaffold the per-repo configuration that loop-engineering skills assume:
This is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.
Two paths. Ask which one the user wants if it isn't obvious:
Look at the current repo to understand its starting state. Read whatever exists; don't assume:
package.json, pyproject.toml, Cargo.toml, go.mod, Makefile — what verification commands exist?AGENTS.md and CLAUDE.md at the repo root — is there already an ## Agent loops section?.agent/context/loops.md — does this skill's prior output already exist?.agent/context/ — other agent config from /setup-optimal-braindocs/agents/ — legacy fallback onlyvitest.config.*, jest.config.*, pytest.ini, etc.)Summarise what's present and what's missing. Walk the user through the three decisions one at a time — present a section, get the user's answer, then move to the next.
Assume the user does not know what these terms mean. Each section starts with a short explainer, then shows choices and the default.
Section A — Verification.
Explainer: Agent loops need an objective pass/fail signal — usually tests, typecheck, or lint. Without a verifier, the agent cannot tell when to stop. These commands run after every code change during a loop.
Propose commands detected from the repo. Typical defaults:
/two-axis-review in gate mode — a FAIL verdict counts as a failing verifierAsk the user to confirm or override each command. If the repo has no tests, propose typecheck or build as the verifier and note the gap.
Section B — Stop rules.
Explainer: Stop rules prevent unbounded iteration — wasted tokens, repeated failures, or risky actions. The agent checks these every loop cycle.
Confirm or override:
.env (default: all of these)Section C — Scope.
Explainer: Scope boundaries keep loops safe. The agent should know which paths it may edit and whether optimization loops (Karpathy-style) apply.
Confirm:
node_modules, .git, generated outputShow the user a draft of:
## Agent loops block to add to whichever of CLAUDE.md / AGENTS.md is being edited.agent/context/loops.mdLet them edit before writing.
Pick the file to edit:
CLAUDE.md exists, edit it.AGENTS.md exists, edit it.Never create AGENTS.md when CLAUDE.md already exists (or vice versa).
If an ## Agent loops block already exists, update in-place. If ## Agent skills also exists, add ### Agent loops as a subsection under it rather than duplicating the heading.
The block:
## Agent loops
[one-line summary of verifier + iteration cap]. See `.agent/context/loops.md`.
Or, if nested under ## Agent skills:
### Agent loops
[one-line summary]. See `.agent/context/loops.md`.
Ensure .agent/context/ exists (create with README from context-readme-template.md if missing).
Write .agent/context/loops.md using loops-template.md as the starting point.
Point the user at starter recipes in this skill folder:
Tell the user setup is complete. Mention:
/until-done for goal-based loops (Cursor's equivalent of /goal)/loop for time-based recurrence — combine with recipes above/implement reads .agent/context/loops.md automatically (fallback: docs/agents/loops.md).agent/context/loops.md directly; re-run this skill only to restart from scratchIf /setup-optimal-brain has not been run yet, recommend it for issue tracker and domain doc setup.
Follow the Git section of AGENT-CONTEXT-PATH.md in /setup-knowledge-vault. In short:
.gitignore. Read it first. If # optimal-brain (personal) is already there, append just the missing lines below the existing block. Otherwise append the whole block at the end (>>, with a blank line before it), creating the file only if it doesn't exist. Never truncate, reorder, or regenerate the file (no > redirect, no full-file write):
# optimal-brain (personal)
.agent/context/knowledge-vault.md
.agent/context/project-context.md
.scratch/
If any of them is already tracked, tell the user to run git rm --cached <file>..agent/context/, the ## Agent skills block in AGENTS.md/CLAUDE.md, CONTEXT.md, and docs/adr/. Shared config gives every teammate and agent the same tracker, labels, and verification. The ignored files hold machine-specific vault paths. Don't commit for them..agent/context/knowledge-vault.example.md (placeholder paths) so teammates can copy it to their own gitignored knowledge-vault.md.REFERENCES.md (opens in a new tab)examples/weekly-vault-review.md (opens in a new tab)loops-template.md (opens in a new tab)recipes/build-test-fix.md (opens in a new tab)recipes/design-custom-workflow.md (opens in a new tab)recipes/implement-issue.md (opens in a new tab)recipes/pr-until-mergeable.md (opens in a new tab)recipes/scheduled-triage.md (opens in a new tab)workflow-spec-template.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (chidiokoene/optimal-brain) — no native marketplace selected
npx claudepluginhub p/chidiokoene-mattpocock-skills36 skills in this plugin
/agent-loopAgentic 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./ask-brainRouter for the whole optimal-brain pack: given a task, picks the single best skill or an ordered chain of skills, says why, and says what to skip. Use when the user is unsure which skill to use, asks what to do next or where to start, or describes a task without naming a skill./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.