Loop Engineering (cobusgreyling)

cobusgreyling/loop-engineering β€” a practical, tool-aware reference repo for Loop Engineering: patterns you can clone, CLI tools that score readiness, and checklists to ship against. It operationalizes the Osmani/Cherny/Steinberger idea β€” β€œstop prompting agents; design the loop that prompts them” β€” for Grok, Claude Code, Codex, Cursor and other coding agents.

Where Loop Engineering (the note) is the why, this is the how: npx-runnable CLIs, seven production patterns, and starter kits. MIT-licensed.

Description

Download or use

# 1. Scaffold a starter for a pattern + tool
npx @cobusgreyling/loop-init . --pattern daily-triage --tool grok
 
# 2. Estimate token spend for your cadence
npx @cobusgreyling/loop-cost --pattern daily-triage --level L1
 
# 3. Audit loop readiness (budget + run-log scored)
npx @cobusgreyling/loop-audit . --suggest
npx @cobusgreyling/loop-audit . --badge   # Loop Ready badge for README
 
# 4. First report-only loop (Grok example)
/loop 1d Run loop-triage. Update STATE.md. No auto-fix in week one.

No clone required β€” all three CLIs publish to npm from tagged releases. loop-sync (STATE.md ↔ LOOP.md drift) and an MCP runtime-lookup server ship in-repo.

πŸ—’οΈ Description

🧩 The five building blocks + memory

The repo’s core model β€” a loop is assembled from these primitives (mapped cross-tool in primitives-matrix.md):

PrimitiveJob in the loop
Automations / SchedulingDiscovery + triage on a cadence
WorktreesSafe parallel execution
SkillsPersistent project knowledge
Plugins & ConnectorsReach into real tools via MCP
Sub-agentsMaker / checker split
+ Memory / StateDurable spine outside any conversation

Anatomy: Schedule β†’ Triage skill β†’ read/write STATE β†’ isolated worktree β†’ implementer sub-agent β†’ verifier sub-agent (tests+gates) β†’ MCP/Git/tickets β†’ human gate β†’ commit/PR or escalate β†’ repeat. This matches the external-state-in-a-DB fix argued in Loop Engineering β€” state lives outside any one agent session.

🧩 The seven patterns

Each ships with a starter kit, a suggested cadence, and a β€œweek 1” maturity target:

PatternCadenceToken cost
Daily Triage1d–2hLow
PR Babysitter5–15mHigh
CI Sweeper5–15mVery high
Dependency Sweeper6h–1dMedium
Changelog Drafter1d or tagLow
Post-Merge Cleanup1d–6hLow
Issue Triage2h–1dLow

Phased rollout is the discipline: L1 report β†’ L2 assisted fixes β†’ L3 unattended. Start report-only.

🧩 The three CLI tools

  • loop-init β€” scaffolds a starter plus budget/run-log files for a chosen pattern + tool.
  • loop-cost β€” token-spend estimator per cadence and maturity level; the antidote to the β€œone run cost a million tokens” problem.
  • loop-audit β€” Loop Readiness Score (v1.4, with activity detection); --suggest recommends next steps, --badge emits a README badge.

✍️ Reasoning for

This is the missing checklist layer between the Loop Engineering concept and actually running loops on Qamera AI / PLSoft repos. The concept note’s conclusion is β€œloop engineering β‰ˆ Harness Engineering, mind the cost/context downsides” β€” this repo turns those warnings into scored gates: loop-cost before you commit to a cadence, loop-audit to check you’re not skipping verification, phased L1β†’L3 so nothing runs unattended before it’s earned trust.

Most useful to me:

  1. loop-cost up front β€” decide affordability before a loop bleeds tokens.
  2. The pattern catalog β€” PR Babysitter / CI Sweeper / Issue Triage are exactly the recurring chores I’d hand a loop first.
  3. Report-only L1 default β€” matches the human-in-the-loop caution I already trust from Archon.

Caveat the repo states plainly: loops amplify judgment β€” good and bad; verification is still on you; comprehension debt grows unless you read what the loop ships.

Alternatives considered

  • Archon β€” a deterministic harness engine (YAML DAG + worktrees + Postgres durability). loop-engineering is patterns + audit CLIs, not a runtime; Archon is the heavier, deterministic answer to the same problem.
  • Loop Engineering via raw /loop /goal /routines β€” the Claude Code primitives alone, no readiness scoring or cost estimation.
  • Karpathy Skills / Awesome Claude Code β€” skill/prompt curation, not loop orchestration.

πŸ”— Resources

πŸ“– Further reading


Template: tool