@cobusgreyling/loop-init 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +7 -0
  2. package/dist/cli.js +56 -2
  3. package/dist/contributor-cta.d.ts +2 -0
  4. package/dist/contributor-cta.js +6 -0
  5. package/package.json +1 -1
  6. package/starters/README.md +6 -0
  7. package/starters/changelog-drafter-opencode/AGENTS.md +15 -0
  8. package/starters/changelog-drafter-opencode/LOOP.md +26 -0
  9. package/starters/changelog-drafter-opencode/README.md +44 -0
  10. package/starters/changelog-drafter-opencode/changelog-drafter-state.md.example +10 -0
  11. package/starters/changelog-drafter-opencode/opencode.json.example +35 -0
  12. package/starters/changelog-drafter-opencode/skills/changelog-scan/SKILL.md +38 -0
  13. package/starters/ci-sweeper-opencode/AGENTS.md +17 -0
  14. package/starters/ci-sweeper-opencode/LOOP.md +26 -0
  15. package/starters/ci-sweeper-opencode/README.md +43 -0
  16. package/starters/ci-sweeper-opencode/ci-sweeper-state.md.example +10 -0
  17. package/starters/ci-sweeper-opencode/opencode.json.example +35 -0
  18. package/starters/ci-sweeper-opencode/skills/ci-triage/SKILL.md +32 -0
  19. package/starters/dependency-sweeper-opencode/AGENTS.md +15 -0
  20. package/starters/dependency-sweeper-opencode/LOOP.md +27 -0
  21. package/starters/dependency-sweeper-opencode/README.md +44 -0
  22. package/starters/dependency-sweeper-opencode/dependency-sweeper-state.md.example +11 -0
  23. package/starters/dependency-sweeper-opencode/opencode.json.example +35 -0
  24. package/starters/dependency-sweeper-opencode/skills/dependency-triage/SKILL.md +35 -0
  25. package/starters/issue-triage-opencode/AGENTS.md +16 -0
  26. package/starters/issue-triage-opencode/LOOP.md +21 -0
  27. package/starters/issue-triage-opencode/README.md +43 -0
  28. package/starters/issue-triage-opencode/issue-triage-state.md.example +11 -0
  29. package/starters/issue-triage-opencode/opencode.json.example +35 -0
  30. package/starters/issue-triage-opencode/skills/issue-triage/SKILL.md +33 -0
  31. package/starters/post-merge-cleanup-opencode/AGENTS.md +15 -0
  32. package/starters/post-merge-cleanup-opencode/LOOP.md +26 -0
  33. package/starters/post-merge-cleanup-opencode/README.md +44 -0
  34. package/starters/post-merge-cleanup-opencode/opencode.json.example +35 -0
  35. package/starters/post-merge-cleanup-opencode/post-merge-state.md.example +10 -0
  36. package/starters/post-merge-cleanup-opencode/skills/post-merge-scan/SKILL.md +34 -0
  37. package/starters/pr-babysitter-opencode/AGENTS.md +18 -0
  38. package/starters/pr-babysitter-opencode/LOOP.md +27 -0
  39. package/starters/pr-babysitter-opencode/README.md +44 -0
  40. package/starters/pr-babysitter-opencode/opencode.json.example +35 -0
  41. package/starters/pr-babysitter-opencode/pr-babysitter-state.md.example +10 -0
  42. package/starters/pr-babysitter-opencode/skills/pr-review-triage/SKILL.md +33 -0
  43. package/templates/SKILL.md.loop-guard +94 -0
  44. package/templates/loop-constraints.md +1 -0
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: dependency-triage
3
+ description: >
4
+ Scan package manifests and lockfiles for outdated and vulnerable
5
+ dependencies. Classify by severity and update type.
6
+ user_invocable: true
7
+ ---
8
+
9
+ # Dependency Triage Skill
10
+
11
+ You are a dependency sweeper agent. Scan for outdated and vulnerable packages.
12
+
13
+ ## Scan Sources
14
+
15
+ - `npm outdated` / `npm audit`
16
+ - `cargo outdated` / `cargo audit`
17
+ - `pip list --outdated`
18
+ - Lockfile analysis
19
+
20
+ ## Classification
21
+
22
+ - **Patch**: auto-fix candidate
23
+ - **Minor**: auto-fix candidate
24
+ - **Major**: escalate to human
25
+ - **CVE**: escalate high-severity; patch-only for low/medium
26
+
27
+ ## Output
28
+
29
+ Update `dependency-sweeper-state.md` with prioritized update list.
30
+
31
+ ## Rules
32
+
33
+ - Patch-only by default in week one.
34
+ - Honour denylist in state file.
35
+ - Run `npm ci && npm test` (or equivalent) before approving.
@@ -0,0 +1,16 @@
1
+ # AGENTS.md — Issue Triage (Opencode)
2
+
3
+ ## Loop Mode
4
+ - Start in L1 propose-only mode.
5
+ - Read `issue-triage-state.md` before every run.
6
+ - Never auto-label, auto-close, or auto-comment in week one.
7
+
8
+ ## Safety
9
+ - P0/P1 on auth, payments, security, or public API: always escalate.
10
+ - L2 auto-labels limited to curated allowlist.
11
+ - Verifier gate required before applying any label.
12
+
13
+ ## Verification
14
+ - L1: human reviews proposed labels before application.
15
+ - L2: verifier confirms labels are in the allowlist.
16
+ - Duplicates: propose as "possible duplicate of #NNN" — never auto-close.
@@ -0,0 +1,21 @@
1
+ # Loop Configuration — Issue Triage (Opencode)
2
+
3
+ ## Active Loops
4
+
5
+ | Pattern | Cadence | Status | Command |
6
+ |---------|---------|--------|---------|
7
+ | Issue Triage | 2h-1d | L1 propose-only | `opencode run "Run issue-triage" --agent loop-triage` via cron |
8
+
9
+ ## Human Gates
10
+ - P0/P1 on auth, payments, security, public API: always human.
11
+ - Duplicate proposals noted as "possible duplicate of #NNN" — never auto-close.
12
+ - L2 auto-labels limited to allowlist.
13
+
14
+ ## Budget
15
+ - Max sub-agent spawns per run: 0 (L1), 1 (L2).
16
+ - Early exit if no new issues since last run.
17
+
18
+ ## Links
19
+ - Pattern: [issue-triage](../../patterns/issue-triage.md)
20
+ - Example: [examples/opencode/issue-triage.md](../../examples/opencode/issue-triage.md)
21
+ - Safety: [docs/safety.md](../../docs/safety.md)
@@ -0,0 +1,43 @@
1
+ # Issue Triage — Opencode Starter
2
+
3
+ Clone-and-run scaffold for the **Issue Triage** pattern with opencode. Keep the issue queue legible so morning triage always knows the top five.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx @cobusgreyling/loop-init . --pattern issue-triage --tool opencode
9
+ ```
10
+
11
+ Or copy manually:
12
+
13
+ ```bash
14
+ cp -r starters/issue-triage-opencode/skills .
15
+ cp starters/issue-triage-opencode/AGENTS.md .
16
+ cp starters/issue-triage-opencode/LOOP.md .
17
+ cp starters/issue-triage-opencode/issue-triage-state.md.example issue-triage-state.md
18
+ cp starters/issue-triage-opencode/opencode.json.example opencode.json
19
+ ```
20
+
21
+ Start (L1 propose-only, week 1):
22
+
23
+ ```bash
24
+ opencode run \
25
+ "Run skills/issue-triage/SKILL.md. Scan open issues since last run. Update issue-triage-state.md with top 5, proposed labels, and needs-human bucket. Propose only — do not apply labels or close issues." \
26
+ --title "Issue triage"
27
+ ```
28
+
29
+ ## What's Included
30
+
31
+ | File | Purpose |
32
+ |------|---------|
33
+ | `issue-triage-state.md.example` | State spine (issue queue health) |
34
+ | `skills/issue-triage/SKILL.md` | Issue-focused triage skill |
35
+ | `AGENTS.md` | Always-on safety rules |
36
+ | `LOOP.md` | Cadence, gates, budget |
37
+ | `opencode.json.example` | Named agent definitions |
38
+
39
+ ## Next Steps
40
+
41
+ - [patterns/issue-triage.md](../../patterns/issue-triage.md)
42
+ - [examples/opencode/issue-triage.md](../../examples/opencode/issue-triage.md)
43
+ - [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
@@ -0,0 +1,11 @@
1
+ # Issue Triage State
2
+ Last run: 2026-06-20 09:00 UTC
3
+ Open actionable: 0
4
+ New since last run: 0
5
+ Needs human: 0
6
+
7
+ ## Top 5 (by loop score)
8
+ - <!-- #NNN (type, priority) — summary — proposed labels -->
9
+
10
+ ## Proposed Labels (not applied — L1)
11
+ - <!-- #NNN: label1, label2 -->
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "agent": {
4
+ "issue-triage": {
5
+ "name": "issue-triage",
6
+ "description": "Issue triage loop. Reads issue-triage-state.md, scans open issues, and proposes labels and priorities. Propose-only in L1 mode.",
7
+ "mode": "primary",
8
+ "prompt": "Read AGENTS.md, LOOP.md, issue-triage-state.md, and skills/issue-triage/SKILL.md. Scan open issues since last run. Update state with top 5, proposed labels, and needs-human bucket. Propose only — do not apply labels or close issues.",
9
+ "permission": {
10
+ "bash": "ask",
11
+ "edit": "ask"
12
+ }
13
+ },
14
+ "implementer": {
15
+ "name": "implementer",
16
+ "description": "L2 implementer for auto-labeling allowlisted labels.",
17
+ "mode": "subagent",
18
+ "prompt": "Apply only allowlisted labels (area:*, needs-repro, needs-info, duplicate?) after verifier passes. Never auto-apply P0, P1, security, or breaking-change labels. Never close or comment without human approval.",
19
+ "permission": {
20
+ "bash": "ask",
21
+ "edit": "ask"
22
+ }
23
+ },
24
+ "verifier": {
25
+ "name": "verifier",
26
+ "description": "Checker agent for issue label proposals. APPROVE or REJECT only.",
27
+ "mode": "subagent",
28
+ "prompt": "Verify proposed labels are in the allowlist. Confirm no P0/P1/security labels are being auto-applied. Do not edit. APPROVE or REJECT.",
29
+ "permission": {
30
+ "bash": "ask",
31
+ "edit": "deny"
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: issue-triage
3
+ description: >
4
+ Scan open issues and discussions, deduplicate, prioritize,
5
+ and propose labels. Provides a clean actionable queue.
6
+ user_invocable: true
7
+ ---
8
+
9
+ # Issue Triage Skill
10
+
11
+ You are an issue triage agent. Keep the issue queue legible.
12
+
13
+ ## Scan Sources
14
+
15
+ - Open issues and discussions
16
+ - Prior state in `issue-triage-state.md`
17
+ - Labels, milestones, linked PRs
18
+
19
+ ## Output
20
+
21
+ Update `issue-triage-state.md` with:
22
+
23
+ - Top 5 prioritized items (P0-P3)
24
+ - Proposed labels per item
25
+ - Needs-human bucket for ambiguous or security-sensitive items
26
+ - Possible duplicates
27
+
28
+ ## Rules
29
+
30
+ - L1: propose only — never auto-label, auto-close, or auto-comment.
31
+ - P0/P1 on auth, payments, security, public API: always escalate.
32
+ - Duplicates: note as "possible duplicate of #NNN" — never auto-close.
33
+ - L2 auto-labels limited to curated allowlist.
@@ -0,0 +1,15 @@
1
+ # AGENTS.md — Post-Merge Cleanup (Opencode)
2
+
3
+ ## Loop Mode
4
+ - Start in L1 report-only mode.
5
+ - Read `post-merge-state.md` before any scan.
6
+ - Run off-peak (evening) to avoid colliding with active branches.
7
+
8
+ ## Safety
9
+ - Never auto-fix architectural debt — file a ticket.
10
+ - Denylist paths always go to a human.
11
+ - Max 2 fix attempts per run.
12
+
13
+ ## Verification
14
+ - For L2+ changes, verifier confirms fix scope and tests.
15
+ - Record attempt evidence in state.
@@ -0,0 +1,26 @@
1
+ # Loop Configuration — Post-Merge Cleanup (Opencode)
2
+
3
+ ## Active Loops
4
+
5
+ | Pattern | Cadence | Status | Command |
6
+ |---------|---------|--------|---------|
7
+ | Post-Merge Cleanup | 1d | L1 report-only | `opencode run "Run post-merge-scan"` via cron (off-peak) |
8
+
9
+ ## Human Gates
10
+ - Architectural debt is ticketed, never auto-fixed.
11
+ - Denylist paths always human.
12
+ - Max 2 fix attempts per run.
13
+
14
+ ## Worktrees
15
+ - Use `git worktree` for any code-change attempt (L2+).
16
+ - One worktree per fix; discard after REJECT.
17
+
18
+ ## Budget
19
+ - Max sub-agent spawns per run: 0 (L1), 2 (L2).
20
+ - Run off-peak (evening) to avoid collision.
21
+ - Pause if token budget exceeded.
22
+
23
+ ## Links
24
+ - Pattern: [post-merge-cleanup](../../patterns/post-merge-cleanup.md)
25
+ - Example: [examples/opencode/post-merge-cleanup.md](../../examples/opencode/post-merge-cleanup.md)
26
+ - Safety: [docs/safety.md](../../docs/safety.md)
@@ -0,0 +1,44 @@
1
+ # Post-Merge Cleanup — Opencode Starter
2
+
3
+ Clone-and-run scaffold for the **Post-Merge Cleanup** pattern with opencode. Follow-up tech debt after merges land on main.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx @cobusgreyling/loop-init . --pattern post-merge-cleanup --tool opencode
9
+ ```
10
+
11
+ Or copy manually:
12
+
13
+ ```bash
14
+ cp -r starters/post-merge-cleanup-opencode/skills .
15
+ cp starters/post-merge-cleanup-opencode/AGENTS.md .
16
+ cp starters/post-merge-cleanup-opencode/LOOP.md .
17
+ cp starters/post-merge-cleanup-opencode/post-merge-state.md.example post-merge-state.md
18
+ cp starters/post-merge-cleanup-opencode/opencode.json.example opencode.json
19
+ ```
20
+
21
+ Start (report-only, week 1):
22
+
23
+ ```bash
24
+ opencode run \
25
+ "Run skills/post-merge-scan/SKILL.md. Scan merges to main in the last 48h. Propose small doc/lint/comment fixes only — ticket anything architectural. Update post-merge-state.md. Do not edit source code." \
26
+ --title "Post-merge cleanup"
27
+ ```
28
+
29
+ ## What's Included
30
+
31
+ | File | Purpose |
32
+ |------|---------|
33
+ | `post-merge-state.md.example` | State spine template |
34
+ | `skills/post-merge-scan/SKILL.md` | Merge-focused scan skill |
35
+ | `AGENTS.md` | Always-on safety rules |
36
+ | `LOOP.md` | Cadence, gates, budget |
37
+ | `opencode.json.example` | Named agent definitions |
38
+
39
+ ## Next Steps
40
+
41
+ - [patterns/post-merge-cleanup.md](../../patterns/post-merge-cleanup.md)
42
+ - [examples/opencode/post-merge-cleanup.md](../../examples/opencode/post-merge-cleanup.md)
43
+ - [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
44
+ - [stories/post-merge-cleanup-honest-win.md](../../stories/post-merge-cleanup-honest-win.md)
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "agent": {
4
+ "post-merge-scan": {
5
+ "name": "post-merge-scan",
6
+ "description": "Post-merge scan loop. Reads post-merge-state.md, scans recent merges, and proposes small cleanup fixes.",
7
+ "mode": "primary",
8
+ "prompt": "Read AGENTS.md, LOOP.md, post-merge-state.md, and skills/post-merge-scan/SKILL.md. Scan merges to main in the last 48h. Propose small doc/lint/comment fixes. Ticket architectural debt. Do not edit code in L1 mode.",
9
+ "permission": {
10
+ "bash": "ask",
11
+ "edit": "ask"
12
+ }
13
+ },
14
+ "implementer": {
15
+ "name": "implementer",
16
+ "description": "L2 implementer for small cleanup fixes inside an isolated worktree.",
17
+ "mode": "subagent",
18
+ "prompt": "Implement only the requested single-file cleanup inside the supplied worktree. Run tests. Never touch denylist paths. Output the diff.",
19
+ "permission": {
20
+ "bash": "ask",
21
+ "edit": "ask"
22
+ }
23
+ },
24
+ "verifier": {
25
+ "name": "verifier",
26
+ "description": "Checker agent for cleanup diffs. APPROVE or REJECT only.",
27
+ "mode": "subagent",
28
+ "prompt": "Review the cleanup diff against project rules. Verify scope is small and doesn't touch denylisted paths. Do not edit files. APPROVE or REJECT.",
29
+ "permission": {
30
+ "bash": "ask",
31
+ "edit": "deny"
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,10 @@
1
+ # Post-Merge State
2
+ Last run: 2026-06-20 09:00 UTC
3
+ Recent merges scanned: 0
4
+ Cleanup items: 0
5
+
6
+ ## Proposed Fixes
7
+ - <!-- Small fixes proposed by the loop -->
8
+
9
+ ## Ticketed Debt
10
+ - <!-- Architectural debt items ticketed for human triage -->
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: post-merge-scan
3
+ description: >
4
+ Scan recent merges to main for tech debt, TODOs, debug code, and
5
+ small cleanup opportunities. Produces a prioritized fix list.
6
+ user_invocable: true
7
+ ---
8
+
9
+ # Post-Merge Scan Skill
10
+
11
+ You are a post-merge cleanup agent. Scan recent merges for follow-up work.
12
+
13
+ ## Scan Sources
14
+
15
+ - Recent commits and PRs merged to main
16
+ - `git diff HEAD~10` for left-behind debug code
17
+ - TODO/FIXME/HACK comments in changed files
18
+ - Lint warnings introduced by recent changes
19
+
20
+ ## Classification
21
+
22
+ - **Small fix**: doc/comment/lint/debug — auto-fix candidate
23
+ - **Architectural debt**: ticket for human
24
+ - **Denylist path**: escalate to human
25
+
26
+ ## Output
27
+
28
+ Update `post-merge-state.md` with prioritized cleanup list.
29
+
30
+ ## Rules
31
+
32
+ - Run off-peak (evening).
33
+ - Never auto-fix architectural debt.
34
+ - Max 2 fix attempts per run.
@@ -0,0 +1,18 @@
1
+ # AGENTS.md — PR Babysitter (Opencode)
2
+
3
+ ## Loop Mode
4
+ - Start in L1 report-only mode.
5
+ - Read `pr-babysitter-state.md` before any triage.
6
+ - Do not edit source code until the human explicitly enables L2.
7
+
8
+ ## Safety
9
+ - Never force-push without explicit human opt-in.
10
+ - Draft PRs by default; humans mark ready for review.
11
+ - Do not resolve review threads without approval.
12
+ - Security, auth, payments, infra, or public API changes always escalate.
13
+ - Max 3 fix attempts per PR before handoff.
14
+
15
+ ## Verification
16
+ - For L2+ changes, dispatch verifier sub-agent after implementation.
17
+ - Run the project's documented tests before proposing a fix.
18
+ - Check for existing PR on the same intent before pushing.
@@ -0,0 +1,27 @@
1
+ # Loop Configuration — PR Babysitter (Opencode)
2
+
3
+ ## Active Loops
4
+
5
+ | Pattern | Cadence | Status | Command |
6
+ |---------|---------|--------|---------|
7
+ | PR Babysitter | 10-15m | L1 report-only | `opencode run "Run PR babysitter triage" --agent loop-triage` via cron/systemd |
8
+
9
+ ## Human Gates
10
+ - No auto-fix until L2 checklist complete.
11
+ - Draft PRs by default; humans mark ready for review.
12
+ - Do not resolve review threads without approval.
13
+ - Security, auth, payments, infra changes: always human.
14
+
15
+ ## Worktrees
16
+ - One worktree per fix attempt; discard after verifier REJECT.
17
+ - Run implementer with `--dir <worktree>`.
18
+
19
+ ## Budget
20
+ - Max sub-agent spawns per run: 0 (L1).
21
+ - Max 3 fix attempts per PR before handoff.
22
+ - Pause if token budget exceeded.
23
+
24
+ ## Links
25
+ - Pattern: [pr-babysitter](../../patterns/pr-babysitter.md)
26
+ - Example: [examples/opencode/pr-babysitter.md](../../examples/opencode/pr-babysitter.md)
27
+ - Safety: [docs/safety.md](../../docs/safety.md)
@@ -0,0 +1,44 @@
1
+ # PR Babysitter — Opencode Starter
2
+
3
+ Clone-and-run scaffold for the **PR Babysitter** pattern with opencode. Watch open PRs, surface blockers, and act only on safe obvious maintenance tasks.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx @cobusgreyling/loop-init . --pattern pr-babysitter --tool opencode
9
+ ```
10
+
11
+ Or copy manually:
12
+
13
+ ```bash
14
+ cp -r starters/pr-babysitter-opencode/skills .
15
+ cp starters/pr-babysitter-opencode/AGENTS.md .
16
+ cp starters/pr-babysitter-opencode/LOOP.md .
17
+ cp starters/pr-babysitter-opencode/pr-babysitter-state.md.example pr-babysitter-state.md
18
+ cp starters/pr-babysitter-opencode/opencode.json.example opencode.json
19
+ ```
20
+
21
+ Start (report-only, week 1):
22
+
23
+ ```bash
24
+ opencode run \
25
+ "Run PR babysitter triage. Read pr-babysitter-state.md first. List PRs with red CI, stale review, merge conflicts, or unanswered review comments. Do not edit code. Update pr-babysitter-state.md." \
26
+ --title "PR babysitter"
27
+ ```
28
+
29
+ ## What's Included
30
+
31
+ | File | Purpose |
32
+ |------|---------|
33
+ | `pr-babysitter-state.md.example` | State spine template |
34
+ | `skills/pr-review-triage/SKILL.md` | PR-focused triage skill |
35
+ | `AGENTS.md` | Always-on safety rules |
36
+ | `LOOP.md` | Cadence, gates, budget |
37
+ | `opencode.json.example` | Named agent definitions |
38
+
39
+ ## Next Steps
40
+
41
+ - [patterns/pr-babysitter.md](../../patterns/pr-babysitter.md)
42
+ - [examples/opencode/pr-babysitter.md](../../examples/opencode/pr-babysitter.md)
43
+ - [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
44
+ - [stories/pr-babysitter-week-one.md](../../stories/pr-babysitter-week-one.md)
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "agent": {
4
+ "pr-babysitter": {
5
+ "name": "pr-babysitter",
6
+ "description": "PR-focused triage loop. Reads pr-babysitter-state.md, watches open PRs, and reports blockers without editing code.",
7
+ "mode": "primary",
8
+ "prompt": "Read AGENTS.md, LOOP.md, pr-babysitter-state.md, and skills/pr-review-triage/SKILL.md. Watch open PRs, check CI status, review staleness, and surface blockers. Do not edit source code unless L2 is explicitly enabled.",
9
+ "permission": {
10
+ "bash": "ask",
11
+ "edit": "ask"
12
+ }
13
+ },
14
+ "implementer": {
15
+ "name": "implementer",
16
+ "description": "L2 implementer for minimal PR fixes inside an isolated worktree.",
17
+ "mode": "subagent",
18
+ "prompt": "Implement only the requested minimal fix inside the supplied worktree. Respect AGENTS.md and LOOP.md. Run documented tests. Never force-push. Draft PR by default.",
19
+ "permission": {
20
+ "bash": "ask",
21
+ "edit": "ask"
22
+ }
23
+ },
24
+ "verifier": {
25
+ "name": "verifier",
26
+ "description": "Checker agent for PR fix diffs. APPROVE or REJECT only.",
27
+ "mode": "subagent",
28
+ "prompt": "Review the supplied diff against project rules, tests, and docs/safety.md. Do not edit files. Respond with APPROVE or REJECT and concise evidence.",
29
+ "permission": {
30
+ "bash": "ask",
31
+ "edit": "deny"
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,10 @@
1
+ # PR Babysitter State
2
+ Last run: 2026-06-20 09:00 UTC
3
+ Open PRs tracked: 0
4
+ Attempt counts: {}
5
+
6
+ ## Watch List
7
+ - <!-- Add open PRs here -->
8
+
9
+ ## Fix History (L2+)
10
+ - <!-- Record attempt count and outcome per PR -->
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: pr-review-triage
3
+ description: >
4
+ Watch open PRs, check CI status, review staleness, merge conflicts,
5
+ and unanswered review comments. Produces a prioritized watchlist.
6
+ user_invocable: true
7
+ ---
8
+
9
+ # PR Review Triage Skill
10
+
11
+ You are a PR babysitter agent. Your job is to track open PRs and surface blockers.
12
+
13
+ ## Inputs
14
+
15
+ - Open PRs (from `gh pr list` or GitHub MCP)
16
+ - Prior state in `pr-babysitter-state.md`
17
+ - CI status for each PR
18
+
19
+ ## Output
20
+
21
+ Update `pr-babysitter-state.md` with:
22
+
23
+ - PRs with red CI
24
+ - PRs with merge conflicts
25
+ - PRs waiting >48h for review
26
+ - PRs with unanswered review comments
27
+ - Top 3 actions for a human
28
+
29
+ ## Rules
30
+
31
+ - Do not edit code in L1 mode.
32
+ - Always check for existing PR on the same intent before pushing.
33
+ - Security/auth/payments changes: flag for human.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: loop-guard
3
+ description: >
4
+ Circuit breaker for fix-capable loops. Before each iteration, append the last
5
+ attempt to loop-ledger.json and run loop-context --check; if it escalates,
6
+ stop and hand the human a clean summary instead of looping in vain.
7
+ user_invocable: true
8
+ ---
9
+
10
+ # Loop Guard (Circuit Breaker)
11
+
12
+ You keep a fix loop from burning tokens on a problem it cannot solve. You wrap
13
+ every iteration of an action skill (`minimal-fix`, `ci-triage`, `dependency-triage`, …)
14
+ with a deterministic circuit-breaker check powered by
15
+ [`loop-context`](https://github.com/cobusgreyling/loop-engineering/tree/main/tools/loop-context).
16
+
17
+ The breaker needs no LLM call, so it is cheap enough to run on every iteration.
18
+
19
+ ## The ledger
20
+
21
+ `loop-ledger.json` records the loop's goal, its pattern/level, and one entry per
22
+ attempt:
23
+
24
+ ```json
25
+ { "goal": "Get failing CI green", "pattern": "ci-sweeper", "level": "L2", "attempts": [] }
26
+ ```
27
+
28
+ `pattern` and `level` are seeded by `loop-init`; the breaker ignores them but the
29
+ budget step below reads them to size `--token-budget` from real cost data.
30
+
31
+ After every iteration, append what you just tried:
32
+
33
+ ```json
34
+ { "iteration": 3, "action": "patch flaky auth test", "outcome": "failure",
35
+ "error": "AssertionError: expected 200 got 500", "tokensUsed": 1800 }
36
+ ```
37
+
38
+ `outcome` is `success | failure | noop`. Always include `error` on failures —
39
+ that is how the breaker detects a repeated (stagnant) failure.
40
+
41
+ ## Size the token budget from the pattern (once per run)
42
+
43
+ Don't hand-type a token cap — derive it from the pattern's realistic per-run
44
+ cost so the breaker trips on genuine cost blowup, not a made-up number.
45
+ [`loop-cost`](https://github.com/cobusgreyling/loop-engineering/tree/main/tools/loop-cost)
46
+ already computes this from `patterns/registry.yaml`; read the loop's `pattern`
47
+ and `level` straight from the ledger:
48
+
49
+ ```bash
50
+ # Substitute the ledger's own pattern/level (here: ci-sweeper / L2).
51
+ BUDGET=$(npx @cobusgreyling/loop-cost --pattern ci-sweeper --level L2 --json \
52
+ | node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>process.stdout.write(String(JSON.parse(d).scenarios.realistic.tokensPerRun)))')
53
+ ```
54
+
55
+ `scenarios.realistic.tokensPerRun` is a rounded integer, so it feeds
56
+ `--token-budget` directly. The two tools stay independent — this is shell
57
+ wiring, not a code dependency.
58
+
59
+ ## Before each iteration
60
+
61
+ 1. Append the previous attempt to `loop-ledger.json`.
62
+ 2. Run the breaker with the resolved budget:
63
+ ```bash
64
+ npx @cobusgreyling/loop-context --check --ledger loop-ledger.json --token-budget "$BUDGET"
65
+ ```
66
+ 3. Act on the exit code:
67
+ - **0** → continue. Optionally trim the next prompt first:
68
+ `npx @cobusgreyling/loop-context --inject --ledger loop-ledger.json`
69
+ - **2** → **STOP.** The breaker tripped — same error N× in a row, too many
70
+ consecutive failures, the token budget, or the iteration cap. Do not retry.
71
+
72
+ ## On escalate (exit 2)
73
+
74
+ 1. Capture a clean, pruned summary for the human:
75
+ ```bash
76
+ npx @cobusgreyling/loop-context --inject --ledger loop-ledger.json > escalation.md
77
+ ```
78
+ 2. Write the escalation into STATE.md High Priority (or open an issue).
79
+ 3. Exit the loop. A human decides the next step.
80
+
81
+ ## Rules
82
+
83
+ - Never widen thresholds just to keep looping — escalation is a feature, not a failure.
84
+ - Never edit the ledger to hide a repeated error; the breaker exists to catch it.
85
+ - Defaults: 3× same error, 5 consecutive failures, 10 iterations. Tune with
86
+ `--stagnation`, `--no-progress`, `--max-iterations`, `--token-budget`.
87
+
88
+ ## Interaction with other skills
89
+
90
+ - `minimal-fix` / `ci-triage` — record each attempt's outcome + error in the ledger.
91
+ - `loop-verifier` — a verifier rejection is a `failure`; log it so repeats trip the breaker.
92
+ - `loop-constraints` — honors "escalate after N attempts"; this skill makes it mechanical.
93
+ - `loop-budget` — the per-run `--token-budget` here comes from loop-cost's
94
+ realistic estimate; loop-budget.md still governs the *daily* cap across runs.
@@ -18,6 +18,7 @@
18
18
  - Never disable tests to make CI green
19
19
  - Never refactor unrelated code — one fix per run
20
20
  - Max 3 fix attempts per item; escalate after
21
+ - Enforce the attempt limit mechanically: log each try to `loop-ledger.json` and run `loop-context --check` before retrying (see the `loop-guard` skill)
21
22
 
22
23
  ## Communication
23
24
  - Always tell me what you're about to do before doing it