Skip to content

Production Patterns

Marius Egerhei Torjusen edited this page Oct 3, 2026 · 1 revision

πŸš€ Production Loop Patterns

Loop engineering provides seven battle-tested patterns designed for real-world development workflows. Each pattern provides defined scheduling, risk profiles, verification gates, and human hand-off protocols.


1. Pattern Registry Overview

Pattern Recommended Cadence Risk Level Primary Objective
Daily Triage 2h – 24h Low Scans open PRs, stale issues, and updates STATE.md with team priorities.
CI Sweeper 5m – 15m Medium Detects failing CI runs, isolates root cause, generates minimal reproducible fix.
PR Babysitter 5m – 15m Medium Keeps PRs rebased against main, resolves merge conflicts, ensures CI checks pass.
Dependency Sweeper 6h – 24h Medium Audits npm/pip advisories, bumps patch versions, verifies lockfiles against tests.
Issue Triage 2h – 24h Low Categorizes issues, detects duplicates, requests missing reproduction steps.
Changelog Drafter 24h Low Parses merged PRs and commit logs to draft release notes grouped by feature.
Post-Merge Cleanup 6h – 24h Low Deletes merged remote branches, closes resolved tickets, updates documentation.

2. In-Depth Pattern Specifications

1. Daily Triage (daily-triage)

  • Problem Solved: Standup overhead and uncoordinated agent work.
  • Mechanism: Queries GitHub/Linear for assigned items, inspects blockers, reconciles STATE.md, and prepares the task queue for downstream specialist agents.
  • Safety Gate: Read-only analysis. Never modifies production code or closes tickets without explicit label rules.

2. CI Sweeper (ci-sweeper)

  • Problem Solved: Flaky tests, broken trunk builds, and slow developer feedback loops.
  • Mechanism: Triggered on CI failure webhook or polled schedule. Clones the failing commit into an isolated worktree, reproduces the failure locally, applies a minimal fix, and verifies via local test suite.
  • Verification: The fix must pass 100% of existing tests plus add a targeted regression test.

3. PR Babysitter (pr-babysitter)

  • Problem Solved: PR bit-rot, merge conflicts, and stale review comments.
  • Mechanism: Monitors active PRs. When main advances, fetches the PR branch into a worktree, rebases cleanly, resolves trivial conflicts, runs verification, and force-pushes with lease.
  • Human Gate: If non-trivial semantic conflicts occur, tags the author and exits without destructive action.

4. Dependency Sweeper (dependency-sweeper)

  • Problem Solved: Security vulnerabilities (Dependabot spam) and stale package versions.
  • Mechanism: Runs npm audit / cargo audit / pip audit. Identifies non-breaking semver patches. Updates dependencies one at a time and runs the full test suite.
  • Safety Rule: Major version bumps and lockfile anomalies are strictly escalated to human engineers.

5. Issue Triage (issue-triage)

  • Problem Solved: Unstructured bug reports and feature requests cluttering the backlog.
  • Mechanism: Reads incoming issues. Checks against an issue template schema. Prompts the author for missing reproduction steps, logs environment details, and assigns component labels.

6. Changelog Drafter (changelog-drafter)

  • Problem Solved: Late, inaccurate, or missing release notes.
  • Mechanism: Analyzes the delta between the latest git tag and HEAD. Extracts PR titles and conventional commit prefixes (feat:, fix:, perf:). Drafts release markdown in docs/releases/.

7. Post-Merge Cleanup (post-merge-cleanup)

  • Problem Solved: Branch sprawl and lingering tracking issues.
  • Mechanism: Scans remote branches whose commits have been merged into main. Deletes the remote branch if delete-on-merge was not triggered, and marks corresponding tickets as resolved.

3. Deployment Lifecycle: The Two-Phase Rule

WEEK 1: L1 REPORT-ONLY MODE
  β”œβ”€β”€ Loop executes triggers and runs checks
  β”œβ”€β”€ Generates reports and diffs to STATE.md
  └── Prohibits direct pushes and PR merges

WEEK 2+: GRADUATED ACTUATION
  β”œβ”€β”€ Only after 7 days of 100% report accuracy
  β”œβ”€β”€ Enable automated branch creation and PR opening
  └── Maintain human gate on auto-merge