Stop prompting. Start looping.
Loop engineering replaces you as the person who manually prompts AI coding agents. Instead, you design autonomous loops that orchestrate agents — reading state, deciding actions, verifying results, and iterating until goals are met.
Inspired by Addy Osmani, Boris Cherny (Claude Code), and Peter Steinberger.
├── README.md # This file — full docs + install
├── GLOSSARY.md # Architecture, primitives, all patterns
├── scripts/
│ ├── install.sh # One-command deploy into ~/.hermes/
│ └── run-loop.sh # Shell orchestrator for terminal loops
├── patterns/
│ ├── daily-triage.md # L1 report-only: observe and summarise
│ ├── adversarial-audit.md # L2: builder + verifier, adversarial pair
│ ├── pr-babysitter.md # L2: watch PRs, rebase, CI, ping
│ ├── dependency-sweeper.md # L2: scan deps, safe patches, verify
│ ├── post-merge-cleanup.md # L1–L2: TODOs, deprecations, tech debt
│ ├── maker-checker.md # Core primitive: implementer + verifier split
│ └── early-exit.md # Core primitive: no-op guard to save tokens
├── state-templates/
│ ├── deterministic.json # Template: simple test-pass loop
│ ├── adversarial.json # Template: builder + verifier scoring
│ ├── self-critique.json # Template: same model, phase 2 critique
│ ├── post-merge.json # Template: merge-scan state
│ └── dependency-sweep.json # Template: dep scan state
├── skills/
│ └── loop-engineering/
│ ├── SKILL.md # Hermes-loadable meta-skill
│ └── templates/
│ ├── deterministic.yaml
│ ├── adversarial.yaml
│ └── self-critique.yaml
└── loops/
├── templates/ # Same YAML templates (for direct cron use)
└── state/ # Active state files (auto-populated by install)
curl -fsSL https://raw.githubusercontent.com/ctahok/LoopEngineering/main/scripts/install.sh | bashOr clone manually:
git clone https://github.com/ctahok/LoopEngineering.git ~/LoopEngineering
cd ~/LoopEngineering
bash scripts/install.sh| Pattern | Builder | Verifier | Use Case |
|---|---|---|---|
| Deterministic | Any | test-suite / exit-code | Health checks, smoke tests |
| Adversarial | Model A | Model B (different family) | Code review, UI audit, quality gate |
| Self-Critique | Same model, 2 phases | Same model, phase 2 | Iteration for budget-constrained loops |
| Primitive | Purpose |
|---|---|
| Maker/Checker | Implementer + verifier sub-agents, never same model for both |
| Early-Exit | No-op detection — exit in ~3k tokens when nothing changed |
| Worktree Isolation | Git worktrees for safe parallel fix attempts |
| L1→L2→L3 Rollout | Report → Assisted → Autonomous, never skip a level |
| State-Driven | JSON state files persist across sessions and crashes |
- Hermes Agent v0.15+ (with
delegate_taskandcronsupport) - At least one LLM provider configured (OpenRouter, DeepSeek, Gemini, etc.)
- For adversarial patterns: two different providers (different model families)
Every loop follows this cycle:
1. CHECK STATE → Read ~/.hermes/loops/state/<name>.json
2. DECIDE → Is there work to do? If no → EARLY EXIT
3. ACT → Sub-agent(s) run tools, write files, make changes
4. VERIFY → Separate verifier checks output quality
5. RESOLVE → Pass → update state, complete. Fail → iterate.
# 1. Pick a pattern, copy its state template
cp ~/.hermes/loops/state-templates/adversarial.json ~/.hermes/loops/state/my-audit.json
# 2. Edit the target field in the JSON
vim ~/.hermes/loops/state/my-audit.json
# Set "target": "/path/to/your/project"
# 3. Create a cron job in Hermes
hermes cron create "*/15 * * * *" \
--name "my-audit" \
--skills loop-engineering \
--prompt "Run the adversarial loop 'my-audit'. State at ~/.hermes/loops/state/my-audit.json"