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.
TypeScript agentic-aiai-agentsai-codinganthropicautomationclaudeclaude-codecodexcoding-agentsdevops-automationdevtoolsgithub-actionsgrokllmloop-engineeringmcpprompt-engineering
docs(hermes): add CI Sweeper example (#500)
Shixi Li345705b9d9d5
diff --git a/examples/README.md b/examples/README.mdindex e95c46a..f8d6346 100644--- a/examples/README.md+++ b/examples/README.md@@ -25,7 +25,7 @@ Start with [primitives-matrix.md](../docs/primitives-matrix.md) to map capabilit|---------|------|--------|-------|----------|--------|----------|----------|--------|------------|| Daily Triage | [grok/daily-triage.md](./grok/daily-triage.md) | [claude-code/daily-triage.md](./claude-code/daily-triage.md) | [codex/daily-triage.md](./codex/daily-triage.md) | [openclaw/daily-triage.md](./openclaw/daily-triage.md) | [cursor/daily-triage.md](./cursor/daily-triage.md) | [windsurf/daily-triage.md](./windsurf/daily-triage.md) | [opencode/daily-triage.md](./opencode/daily-triage.md) | [hermes/daily-triage.md](./hermes/daily-triage.md) | [github-actions/daily-triage.yml](./github-actions/daily-triage.yml) || PR Babysitter | [grok/pr-babysitter.md](./grok/pr-babysitter.md) | [claude-code/pr-babysitter.md](./claude-code/pr-babysitter.md) | [codex/pr-babysitter.md](./codex/pr-babysitter.md) | [openclaw/pr-babysitter.md](./openclaw/pr-babysitter.md) | [cursor/pr-babysitter.md](./cursor/pr-babysitter.md) | [windsurf/pr-babysitter.md](./windsurf/pr-babysitter.md) | [opencode/pr-babysitter.md](./opencode/pr-babysitter.md) | [hermes/pr-babysitter.md](./hermes/pr-babysitter.md) | [github-actions/pr-babysitter.yml](./github-actions/pr-babysitter.yml) |-| CI Sweeper | [grok/ci-sweeper.md](./grok/ci-sweeper.md) | [claude-code/ci-sweeper.md](./claude-code/ci-sweeper.md) | [codex/ci-sweeper.md](./codex/ci-sweeper.md) | [openclaw/ci-sweeper.md](./openclaw/ci-sweeper.md) | [cursor/ci-sweeper.md](./cursor/ci-sweeper.md) | [windsurf/ci-sweeper.md](./windsurf/ci-sweeper.md) | [opencode/ci-sweeper.md](./opencode/ci-sweeper.md) | — | [github-actions/ci-sweeper.yml](./github-actions/ci-sweeper.yml) |+| CI Sweeper | [grok/ci-sweeper.md](./grok/ci-sweeper.md) | [claude-code/ci-sweeper.md](./claude-code/ci-sweeper.md) | [codex/ci-sweeper.md](./codex/ci-sweeper.md) | [openclaw/ci-sweeper.md](./openclaw/ci-sweeper.md) | [cursor/ci-sweeper.md](./cursor/ci-sweeper.md) | [windsurf/ci-sweeper.md](./windsurf/ci-sweeper.md) | [opencode/ci-sweeper.md](./opencode/ci-sweeper.md) | [hermes/ci-sweeper.md](./hermes/ci-sweeper.md) | [github-actions/ci-sweeper.yml](./github-actions/ci-sweeper.yml) || Post-Merge Cleanup | [grok/post-merge-cleanup.md](./grok/post-merge-cleanup.md) | [claude-code/post-merge-cleanup.md](./claude-code/post-merge-cleanup.md) | [codex/post-merge-cleanup.md](./codex/post-merge-cleanup.md) | [openclaw/post-merge-cleanup.md](./openclaw/post-merge-cleanup.md) | [cursor/post-merge-cleanup.md](./cursor/post-merge-cleanup.md) | [windsurf/post-merge-cleanup.md](./windsurf/post-merge-cleanup.md) | [opencode/post-merge-cleanup.md](./opencode/post-merge-cleanup.md) | — | [github-actions/post-merge-cleanup.yml](./github-actions/post-merge-cleanup.yml) || Dependency Sweeper | [grok/dependency-sweeper.md](./grok/dependency-sweeper.md) | [claude-code/dependency-sweeper.md](./claude-code/dependency-sweeper.md) | [codex/dependency-sweeper.md](./codex/dependency-sweeper.md) | [openclaw/dependency-sweeper.md](./openclaw/dependency-sweeper.md) | [cursor/dependency-sweeper.md](./cursor/dependency-sweeper.md) | [windsurf/dependency-sweeper.md](./windsurf/dependency-sweeper.md) | [opencode/dependency-sweeper.md](./opencode/dependency-sweeper.md) | — | [github-actions/dependency-sweeper.yml](./github-actions/dependency-sweeper.yml) || Changelog Drafter | [grok/changelog-drafter.md](./grok/changelog-drafter.md) | [claude-code/changelog-drafter.md](./claude-code/changelog-drafter.md) | [codex/changelog-drafter.md](./codex/changelog-drafter.md) | [openclaw/changelog-drafter.md](./openclaw/changelog-drafter.md) | [cursor/changelog-drafter.md](./cursor/changelog-drafter.md) | [windsurf/changelog-drafter.md](./windsurf/changelog-drafter.md) | [opencode/changelog-drafter.md](./opencode/changelog-drafter.md) | — | [github-actions/changelog-drafter.yml](./github-actions/changelog-drafter.yml) |@@ -41,5 +41,5 @@ L2 patterns ship multi-tool skills inside one starter folder — see `starters/<| Claude Code | [minimal-loop-claude](../starters/minimal-loop-claude/) | via `loop-init --tool claude` | via `loop-init --tool claude` | via `loop-init --tool claude` | via `loop-init --tool claude` | via `loop-init --tool claude` | via `loop-init --tool claude` || Codex | [minimal-loop-codex](../starters/minimal-loop-codex/) | via `loop-init --tool codex` | via `loop-init --tool codex` | via `loop-init --tool codex` | via `loop-init --tool codex` | via `loop-init --tool codex` | via `loop-init --tool codex` || OpenClaw | [openclaw/daily-triage.md](./openclaw/daily-triage.md) (manual) | [openclaw/pr-babysitter.md](./openclaw/pr-babysitter.md) | [openclaw/ci-sweeper.md](./openclaw/ci-sweeper.md) | [openclaw/dependency-sweeper.md](./openclaw/dependency-sweeper.md) | [openclaw/post-merge-cleanup.md](./openclaw/post-merge-cleanup.md) | [openclaw/changelog-drafter.md](./openclaw/changelog-drafter.md) | [openclaw/issue-triage.md](./openclaw/issue-triage.md) |-| Hermes | [hermes/daily-triage.md](./hermes/daily-triage.md) (manual) | [hermes/pr-babysitter.md](./hermes/pr-babysitter.md) (manual) | — | — | — | — | — |+| Hermes | [hermes/daily-triage.md](./hermes/daily-triage.md) (manual) | [hermes/pr-babysitter.md](./hermes/pr-babysitter.md) (manual) | [hermes/ci-sweeper.md](./hermes/ci-sweeper.md) (manual) | — | — | — | — || Opencode | [minimal-loop-opencode](../starters/minimal-loop-opencode/) | [pr-babysitter-opencode](../starters/pr-babysitter-opencode/) | [ci-sweeper-opencode](../starters/ci-sweeper-opencode/) | [dependency-sweeper-opencode](../starters/dependency-sweeper-opencode/) | [post-merge-cleanup-opencode](../starters/post-merge-cleanup-opencode/) | [changelog-drafter-opencode](../starters/changelog-drafter-opencode/) | [issue-triage-opencode](../starters/issue-triage-opencode/) |diff --git a/examples/hermes/README.md b/examples/hermes/README.mdindex 7e31bdc..82b879c 100644--- a/examples/hermes/README.md+++ b/examples/hermes/README.md@@ -6,9 +6,10 @@|---------|---------|| [daily-triage.md](./daily-triage.md) | Daily Triage (L1 report → L2 assisted) || [pr-babysitter.md](./pr-babysitter.md) | PR Babysitter (L1 report → L2 worktree + verifier) |+| [ci-sweeper.md](./ci-sweeper.md) | CI Sweeper (L1 report → L2 worktree + verifier) |Optional **channel delivery** (Telegram, Slack, Discord, WhatsApp, SMS, Feishu) is Hermes's differentiator — the same cron job can post its summary into any connected home channel.No `loop-init --tool hermes` yet — copy skills and state manually, then schedule via `hermes cron`.-See [docs/primitives-matrix.md](../../docs/primitives-matrix.md) for the Hermes column in the cross-tool matrix.\ No newline at end of file+See [docs/primitives-matrix.md](../../docs/primitives-matrix.md) for the Hermes column in the cross-tool matrix.diff --git a/examples/hermes/ci-sweeper.md b/examples/hermes/ci-sweeper.mdnew file mode 100644index 0000000..68f042b--- /dev/null+++ b/examples/hermes/ci-sweeper.md@@ -0,0 +1,135 @@+# CI Sweeper — Hermes Agent (`hermes cron`)++This example maps the [CI Sweeper pattern](../../patterns/ci-sweeper.md) to+Hermes's native scheduler. Week one is deliberately **report-only**: each run+classifies failing checks, updates a state file, and exits without changing code+or GitHub state.++Keep delivery local while you tune the loop. After its reports are consistently+useful, the same cron job can deliver summaries to a connected channel.++## Setup++Copy the shared state and `ci-triage` skill, then confirm Hermes can discover the+skill:++```bash+cp starters/ci-sweeper/ci-sweeper-state.md.example ci-sweeper-state.md++mkdir -p ~/.hermes/skills/ci-triage+cp starters/ci-sweeper/.claude/skills/ci-triage/SKILL.md \+ ~/.hermes/skills/ci-triage/SKILL.md++hermes skills list | grep ci-triage+```++The skill format is shared across tools. Use `.hermes/skills/ci-triage/` instead+when the skill should be available only inside this project.++## Week one — report only++Start with a 15-minute cadence on active repositories. The prompt has an early+exit so green CI remains a cheap no-op.++```bash+hermes cron create "*/15 * * * *" \+ --name "CI sweeper" \+ --deliver local \+ --skill ci-triage \+ --workdir "$PWD" \+ "Run the ci-triage skill. Read ci-sweeper-state.md, then inspect the latest CI checks on the default branch and active PRs. If every watched check is green, update Last run and stop. For each failure, record the check URL, job or test, first failing commit SHA, classification (regression, flake, infrastructure, config, or unknown), confidence, evidence, proposed human action, and attempt count. Move entries between Active Failures, Watch, and Resolved (last 7d). Week one is report-only: do not edit source or workflow files; do not create a worktree, branch, commit, or PR; do not retry CI; do not post GitHub comments or change checks; do not merge or enable auto-merge. Escalate ambiguous, security, release, secret, permission, and infrastructure failures. End with the top three human actions."+```++- `--workdir "$PWD"` pins the repository and injects its `AGENTS.md`,+ `CLAUDE.md`, or `.cursorrules` into the fresh cron session.+- `--deliver local` writes to `~/.hermes/cron/output/`; it does not add routine+ reports to a human chat.+- `--skill ci-triage` attaches the shared classifier without granting a fixer+ permission to act.++Run one tick manually before relying on the schedule:++```bash+hermes cron list+hermes cron run <job-id>+hermes cron status+```++Pause the job while changing its scope: `hermes cron pause <job-id>`. Resume only+after reviewing the prompt and the latest state file.++## State file++Keep enough evidence to distinguish a new regression from a known flake or+infrastructure incident:++```markdown+# CI Sweeper State++Last run: 2026-08-10 09:30 UTC+Mode: report-only++## Active Failures++### main @ abc1234 — unit-tests / parses empty input+- Check: https://github.com/example/project/actions/runs/123+- Classification: regression (medium confidence)+- Evidence: first fails at abc1234; reproduced twice without a retry+- Proposed action: human confirms scope and validation command+- Attempts: 0 / 3++## Watch (flakes / infra)++### release/2.x @ def5678 — integration / registry login+- Classification: infrastructure (high confidence)+- Evidence: registry returned 503 across unrelated jobs+- Proposed action: escalate; no retry or code change++## Resolved (last 7d)++- main @ 789abcd — lint failure fixed by PR #456+```++Do not put credentials or unredacted secrets from CI logs into this file.++## Optional channel delivery++Keep `local` as the trust-building default. Once reports have been reviewed over+several runs, edit the job to use `--deliver origin`, a configured home channel+such as `slack` or `feishu`, or a specific `platform:chat_id:thread_id` target.+Set the channel's `allowFrom` and mention rules first; delivery changes where the+summary appears, not what the loop is allowed to do.++A CI webhook can replace polling when your Hermes gateway is already configured+for trusted event delivery. Keep the same report-only prompt and the same state+transition rules.++## Week two — isolated fixes with an independent verifier++Enable fixes only after a human approves the exact failing check, allowed paths,+and validation command. Each attempt follows this boundary:++1. Create an isolated attempt with+ `npx @cobusgreyling/loop-worktree create --run-id <run-id> --pattern ci-sweeper`.+2. Run `minimal-fix` inside the printed worktree; never edit the primary checkout.+3. Run the approved test command in that worktree.+4. Ask a separate verifier to review the diff and test output, either with a+ review-only `delegate_task` call or a chained Hermes cron job using+ `--context-from`.+5. Present an approved patch or draft PR to a human. Never merge or enable+ auto-merge from the loop.+6. After three attempts on the same root cause, stop and escalate with the state+ history instead of retrying again.++The verifier must be independent of the implementer and must reject unrelated+changes, denylisted paths, or a fix that only hides the symptom. Security,+authentication, payments, secrets, permissions, release, and infrastructure+failures always remain human-owned.++## References++- [CI Sweeper pattern](../../patterns/ci-sweeper.md)+- [CI Sweeper starter](../../starters/ci-sweeper/)+- [`loop-worktree`](../../tools/loop-worktree/)+- [Safety and human gates](../../docs/safety.md)+- [Primitives matrix](../../docs/primitives-matrix.md)