@cobusgreyling/loop-init 1.2.3 → 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/README.md +2 -0
- package/dist/cli.js +133 -31
- package/package.json +6 -2
- package/starters/README.md +8 -1
- 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/minimal-loop-opencode/AGENTS.md +23 -0
- package/starters/minimal-loop-opencode/LOOP.md +33 -0
- package/starters/minimal-loop-opencode/README.md +50 -0
- package/starters/minimal-loop-opencode/STATE.md.example +12 -0
- package/starters/minimal-loop-opencode/opencode.json.example +35 -0
- package/starters/minimal-loop-opencode/skills/loop-triage/SKILL.md +59 -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
|
@@ -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,23 @@
|
|
|
1
|
+
# AGENTS.md — Opencode Minimal Loop
|
|
2
|
+
|
|
3
|
+
These rules are loaded by opencode before loop work.
|
|
4
|
+
|
|
5
|
+
## Loop Mode
|
|
6
|
+
|
|
7
|
+
- Start in L1 report-only mode.
|
|
8
|
+
- Read `STATE.md` before any triage.
|
|
9
|
+
- Update `STATE.md` after every loop run.
|
|
10
|
+
- Do not edit source code until the human explicitly enables L2.
|
|
11
|
+
|
|
12
|
+
## Safety
|
|
13
|
+
|
|
14
|
+
- Never push or merge without human approval.
|
|
15
|
+
- Never edit `.env`, `.env.*`, `auth/`, `payments/`, `secrets/`, or `credentials/`.
|
|
16
|
+
- Use a git worktree for every code-changing attempt.
|
|
17
|
+
- Max 3 fix attempts per item; escalate after that.
|
|
18
|
+
|
|
19
|
+
## Verification
|
|
20
|
+
|
|
21
|
+
- For L2+ changes, dispatch a verifier sub-agent after implementation.
|
|
22
|
+
- Run the project's documented tests before proposing a fix.
|
|
23
|
+
- Record test evidence in `STATE.md`.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Loop Configuration — Minimal Triage (Opencode)
|
|
2
|
+
|
|
3
|
+
## Active Loops
|
|
4
|
+
|
|
5
|
+
| Pattern | Cadence | Status | Command |
|
|
6
|
+
|---------|---------|--------|---------|
|
|
7
|
+
| Daily Triage | 1d | L1 report-only | `opencode run "Run loop-triage" --agent loop-triage` via cron/systemd |
|
|
8
|
+
|
|
9
|
+
## Human Gates
|
|
10
|
+
|
|
11
|
+
- No auto-fix until L2 checklist complete.
|
|
12
|
+
- All high-risk paths require human review (see docs/safety.md denylist).
|
|
13
|
+
|
|
14
|
+
## Worktrees
|
|
15
|
+
|
|
16
|
+
- Use an explicit `git worktree` and run opencode with `--dir <worktree>` for implementer runs (L2+).
|
|
17
|
+
- One worktree per fix attempt; discard after verifier REJECT.
|
|
18
|
+
|
|
19
|
+
## Connectors (MCP)
|
|
20
|
+
|
|
21
|
+
- MCP optional for L1 report-only loops.
|
|
22
|
+
- For L2+: GitHub MCP can read CI/issues; scope connectors to read + comment until trusted.
|
|
23
|
+
|
|
24
|
+
## Budget
|
|
25
|
+
|
|
26
|
+
- Max sub-agent spawns per run: 0 (L1).
|
|
27
|
+
- Review STATE.md daily.
|
|
28
|
+
- If token spend hits 80% of daily cap, switch to report-only.
|
|
29
|
+
|
|
30
|
+
## Links
|
|
31
|
+
|
|
32
|
+
- Pattern: [daily-triage](../../patterns/daily-triage.md)
|
|
33
|
+
- Checklist: [loop-design-checklist](../../docs/loop-design-checklist.md)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Minimal Loop Starter — Opencode
|
|
2
|
+
|
|
3
|
+
Clone this into your project root to run a **report-only daily triage loop** (L1 readiness) with opencode.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
1. Scaffold (recommended):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @cobusgreyling/loop-init . --pattern daily-triage --tool opencode
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or copy manually:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cp -r starters/minimal-loop-opencode/skills .
|
|
17
|
+
cp starters/minimal-loop-opencode/AGENTS.md .
|
|
18
|
+
cp starters/minimal-loop-opencode/LOOP.md .
|
|
19
|
+
cp starters/minimal-loop-opencode/STATE.md.example STATE.md
|
|
20
|
+
cp starters/minimal-loop-opencode/opencode.json.example opencode.json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. Customize `STATE.md` project name.
|
|
24
|
+
|
|
25
|
+
3. Start the loop:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
opencode run "Run loop-triage. Read STATE.md first. Append high-priority and watch items. Update Last run timestamp. Do not auto-fix anything in week one." --agent loop-triage
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
4. Read `STATE.md` each morning for 1-2 weeks. Tune the triage skill.
|
|
32
|
+
|
|
33
|
+
5. When triage quality is good, add `minimal-fix` from `templates/SKILL.md.minimal-fix` and enable small auto-wins with a verifier agent in a worktree.
|
|
34
|
+
|
|
35
|
+
## What's Included
|
|
36
|
+
|
|
37
|
+
| File | Purpose |
|
|
38
|
+
|------|---------|
|
|
39
|
+
| `STATE.md.example` | State spine template |
|
|
40
|
+
| `skills/loop-triage/SKILL.md` | Triage skill |
|
|
41
|
+
| `AGENTS.md` | Always-on project rules for opencode |
|
|
42
|
+
| `LOOP.md` | Loop config doc for your team |
|
|
43
|
+
| `opencode.json.example` | Example opencode agent definitions |
|
|
44
|
+
|
|
45
|
+
## Next Steps
|
|
46
|
+
|
|
47
|
+
- [Loop Design Checklist](../../docs/loop-design-checklist.md)
|
|
48
|
+
- [Daily Triage pattern](../../patterns/daily-triage.md)
|
|
49
|
+
- [Opencode example](../../examples/opencode/daily-triage.md)
|
|
50
|
+
- Run `npx @cobusgreyling/loop-audit .` for readiness score
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"agent": {
|
|
4
|
+
"loop-triage": {
|
|
5
|
+
"name": "loop-triage",
|
|
6
|
+
"description": "Report-only daily triage loop. Reads STATE.md, updates high-priority items, and does not edit source code in L1 mode.",
|
|
7
|
+
"mode": "primary",
|
|
8
|
+
"prompt": "Read AGENTS.md, LOOP.md, STATE.md, and skills/loop-triage/SKILL.md. Run report-only triage. Update STATE.md. Do not edit source code unless the human has explicitly enabled L2.",
|
|
9
|
+
"permission": {
|
|
10
|
+
"bash": "ask",
|
|
11
|
+
"edit": "ask"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"implementer": {
|
|
15
|
+
"name": "implementer",
|
|
16
|
+
"description": "L2 implementer agent for minimal scoped fixes inside an isolated worktree.",
|
|
17
|
+
"mode": "subagent",
|
|
18
|
+
"prompt": "Implement only the requested minimal fix. Stay within the supplied worktree, respect AGENTS.md and LOOP.md, run documented tests, and stop for human approval on denylisted paths.",
|
|
19
|
+
"permission": {
|
|
20
|
+
"bash": "ask",
|
|
21
|
+
"edit": "ask"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"verifier": {
|
|
25
|
+
"name": "verifier",
|
|
26
|
+
"description": "Checker agent for L2+ changes. Reviews diffs and test evidence; APPROVE or REJECT only.",
|
|
27
|
+
"mode": "subagent",
|
|
28
|
+
"prompt": "Review the supplied diff or worktree summary 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,59 @@
|
|
|
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 issue tracker.
|
|
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
|
+
|
|
16
|
+
- Recent CI / test failures (last 24h)
|
|
17
|
+
- Open issues / tickets assigned to the team
|
|
18
|
+
- Recent commits on main (last 24-48h)
|
|
19
|
+
- Any chat threads the loop has visibility into
|
|
20
|
+
- The current state file (what the loop already knows about)
|
|
21
|
+
|
|
22
|
+
## Output Format
|
|
23
|
+
|
|
24
|
+
Produce a markdown report with these sections:
|
|
25
|
+
|
|
26
|
+
### 1. High-Priority Items (act on these)
|
|
27
|
+
|
|
28
|
+
- Clear, one-line description
|
|
29
|
+
- Why it matters (impact, risk, or customer pain)
|
|
30
|
+
- Suggested next action for the loop (for example, "draft minimal fix in isolated worktree")
|
|
31
|
+
- Rough effort estimate
|
|
32
|
+
|
|
33
|
+
### 2. Watch Items (monitor, do not act yet)
|
|
34
|
+
|
|
35
|
+
- Same format but lower urgency
|
|
36
|
+
|
|
37
|
+
### 3. Noise / Ignore
|
|
38
|
+
|
|
39
|
+
- Brief list of things the loop looked at and decided were not worth action
|
|
40
|
+
|
|
41
|
+
### 4. State Updates
|
|
42
|
+
|
|
43
|
+
- Any facts the loop should remember for the next run (for example, "PR #1234 now has 2 approvals")
|
|
44
|
+
|
|
45
|
+
## Rules
|
|
46
|
+
|
|
47
|
+
- Be brutally concise. The loop and the human reading the state will thank you.
|
|
48
|
+
- Only put something in "High-Priority" if a reasonable engineer would want to know about it today.
|
|
49
|
+
- When in doubt, put it in Watch or Noise rather than creating work.
|
|
50
|
+
- Never propose architectural overhauls during triage — this skill is for signal, not invention.
|
|
51
|
+
- Respect the project's existing skills and conventions (they will be provided in context).
|
|
52
|
+
|
|
53
|
+
## Example Invocation (in an opencode loop)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
opencode run "Call loop-triage and append high-priority items to STATE.md. Do not edit code."
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The triage skill should be the "eyes" of the loop. Keep it focused and honest.
|
|
@@ -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)
|