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: add Windsurf CI Sweeper example doc (#413)
Muhammad Zeshan Malikf735f60fd7c1
diff --git a/examples/README.md b/examples/README.mdindex 9f93a89..a671065 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) | — | [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) | — | [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) | — | [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) | — | [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) | — | [opencode/changelog-drafter.md](./opencode/changelog-drafter.md) | — | [github-actions/changelog-drafter.yml](./github-actions/changelog-drafter.yml) |diff --git a/examples/windsurf/README.md b/examples/windsurf/README.mdindex cfe8c56..71bbd7e 100644--- a/examples/windsurf/README.md+++ b/examples/windsurf/README.md@@ -6,6 +6,7 @@ Copy-pasteable loop patterns for Windsurf, using Cascade Workflows as the manual|---|---|---|---|| Daily Triage | 1d–2h (manual `/daily-triage`) | Low | [daily-triage.md](daily-triage.md) || PR Babysitter | 5m–15m (manual `/pr-babysitter`; external reminder optional) | Medium | [pr-babysitter.md](pr-babysitter.md) |+| CI Sweeper | 5m–15m (manual `/ci-sweeper`; external reminder optional) | Medium | [ci-sweeper.md](ci-sweeper.md) |No `loop-init --tool windsurf` yet — copy `SKILL.md` + `STATE.md` from any starter (e.g. `starters/minimal-loop`), then follow the example to wire a Cascade Workflow.diff --git a/examples/windsurf/ci-sweeper.md b/examples/windsurf/ci-sweeper.mdnew file mode 100644index 0000000..7ae5c67--- /dev/null+++ b/examples/windsurf/ci-sweeper.md@@ -0,0 +1,91 @@+# CI Sweeper — Windsurf (Cascade Workflows)++This is a practical, copy-pasteable example of a CI Sweeper loop using Windsurf's Cascade.++Windsurf has no native `/loop` scheduler or built-in cron. Map the loop to a **Cascade Workflow** (`.windsurf/workflows/ci-sweeper.md`) and invoke it manually with `/ci-sweeper`; if you need an unattended cadence, pair it with an external reminder or trigger (such as GitHub Actions cron, `launchd`, `cron`, or systemd) that prompts a human to run the workflow.++## Setup++Copy the shared skills and state into Windsurf's project-local paths:++```bash+mkdir -p .windsurf/rules/ci-triage \+ .windsurf/rules/minimal-fix \+ .windsurf/rules/loop-verifier+cp starters/ci-sweeper/.claude/skills/ci-triage/SKILL.md \+ .windsurf/rules/ci-triage/SKILL.md+cp templates/SKILL.md.minimal-fix \+ .windsurf/rules/minimal-fix/SKILL.md+cp templates/SKILL.md.verifier \+ .windsurf/rules/loop-verifier/SKILL.md+cp starters/ci-sweeper/ci-sweeper-state.md.example \+ ci-sweeper-state.md+```++Put always-on path denylists, attempt limits, and the no-auto-merge rule in `.windsurf/rules/` as well as in the workflow prompt.++## Workflow (week one — report only)++Create `.windsurf/workflows/ci-sweeper.md`:++```markdown+# CI Sweeper++**Description:** Inspect failing CI checks, classify failures, update state. Report only, no auto-fix.++1. Read `ci-sweeper-state.md` and `.windsurf/rules/ci-triage/SKILL.md`.+2. Run the `ci-triage` skill against the latest failing checks on the default branch.+3. Record the check URL, failing job or test, first failing commit, confidence, and whether the failure is a regression, flake, infrastructure issue, or unknown.+4. Update `ci-sweeper-state.md` with evidence and proposed next action.+5. Week one is report-only:+ - do not edit source files or workflow files;+ - do not create a worktree, branch, commit, pull request, or CI retry;+ - do not post comments or change check status;+ - do not merge or enable auto-merge.+6. Escalate security, release, permissions, secrets, and infrastructure failures. Stop after reporting when root cause is ambiguous.+```++Invoke in Cascade chat with `/ci-sweeper`.++For an unattended cadence, keep Windsurf as the reviewer/triage surface and use an external scheduler only to remind a human or trigger execution. Review the state file after every run. See [Safety and human gates](../../docs/safety.md) for permission boundaries and least-privilege guidelines.++## L2 fix attempts (only after tuning)++After the report-only output is consistently accurate, allow one narrowly scoped fix attempt for a confirmed repository regression:++1. A human approves the failing check, allowed paths, and validation command.+2. Create an isolated attempt with `npx @cobusgreyling/loop-worktree create --run-id <run-id> --pattern ci-sweeper`.+3. Run `minimal-fix` (`.windsurf/rules/minimal-fix/SKILL.md`) in that worktree; never edit the main checkout directly.+4. Run `loop-verifier` (`.windsurf/rules/loop-verifier/SKILL.md`) in a separate session/verifier step over the diff and test output.+5. On rejection, mark and discard the attempt. On approval, present the diff to a human for the final decision.++Never enable auto-merge. Stop after three attempts on one root cause and escalate with the collected evidence.++## Example `ci-sweeper-state.md`++```markdown+# CI Sweeper State+Last run: 2026-07-23 06:00 UTC+Mode: report-only++## Failing checks++### validate / unit-tests+- URL: https://github.com/example/project/actions/runs/123+- First failing commit: abc1234+- Classification: likely regression (medium confidence)+- Evidence: test `parses empty input` fails consistently on two runs+- Proposed action: human review before an isolated fix attempt+- Attempts: 0 / 3++## Escalated+- deploy-production: permissions failure; no automated retry or fix+```++## 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#appendix-editor-transfer-recipes-opencode-cursor--windsurf)diff --git a/patterns/registry.yaml b/patterns/registry.yamlindex c29c72b..bf3942a 100644--- a/patterns/registry.yaml+++ b/patterns/registry.yaml@@ -52,7 +52,7 @@ patterns:goal: React to failing CI with minimal fixes and escalationcadence: 5m-15mrisk: medium- tools: [grok, claude-code, codex, openclaw, opencode, github-actions]+ tools: [grok, claude-code, codex, openclaw, opencode, github-actions, windsurf]skills: [ci-triage, minimal-fix]state: ci-sweeper-state.mdphases: [detect, classify, fix, verify, escalate]