@cobusgreyling/loop-init 1.3.1 → 1.3.2
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.
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/starters/README.md +6 -0
- package/starters/changelog-drafter-opencode/AGENTS.md +15 -0
- package/starters/changelog-drafter-opencode/LOOP.md +26 -0
- package/starters/changelog-drafter-opencode/README.md +44 -0
- package/starters/changelog-drafter-opencode/changelog-drafter-state.md.example +10 -0
- package/starters/changelog-drafter-opencode/opencode.json.example +35 -0
- package/starters/changelog-drafter-opencode/skills/changelog-scan/SKILL.md +38 -0
- package/starters/ci-sweeper-opencode/AGENTS.md +17 -0
- package/starters/ci-sweeper-opencode/LOOP.md +26 -0
- package/starters/ci-sweeper-opencode/README.md +43 -0
- package/starters/ci-sweeper-opencode/ci-sweeper-state.md.example +10 -0
- package/starters/ci-sweeper-opencode/opencode.json.example +35 -0
- package/starters/ci-sweeper-opencode/skills/ci-triage/SKILL.md +32 -0
- package/starters/dependency-sweeper-opencode/AGENTS.md +15 -0
- package/starters/dependency-sweeper-opencode/LOOP.md +27 -0
- package/starters/dependency-sweeper-opencode/README.md +44 -0
- package/starters/dependency-sweeper-opencode/dependency-sweeper-state.md.example +11 -0
- package/starters/dependency-sweeper-opencode/opencode.json.example +35 -0
- package/starters/dependency-sweeper-opencode/skills/dependency-triage/SKILL.md +35 -0
- package/starters/issue-triage-opencode/AGENTS.md +16 -0
- package/starters/issue-triage-opencode/LOOP.md +21 -0
- package/starters/issue-triage-opencode/README.md +43 -0
- package/starters/issue-triage-opencode/issue-triage-state.md.example +11 -0
- package/starters/issue-triage-opencode/opencode.json.example +35 -0
- package/starters/issue-triage-opencode/skills/issue-triage/SKILL.md +33 -0
- package/starters/post-merge-cleanup-opencode/AGENTS.md +15 -0
- package/starters/post-merge-cleanup-opencode/LOOP.md +26 -0
- package/starters/post-merge-cleanup-opencode/README.md +44 -0
- package/starters/post-merge-cleanup-opencode/opencode.json.example +35 -0
- package/starters/post-merge-cleanup-opencode/post-merge-state.md.example +10 -0
- package/starters/post-merge-cleanup-opencode/skills/post-merge-scan/SKILL.md +34 -0
- package/starters/pr-babysitter-opencode/AGENTS.md +18 -0
- package/starters/pr-babysitter-opencode/LOOP.md +27 -0
- package/starters/pr-babysitter-opencode/README.md +44 -0
- package/starters/pr-babysitter-opencode/opencode.json.example +35 -0
- package/starters/pr-babysitter-opencode/pr-babysitter-state.md.example +10 -0
- package/starters/pr-babysitter-opencode/skills/pr-review-triage/SKILL.md +33 -0
package/dist/cli.js
CHANGED
|
@@ -361,7 +361,7 @@ Examples:
|
|
|
361
361
|
const targetDir = path.resolve(target);
|
|
362
362
|
const baseStarter = PATTERN_STARTERS[pattern];
|
|
363
363
|
const suffix = TOOL_SUFFIX[tool];
|
|
364
|
-
const starterName =
|
|
364
|
+
const starterName = `${baseStarter}${suffix}`;
|
|
365
365
|
const startersRoot = await resolveBundledOrMonorepo('starters');
|
|
366
366
|
const templatesRoot = await resolveBundledOrMonorepo('templates');
|
|
367
367
|
const starterRoot = path.join(startersRoot, starterName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobusgreyling/loop-init",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Scaffold loop engineering patterns and starters into any project. Supports Grok, Claude Code, Codex, Opencode and more. npx @cobusgreyling/loop-init . --pattern daily-triage --tool opencode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/starters/README.md
CHANGED
|
@@ -21,11 +21,17 @@ npx @cobusgreyling/loop-init . -p pr-babysitter -t claude
|
|
|
21
21
|
| Starter | Pattern | Tools | Readiness |
|
|
22
22
|
|---------|---------|-------|-----------|
|
|
23
23
|
| [pr-babysitter](./pr-babysitter/) | PR Babysitter | Grok, Claude, Codex | L2 assisted |
|
|
24
|
+
| [pr-babysitter-opencode](./pr-babysitter-opencode/) | PR Babysitter | Opencode | L1 → L2 |
|
|
24
25
|
| [ci-sweeper](./ci-sweeper/) | CI Sweeper | Grok, Claude, Codex | L2 assisted |
|
|
26
|
+
| [ci-sweeper-opencode](./ci-sweeper-opencode/) | CI Sweeper | Opencode | L2 cautious |
|
|
25
27
|
| [dependency-sweeper](./dependency-sweeper/) | Dependency Sweeper | Grok, Claude, Codex | L2 patch-only |
|
|
28
|
+
| [dependency-sweeper-opencode](./dependency-sweeper-opencode/) | Dependency Sweeper | Opencode | L2 patch-only |
|
|
26
29
|
| [post-merge-cleanup](./post-merge-cleanup/) | Post-Merge Cleanup | Grok, Claude, Codex | L1 → L2 |
|
|
30
|
+
| [post-merge-cleanup-opencode](./post-merge-cleanup-opencode/) | Post-Merge Cleanup | Opencode | L1 → L2 |
|
|
27
31
|
| [changelog-drafter](./changelog-drafter/) | Changelog Drafter | Grok, Claude, Codex | L1 draft → L2 |
|
|
32
|
+
| [changelog-drafter-opencode](./changelog-drafter-opencode/) | Changelog Drafter | Opencode | L1 draft → L2 |
|
|
28
33
|
| [issue-triage](./issue-triage/) | Issue Triage | Grok, Claude, Codex | L1 propose-only |
|
|
34
|
+
| [issue-triage-opencode](./issue-triage-opencode/) | Issue Triage | Opencode | L1 propose-only |
|
|
29
35
|
|
|
30
36
|
After copying:
|
|
31
37
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# AGENTS.md — Changelog Drafter (Opencode)
|
|
2
|
+
|
|
3
|
+
## Loop Mode
|
|
4
|
+
- L1 report + draft for the first 1-2 weeks.
|
|
5
|
+
- Read `changelog-drafter-state.md` before every run.
|
|
6
|
+
- Human approves every draft before any publish or PR.
|
|
7
|
+
|
|
8
|
+
## Safety
|
|
9
|
+
- Never create tags, GitHub releases, or update CHANGELOG.md without explicit human approval.
|
|
10
|
+
- Breaking changes and security items must be surfaced explicitly.
|
|
11
|
+
- Draft PRs only when L2 is enabled — never auto-merge.
|
|
12
|
+
|
|
13
|
+
## Verification
|
|
14
|
+
- Verifier checks draft completeness: categories, date range, links.
|
|
15
|
+
- Record draft status and human feedback in state.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Loop Configuration — Changelog Drafter (Opencode)
|
|
2
|
+
|
|
3
|
+
## Active Loops
|
|
4
|
+
|
|
5
|
+
| Pattern | Cadence | Status | Command |
|
|
6
|
+
|---------|---------|--------|---------|
|
|
7
|
+
| Changelog Drafter | 1d or on release prep | L1 draft-only | `opencode run "Run changelog-scan"` via cron (after merges settle) |
|
|
8
|
+
|
|
9
|
+
## Human Gates
|
|
10
|
+
- Breaking changes always human review.
|
|
11
|
+
- Security notes / CVEs human must approve wording.
|
|
12
|
+
- No tags, no PRs, no publishes without explicit approval.
|
|
13
|
+
- First 3 releases: human approves full draft.
|
|
14
|
+
|
|
15
|
+
## Budget
|
|
16
|
+
- Max sub-agent spawns per run: 2 (scanner + drafter).
|
|
17
|
+
- Prefer running after merges settle (evening).
|
|
18
|
+
|
|
19
|
+
## Output Convention
|
|
20
|
+
- Draft: `RELEASE_NOTES_DRAFT.md` at repo root.
|
|
21
|
+
- State: `changelog-drafter-state.md`.
|
|
22
|
+
|
|
23
|
+
## Links
|
|
24
|
+
- Pattern: [changelog-drafter](../../patterns/changelog-drafter.md)
|
|
25
|
+
- Example: [examples/opencode/changelog-drafter.md](../../examples/opencode/changelog-drafter.md)
|
|
26
|
+
- Safety: [docs/safety.md](../../docs/safety.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Changelog Drafter — Opencode Starter
|
|
2
|
+
|
|
3
|
+
Clone-and-run scaffold for the **Changelog Drafter** pattern with opencode. Scan merged PRs and commits, produce categorized release notes.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @cobusgreyling/loop-init . --pattern changelog-drafter --tool opencode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or copy manually:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cp -r starters/changelog-drafter-opencode/skills .
|
|
15
|
+
cp starters/changelog-drafter-opencode/AGENTS.md .
|
|
16
|
+
cp starters/changelog-drafter-opencode/LOOP.md .
|
|
17
|
+
cp starters/changelog-drafter-opencode/changelog-drafter-state.md.example changelog-drafter-state.md
|
|
18
|
+
cp starters/changelog-drafter-opencode/opencode.json.example opencode.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Start (L1 report + draft, week 1):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
opencode run \
|
|
25
|
+
"Run skills/changelog-scan/SKILL.md. Scan merges since last tag (or last 7 days). Produce categorized draft in RELEASE_NOTES_DRAFT.md. Update state. Do not publish or create PRs." \
|
|
26
|
+
--title "Changelog drafter"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What's Included
|
|
30
|
+
|
|
31
|
+
| File | Purpose |
|
|
32
|
+
|------|---------|
|
|
33
|
+
| `changelog-drafter-state.md.example` | State spine (last release, draft status) |
|
|
34
|
+
| `skills/changelog-scan/SKILL.md` | Merge scan and categorization 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/changelog-drafter.md](../../patterns/changelog-drafter.md)
|
|
42
|
+
- [examples/opencode/changelog-drafter.md](../../examples/opencode/changelog-drafter.md)
|
|
43
|
+
- [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
|
|
44
|
+
- [stories/changelog-drafter-week-one.md](../../stories/changelog-drafter-week-one.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"agent": {
|
|
4
|
+
"changelog-scan": {
|
|
5
|
+
"name": "changelog-scan",
|
|
6
|
+
"description": "Changelog drafting loop. Reads changelog-drafter-state.md, scans merges, and produces categorized release notes.",
|
|
7
|
+
"mode": "primary",
|
|
8
|
+
"prompt": "Read AGENTS.md, LOOP.md, changelog-drafter-state.md, and skills/changelog-scan/SKILL.md. Scan merges since last tag. Produce categorized draft in RELEASE_NOTES_DRAFT.md. Never publish or tag without human approval.",
|
|
9
|
+
"permission": {
|
|
10
|
+
"bash": "ask",
|
|
11
|
+
"edit": "ask"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"implementer": {
|
|
15
|
+
"name": "implementer",
|
|
16
|
+
"description": "L2 implementer for creating changelog PRs.",
|
|
17
|
+
"mode": "subagent",
|
|
18
|
+
"prompt": "Commit the approved release notes to a new branch and open a draft PR. Flag breaking changes and security items explicitly in the PR body. Do not merge.",
|
|
19
|
+
"permission": {
|
|
20
|
+
"bash": "ask",
|
|
21
|
+
"edit": "ask"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"verifier": {
|
|
25
|
+
"name": "verifier",
|
|
26
|
+
"description": "Checker agent for draft release notes. APPROVE or REJECT only.",
|
|
27
|
+
"mode": "subagent",
|
|
28
|
+
"prompt": "Review the draft notes for completeness, categorization, and correct date range. Flag missing sections. Do not edit. APPROVE or REJECT.",
|
|
29
|
+
"permission": {
|
|
30
|
+
"bash": "ask",
|
|
31
|
+
"edit": "deny"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: changelog-scan
|
|
3
|
+
description: >
|
|
4
|
+
Scan merged PRs and commits since a given reference, extract
|
|
5
|
+
titles, labels, types, and signals. Produces structured input
|
|
6
|
+
for release notes drafting.
|
|
7
|
+
user_invocable: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Changelog Scan Skill
|
|
11
|
+
|
|
12
|
+
You are a changelog drafting agent. Scan merges and produce release notes.
|
|
13
|
+
|
|
14
|
+
## Scan Sources
|
|
15
|
+
|
|
16
|
+
- `git log --merges --oneline <last-tag>..HEAD`
|
|
17
|
+
- PR labels and milestones
|
|
18
|
+
- Commit messages since last tag
|
|
19
|
+
|
|
20
|
+
## Categories
|
|
21
|
+
|
|
22
|
+
- Features
|
|
23
|
+
- Bug fixes
|
|
24
|
+
- Documentation
|
|
25
|
+
- Dependencies
|
|
26
|
+
- Breaking changes
|
|
27
|
+
- Security
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
|
|
31
|
+
- Categorized draft in `RELEASE_NOTES_DRAFT.md`
|
|
32
|
+
- Update `changelog-drafter-state.md` with scan window
|
|
33
|
+
|
|
34
|
+
## Rules
|
|
35
|
+
|
|
36
|
+
- Never publish or tag without explicit human approval.
|
|
37
|
+
- Surface breaking changes and security items explicitly.
|
|
38
|
+
- L1: draft only — no PRs, no tags.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# AGENTS.md — CI Sweeper (Opencode)
|
|
2
|
+
|
|
3
|
+
## Loop Mode
|
|
4
|
+
- CI sweeper is L2 from week one (action-oriented — CIs are urgent).
|
|
5
|
+
- Read `ci-sweeper-state.md` before every run.
|
|
6
|
+
- Classify failures before attempting any fix.
|
|
7
|
+
|
|
8
|
+
## Safety
|
|
9
|
+
- Always dispatch into a git worktree per attempt.
|
|
10
|
+
- Infra / security / payments test failures: do not auto-fix; flag and stop.
|
|
11
|
+
- Max 3 fix attempts per item; escalate after.
|
|
12
|
+
- Enforce budget cap from `LOOP.md`.
|
|
13
|
+
|
|
14
|
+
## Verification
|
|
15
|
+
- Verifier must run tests after implementer.
|
|
16
|
+
- Record attempt count in `ci-sweeper-state.md`.
|
|
17
|
+
- No auto-merge without verifier approval.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Loop Configuration — CI Sweeper (Opencode)
|
|
2
|
+
|
|
3
|
+
## Active Loops
|
|
4
|
+
|
|
5
|
+
| Pattern | Cadence | Status | Command |
|
|
6
|
+
|---------|---------|--------|---------|
|
|
7
|
+
| CI Sweeper | 5-15m | L2 cautious | `opencode run "Run ci-triage" --agent loop-triage` via cron/systemd |
|
|
8
|
+
|
|
9
|
+
## Human Gates
|
|
10
|
+
- Infra / security / payments test failures: do not auto-fix.
|
|
11
|
+
- Max 3 fix attempts per item; escalate after.
|
|
12
|
+
- No auto-merge without verifier pass.
|
|
13
|
+
|
|
14
|
+
## Worktrees
|
|
15
|
+
- Always dispatch into a git worktree per attempt.
|
|
16
|
+
- One worktree per fix; discard after REJECT.
|
|
17
|
+
|
|
18
|
+
## Budget
|
|
19
|
+
- Max sub-agent spawns per run: 3.
|
|
20
|
+
- Max auto-PRs per day: 5.
|
|
21
|
+
- Early exit if no failures found.
|
|
22
|
+
|
|
23
|
+
## Links
|
|
24
|
+
- Pattern: [ci-sweeper](../../patterns/ci-sweeper.md)
|
|
25
|
+
- Example: [examples/opencode/ci-sweeper.md](../../examples/opencode/ci-sweeper.md)
|
|
26
|
+
- Safety: [docs/safety.md](../../docs/safety.md)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# CI Sweeper — Opencode Starter
|
|
2
|
+
|
|
3
|
+
Clone-and-run scaffold for the **CI Sweeper** pattern with opencode. React to failing CI with minimal fixes at short cadences.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @cobusgreyling/loop-init . --pattern ci-sweeper --tool opencode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or copy manually:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cp -r starters/ci-sweeper-opencode/skills .
|
|
15
|
+
cp starters/ci-sweeper-opencode/AGENTS.md .
|
|
16
|
+
cp starters/ci-sweeper-opencode/LOOP.md .
|
|
17
|
+
cp starters/ci-sweeper-opencode/ci-sweeper-state.md.example ci-sweeper-state.md
|
|
18
|
+
cp starters/ci-sweeper-opencode/opencode.json.example opencode.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Start (L2 cautious — CI sweeper is action-oriented from week one):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
opencode run \
|
|
25
|
+
"Run skills/ci-triage/SKILL.md. Classify each failing check. For clear single-file regressions, create a worktree and apply a minimal fix with verifier. Update ci-sweeper-state.md. Infra and security failures: escalate." \
|
|
26
|
+
--title "CI sweeper"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What's Included
|
|
30
|
+
|
|
31
|
+
| File | Purpose |
|
|
32
|
+
|------|---------|
|
|
33
|
+
| `ci-sweeper-state.md.example` | State spine (in-flight CI failures) |
|
|
34
|
+
| `skills/ci-triage/SKILL.md` | CI-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/ci-sweeper.md](../../patterns/ci-sweeper.md)
|
|
42
|
+
- [examples/opencode/ci-sweeper.md](../../examples/opencode/ci-sweeper.md)
|
|
43
|
+
- [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"agent": {
|
|
4
|
+
"ci-triage": {
|
|
5
|
+
"name": "ci-triage",
|
|
6
|
+
"description": "CI-focused triage and fix loop. Reads ci-sweeper-state.md, classifies CI failures, and applies minimal fixes in worktrees with verifier.",
|
|
7
|
+
"mode": "primary",
|
|
8
|
+
"prompt": "Read AGENTS.md, LOOP.md, ci-sweeper-state.md, and skills/ci-triage/SKILL.md. Classify each failing check. For clear regressions: worktree + implementer + verifier. Escalate infra and security failures.",
|
|
9
|
+
"permission": {
|
|
10
|
+
"bash": "ask",
|
|
11
|
+
"edit": "ask"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"implementer": {
|
|
15
|
+
"name": "implementer",
|
|
16
|
+
"description": "L2 implementer for CI-fix patches inside an isolated worktree.",
|
|
17
|
+
"mode": "subagent",
|
|
18
|
+
"prompt": "Implement the minimal fix for the identified CI failure inside the supplied worktree. Run tests. Output the diff path. Max 3 attempts per item.",
|
|
19
|
+
"permission": {
|
|
20
|
+
"bash": "ask",
|
|
21
|
+
"edit": "ask"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"verifier": {
|
|
25
|
+
"name": "verifier",
|
|
26
|
+
"description": "Checker agent for CI fix diffs. APPROVE or REJECT only.",
|
|
27
|
+
"mode": "subagent",
|
|
28
|
+
"prompt": "Review the supplied CI-fix diff. Verify tests pass. Do not edit files. APPROVE or REJECT with evidence.",
|
|
29
|
+
"permission": {
|
|
30
|
+
"bash": "ask",
|
|
31
|
+
"edit": "deny"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ci-triage
|
|
3
|
+
description: >
|
|
4
|
+
Classify CI failures — distinguish clear regressions from infra flakes
|
|
5
|
+
and security-test failures. Produces structured failure reports.
|
|
6
|
+
user_invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# CI Triage Skill
|
|
10
|
+
|
|
11
|
+
You are a CI triage agent. Classify each failing check and decide the next action.
|
|
12
|
+
|
|
13
|
+
## Classification
|
|
14
|
+
|
|
15
|
+
- **Clear regression**: single-file, obvious root cause (candidate for auto-fix)
|
|
16
|
+
- **Infra flake**: network timeout, runner issue, dependency unavailable
|
|
17
|
+
- **Security test failure**: never auto-fix; escalate to human
|
|
18
|
+
- **Non-deterministic**: retry once before classifying
|
|
19
|
+
|
|
20
|
+
## Output
|
|
21
|
+
|
|
22
|
+
Update `ci-sweeper-state.md` with:
|
|
23
|
+
|
|
24
|
+
- List of failures by category
|
|
25
|
+
- Suggested next action per item
|
|
26
|
+
- Attempt count per item
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
- Infra and security failures always escalate.
|
|
31
|
+
- Max 3 fix attempts per item.
|
|
32
|
+
- Worktree isolation required for any code change.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# AGENTS.md — Dependency Sweeper (Opencode)
|
|
2
|
+
|
|
3
|
+
## Loop Mode
|
|
4
|
+
- L2 assisted from week one (patch-only with strong verifier gates).
|
|
5
|
+
- Read `dependency-sweeper-state.md` before every run.
|
|
6
|
+
|
|
7
|
+
## Safety
|
|
8
|
+
- Patch-only by default. Majors and breaking changes escalate to human.
|
|
9
|
+
- Maintain denylist in state file — never touch those packages.
|
|
10
|
+
- One worktree per update attempt.
|
|
11
|
+
- Max 3 fix attempts per run; max 5 auto-PRs per day.
|
|
12
|
+
|
|
13
|
+
## Verification
|
|
14
|
+
- Verifier must run `npm ci && npm test` (or equivalent).
|
|
15
|
+
- Record attempt count and test evidence in state.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Loop Configuration — Dependency Sweeper (Opencode)
|
|
2
|
+
|
|
3
|
+
## Active Loops
|
|
4
|
+
|
|
5
|
+
| Pattern | Cadence | Status | Command |
|
|
6
|
+
|---------|---------|--------|---------|
|
|
7
|
+
| Dependency Sweeper | 6h | L2 patch-only | `opencode run "Run dependency-triage" --agent loop-triage` via cron |
|
|
8
|
+
|
|
9
|
+
## Human Gates
|
|
10
|
+
- Major version bumps always human.
|
|
11
|
+
- High-severity CVE requiring breaking change: human.
|
|
12
|
+
- Denylist packages (edit in state) never auto-touched.
|
|
13
|
+
- No auto-merge without verifier pass.
|
|
14
|
+
|
|
15
|
+
## Worktrees
|
|
16
|
+
- One worktree per package update attempt.
|
|
17
|
+
- Discard on REJECT or human escalation.
|
|
18
|
+
|
|
19
|
+
## Budget
|
|
20
|
+
- Max sub-agent spawns per run: 3.
|
|
21
|
+
- Max auto-PRs per day: 5.
|
|
22
|
+
- Pause if token budget exceeded.
|
|
23
|
+
|
|
24
|
+
## Links
|
|
25
|
+
- Pattern: [dependency-sweeper](../../patterns/dependency-sweeper.md)
|
|
26
|
+
- Example: [examples/opencode/dependency-sweeper.md](../../examples/opencode/dependency-sweeper.md)
|
|
27
|
+
- Safety: [docs/safety.md](../../docs/safety.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Dependency Sweeper — Opencode Starter
|
|
2
|
+
|
|
3
|
+
Clone-and-run scaffold for the **Dependency Sweeper** pattern with opencode. Discover, safely apply, and verify dependency updates.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @cobusgreyling/loop-init . --pattern dependency-sweeper --tool opencode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or copy manually:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cp -r starters/dependency-sweeper-opencode/skills .
|
|
15
|
+
cp starters/dependency-sweeper-opencode/AGENTS.md .
|
|
16
|
+
cp starters/dependency-sweeper-opencode/LOOP.md .
|
|
17
|
+
cp starters/dependency-sweeper-opencode/dependency-sweeper-state.md.example dependency-sweeper-state.md
|
|
18
|
+
cp starters/dependency-sweeper-opencode/opencode.json.example opencode.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Start (L2 assisted, patch-only):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
opencode run \
|
|
25
|
+
"Run skills/dependency-triage/SKILL.md. Scan package manifests for outdated and vulnerable deps. Patch-only auto-fix in worktree with verifier. Escalate majors, high-sev CVEs, and denylist packages. Update state." \
|
|
26
|
+
--title "Dependency sweeper"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What's Included
|
|
30
|
+
|
|
31
|
+
| File | Purpose |
|
|
32
|
+
|------|---------|
|
|
33
|
+
| `dependency-sweeper-state.md.example` | State spine (in-flight updates, denylist) |
|
|
34
|
+
| `skills/dependency-triage/SKILL.md` | Dependency-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/dependency-sweeper.md](../../patterns/dependency-sweeper.md)
|
|
42
|
+
- [examples/opencode/dependency-sweeper.md](../../examples/opencode/dependency-sweeper.md)
|
|
43
|
+
- [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
|
|
44
|
+
- [stories/dependency-sweeper-week-one.md](../../stories/dependency-sweeper-week-one.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Dependency Sweeper State
|
|
2
|
+
Last run: 2026-06-20 09:00 UTC
|
|
3
|
+
Outdated packages: 0
|
|
4
|
+
Attempt counts: {}
|
|
5
|
+
Auto-PRs today: 0
|
|
6
|
+
|
|
7
|
+
## Denylist (never touch)
|
|
8
|
+
- <!-- Add packages the loop must never update -->
|
|
9
|
+
|
|
10
|
+
## Escalated to Human
|
|
11
|
+
- <!-- Major bumps and high-sev CVEs -->
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"agent": {
|
|
4
|
+
"dependency-triage": {
|
|
5
|
+
"name": "dependency-triage",
|
|
6
|
+
"description": "Dependency-focused triage loop. Reads dependency-sweeper-state.md, scans manifests, and applies patch-only upgrades with verifier.",
|
|
7
|
+
"mode": "primary",
|
|
8
|
+
"prompt": "Read AGENTS.md, LOOP.md, dependency-sweeper-state.md, and skills/dependency-triage/SKILL.md. Scan manifests for outdated and vulnerable deps. Patch-only auto-fix in worktree. Escalate majors and denylisted packages.",
|
|
9
|
+
"permission": {
|
|
10
|
+
"bash": "ask",
|
|
11
|
+
"edit": "ask"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"implementer": {
|
|
15
|
+
"name": "implementer",
|
|
16
|
+
"description": "L2 implementer for patch-only dependency upgrades in a worktree.",
|
|
17
|
+
"mode": "subagent",
|
|
18
|
+
"prompt": "Apply the identified patch-only upgrade inside the supplied worktree. Run npm ci && npm test. Never touch denylisted packages. Output the diff.",
|
|
19
|
+
"permission": {
|
|
20
|
+
"bash": "ask",
|
|
21
|
+
"edit": "ask"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"verifier": {
|
|
25
|
+
"name": "verifier",
|
|
26
|
+
"description": "Checker agent for dependency upgrade diffs. APPROVE or REJECT only.",
|
|
27
|
+
"mode": "subagent",
|
|
28
|
+
"prompt": "Verify the dependency patch passes tests and touches no denylisted packages. Do not edit files. APPROVE or REJECT with evidence.",
|
|
29
|
+
"permission": {
|
|
30
|
+
"bash": "ask",
|
|
31
|
+
"edit": "deny"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -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,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,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.
|