Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.
PR Babysitter — Hermes Agent (hermes cron)
This is a practical, copy-pasteable example of a PR babysitter loop using Hermes.
Hermes ships a native scheduler on its gateway — map the loop to hermes cron
instead of a TUI /loop. Optional channel delivery (Feishu, Slack, Telegram,
Discord, WhatsApp, SMS) can ping blockers into the channel the team already watches
once you trust the output; week one stays on --deliver local.
Cron job (week one — report only)
Isolated session each tick: reads GitHub state, updates pr-babysitter-state.md,
no code edits, no merges.
hermes cron create "*/15 * * * *" \
--name "PR babysitter" \
--deliver local \
--skill pr-review-triage \
--workdir "$PWD" \
"Run the pr-review-triage skill on all open PRs. Read pr-babysitter-state.md first, then update it with current CI status, review state, merge conflicts, and unanswered comments. Do not merge or push fixes in week one — report only. Flag anything ambiguous or high-risk for human review in pr-babysitter-state.md. End with the top 3 human actions."
--deliver localwrites output to~/.hermes/cron/output/only — nothing lands in the human's chat history until you trust the output. Swap for--deliver origin(current chat), a home channel name (e.g.slack,feishu), orplatform:chat_id:thread_idfor a specific thread.--workdir "$PWD"injectsAGENTS.md/CLAUDE.md/.cursorrulesfrom the project into the system prompt and pins the terminal cwd to the repo.- Repeat
--skillto attach multiple skills (e.g.--skill pr-review-triage --skill github-workflowif PR reads go through a GitHub skill instead ofgh). - Operations:
hermes cron run <job-id>for a one-off test tick, thenpause/resume/edit/removeas needed.
Progression
- Week one — report only. Fresh isolated session each tick appends to
pr-babysitter-state.md. Read it yourself before acting on any suggestion. Human gates all merges. - Week two — minimal fixes in worktrees. Extend the prompt to propose fixes
in an isolated worktree for allowlisted low-risk PRs only — one worktree per
fix attempt via
loop-worktreeso retries never collide on the same branch. Draft PRs only; never force-push. - Week two — verifier split. A separate verifier approves before any fix is
committed: a second
delegate_taskcall with a review-only prompt, or a chained cron job viahermes cron edit <fixer-id> --context-from <triage-id>(the upstream job's stdout is injected into the downstream prompt). Never let the implementer mark its own work done. Escalate after 3 attempts per PR. - Add channel delivery. Swap
--deliver localfor a home channel once the output has earned trust; set channelallowFrom/ mention rules first.
Week-two worktree lifecycle (see the loop-worktree subsection of the QUICKSTART):
npx @cobusgreyling/loop-worktree create --run-id pr-217-fix-1 --pattern pr-babysitter
# fix + verifier run inside the printed worktree path
npx @cobusgreyling/loop-worktree mark --run-id pr-217-fix-1 --status rejected # verifier said no
npx @cobusgreyling/loop-worktree cleanup --older-than 24h
Requirements
- Hermes Agent installed and
configured (
hermes setup) pr-babysitter-state.mdin the repo root (fromstarters/pr-babysitter/)- The
pr-review-triageskill in~/.hermes/skills/pr-review-triage/SKILL.md(user-scoped) or.hermes/skills/(project-scoped) — theSKILL.mdformat is shared across tools, so the starter copy works unchanged
cp starters/pr-babysitter/pr-babysitter-state.md.example pr-babysitter-state.md
mkdir -p ~/.hermes/skills/pr-review-triage
cp starters/pr-babysitter/.claude/skills/pr-review-triage/SKILL.md ~/.hermes/skills/pr-review-triage/SKILL.md
hermes skills list | grep pr-review-triage
Example pr-babysitter-state.md
# PR Babysitter State
Last run: 2026-07-05 09:00 UTC
## Open PRs
### #1234 — fix: correct login redirect
- CI: green
- Reviews: 1 approval, 1 blocking comment
- Loop action: report only (week one). Needs human triage.
- Attempts: 1 / 3
Notes
- Never force-push; draft PRs by default; do not resolve review threads without approval. Security, auth, payments, infra, or public API changes always escalate — see docs/safety.md
- Sign loop comments on PRs:
🤖 Loop Engineering — PR Babysitter - Webhooks (
POST /hooks/agent) can fire a check the moment CI finishes instead of waiting for the next tick — keep hook endpoints on loopback or a trusted tailnet hermes config set approvals.mode smartso low-risk reads don't stall the loop on manual gateway approvals- Most runs should no-op on an empty watchlist. Cost check:
npx @cobusgreyling/loop-cost --pattern pr-babysitter --cadence 15m --level L1 --conservative; audit readiness:npx @cobusgreyling/loop-audit . --suggest - See patterns/pr-babysitter.md and starters/pr-babysitter for the full pattern spec
See the primitives matrix for how Hermes maps to the same six-part loop shape.