Skip to content

Chapter 27 · Seven Production Loop Patterns ​

Chapter goals: Master the seven most practical production loop patterns in the Loop Engineering ecosystem; understand each pattern's节奏, required skills, and token cost; select appropriately for real projects.

27.1 Pattern Overview ​

There are seven officially认证 production loop patterns,排列 by complexity and token cost ascending:

PatternCadenceAutonomy LevelToken Cost
Daily Triage1 day – 2 hoursL1Low
PR Babysitter5 – 15 minutesL1High
CI Sweeper5 – 15 minutesL2 (cautious)Very High
Dependency Sweeper6 hours – 1 dayL2Medium
Changelog Drafter1 day or tagL1Low
Post-Merge Cleanup1 day – 6 hoursL1Low
Issue Triage2 hours – 1 dayL1Low

27.2 Daily Triage ​

Goal ​

Auto-generate a priority-sortedissue清单 at the start of each day, letting the team know what to do today.

Required Skills ​

  • loop-triage: reads CI, issues, commits, chat; produces priority findings
  • minimal-fix (optional, Phase 2): drafts a minimal fix for明显 failures
  • Reviewer sub-agent or skill (optional):验证 the proposed fix

State Management ​

Use STATE.md as the记忆 backbone:

markdown
# Loop State — Project X

Last run: 2026-06-09 08:15 UTC

## High Priority
- [ ] #1241 — flaky test in auth flow (CI red on main)
  Loop action: Opened worktree. Fix proposed. Waiting for human PR review.

## Watch List
- PR #1238 open 4 days with no activity.
  • Morning triage: /loop 1d
  • Active sprintperiod: /loop 2h
  • Team without TUI: GitHub Action cron 0 8 * * 1-5

27.3 PR Babysitter ​

Goal ​

Auto-track PRs after opening;remind stale PRs;自动 comment or标记 when necessary.

Cadence and Cost ​

  • Check every 5–15 minutes
  • Token cost is高 (frequent LLM calls to judge状态)
  • Recommend L1 only observation; no auto operations

Key Constraints ​

  • Don't auto-close or merge PRs
  • Don't replace the human reviewer's judgment
  • Only remind; only mark; only summarize

27.4 CI Sweeper ​

Goal ​

Auto-diagnose the cause when CI fails;尝试修复;开 new PR.

Risks and Constraints ​

  • Token cost is极高 (involves code generation + test running)
  • Must start at L2: first have a stable L1 triage record for 1–2 weeks
  • Must have an独立 verifier (verification sub-agent)
  • Must have an attempt上限 (e.g. 3 times)

Safety Boundaries ​

yaml
# loop-budget.md
max_tokens_per_run: 50000
max_attempts: 3
denylist_paths:
  - "config/prod-secret*"
  - ".env"

27.5 Dependency Sweeper ​

Goal ​

定期 check dependency security vulnerabilities and outdated packages; auto开 PR to upgrade.

Cadence ​

  • Every 6 hours to 1 day
  • Token cost: medium

Pattern Characteristics ​

  • Suitable for L2: can auto-upgrad非破坏性 dependencies -破坏性 upgrades need人工 confirmation

27.6 Changelog Drafter ​

Goal ​

Auto-generate a CHANGELOG.md draft based on git commits.

Cadence ​

  • Manually triggered (at tag time) or once daily

Characteristics ​

  • Token cost低
  • L1 is enough: only draft; don't改 CHANGELOG
  • Human最终 approval

27.7 Post-Merge Cleanup ​

Goal ​

Auto-clean branches, delete临时 files, update docs after a PR is merged.

Cadence ​

  • Once every 1 day – 6 hours

Characteristics ​

  • Token cost低
  • L1: only cleanup; don't touch business code

27.8 Issue Triage ​

Goal ​

When a new Issue arrives, auto-classify,标记 priority, assign labels.

Cadence ​

  • Every 2 hours – 1 day

Characteristics ​

  • L1: only建议; don't auto-assign
  • Can结合 project历史 issue to learn classification patterns

27.9 Pattern Selection Quick Reference ​

Your ScenarioRecommended Pattern
Team doesn't know what to do每天Daily Triage
PRs经常石沉大海PR Babysitter
CI经常挂且没人修CI Sweeper (L2+)
Dependency vulnerabilities堆积Dependency Sweeper
CHANGELOG从不更新Changelog Drafter
Branches are a mess aftermergePost-Merge Cleanup
Issue labels are混乱Issue Triage

Chapter Summary ​

  • Seven patterns各有定位; ranging from L1 to L2;
  • Token cost ranges from low to very high; selection需权衡价值与成本;
  • Safety principle: prove you can see accurately at L1 first; then consider L2 allowing hands-on;
  • An interactive pattern picker is available to辅助 decision-making.

🧪 随堂测验

点击你认为正确的选项。答错时会展示正确答案与原因解析。

1. Which loop pattern has the highest token cost?

2. Regarding CI Sweeper safety requirements, which is NOT必须的?

3. At which autonomy level is the Issue Triage pattern通常建议 to stay?

4. Which of the following is NOT in the recommended cadence for Daily Triage?

🛠️ Hands-on Practice ​

  1. Use npx @cobusgreyling/loop init . --pattern daily-triage --tool claude to initialize a Daily Triage loop; observe the generated file structure.
  2. Design a CI Sweeper loop (L1 reporting phase only) for a simple GitHub Actions CI failure scenario; write your STATE.md template.
  3. Compare the token cost difference between the Changelog Drafter and Issue Triage patterns;解释 why the former is lower.

After completing the exercises, proceed to Next chapter: Autonomy Levels and Loop Ready Scoring.