---
name: ci-repair-loop
description: Use when deploying the loopmaster.ai ci-repair template to triage failing CI, propose minimal repairs, and preserve human review gates.
category: loops
requirements:
  - Python 3
  - repository checkout containing templates/ci-repair
  - uv for manifest validation, or preinstalled pyyaml/jsonschema for tools/validate_manifests.py
  - GitHub token with actions/checks read plus repo and pull-request write scopes for real repairs
  - maintainer or delegated reviewer for non-test production code changes
public: true
deploys-template: ci-repair
backends:
  - cron
  - github_actions
  - agent_kanban
---

# CI repair loop skill

Use this pack to install or verify `ci-repair` as a guarded repair workflow. It does not replace the template guide and must not weaken tests, required checks, or review gates.

Canonical references:

- `templates/ci-repair/loop.yaml` — permissions, forbidden actions, human gates, verification commands, and backend hints.
- `templates/ci-repair/AGENT-INSTALL.md` — complete backend install guide.
- `templates/ci-repair/verification/dry-read-ambiguity-checklist.md` — install ambiguity evidence.
- `templates/ci-repair/verification/safety-gate-examples.md` — examples of the required review gate.

If this pack conflicts with `templates/ci-repair/AGENT-INSTALL.md`, follow the template guide and fix this pack.

## Preflight from repo root

```bash
git status --short
test -f templates/ci-repair/loop.yaml
test -f templates/ci-repair/AGENT-INSTALL.md
uv run --with check-jsonschema --with pyyaml check-jsonschema --schemafile spec/loop.schema.json templates/ci-repair/loop.yaml
uv run --with pyyaml --with jsonschema python tools/validate_manifests.py
```

Expected result: scoped or clean git status, manifest validation exits 0, and repository validation reports `Validation passed.`

## Pick a backend

- cron: polls for failures and creates repair tasks; it must not merge repairs by itself.
- GitHub Actions: dispatches from failed workflow evidence and opens an issue, task, or repair PR.
- agent-kanban: assigns a focused repair task with logs, branch, failing command, and review requirements.

Use `templates/ci-repair/AGENT-INSTALL.md` for exact backend setup.

## Required safety gate

Before enabling any backend, copy the operating rule from `templates/ci-repair/AGENT-INSTALL.md`: green CI alone is not approval to merge non-test production code. A maintainer or delegated code owner must review that the patch fixes root cause rather than hiding the signal.

## Verification path

```bash
test -f templates/ci-repair/verification/dry-read-ambiguity-checklist.md
grep -q "Unresolved ambiguities: 0" templates/ci-repair/verification/dry-read-ambiguity-checklist.md
grep -q "human diff review" templates/ci-repair/verification/safety-gate-examples.md
```

Expected result: all commands exit 0. For a real install, also record a failed run id or `NO_FAILED_RUNS_FOUND` exactly as described in the template guide; do not fabricate CI failures.

## Stop or roll back

- cron: remove the polling entry and leave existing repair PRs open for normal review.
- GitHub Actions: disable or delete the dispatch workflow in a PR.
- agent-kanban: pause or remove the recurring repair dispatcher task.
- Bad repair: revert the repair branch to the last CI-observed commit and keep the failure analysis.

## First-week ownership checklist

- Confirm repair tasks include check name, command, log excerpt, branch, and SHA.
- Confirm pre-existing failures are routed to follow-up work instead of hidden.
- Confirm every non-test production patch has human diff-review evidence.
- Watch for retries, skipped tests, or allow-failure edits that mask the signal.
