@cobusgreyling/loop-init 1.1.0

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 (69) hide show
  1. package/README.md +47 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +296 -0
  4. package/package.json +45 -0
  5. package/starters/README.md +33 -0
  6. package/starters/changelog-drafter/.claude/agents/verifier.md +5 -0
  7. package/starters/changelog-drafter/.claude/skills/changelog-scan/SKILL.md +11 -0
  8. package/starters/changelog-drafter/.claude/skills/draft-release-notes/SKILL.md +11 -0
  9. package/starters/changelog-drafter/.codex/agents/verifier.toml +12 -0
  10. package/starters/changelog-drafter/.codex/skills/changelog-scan/SKILL.md +9 -0
  11. package/starters/changelog-drafter/.codex/skills/draft-release-notes/SKILL.md +9 -0
  12. package/starters/changelog-drafter/.grok/skills/changelog-scan/SKILL.md +53 -0
  13. package/starters/changelog-drafter/.grok/skills/draft-release-notes/SKILL.md +65 -0
  14. package/starters/changelog-drafter/.grok/skills/loop-verifier/SKILL.md +40 -0
  15. package/starters/changelog-drafter/LOOP.md +32 -0
  16. package/starters/changelog-drafter/README.md +48 -0
  17. package/starters/changelog-drafter/changelog-drafter-state.md.example +18 -0
  18. package/starters/ci-sweeper/.claude/agents/loop-verifier.md +35 -0
  19. package/starters/ci-sweeper/.claude/skills/ci-triage/SKILL.md +29 -0
  20. package/starters/ci-sweeper/.codex/agents/verifier.toml +15 -0
  21. package/starters/ci-sweeper/.codex/skills/ci-triage/SKILL.md +29 -0
  22. package/starters/ci-sweeper/.grok/skills/ci-triage/SKILL.md +29 -0
  23. package/starters/ci-sweeper/README.md +27 -0
  24. package/starters/ci-sweeper/ci-sweeper-state.md.example +12 -0
  25. package/starters/dependency-sweeper/.claude/agents/loop-verifier.md +35 -0
  26. package/starters/dependency-sweeper/.claude/skills/dependency-triage/SKILL.md +36 -0
  27. package/starters/dependency-sweeper/.codex/agents/verifier.toml +15 -0
  28. package/starters/dependency-sweeper/.codex/skills/dependency-triage/SKILL.md +36 -0
  29. package/starters/dependency-sweeper/.grok/skills/dependency-triage/SKILL.md +36 -0
  30. package/starters/dependency-sweeper/LOOP.md +30 -0
  31. package/starters/dependency-sweeper/README.md +46 -0
  32. package/starters/dependency-sweeper/dependency-sweeper-state.md.example +23 -0
  33. package/starters/minimal-loop/.grok/skills/loop-triage/SKILL.md +46 -0
  34. package/starters/minimal-loop/LOOP.md +22 -0
  35. package/starters/minimal-loop/README.md +41 -0
  36. package/starters/minimal-loop/STATE.md.example +12 -0
  37. package/starters/minimal-loop-claude/.claude/agents/loop-verifier.md +35 -0
  38. package/starters/minimal-loop-claude/.claude/skills/loop-triage/SKILL.md +46 -0
  39. package/starters/minimal-loop-claude/LOOP.md +32 -0
  40. package/starters/minimal-loop-claude/README.md +42 -0
  41. package/starters/minimal-loop-claude/STATE.md.example +12 -0
  42. package/starters/minimal-loop-codex/.codex/agents/verifier.toml +15 -0
  43. package/starters/minimal-loop-codex/.codex/skills/loop-triage/SKILL.md +46 -0
  44. package/starters/minimal-loop-codex/LOOP.md +32 -0
  45. package/starters/minimal-loop-codex/README.md +49 -0
  46. package/starters/minimal-loop-codex/STATE.md.example +12 -0
  47. package/starters/post-merge-cleanup/.claude/agents/loop-verifier.md +35 -0
  48. package/starters/post-merge-cleanup/.claude/skills/post-merge-scan/SKILL.md +34 -0
  49. package/starters/post-merge-cleanup/.codex/agents/verifier.toml +15 -0
  50. package/starters/post-merge-cleanup/.codex/skills/post-merge-scan/SKILL.md +34 -0
  51. package/starters/post-merge-cleanup/.grok/skills/post-merge-scan/SKILL.md +34 -0
  52. package/starters/post-merge-cleanup/LOOP.md +22 -0
  53. package/starters/post-merge-cleanup/README.md +34 -0
  54. package/starters/post-merge-cleanup/post-merge-state.md.example +22 -0
  55. package/starters/pr-babysitter/.claude/agents/loop-verifier.md +35 -0
  56. package/starters/pr-babysitter/.claude/skills/pr-review-triage/SKILL.md +29 -0
  57. package/starters/pr-babysitter/.codex/agents/verifier.toml +15 -0
  58. package/starters/pr-babysitter/.codex/skills/pr-review-triage/SKILL.md +29 -0
  59. package/starters/pr-babysitter/.grok/skills/pr-review-triage/SKILL.md +29 -0
  60. package/starters/pr-babysitter/LOOP.md +20 -0
  61. package/starters/pr-babysitter/README.md +36 -0
  62. package/starters/pr-babysitter/pr-babysitter-state.md.example +19 -0
  63. package/templates/SKILL.md.loop-triage +54 -0
  64. package/templates/SKILL.md.minimal-fix +45 -0
  65. package/templates/SKILL.md.verifier +48 -0
  66. package/templates/STATE.md.template +22 -0
  67. package/templates/loop-budget.md.template +22 -0
  68. package/templates/loop-run-log.md.template +22 -0
  69. package/templates/pattern-template.md +58 -0
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: pr-review-triage
3
+ description: >
4
+ Triage open pull requests for CI status, review comments, and merge readiness.
5
+ Use in PR babysitter loops. Respects project review norms and required checks.
6
+ user_invocable: true
7
+ ---
8
+
9
+ # PR Review Triage Skill
10
+
11
+ For each watched PR, report:
12
+
13
+ ## Per-PR Output
14
+
15
+ ```markdown
16
+ ### PR #N — title
17
+ - CI: green | red (job names if red)
18
+ - Reviews: approved N | changes requested | none
19
+ - Blocking comments: (list actionable ones)
20
+ - Ready to merge: yes | no — reason
21
+ - Suggested loop action: none | minimal-fix | rebase | escalate-human
22
+ ```
23
+
24
+ ## Rules
25
+
26
+ - "Ready to merge" requires all required checks + approvals per project policy.
27
+ - Non-actionable nits → note but do not spawn fix.
28
+ - If PR idle >4 days → suggest human handoff.
29
+ - High-risk labels (security, breaking) → escalate-human always.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: pr-review-triage
3
+ description: >
4
+ Triage open pull requests for CI status, review comments, and merge readiness.
5
+ Use in PR babysitter loops. Respects project review norms and required checks.
6
+ user_invocable: true
7
+ ---
8
+
9
+ # PR Review Triage Skill
10
+
11
+ For each watched PR, report:
12
+
13
+ ## Per-PR Output
14
+
15
+ ```markdown
16
+ ### PR #N — title
17
+ - CI: green | red (job names if red)
18
+ - Reviews: approved N | changes requested | none
19
+ - Blocking comments: (list actionable ones)
20
+ - Ready to merge: yes | no — reason
21
+ - Suggested loop action: none | minimal-fix | rebase | escalate-human
22
+ ```
23
+
24
+ ## Rules
25
+
26
+ - "Ready to merge" requires all required checks + approvals per project policy.
27
+ - Non-actionable nits → note but do not spawn fix.
28
+ - If PR idle >4 days → suggest human handoff.
29
+ - High-risk labels (security, breaking) → escalate-human always.
@@ -0,0 +1,20 @@
1
+ # Loop Configuration — PR Babysitter
2
+
3
+ | Pattern | Cadence | Status |
4
+ |---------|---------|--------|
5
+ | PR Babysitter | 5m (work hours) | L2 assisted |
6
+
7
+ ## Limits
8
+
9
+ - Max fix attempts per PR: 3
10
+ - Auto-merge: **disabled**
11
+ - Watched: PRs authored by team / label `loop-watch`
12
+
13
+ ## Human Gates
14
+
15
+ - Security, auth, payments, infrastructure
16
+ - PRs with >10 files changed in loop fix
17
+
18
+ ## Pattern
19
+
20
+ [pr-babysitter.md](../../patterns/pr-babysitter.md)
@@ -0,0 +1,36 @@
1
+ # PR Babysitter Starter
2
+
3
+ Scaffold for the [PR Babysitter](../../patterns/pr-babysitter.md) loop (L2 — assisted fixes with verifier).
4
+
5
+ ## Quick Start
6
+
7
+ 1. Copy into your repo:
8
+ ```bash
9
+ npx @cobusgreyling/loop-init . --pattern pr-babysitter --tool grok
10
+ # Or manual:
11
+ cp -r starters/pr-babysitter/.grok/skills/* .grok/skills/
12
+ cp starters/pr-babysitter/pr-babysitter-state.md.example pr-babysitter-state.md
13
+ cp starters/pr-babysitter/LOOP.md .
14
+ ```
15
+
16
+ 2. Customize skills with your review norms and required checks.
17
+
18
+ 3. Start (Grok):
19
+ ```bash
20
+ /loop 5m Check open PRs. Update pr-babysitter-state.md. For CI failures or actionable review comments on allowlisted PRs: worktree + minimal-fix + loop-verifier. Never merge — propose only. Escalate after 3 attempts per PR.
21
+ ```
22
+
23
+ 4. Sign PR comments: `🤖 Loop Engineering — PR Babysitter`
24
+
25
+ ## Files
26
+
27
+ | File | Purpose |
28
+ |------|---------|
29
+ | `pr-babysitter-state.md.example` | Watcher state |
30
+ | `.grok/skills/pr-review-triage/` | PR triage skill |
31
+ | `LOOP.md` | Team loop config |
32
+
33
+ ## Safety
34
+
35
+ - No auto-merge by default
36
+ - Denylist: auth, payments, secrets — see [safety.md](../../docs/safety.md)
@@ -0,0 +1,19 @@
1
+ # PR Babysitter State
2
+
3
+ Last run: never
4
+
5
+ ## Watched PRs
6
+
7
+ <!-- - #1234 (branch-name)
8
+ Status: CI red | changes requested | ready
9
+ Attempts: 0/3
10
+ Last action: —
11
+ Human decision: —
12
+ -->
13
+
14
+ ## Escalated (human required)
15
+
16
+ ## Resolved (last 7d)
17
+
18
+ ---
19
+ Run log: —
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: loop-triage
3
+ description: >
4
+ Triage recent changes, CI failures, issues, and conversations.
5
+ Produces a concise, actionable findings report suitable for a loop to consume.
6
+ Writes structured output to a state file or Linear board.
7
+ user_invocable: true
8
+ ---
9
+
10
+ # Loop Triage Skill
11
+
12
+ You are an expert engineering triage agent. Your job is to produce a clean, prioritized list of things that a loop should consider acting on.
13
+
14
+ ## Inputs (the loop will provide these)
15
+ - Recent CI / test failures (last 24h)
16
+ - Open issues / Linear tickets assigned to the team
17
+ - Recent commits on main (last 24–48h)
18
+ - Any Slack / chat threads the loop has visibility into
19
+ - The current state file (what the loop already knows about)
20
+
21
+ ## Output Format
22
+
23
+ Produce a markdown report with these sections:
24
+
25
+ ### 1. High-Priority Items (act on these)
26
+ - Clear, one-line description
27
+ - Why it matters (impact, risk, or customer pain)
28
+ - Suggested next action for the loop (e.g. "draft minimal fix in isolated worktree")
29
+ - Rough effort estimate
30
+
31
+ ### 2. Watch Items (monitor, do not act yet)
32
+ - Same format but lower urgency
33
+
34
+ ### 3. Noise / Ignore
35
+ - Brief list of things the loop looked at and decided were not worth action
36
+
37
+ ### 4. State Updates
38
+ - Any facts the loop should remember for the next run (e.g. "PR #1234 now has 2 approvals")
39
+
40
+ ## Rules
41
+
42
+ - Be brutally concise. The loop (and the human reading the state) will thank you.
43
+ - Only put something in "High-Priority" if a reasonable engineer would want to know about it today.
44
+ - When in doubt, put it in Watch or Noise rather than creating work.
45
+ - Never propose architectural overhauls during triage — this skill is for signal, not invention.
46
+ - Respect the project's existing skills and conventions (they will be provided in context).
47
+
48
+ ## Example Invocation (in a Grok loop)
49
+
50
+ ```
51
+ /loop 30m Call $loop-triage and append the high-priority items to STATE.md. For any high-priority item that looks like a small bugfix, open a worktree and spawn a minimal-fix sub-agent.
52
+ ```
53
+
54
+ The triage skill should be the "eyes" of the loop. Keep it focused and honest.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: minimal-fix
3
+ description: >
4
+ Produce the smallest possible code change that fixes a specific, well-scoped
5
+ issue (CI failure, reviewer comment, typo). Use only when the fix target is
6
+ explicit. Never refactor unrelated code.
7
+ user_invocable: true
8
+ ---
9
+
10
+ # Minimal Fix Skill
11
+
12
+ You fix **one specific problem** with the **smallest diff** that could work.
13
+
14
+ ## Inputs
15
+
16
+ - Exact failure message, reviewer comment, or issue description
17
+ - File(s) implicated (if known)
18
+ - Project build/test commands (from AGENTS.md or project skills)
19
+ - Path denylist (from loop safety policy — never edit `.env`, `auth/`, `payments/`, secrets)
20
+
21
+ ## Process
22
+
23
+ 1. Reproduce or confirm the failure locally if possible.
24
+ 2. Identify the minimal root cause — not symptoms in distant files.
25
+ 3. Change only what is required. No drive-by refactors.
26
+ 4. Run tests/lint relevant to the change.
27
+ 5. Summarize: what changed, why, what you ran.
28
+
29
+ ## Output
30
+
31
+ ```markdown
32
+ ## Minimal Fix Proposal
33
+ - Target: (issue/comment/failure)
34
+ - Files changed: (list)
35
+ - Diff summary: (1-3 bullets)
36
+ - Tests run: (commands + result)
37
+ - Risk: low | medium — if medium, recommend human review
38
+ ```
39
+
40
+ ## Rules
41
+
42
+ - If fix requires >5 files or design change → stop and escalate.
43
+ - If path is on denylist → stop and escalate.
44
+ - Do not disable tests or weaken assertions to go green.
45
+ - Do not mark yourself "done" — verifier decides.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: loop-verifier
3
+ description: >
4
+ Independent verification agent for loop-produced changes. Finds reasons to
5
+ reject. Runs tests. Confirms diff scope. Use after minimal-fix or any
6
+ implementer sub-agent — never in the same role as the implementer.
7
+ user_invocable: true
8
+ ---
9
+
10
+ # Loop Verifier Skill
11
+
12
+ You are the **checker** in a maker/checker split. Your job is to **reject** unless evidence is strong.
13
+
14
+ ## Inputs
15
+
16
+ - Implementer's proposal summary and diff
17
+ - Original issue / CI failure / comment being addressed
18
+ - Project test/lint commands
19
+ - Allowed file scope (if specified by the loop)
20
+
21
+ ## Checklist (all must pass for APPROVE)
22
+
23
+ 1. **Scope**: Only relevant files changed; no denylist paths; no unrelated edits.
24
+ 2. **Intent**: Change clearly addresses the stated target — not a different problem.
25
+ 3. **Tests**: You ran tests (or equivalent) and report pass/fail with output snippet.
26
+ 4. **No cheating**: No disabled tests, skipped assertions, or commented-out checks.
27
+ 5. **Risk**: For medium+ risk, recommend human review even if tests pass.
28
+
29
+ ## Output
30
+
31
+ ```markdown
32
+ ## Verdict: APPROVE | REJECT | ESCALATE_HUMAN
33
+
34
+ ### Evidence
35
+ - Tests: (command + result)
36
+ - Scope check: (pass/fail + notes)
37
+
38
+ ### If REJECT
39
+ - Reasons: (numbered, specific)
40
+ - Suggested next step for implementer
41
+ ```
42
+
43
+ ## Rules
44
+
45
+ - Default stance: REJECT until proven otherwise.
46
+ - Do not trust implementer's claim that tests passed — run them.
47
+ - If you cannot run tests (env issue) → ESCALATE_HUMAN.
48
+ - Be concise. The loop and human read this under time pressure.
@@ -0,0 +1,22 @@
1
+ # Loop State — {{PROJECT_NAME}}
2
+
3
+ Last run: (set by loop on each run)
4
+
5
+ ## High Priority (loop is acting or waiting on human)
6
+
7
+ <!-- Format:
8
+ - [ ] ID — one-line description
9
+ Loop action: what the loop did last
10
+ Human decision: (if any)
11
+ -->
12
+
13
+ ## Watch List
14
+
15
+ <!-- Items to monitor but not act on yet -->
16
+
17
+ ## Recent Noise (ignored this run)
18
+
19
+ <!-- Brief list — helps tune triage skill -->
20
+
21
+ ---
22
+ Run log: (timestamp) | findings | actions | escalations
@@ -0,0 +1,22 @@
1
+ # Loop Budget — YOUR_PROJECT
2
+
3
+ ## Daily limits
4
+
5
+ | Loop | Max runs/day | Max tokens/day | Max sub-agent spawns/run |
6
+ |------|--------------|----------------|--------------------------|
7
+ | Daily Triage | 2 | 100k | 0 (L1) / 2 (L2) |
8
+ | PR Babysitter | 288 | 2M | 3 |
9
+ | CI Sweeper | 96 | 1M | 3 |
10
+ | Dependency Sweeper | 4 | 500k | 3 |
11
+ | Post-Merge Cleanup | 1 | 200k | 2 |
12
+
13
+ ## On budget exceed
14
+
15
+ 1. Pause all schedulers (`scheduler_delete` or disable automations)
16
+ 2. Append event to `loop-run-log.md`
17
+ 3. Notify human (Slack / issue / STATE.md High Priority)
18
+
19
+ ## Kill switch
20
+
21
+ - Command or issue label: `loop-pause-all`
22
+ - Resume only after human clears the flag in STATE.md
@@ -0,0 +1,22 @@
1
+ # Loop Run Log — YOUR_PROJECT
2
+
3
+ Append one entry per run. Prune entries older than 30 days.
4
+
5
+ ## Format
6
+
7
+ ```json
8
+ {
9
+ "run_id": "2026-06-09T08:15:00Z",
10
+ "pattern": "daily-triage",
11
+ "duration_s": 45,
12
+ "items_found": 4,
13
+ "actions_taken": 1,
14
+ "escalations": 0,
15
+ "tokens_estimate": 52000,
16
+ "outcome": "report-only | fix-proposed | escalated | no-op"
17
+ }
18
+ ```
19
+
20
+ ## Recent Runs
21
+
22
+ <!-- Loop appends below this line -->
@@ -0,0 +1,58 @@
1
+ # {{PATTERN_NAME}} Loop
2
+
3
+ **Goal**: {{ONE_SENTENCE_GOAL}}
4
+
5
+ ## Scheduling
6
+
7
+ **Recommended**:
8
+ - Grok: `{{GROK_COMMAND}}`
9
+ - Claude Code: `{{CLAUDE_COMMAND}}`
10
+ - Codex: {{CODEX_DESCRIPTION}}
11
+ - GitHub Actions: see `examples/github-actions/{{FILE}}.yml`
12
+
13
+ ## Required Skills
14
+
15
+ - `{{SKILL_1}}` — {{DESCRIPTION}}
16
+ - `{{SKILL_2}}` — {{DESCRIPTION}}
17
+
18
+ ## State
19
+
20
+ Filename: `{{STATE_FILE}}`
21
+
22
+ ```markdown
23
+ <!-- Minimal example schema -->
24
+ ```
25
+
26
+ ## How the Loop Runs (Typical Cycle)
27
+
28
+ 1. {{STEP_1}}
29
+ 2. {{STEP_2}}
30
+ 3. {{STEP_3}}
31
+
32
+ ## Verification Strategy
33
+
34
+ - {{VERIFIER_RULES}}
35
+
36
+ ## Human Handoff Points
37
+
38
+ - {{GATE_1}}
39
+ - {{GATE_2}}
40
+
41
+ ## Tool-Specific Notes
42
+
43
+ **Grok Build TUI**: {{NOTES}}
44
+
45
+ **Claude Code**: {{NOTES}}
46
+
47
+ **Codex**: {{NOTES}}
48
+
49
+ ## Failure Modes & Mitigations
50
+
51
+ | Failure | Mitigation |
52
+ |---------|------------|
53
+ | {{FAILURE}} | {{MITIGATION}} |
54
+
55
+ ## Success Metrics
56
+
57
+ - {{METRIC_1}}
58
+ - {{METRIC_2}}