Sandbox
@cobusgreyling/loop-engineering

Loop patterns and CLI for coding agents

This repo gives you a way to design the system around an agent: what work it picks up, how it is handed off, how it is checked, and when it is safe to run more autonomously. The main pieces are the loop patterns, the starter templates, the skills, and a CLI that initializes and audits a repo.

11,146 stars1.5k forksTypeScriptUpdated 6d ago
Loop Engineering explained in 8min..
Caleb Writes Code190k views • 2 months ago

Videos about this repo

Who it's for

Builders who want to run repeatable agent workflows across a codebase with Claude Code, Codex, Grok, or similar tools.

What it delivers

You can turn ad hoc prompting into a loop with defined work intake, verification, and state.

What it does

Loop pattern library

Provides patterns such as daily triage, CI sweeper, dependency sweeper, changelog drafter, issue triage, PR babysitter, and post-merge cleanup.

CLI front door

Uses `@cobusgreyling/loop` to initialize a loop, inspect readiness, measure cost, and audit a repo.

Starter setups

Includes starter folders like `minimal-loop`, `thin-loop`, and tool-specific variants for Claude, Codex, and Opencode.

Skills and loop helpers

Ships packaged skills such as budget negotiation, loop budget, loop constraints, loop triage, loop verifier, and minimal fix.

Safety and operating docs

Documents failure modes, anti-patterns, safety rules, and loop design checks before moving from report-only to unattended runs.

Examples by tool

Shows example setups for Claude Code, Codex, Grok, GitHub Actions, and other agent runtimes.

How to get it

  1. 1Run
    npx @cobusgreyling/loop init . --pattern daily-triage --tool claude
    npx @cobusgreyling/loop doctor .
    npx @cobusgreyling/loop cost --pattern daily-triage --level L1

README

Loop Engineering

Showcase GitHub stars loop npm last triage MIT

Loop Engineering logo

Stop prompting. Design the loop. Get a score.

Loop Engineering — design the system that prompts your agents

Start in 5 minutes · Quickstart · What do you want to do? · Refactor path · 中文 · Pattern picker

npx @cobusgreyling/loop init . --pattern daily-triage --tool claude
npx @cobusgreyling/loop doctor .

--tool defaults to claude if you omit it. Swap for grok, codex, or opencode. Week one is report-only.

Loop Ready score climbing

You design a system that discovers work, hands it to agents, verifies results, and persists state — instead of typing the next prompt yourself.

New here? Quickstart · Refactor a project · Thin GitHub Action loop (no STATE.md required)

What do you want to do?

This is a pattern library for operating agents around a codebase. It is not a “rewrite the module” button.

I want to…Start here
Keep the repo healthy (issues, CI, deps)Quickstartdaily-triage
Land and babysit PRsPR Babysitter
Run a loop in GitHub Actions with almost no filesThin loop
Ship a feature or refactor (todos → small PRs)Refactor / change path

Full jobs table: docs/jobs.md.

Patterns

PatternCadenceWeek 1Cost
Daily Triage1d–2hL1 reportLow
Thin loopevent + 1dL1 snapshotVery low
PR Babysitter5–15mL1 watchHigh
CI Sweeper5–15mL2 cautiousVery high
Dependency Sweeper6h–1dL2 patch-onlyMedium
Changelog Drafter1d or tagL1 draftLow
Post-Merge Cleanup1d–6hL1 off-peakLow
Issue Triage2h–1dL1 propose-onlyLow

Interactive picker: showcase. Index: patterns/registry.yaml.

Getting started

npx @cobusgreyling/loop init . --pattern daily-triage --tool claude
npx @cobusgreyling/loop doctor .
npx @cobusgreyling/loop cost --pattern daily-triage --level L1

Empty repo → first STATE.md walkthrough: scripts/empty-to-state-demo.sh.

Roll out L1 report → L2 assisted → L3 unattended only after the verifier has been right for a week. See loop-design-checklist.

Loop Ready now weights recent runs harder than files on disk. A 30-day-old STATE.md is not L3.

Examples by tool

Claude Code (including the plugin) · Grok · Codex · OpenClaw · Opencode · GitHub Actions

Operating & safety

Failure modes · Anti-patterns · Safety · Operating loops · Stories (wins and failures)

Loop engineering amplifies judgment. Token costs can explode. Unattended loops make unattended mistakes. Read what the loop ships.

Help wanted

Docs and small PRs: first response within 48 hours.

See CONTRIBUTING.md.

CLI packages and companion repos (optional — not required for week one)

Unified front door: npx @cobusgreyling/loop (init · doctor · status · audit · cost). Older packages (loop-init, loop-audit, …) stay supported.

Companions exist for later: memory-engineering, harness-foundry, outerloop, fleet-engineering, goal-engineering. Do not add them until a loop has actually run.

Sources

License

MIT

Files in the repo

Repository payload35 top-level entries
  • .claude-plugin
  • .github
  • assets
  • docs
  • examples
  • patterns
  • resources
  • scripts
  • skills
  • starters
  • stories
  • templates
  • tools
  • _config.yml
  • .gitignore
  • AGENTS.md
  • changelog-drafter-state.md
  • CODE_OF_CONDUCT.md
  • CODEOWNERS
  • CONTRIBUTING.md
  • CONTRIBUTORS.md
  • gate.yaml
  • LICENSE
  • loop-budget.md
  • loop-constraints.md
  • loop-run-log.md
  • LOOP.md
  • package-lock.json
  • package.json
  • README.md
  • README.zh-CN.md
  • RELEASE_NOTES_DRAFT.md
  • RELEASE_NOTES_v1.5.0.md
  • SECURITY.md
  • STATE.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More harnesses

affaan-m/
ECC
affaan-m/ECCHarnesses

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

258k
ruvnet/rufloHarnesses

🌊 The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

72k
chaitanyagiri/
munder-difflin

A local multi-agent harness that works with your existing Claude Code, Codex subscriptions, allows you to run an office of agents

6.8k