Open source · Tool-agnostic · Production-ready · L3 dogfood · 7 patterns · Interactive tools

Design the system
that prompts your agents

Agentic Loop Working moves you from "I prompt → agent responds → I prompt again" to "I design the autonomous system that discovers work, verifies results, and drives progress."

Clone a Starter → Read the Essay Primitives Matrix Goal Engineering

Or try instantly: npx @jununfly/zj-loop-init . --pattern daily-triage --tool grok      npx @jununfly/zj-loop-audit . --suggest

ZAgenticLoop — Design the system that prompts your agents
"You shouldn't be prompting coding agents anymore. You should be designing loops that prompt your agents."
— Peter Steinberger
"I don't prompt Claude anymore. I have loops running that prompt Claude. My job is to write loops."
— Boris Cherny, Head of Claude Code
"Build the loop. But build it like someone who intends to stay the engineer, not just the person who presses go."
— Addy Osmani

Anatomy

What one loop looks like

You design it once. You're not prompting every micro-step.

Anatomy of a loop — schedule, triage, state, worktree, implementer, verifier, MCP, human gate
⏱ Schedule 👁 Triage skill 📋 STATE.md 🌲 Worktree ⚙️ Implementer ✓ Verifier 🔗 MCP / PR 🧑 Human gate

Building blocks

Five primitives + memory

The same shape works in Grok, Claude Code, Codex, and OpenClaw. Tool names differ; capabilities converge.

Scheduling

/loop, cron, automations

🌲

Worktrees

Parallel without collisions

📚

Skills

Intent written once

🔌

Connectors

MCP → real tools

🔀

Sub-agents

Maker / checker split

💾

State

Memory outside the model

Grok Build Claude Code Codex OpenClaw GitHub Actions

Full cross-tool matrix →

Copy & run

Production patterns

Documented loops with scheduling, skills, state schemas, verification, and honest failure modes.

Seven production loop patterns — cadence and token cost overview
Most popular

PR Babysitter

Shepherd PRs through review, CI, rebase, and merge. Human stays in the judgment seat.

⏱ 5–15m ◆ Medium risk
Read pattern → Starter →
Start here

Daily Triage

Morning scan of CI, issues, and commits. Report-only week one, then small auto-wins.

⏱ 1d–2h ◆ Low risk
Read pattern → Starter →
High frequency

CI Sweeper

React to failing checks with minimal fixes. Classify flakes. Escalate after 3 attempts.

⏱ 5–15m ◆ Medium risk
Read pattern → Starter →
Off-peak

Post-Merge Cleanup

TODOs, deprecations, and tech debt after merges. Small PRs overnight.

⏱ 1d–6h ◆ Low risk
Read pattern → Starter →
Security

Dependency Sweeper

Patch CVEs and stale deps in worktrees. Majors and denylist stay human-gated.

⏱ 6h–1d ◆ Medium risk
Read pattern → Starter →
Low risk

Issue Triage

Dedupe, score, and label incoming issues. Propose-only week one — pairs well with Daily Triage.

⏱ 2h–1d ◆ Low risk
Read pattern → Starter →
Low risk

Changelog Drafter

Scan merges & commits, produce polished categorized release notes drafts. Human approves before publish. Huge leverage, tiny risk.

⏱ 1d or tag ◆ Low risk
Read pattern → Starter →
7
Patterns
8
Starter kits
L0→L3
Readiness levels
100
Audit score max

5 minutes

Get started

Scaffold in your repo, audit readiness, run report-only for one week. Full quickstart guide →

terminal — minimal loop
# Scaffold starter (or copy manually)
npx @jununfly/zj-loop-init . --pattern daily-triage --tool grok

# Score loop readiness (PRs get audit comments in CI)
npx @jununfly/zj-loop-audit . --suggest

# Grok — report only, week one
/loop 1d Run loop-triage. Update STATE.md. No auto-fix.

# Also try the new low-risk pattern
/loop 1d Run changelog-scan + draft-release-notes. Write RELEASE_NOTES_DRAFT.md. Human review only.

Quickstart guide · All starters · Design checklist · Production stories

Play with it

Interactive Pattern Picker & Readiness Simulator

Pick your pain. See the exact loop + commands. Simulate your score live.

What's hurting right now?

CI red / flaky checks
PRs stalling on review/CI
Morning chaos — what should I do?
Dependabot / CVE noise
Merge debt / TODOs piling up
Stale release notes / changelogs
Noisy issue backlog / duplicates

Live Loop Readiness Simulator (mirrors zj-loop-audit)

Check the boxes you already have (or plan to add). Score updates live.

10
/ 100
L0Not loop-ready — start with a starter.
Client-side approximation of zj-loop-audit v1.4 scoring. L3 requires verifier + state + cost observability + proven activity.

Deep dives

Engineering, not hype

Failure Modes

Infinite fix loops, verifier theater, token burn — with mitigations.

Read catalog →

Safety & Guardrails

Path denylist, auto-merge policy, MCP least privilege.

Read safety doc →

zj-loop-audit CLI

Loop Readiness Score 0–100. Know before you ship unattended.

Run audit →

Pattern Picker

CI red? PRs stalling? Morning chaos? Pick the right loop first.

Choose pattern →

Stay in control

Observability & cost

Loops should be boring and transparent. Use state files, run logs, and budgets.

STATE.md + pattern state

The durable memory spine. Every loop reads it at start and writes outcomes.

See example →

Run logs & budgets

Structured JSON per run + daily token / spawn limits. Detect problems before they explode.

See sample logs →

zj-loop-audit on every PR

Automated Loop Readiness Score + suggestions. The reference dogfoods it.

Run it →

Ready to stop prompting?

The best loops are boring, reliable, and transparent.

Star on GitHub GitHub stars Contribute a pattern

Community

Adopters

Forks mean people are trying this. Listed projects run (or adapted) loops from this reference. Add yours via the Add Adopter issue or a PR to docs/adopters.md.

Show your Loop Ready score

Paste a badge in your README after zj-loop-audit — social proof for your team and contributors.

npx @jununfly/zj-loop-audit . --badge
Add my project →

zagenticloop

Daily Triage · Changelog Drafter · audit dogfood · L3

Reference implementation — zj-loop-audit on every PR; readiness score 100.

zagenticloop (maintainer)

Issue Triage + Daily Triage · Grok · L1

Propose labels only week one; pairs with morning STATE.md triage.

Your project here

Pattern · Tool · Level

One line on what worked or broke — failures are first-class.

List yours →