Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/adopters.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ Open a PR that adds a row to the table below:
|-------|-----------------|
| **Project** | Repo link or product name |
| **Pattern(s)** | e.g. Daily Triage + Issue Triage |
| **Tool** | Grok, Claude Code, Codex, GitHub Actions, mixed |
| **Tool** | Grok, Claude Code, Codex, Cursor, Windsurf, GitHub Actions, mixed |
| **Level** | L1 / L2 / L3 (honest) |
| **Notes** | One line — what worked or what broke |

## Adopters

| Project | Pattern(s) | Tool | Level | Notes |
|---------|------------|------|-------|-------|
| [loop-engineering](https://github.com/cobusgreyling/loop-engineering) (this repo) | Daily Triage, Changelog Drafter, audit dogfood | GitHub Actions + Grok | L3 | Reference implementation — dogfoods `loop-audit` on every PR |
| [loop-engineering](https://github.com/cobusgreyling/loop-engineering) (this repo) | Daily Triage, Changelog Drafter, audit dogfood | GitHub Actions + Grok | L3 | Reference implementation — `loop-audit` on every PR; readiness score 100 |
| [loop-engineering](https://github.com/cobusgreyling/loop-engineering) (maintainer) | Post-Merge Cleanup | Grok + GitHub Actions | L1→L2 | Off-peak scan; verifier caught doc/API drift — see [story](../stories/post-merge-cleanup-honest-win.md) |
| [loop-engineering](https://github.com/cobusgreyling/loop-engineering) (maintainer) | Issue Triage + Daily Triage | Grok | L1 | Issue queue feeder: propose labels only week one; pairs with morning `STATE.md` triage |
| [loop-engineering](https://github.com/cobusgreyling/loop-engineering) (maintainer) | PR Babysitter, Dependency Sweeper | Grok / Claude Code | L2 | Assisted fixes in worktrees; human gate on merges; patch-only deps |

*Your project here — see [CONTRIBUTING.md](../CONTRIBUTING.md).*

Expand Down
81 changes: 42 additions & 39 deletions docs/primitives-matrix.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# Primitives Matrix — Grok, Claude Code, Codex
# Primitives Matrix — Grok, Claude Code, Codex, Cursor, Windsurf

Tool-agnostic loop design: the **capability** is what matters, not the product name. This matrix maps each primitive to how it appears in three major agent environments.
Tool-agnostic loop design: the **capability** is what matters, not the product name. This matrix maps each primitive to how it appears in five major agent environments.

| Primitive | Job in the Loop | Grok Build TUI | Claude Code | Codex |
|-----------|-----------------|----------------|-------------|-------|
| **Automations / Scheduling** | Discovery + triage on a cadence | `/loop [interval] <prompt>`, `scheduler_create` / `scheduler_list` / `scheduler_delete` (`recurring`, `durable`, `fireImmediately`), `monitor` for streaming events | `/loop`, scheduled tasks, cron, hooks, GitHub Actions | [Automations tab](https://developers.openai.com/codex/app/automations): project, prompt, cadence, environment; Triage inbox |
| **Run-until-done** | Keep working until a verifiable condition holds | Goal mode / explicit stopping conditions in loop prompts | `/goal` — separate model checks completion | `/goal` — pause/resume, verifiable stop condition |
| **Worktrees** | Safe parallel execution | Subagents with `isolation: "worktree"`, background tasks | `git worktree`, `--worktree`, `isolation: worktree` on subagents | Built-in worktree per thread |
| **Skills** | Persistent project knowledge | `SKILL.md` in `.grok/skills/` or `~/.grok/skills/`; invoked by name | `SKILL.md` in `.claude/skills/` or project skills | [Agent Skills](https://developers.openai.com/codex/skills) — `$name` or implicit match |
| **Plugins & Connectors** | Reach into real tools | MCP servers via `CallMcpTool` | MCP servers + plugins | Connectors (MCP) + plugins for distribution |
| **Sub-agents** | Maker / checker split | `Task` tool with `subagent_type`, worktree isolation | Task subagents in `.claude/agents/`, agent teams | Subagents as TOML in `.codex/agents/` |
| **State / Memory** | Track what's done across runs | `STATE.md`, todos, durable scheduler state | `AGENTS.md`, progress files, Linear via MCP | Markdown or Linear via connector |
| Primitive | Job in the Loop | Grok Build TUI | Claude Code | Codex | Cursor | Windsurf |
|-----------|-----------------|----------------|-------------|-------|--------|----------|
| **Automations / Scheduling** | Discovery + triage on a cadence | `/loop [interval] <prompt>`, `scheduler_create` / `scheduler_list` / `scheduler_delete` (`recurring`, `durable`, `fireImmediately`), `monitor` for streaming events | `/loop`, scheduled tasks, cron, hooks, GitHub Actions | [Automations tab](https://developers.openai.com/codex/app/automations): project, prompt, cadence, environment; Triage inbox | Cloud Agents + **Automations** (cron, webhooks, Linear/GitHub/Slack triggers); foreground Agent chat for ad-hoc `/loop`-style prompts | Cascade **Workflows** (`/workflow-name`, manual invoke); pair with GitHub Actions or external cron for true scheduling |
| **Run-until-done** | Keep working until a verifiable condition holds | Goal mode / explicit stopping conditions in loop prompts | `/goal` — separate model checks completion | `/goal` — pause/resume, verifiable stop condition | Agent mode + **hooks** (`.cursor/hooks.json`) for grind-until-green loops | Workflow steps with explicit verification checkpoints; **Memories** for cross-session continuity |
| **Worktrees** | Safe parallel execution | Subagents with `isolation: "worktree"`, background tasks | `git worktree`, `--worktree`, `isolation: worktree` on subagents | Built-in worktree per thread | Git worktree per Composer / Cloud Agent task | Workspace isolation; multiple simultaneous Cascade sessions |
| **Skills** | Persistent project knowledge | `SKILL.md` in `.grok/skills/` or `~/.grok/skills/`; invoked by name | `SKILL.md` in `.claude/skills/` or project skills | [Agent Skills](https://developers.openai.com/codex/skills) — `$name` or implicit match | `.cursor/rules/*.mdc` (globs, `alwaysApply`), `AGENTS.md`, `.cursor/skills/` | `.devin/rules/` or `.windsurf/rules/` (persistent context); `.windsurf/workflows/` (reusable recipes) |
| **Plugins & Connectors** | Reach into real tools | MCP servers via `CallMcpTool` | MCP servers + plugins | Connectors (MCP) + plugins for distribution | MCP in settings; Cloud Agent sandbox with full connector access | MCP via Cascade settings / `mcp_config.json` |
| **Sub-agents** | Maker / checker split | `Task` tool with `subagent_type`, worktree isolation | Task subagents in `.claude/agents/`, agent teams | Subagents as TOML in `.codex/agents/` | Multi-agent mode, review mode, custom agents in `.cursor/agents/` | Multiple Cascades in parallel; workflow-orchestrated implementer → reviewer steps |
| **State / Memory** | Track what's done across runs | `STATE.md`, todos, durable scheduler state | `AGENTS.md`, progress files, Linear via MCP | Markdown or Linear via connector | `STATE.md`, `LOOP.md`, Cloud Agent memories | `STATE.md`, Cascade **Memories**, workflow run notes |

## Scheduling Quick Reference

| Use case | Grok | Claude Code | Codex |
|----------|------|-------------|-------|
| Every 5 minutes | `/loop 5m <prompt>` | `/loop 5m <prompt>` | Automation, 5m cadence |
| Daily morning | `/loop 1d <prompt>` | Cron / `/loop 1d` | Automation, daily |
| Until tests pass | Loop + verifier sub-agent | `/goal all tests pass` | `/goal` |
| Survive restart | `scheduler_create` with `durable: true` | Hooks + persisted config | Automation (server-side) |
| Event-driven (CI fail) | `monitor` or GitHub Action | GitHub Action + webhook | Automation + webhook |
| Use case | Grok | Claude Code | Codex | Cursor | Windsurf |
|----------|------|-------------|-------|--------|----------|
| Every 5 minutes | `/loop 5m <prompt>` | `/loop 5m <prompt>` | Automation, 5m cadence | Automation cron trigger | External cron + `/workflow` or Action |
| Daily morning | `/loop 1d <prompt>` | Cron / `/loop 1d` | Automation, daily | Automation daily + `AGENTS.md` context | Daily workflow + Memories |
| Until tests pass | Loop + verifier sub-agent | `/goal all tests pass` | `/goal` | Hooks grind-until-green | Workflow with test/fix loop |
| Survive restart | `scheduler_create` with `durable: true` | Hooks + persisted config | Automation (server-side) | Cloud Agent + repo-persisted state | Memories + committed `STATE.md` |
| Event-driven (CI fail) | `monitor` or GitHub Action | GitHub Action + webhook | Automation + webhook | Automation on PR/issue events | GitHub Action triggers + `/workflow` |

## Skill Packaging

| Concept | Grok | Claude Code | Codex |
|---------|------|-------------|-------|
| Authoring format | `SKILL.md` + optional scripts/references | Same | Same |
| Distribution | Copy to `.grok/skills/` or user skills dir | Plugin / copy to project | Plugin bundle |
| Invocation | Skill name in prompt or auto-match on description | `$skill-name` or implicit | `$skill-name` |
| Concept | Grok | Claude Code | Codex | Cursor | Windsurf |
|---------|------|-------------|-------|--------|----------|
| Authoring format | `SKILL.md` + optional scripts/references | Same | Same | `SKILL.md` or `.mdc` rules with frontmatter | Markdown rules + workflow files |
| Distribution | Copy to `.grok/skills/` or user skills dir | Plugin / copy to project | Plugin bundle | `.cursor/skills/` or `.cursor/rules/` | `.windsurf/rules/` + `.windsurf/workflows/` in repo |
| Invocation | Skill name in prompt or auto-match on description | `$skill-name` or implicit | `$skill-name` | Rules auto-apply by glob; skills on demand | `/workflow-name` or Rules always-on in Cascade |

## Sub-agent Patterns

| Split | When to use | Grok | Claude Code | Codex |
|-------|-------------|------|-------------|-------|
| Implementer → Verifier | Any unattended code change | `Task` + different instructions/model | `.claude/agents/reviewer.md` | TOML agent with higher `reasoning_effort` |
| Explorer → Implementer | Large unfamiliar codebase | `explore` subagent_type | Explorer agent | Fast read-only subagent |
| Triage only | Report-first loops | `loop-triage` skill | `$loop-triage` | Automation calls skill |
| Split | When to use | Grok | Claude Code | Codex | Cursor | Windsurf |
|-------|-------------|------|-------------|-------|--------|----------|
| Implementer → Verifier | Any unattended code change | `Task` + different instructions/model | `.claude/agents/reviewer.md` | TOML agent with higher `reasoning_effort` | Review mode or second Cloud Agent pass | Second Cascade or workflow review step |
| Explorer → Implementer | Large unfamiliar codebase | `explore` subagent_type | Explorer agent | Fast read-only subagent | `@codebase` + plan mode first | Audit workflow (read-only) then implement |
| Triage only | Report-first loops | `loop-triage` skill | `$loop-triage` | Automation calls skill | `AGENTS.md` + report-only rule | Triage workflow, no edit steps |

## State Conventions

Expand All @@ -45,6 +45,7 @@ Recommended filenames (pick one spine per project):
| File | Purpose |
|------|---------|
| `STATE.md` | General loop memory (daily triage) |
| `issue-triage-state.md` | Issue queue health (feeder for daily triage) |
| `pr-babysitter-state.md` | PR-specific watcher state |
| `ci-sweeper-state.md` | Active CI failures + attempt counts |
| `post-merge-state.md` | Cleanup backlog from recent merges |
Expand All @@ -58,7 +59,7 @@ You do not need to pick one forever. A well-designed loop transfers:
1. Write the **skill** (tool-agnostic `SKILL.md`)
2. Define the **state schema** (markdown or JSON)
3. Document the **verification split** (who checks whom)
4. Map scheduling to your current TUI or Action
4. Map scheduling to your current TUI, editor, or Action

See [examples/](../examples/) for the same pattern implemented across tools.

Expand All @@ -69,22 +70,24 @@ See [examples/](../examples/) for the same pattern implemented across tools.
| Grok | [starters/minimal-loop](../starters/minimal-loop/) |
| Claude Code | [starters/minimal-loop-claude](../starters/minimal-loop-claude/) |
| Codex | [starters/minimal-loop-codex](../starters/minimal-loop-codex/) |
| Cursor / Windsurf | Copy `SKILL.md` + `STATE.md` from any starter; map scheduling to editor Automations or Workflows (see appendix) |

Audit after copying: `npx @cobusgreyling/loop-audit . --suggest`

Scaffold automatically: `npx @cobusgreyling/loop-init . --pattern daily-triage --tool grok`

## Appendix: Other agent environments (capability mapping)
## Appendix: Editor transfer recipes (Cursor & Windsurf)

No dedicated starters yet for the newest patterns (Changelog Drafter is trivial to port — it is mostly read + draft). Map capabilities to the same loop shape:
No dedicated starters yet — map capabilities to the same loop shape:

| Primitive | Cursor | Windsurf | Aider |
|-----------|--------|----------|-------|
| Scheduling | Rules + background agents, manual `/loop`-style prompts | Workflows, cascades | `--watch` / scripted sessions |
| Worktrees | Git worktree per Composer task | Workspace isolation | Git branches |
| Skills | `.cursor/rules`, `AGENTS.md` | Rules files | `CONVENTIONS.md` / `.aider.conf.yml` |
| Connectors | MCP in settings | MCP | CLI + git only |
| Sub-agents | Multi-agent / review mode | Cascade steps | Second terminal reviewer |
| State | `STATE.md`, `LOOP.md` | Same | Same |
| Step | Cursor | Windsurf |
|------|--------|----------|
| 1. Skills | Copy `templates/SKILL.md.loop-triage` → `.cursor/skills/loop-triage/SKILL.md`; add always-on triage rules in `.cursor/rules/` | Copy skill content into `.windsurf/rules/loop-triage.md` |
| 2. State | `cp starters/minimal-loop/STATE.md.example STATE.md` | Same — commit `STATE.md` at repo root |
| 3. Scheduling | Cloud Automation (cron) or manual Agent prompt on cadence | Create `.windsurf/workflows/daily-triage.md`, invoke `/daily-triage` |
| 4. Verification | `.cursor/agents/loop-verifier.md` from `templates/SKILL.md.verifier` | Add review step at end of workflow; human gate on denylist paths |
| 5. Connectors | Enable GitHub MCP read-only for issue/PR discovery | Configure GitHub MCP in Cascade settings |

**Aider** (CLI-only): use `--watch` or scripted sessions; state in `STATE.md`; reviewer = second terminal session.

Transfer recipe: copy the tool-agnostic `SKILL.md` + state schema from this repo; map scheduling to your editor's automation surface.
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Start with [primitives-matrix.md](../docs/primitives-matrix.md) to map capabilit
| Post-Merge Cleanup | [grok/post-merge-cleanup.md](./grok/post-merge-cleanup.md) | [claude-code/post-merge-cleanup.md](./claude-code/post-merge-cleanup.md) | [codex/post-merge-cleanup.md](./codex/post-merge-cleanup.md) | [github-actions/post-merge-cleanup.yml](./github-actions/post-merge-cleanup.yml) |
| Dependency Sweeper | [grok/dependency-sweeper.md](./grok/dependency-sweeper.md) | [claude-code/dependency-sweeper.md](./claude-code/dependency-sweeper.md) | [codex/dependency-sweeper.md](./codex/dependency-sweeper.md) | [github-actions/dependency-sweeper.yml](./github-actions/dependency-sweeper.yml) |
| Changelog Drafter | [grok/changelog-drafter.md](./grok/changelog-drafter.md) | [claude-code/changelog-drafter.md](./claude-code/changelog-drafter.md) | [codex/changelog-drafter.md](./codex/changelog-drafter.md) | [github-actions/changelog-drafter.yml](./github-actions/changelog-drafter.yml) |
| Issue Triage | [grok/issue-triage.md](./grok/issue-triage.md) | [claude-code/issue-triage.md](./claude-code/issue-triage.md) | [codex/issue-triage.md](./codex/issue-triage.md) | — (see daily-triage.yml as template) |

L2 patterns ship multi-tool skills inside one starter folder — see `starters/<pattern>/`.

Expand Down
60 changes: 60 additions & 0 deletions examples/claude-code/issue-triage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Issue Triage — Claude Code

Same pattern as Grok; uses `$issue-triage` skill invocation and Claude Code scheduling.

## Report-Only (Week 1)

```bash
/loop 2h $issue-triage — read issue-triage-state.md first. Scan open issues since last run. Update state with Top 5, suggested labels, and needs-human bucket. Propose only — do not apply labels or close issues. Escalate auth, payments, and security items.
```

## Skills Setup

Copy and adapt triage instructions to `.claude/skills/issue-triage/SKILL.md`:

```bash
mkdir -p .claude/skills/issue-triage
# Start from templates/SKILL.md.loop-triage — retarget for GitHub issues + discussions
cp templates/SKILL.md.loop-triage .claude/skills/issue-triage/SKILL.md
```

Add verifier for L2 graduation:

```bash
cp templates/SKILL.md.verifier .claude/agents/loop-verifier.md
```

## State File

`issue-triage-state.md` at repo root — same schema as [patterns/issue-triage.md](../../patterns/issue-triage.md).

Scaffold:

```bash
npx @cobusgreyling/loop-init . --pattern issue-triage --tool claude --dry-run
```

## Allowlisted Labels (L2 only, week 3+)

After 10 stable L1 runs, enable auto-apply for:

- `area:*` (component labels)
- `needs-repro`, `needs-info`
- `duplicate?` (comment only, never auto-close)

Human gate remains on: `P0`, `P1`, `security`, `breaking-change`.

## Pairing with Daily Triage

```bash
/loop 1d $loop-triage — read STATE.md and issue-triage-state.md. Merge top issue-triage items into High Priority. Report only week one.
```

## GitHub Action Fallback

For event-driven triage on new issues, see [examples/github-actions/daily-triage.yml](../github-actions/daily-triage.yml) as a template — add `issues: opened` trigger and issue-triage prompt.

## References

- [patterns/issue-triage.md](../../patterns/issue-triage.md)
- [docs/primitives-matrix.md](../../docs/primitives-matrix.md)
74 changes: 74 additions & 0 deletions examples/codex/issue-triage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Issue Triage — Codex App

Low-risk issue queue health loop. Report-only in week one.

## Automation Setup

In the Codex **Automations** tab:

| Field | Value |
|-------|--------|
| Project | Your repo checkout |
| Cadence | Every 2h (busy repos) or 1d (quiet repos) |
| Environment | Local or background worktree |
| Prompt | See below |

Optional: add `issues` webhook trigger for immediate triage on new issues.

## Prompt (L1 — Propose Only)

```
Run $issue-triage on this project. Read issue-triage-state.md if present.

Update issue-triage-state.md:
- Last run timestamp
- Open actionable count + delta since last run
- Top 5 prioritized issues with one-sentence summaries
- Suggested labels (proposed only — do not apply)
- "needs human" bucket for ambiguous, duplicate, or security-sensitive items

Week 1: report only. Do not modify issues, labels, or source files.
Flag anything touching auth, payments, or public API for human review.
```

## Skills

Install `issue-triage` per [Codex Agent Skills](https://developers.openai.com/codex/skills) — same `SKILL.md` format. Start from `templates/SKILL.md.loop-triage` and adapt scanning rules for your issue tracker.

Define light verifier in `.codex/agents/verifier.toml` before enabling L2.

## State Schema

```markdown
# Issue Triage State
Last run: 2026-06-18 09:00 UTC
Open actionable: 14
New since last run: 3
Needs human: 2

## Top 5
- #487 (p1) — Crash on export — suggested: bug, needs-repro
```

## Triage Inbox

Runs with findings land in Codex Triage inbox — review there plus `issue-triage-state.md`. Empty runs archive automatically.

## Phase 2 — Allowlisted Auto-Labels

Add to prompt after calibration:

```
For allowlisted labels only (area:*, needs-repro): apply after verifier subagent passes.
Never auto-close. Never label P0/P1 without human confirmation.
```

## Pairing with Daily Triage

Run a separate daily automation that reads both `STATE.md` and `issue-triage-state.md`, merging top issues into Daily Triage High Priority.

## References

- [patterns/issue-triage.md](../../patterns/issue-triage.md)
- [codex/daily-triage.md](./daily-triage.md)
- [docs/primitives-matrix.md](../../docs/primitives-matrix.md)
1 change: 1 addition & 0 deletions examples/grok/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Native primitives: `/loop`, `scheduler_create`, worktree isolation, skills, MCP,
| Example | Pattern |
|---------|---------|
| [daily-triage.md](./daily-triage.md) | Daily Triage |
| [issue-triage.md](./issue-triage.md) | Issue Triage (L1 propose-only) |

## Common Commands

Expand Down
Loading