MCPcopy
hub / github.com/cobusgreyling/loop-engineering

github.com/cobusgreyling/loop-engineering @loop-audit-v1.5.2 sqlite

repository ↗ · DeepWiki ↗ · release loop-audit-v1.5.2 ↗
117 symbols 348 edges 25 files 7 documented · 6%
README

Loop Engineering

Explore the Showcase

GitHub stars loop-audit dogfood loop-audit npm loop-init npm loop-cost npm loop-sync npm MIT Pages

Loop Engineering logo

Stop prompting. Design the loop. Get a score.

Loop Engineering — design the system that prompts your agents

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

loop-init scaffolds your loop and prints your Loop Ready score. Paste the badge when you're proud of it:

npx @cobusgreyling/loop-audit . --badge

Loop Ready score climbs from 10 to 100 in 15 seconds

Loop engineering replaces you as the person who prompts the agent — you design the system that does it instead.

New here? Quickstart (5 min) · Interactive picker

For developers using Grok, Claude Code, Codex, Cursor, and other AI coding agents.

→ Interactive showcase + pattern picker · Essay · Addy Osmani

Contents

Quick Links

Start here Description
Quickstart (5 min) Scaffold → cost check → audit → first loop — start here if you just landed
Loop Engineering essay The concept, primitives, and Grok mapping — read for the why
Pattern Picker Which loop to run first — start here if unsure
Primitives Matrix Cross-tool loop primitive mapping — bookmark this
Loop Design Checklist Ship readiness rubric
Patterns 7 production patterns + interactive picker
Starters Clone-and-run kits (Grok, Claude Code, Codex, Opencode)
Opencode examples CLI-first loops: cron/systemd + opencode run, skills, worktrees
loop-audit Loop Readiness Score CLI (v1.5 + constraints scoring) — npx @cobusgreyling/loop-audit . --suggest · --badge for README
loop-init Scaffold starters + budget/run-log + constraints (v1.2) — npx @cobusgreyling/loop-init . --pattern daily-triage --tool grok
loop-cost Token spend estimator — npx @cobusgreyling/loop-cost
loop-sync Drift detection between STATE.md and LOOP.mdnpx @cobusgreyling/loop-sync .
loop-mcp-server MCP runtime lookup for patterns, skills, state — node tools/mcp-server/dist/index.js (repo v1; npm pending)
Goal Engineering Companion: loops discover, goals finish — /goal + stack cookbook (npx @cobusgreyling/goal doctor .)
Stories Real wins and honest failures
Community update v1.5.0 release — loop-sync, constraints, MCP server
Add your project Pinned: Loop Ready badge + adopters list

Why This Matters

Peter Steinberger:

“You shouldn’t be prompting coding agents anymore. You should be designing loops that prompt your agents.”

Boris Cherny (Head of Claude Code at Anthropic):

“I don’t prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops.”

The leverage point has moved from crafting individual prompts to designing the control systems that orchestrate agents over time.

The Five Building Blocks + Memory

Primitive Job in the Loop
Automations / Scheduling Discovery + triage on a cadence
Worktrees Safe parallel execution
Skills Persistent project knowledge
Plugins & Connectors Reach into your real tools (MCP)
Sub-agents Maker / checker split
+ Memory / State Durable spine outside any conversation

Full detail: docs/primitives.md · Cross-tool matrix: docs/primitives-matrix.md

Visual Overview

The Five Building Blocks + Memory — Loop Engineering

Anatomy of a Loop

Animated loop flow — schedule, triage, state, worktree, implement, verify, MCP, human gate

Mermaid diagram (copy-friendly)

flowchart LR
    A[Schedule / Automation] --> B[Triage Skill]
    B --> C[Read + Write STATE / Memory]
    C --> D[Isolated Worktree]
    D --> E[Implementer Sub-agent]
    E --> F[Verifier Sub-agent

tests + gates]
    F --> G[MCP / Git / Tickets]
    G --> H{Human Gate?}
    H -->|safe / allowlisted| I[Commit / PR / Action]
    H -->|risky / ambiguous| J[Escalate to human

with full context]
    I --> A
    J --> A

This reference repo now runs its own validate-patterns + audit workflows on every push/PR (see .github/workflows/). We also added LOOP.md describing the loops that will maintain it.

Patterns

Seven production loop patterns with cadence and token cost

Pattern Cadence Starter Week 1 Token cost
Daily Triage 1d–2h minimal-loop L1 report Low
PR Babysitter 5–15m pr-babysitter L1 watch High
CI Sweeper 5–15m ci-sweeper L2 cautious Very high
Dependency Sweeper 6h–1d dependency-sweeper L2 patch-only Medium
Changelog Drafter 1d or tag changelog-drafter L1 draft Low
Post-Merge Cleanup 1d–6h post-merge-cleanup L1 off-peak Low
Issue Triage 2h–1d issue-triage L1 propose-only Low

Not sure which to pick? Try the interactive picker or pattern-picker.

Machine-readable index: patterns/registry.yaml (7 patterns)

Getting Started (5 minutes)

# 1. Scaffold + get your Loop Ready score (printed automatically)
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. Re-audit after improvements
npx @cobusgreyling/loop-audit . --suggest

# Optional: paste Loop Ready badge into your README
npx @cobusgreyling/loop-audit . --badge

# 4. See scores climb: empty → L1 → L2
bash scripts/before-after-demo.sh

# 5. Start report-only (Grok example)
/loop 1d Run loop-triage. Update STATE.md. No auto-fix in week one.

All three CLIs publish to npm from tagged releases — see docs/RELEASE.md. No clone required.

Develop from source (monorepo contributors):

cd tools/loop-init && npm ci && npm test && node dist/cli.js /path/to/project --pattern daily-triage --tool grok
cd tools/loop-audit && npm ci && npm test && node dist/cli.js /path/to/project --suggest
cd tools/loop-cost && npm ci && npm test && node dist/cli.js --pattern ci-sweeper --cadence 15m

Phased rollout: L1 report → L2 assisted fixes → L3 unattended — see loop-design-checklist.

Examples by Tool

Operating & Safety

Caveats

Loop engineering amplifies judgment — both good and bad.

  • Token costs can explode with sub-agents and long-running loops.
  • Verification is still on you. Unattended loops make unattended mistakes.
  • Comprehension debt grows faster unless you read what the loop ships.
  • Two people can run the same loop and get opposite results. The loop doesn't know. You do.

Addy Osmani:

“Build the loop. But build it like someone who intends to stay the engineer, not just the person who presses go.”

Contributing

Share production patterns, tool mappings, and failure stories. See CONTRIBUTING.md, adopters, and GitHub Discussions.

Sources

License

MIT


Practical, tool-aware reference for loop engineering, patterns you can clone, checklists you can ship against, and stories that include what broke.

Essay · Showcase · Cobus Greyling

  <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=cobusgreyling/loop-engineering&type=timeline&legend=top-left" />

Extension points exported contracts — how you extend this code

DriftReport (Interface)
(no doc)
tools/loop-sync/src/sync.ts
GoalSignals (Interface)
(no doc)
tools/goal-audit/src/auditor.ts
PatternInfo (Interface)
(no doc)
tools/mcp-server/src/resolver.ts
LoopSignals (Interface)
(no doc)
tools/loop-audit/src/auditor.ts
PatternCost (Interface)
(no doc)
tools/loop-cost/src/estimator.ts
DriftIssue (Interface)
(no doc)
tools/loop-sync/src/sync.ts
Finding (Interface)
(no doc)
tools/goal-audit/src/auditor.ts
RegistryData (Interface)
(no doc)
tools/mcp-server/src/resolver.ts

Core symbols most depended-on inside this repo

fail
called by 24
scripts/validate-registry.mjs
exists
called by 22
tools/loop-init/src/cli.ts
fileExists
called by 22
tools/loop-audit/src/auditor.ts
resolveProjectRoot
called by 18
tools/mcp-server/src/resolver.ts
fileExists
called by 12
tools/goal-audit/src/auditor.ts
copyFile
called by 10
tools/loop-init/src/cli.ts
fmt
called by 10
tools/mcp-server/src/index.ts
formatTokens
called by 9
tools/loop-cost/src/estimator.ts

Shape

Function 100
Interface 17

Languages

TypeScript96%
Python4%

Modules by API surface

tools/loop-init/src/cli.ts20 symbols
tools/mcp-server/src/resolver.ts19 symbols
tools/loop-cost/src/estimator.ts13 symbols
tools/loop-sync/src/sync.ts12 symbols
tools/goal-audit/src/auditor.ts10 symbols
tools/loop-audit/src/auditor.ts8 symbols
tools/loop-audit/src/reporter.ts6 symbols
scripts/generate-audit-demo-gif.py5 symbols
tools/loop-init/scripts/bundle-assets.mjs4 symbols
tools/mcp-server/test/server.test.mjs3 symbols
tools/loop-cost/src/cli.ts3 symbols
tools/goal-audit/src/reporter.ts3 symbols

Dependencies from manifests, versioned

@cobusgreyling/loop-audit1.5.0 · 1×
@modelcontextprotocol/sdk1.12.1 · 1×
@types/node26.0.0 · 1×
ajv8.17.1 · 1×
typescript6.0.3 · 1×
yaml2.8.0 · 1×
zod3.25 || ^4.0 · 1×

For agents

$ claude mcp add loop-engineering \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact