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
# CI Sweeper — event-driven on workflow failure
name: CI Sweeper Loop
on:
workflow_run:
workflows: ['*']
types: [completed]
branches: [main]
permissions:
contents: read
pull-requests: write
checks: read
jobs:
sweep:
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Record failure context
run: |
echo "Failed workflow: ${{ github.event.workflow_run.name }}"
echo "Head branch: ${{ github.event.workflow_run.head_branch }}"
echo "Run URL: ${{ github.event.workflow_run.html_url }}"
- name: Update ci-sweeper-state.md
run: |
FILE=ci-sweeper-state.md
touch "$FILE"
echo "" >> "$FILE"
echo "### $(date -u +%Y-%m-%dT%H:%M:%SZ) — workflow failure" >> "$FILE"
echo "- Workflow: ${{ github.event.workflow_run.name }}" >> "$FILE"
echo "- Branch: ${{ github.event.workflow_run.head_branch }}" >> "$FILE"
echo "- URL: ${{ github.event.workflow_run.html_url }}" >> "$FILE"
echo "- Loop action: pending agent invocation" >> "$FILE"
- name: Invoke CI Sweeper Agent
uses: cobusgreyling/loop-engineering/tools/loop-action@main
with:
pattern: 'ci-sweeper'
level: 'L2'
sandbox: 'true'
sandbox-shell: 'true'
command: |
echo "::notice::Wire to agent: classify failure, worktree fix, verifier, open PR."
echo "See patterns/ci-sweeper.md and docs/safety.md"